@@ -214,6 +214,33 @@ describe('Tile resize', () => {
214214 expect ( getComputedStyle ( firstTile ) . gridColumn ) . to . eql ( 'auto / span 2' ) ;
215215 } ) ;
216216
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+
217244 it ( 'Should correctly create/remove implicit rows and resize row with auto grid' , async ( ) => {
218245 const DOM = getResizeContainerDOM ( firstTile ) ;
219246
@@ -281,6 +308,15 @@ describe('Tile resize', () => {
281308 expect ( getColumns ( ) . length ) . to . eql ( 10 ) ;
282309 } ) ;
283310
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+
284320 it ( 'Should cap resizing to max col if greater than' , async ( ) => {
285321 const DOM = getResizeContainerDOM ( firstTile ) ;
286322
@@ -303,18 +339,33 @@ describe('Tile resize', () => {
303339 expect ( getComputedStyle ( firstTile ) . gridColumn ) . to . eql ( 'auto / span 10' ) ;
304340 } ) ;
305341
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 ( ) => {
308343 tileManager . columnCount = 10 ;
344+ firstTile . colSpan = 15 ;
309345 await elementUpdated ( tileManager ) ;
310346
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+ } ) ;
313350
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' ) ;
318369 } ) ;
319370
320371 it ( 'Should maintain column position on resize when colStart is set' , async ( ) => {
0 commit comments