@@ -214,6 +214,33 @@ describe('Tile resize', () => {
214
214
expect ( getComputedStyle ( firstTile ) . gridColumn ) . to . eql ( 'auto / span 2' ) ;
215
215
} ) ;
216
216
217
+ it ( 'Should correctly shrink tile' , async ( ) => {
218
+ firstTile . colSpan = 3 ;
219
+ firstTile . rowSpan = 3 ;
220
+
221
+ const DOM = getResizeContainerDOM ( firstTile ) ;
222
+
223
+ simulatePointerDown ( DOM . adorners . corner ) ;
224
+ await elementUpdated ( DOM . container ) ;
225
+
226
+ expect ( getComputedStyle ( firstTile ) . gridColumn ) . to . eql ( 'auto / span 3' ) ;
227
+ expect ( getComputedStyle ( firstTile ) . gridRow ) . to . eql ( 'auto / span 3' ) ;
228
+
229
+ simulatePointerMove ( DOM . adorners . corner , {
230
+ clientX : columnSize ,
231
+ clientY : rowSize ,
232
+ } ) ;
233
+
234
+ await elementUpdated ( DOM . resizeElement ) ;
235
+
236
+ simulateLostPointerCapture ( DOM . adorners . corner ) ;
237
+ await elementUpdated ( DOM . resizeElement ) ;
238
+ await nextFrame ( ) ;
239
+
240
+ expect ( getComputedStyle ( firstTile ) . gridColumn ) . to . eql ( 'auto / span 1' ) ;
241
+ expect ( getComputedStyle ( firstTile ) . gridRow ) . to . eql ( 'auto / span 1' ) ;
242
+ } ) ;
243
+
217
244
it ( 'Should correctly create/remove implicit rows and resize row with auto grid' , async ( ) => {
218
245
const DOM = getResizeContainerDOM ( firstTile ) ;
219
246
@@ -281,6 +308,15 @@ describe('Tile resize', () => {
281
308
expect ( getColumns ( ) . length ) . to . eql ( 10 ) ;
282
309
} ) ;
283
310
311
+ it ( 'Should correctly set rowCount' , async ( ) => {
312
+ expect ( getRows ( ) . length ) . to . eql ( 1 ) ;
313
+
314
+ tileManager . rowCount = 10 ;
315
+ await elementUpdated ( tileManager ) ;
316
+
317
+ expect ( getRows ( ) . length ) . to . eql ( 10 ) ;
318
+ } ) ;
319
+
284
320
it ( 'Should cap resizing to max col if greater than' , async ( ) => {
285
321
const DOM = getResizeContainerDOM ( firstTile ) ;
286
322
@@ -303,18 +339,33 @@ describe('Tile resize', () => {
303
339
expect ( getComputedStyle ( firstTile ) . gridColumn ) . to . eql ( 'auto / span 10' ) ;
304
340
} ) ;
305
341
306
- // REVIEW
307
- it ( 'Should initialize tile span as columnCount if it is greater than columnCount' , async ( ) => {
342
+ it ( 'Should initialize tile colSpan as columnCount if it is greater than columnCount' , async ( ) => {
308
343
tileManager . columnCount = 10 ;
344
+ firstTile . colSpan = 15 ;
309
345
await elementUpdated ( tileManager ) ;
310
346
311
- firstTile . colSpan = 15 ;
312
- await elementUpdated ( firstTile ) ;
347
+ expect ( getColumns ( ) . length ) . to . eql ( 10 ) ;
348
+ expect ( getComputedStyle ( firstTile ) . gridColumn ) . to . eql ( 'auto / span 10' ) ;
349
+ } ) ;
313
350
314
- // REVIEW once we decide how to handle the scenario where colSpan is greater than column count
315
- // currently 0px columns are added to cover the difference
316
- expect ( getColumns ( ) . length ) . to . eql ( 15 ) ;
317
- expect ( getComputedStyle ( firstTile ) . gridColumn ) . to . eql ( 'auto / span 15' ) ;
351
+ it ( 'Should preserve tile colStart when colStart is valid and colStart + colSpan is greater than columnCount' , async ( ) => {
352
+ tileManager . columnCount = 10 ;
353
+ firstTile . colStart = 5 ;
354
+ firstTile . colSpan = 10 ;
355
+ await elementUpdated ( tileManager ) ;
356
+
357
+ expect ( getColumns ( ) . length ) . to . eql ( 10 ) ;
358
+ expect ( getComputedStyle ( firstTile ) . gridColumn ) . to . eql ( '5 / span 6' ) ;
359
+ } ) ;
360
+
361
+ it ( 'Should set colStart to 0(auto) and colSpan to columnCount when both are greater than columnCount' , async ( ) => {
362
+ tileManager . columnCount = 10 ;
363
+ firstTile . colStart = 11 ;
364
+ firstTile . colSpan = 12 ;
365
+ await elementUpdated ( tileManager ) ;
366
+
367
+ expect ( getColumns ( ) . length ) . to . eql ( 10 ) ;
368
+ expect ( getComputedStyle ( firstTile ) . gridColumn ) . to . eql ( 'auto / span 10' ) ;
318
369
} ) ;
319
370
320
371
it ( 'Should maintain column position on resize when colStart is set' , async ( ) => {
0 commit comments