@@ -11,6 +11,7 @@ import {
1111 waitUntil ,
1212 find ,
1313 settled ,
14+ pauseTest
1415} from '@ember/test-helpers' ;
1516
1617let deprecations = [ ] ;
@@ -1388,25 +1389,62 @@ module('Integration | Component | basic-dropdown', function (hooks) {
13881389
13891390 assert . dom ( '#dropdown-is-opened' ) . exists ( 'The dropdown is opened' ) ;
13901391
1391- await click ( '#dropdown-is-opened' ) ;
1392-
1393- assert . dom ( '#dropdown-is-opened' ) . exists ( 'The dropdown stays opened when clicking content' ) ;
1394-
13951392 await click ( triggerElement ) ;
13961393
13971394 assert
13981395 . dom ( '#dropdown-is-opened' )
13991396 . doesNotExist ( 'The dropdown is closed again' ) ;
14001397
1398+ wormhole . remove ( ) ;
1399+ } ) ;
1400+
1401+ test ( 'Shadow dom renderInPlace: Its `toggle` action opens and closes the dropdown ' , async function ( assert ) {
1402+
1403+ await render ( hbs `
1404+ <Shadow>
1405+ <BasicDropdown @renderInPlace={{true}} as |dropdown|>
1406+ <dropdown.Trigger>Click me</dropdown.Trigger>
1407+ <dropdown.Content>
1408+ <div style="height: 100px; width: 100px; background: black" id="dropdown-is-opened"></div>
1409+ </dropdown.Content>
1410+ </BasicDropdown>
1411+ </Shadow>
1412+ ` ) ;
1413+
1414+ assert
1415+ . dom ( '#dropdown-is-opened' , this . element . getRootNode ( ) )
1416+ . doesNotExist ( 'The dropdown is closed' ) ;
1417+
1418+ const triggerElement = find ( '[data-shadow]' ) ?. shadowRoot . querySelector (
1419+ '.ember-basic-dropdown-trigger' ,
1420+ ) ;
1421+
14011422 await click ( triggerElement ) ;
14021423
1403- assert . dom ( '#dropdown-is-opened' ) . exists ( 'The dropdown is opened 2d time' ) ;
1424+ assert
1425+ . dom ( '.ember-basic-dropdown-content' , find ( '[data-shadow]' ) . shadowRoot )
1426+ . exists ( 'The dropdown is rendered' ) ;
14041427
1405- await click ( '#dropdown-is-opened' ) ;
14061428
1407- assert . dom ( '#dropdown-is-opened' ) . exists ( 'The dropdown stays opened when clicking contentb after 2d open ' ) ;
1429+ assert . dom ( '#dropdown-is-opened' , find ( '[data-shadow]' ) . shadowRoot ) . exists ( 'The dropdown is opened' ) ;
14081430
1409- wormhole . remove ( ) ;
1431+ await click ( find ( '[data-shadow]' ) . shadowRoot . getElementById ( 'dropdown-is-opened' ) ) ;
1432+
1433+ assert . dom ( '#dropdown-is-opened' , find ( '[data-shadow]' ) . shadowRoot ) . exists ( 'The dropdown stays opened when clicking content' ) ;
1434+
1435+ await click ( triggerElement ) ;
1436+
1437+ assert
1438+ . dom ( '#dropdown-is-opened' , find ( '[data-shadow]' ) . shadowRoot )
1439+ . doesNotExist ( 'The dropdown is closed again' ) ;
1440+
1441+ await click ( triggerElement ) ;
1442+
1443+ assert . dom ( '#dropdown-is-opened' , find ( '[data-shadow]' ) . shadowRoot ) . exists ( 'The dropdown is opened 2d time' ) ;
1444+
1445+ await click ( find ( '[data-shadow]' ) . shadowRoot . getElementById ( 'dropdown-is-opened' ) ) ;
1446+
1447+ assert . dom ( '#dropdown-is-opened' , find ( '[data-shadow]' ) . shadowRoot ) . exists ( 'The dropdown stays opened when clicking content after 2d open' ) ;
14101448 } ) ;
14111449
14121450 test ( 'Shadow dom: Its `toggle` action opens and closes the dropdown when wormhole is inside shadow dom' , async function ( assert ) {
@@ -1418,7 +1456,7 @@ module('Integration | Component | basic-dropdown', function (hooks) {
14181456 <div id="dropdown-is-opened"></div>
14191457 </dropdown.Content>
14201458 </BasicDropdown>
1421-
1459+
14221460 <div id="wormhole-in-shadow-dom"></div>
14231461 </Shadow>
14241462 ` ) ;
0 commit comments