@@ -11,7 +11,7 @@ module('Integration | Component | grid stack', function (hooks) {
1111 setupRenderingTest ( hooks ) ;
1212
1313 test ( 'gridstack renders' , async function ( assert ) {
14- assert . expect ( 2 ) ;
14+ assert . expect ( 1 ) ;
1515
1616 await render ( hbs `
1717 <GridStack class="test-grid">
@@ -22,12 +22,8 @@ module('Integration | Component | grid stack', function (hooks) {
2222 ` ) ;
2323
2424 assert
25- . dom ( '.test-grid.grid-stack .grid-stack-item' )
26- . hasClass ( 'ui-draggable' , 'Dom elements with grid-stack-item class are initialized by gridstack' ) ;
27-
28- assert
29- . dom ( '.test-grid.grid-stack .grid-stack-item' )
30- . hasClass ( 'ui-resizable' , 'Dom elements with grid-stack-item class are initialized by gridstack' ) ;
25+ . dom ( '.test-grid.grid-stack .grid-stack-item > .ui-resizable-handle.ui-resizable-se' )
26+ . exists ( 'Dom elements with grid-stack-item class are initialized by gridstack' ) ;
3127 } ) ;
3228
3329 test ( 'gridstack with items' , async function ( assert ) {
@@ -46,15 +42,15 @@ module('Integration | Component | grid stack', function (hooks) {
4642 ` ) ;
4743
4844 assert
49- . dom ( '.grid-stack .grid-stack-item.ui-draggable .ui-resizable' )
45+ . dom ( '.grid-stack .grid-stack-item > .ui-resizable-handle .ui-resizable-se ' )
5046 . exists ( { count : 2 } , 'initial grid-stack-item components are initialized by gridstack' ) ;
5147
5248 run ( ( ) => {
5349 this . items . pushObject ( 2 ) ;
5450 } ) ;
5551
5652 assert
57- . dom ( '.grid-stack .grid-stack-item.ui-draggable .ui-resizable' )
53+ . dom ( '.grid-stack .grid-stack-item > .ui-resizable-handle .ui-resizable-se ' )
5854 . exists (
5955 { count : 3 } ,
6056 'new grid-stack-item components are initialized by gridstack when added through an each loop'
@@ -275,26 +271,38 @@ module('Integration | Component | grid stack', function (hooks) {
275271 ` ) ;
276272
277273 this . items . forEach ( ( { id, options } ) => {
278- assert . dom ( `[data-id="${ id } "]` ) . hasAttribute ( 'gs-x' , `${ options . x } ` , 'Initial grid-stack-item layout is correct' ) ;
279- assert . dom ( `[data-id="${ id } "]` ) . hasAttribute ( 'gs-y' , `${ options . y } ` , 'Initial grid-stack-item layout is correct' ) ;
274+ if ( options . x === 0 ) {
275+ assert . dom ( `[data-id="${ id } "]` ) . doesNotHaveAttribute ( 'gs-x' , 'Initial grid-stack-item layout is correct' ) ;
276+ } else {
277+ assert
278+ . dom ( `[data-id="${ id } "]` )
279+ . hasAttribute ( 'gs-x' , `${ options . x } ` , 'Initial grid-stack-item layout is correct' ) ;
280+ }
281+
282+ if ( options . y === 0 ) {
283+ assert . dom ( `[data-id="${ id } "]` ) . doesNotHaveAttribute ( 'gs-y' , 'Initial grid-stack-item layout is correct' ) ;
284+ } else {
285+ assert
286+ . dom ( `[data-id="${ id } "]` )
287+ . hasAttribute ( 'gs-y' , `${ options . y } ` , 'Initial grid-stack-item layout is correct' ) ;
288+ }
280289 } ) ;
281290
282291 // Update the position of item 1
283292 this . set ( 'items.1.options' , { x : 2 , y : 1 , w : 12 , h : 1 } ) ;
284-
285293 assert
286294 . dom ( `[data-id="0"]` )
287- . hasAttribute ( 'gs-x' , '0 ', 'Updating a grid-stack-item leaves unaffected items the same' ) ;
295+ . doesNotHaveAttribute ( 'gs-x' , 'Updating a grid-stack-item leaves unaffected items the same' ) ;
288296 assert
289297 . dom ( `[data-id="0"]` )
290- . hasAttribute ( 'gs-y' , '0 ', 'Updating a grid-stack-item leaves unaffected items the same' ) ;
298+ . doesNotHaveAttribute ( 'gs-y' , 'Updating a grid-stack-item leaves unaffected items the same' ) ;
291299
292- assert . dom ( `[data-id="1"]` ) . hasAttribute ( 'gs-x' , '2 ', 'Updating a grid-stack-item updates moves the item' ) ;
300+ assert . dom ( `[data-id="1"]` ) . doesNotHaveAttribute ( 'gs-x' , 'Updating a grid-stack-item updates moves the item' ) ;
293301 assert . dom ( `[data-id="1"]` ) . hasAttribute ( 'gs-y' , '1' , 'Updating a grid-stack-item updates moves the item' ) ;
294302
295303 assert
296304 . dom ( `[data-id="2"]` )
297- . hasAttribute ( 'gs-x' , '0 ', 'Updating a grid-stack-item moves conflicting items to a different row' ) ;
305+ . doesNotHaveAttribute ( 'gs-x' , 'Updating a grid-stack-item moves conflicting items to a different row' ) ;
298306 assert
299307 . dom ( `[data-id="2"]` )
300308 . hasAttribute ( 'gs-y' , '2' , 'Updating a grid-stack-item moves conflicting items to a different row' ) ;
0 commit comments