diff --git a/ember-basic-dropdown/src/components/basic-dropdown-content.ts b/ember-basic-dropdown/src/components/basic-dropdown-content.ts index 516391eb..f18c4ff0 100644 --- a/ember-basic-dropdown/src/components/basic-dropdown-content.ts +++ b/ember-basic-dropdown/src/components/basic-dropdown-content.ts @@ -70,6 +70,7 @@ export default class BasicDropdownContent extends Component + + Click me + + + + + + `); + + assert + .dom('#dropdown-is-opened', this.element.getRootNode()) + .doesNotExist('The dropdown is closed'); + + const triggerElement = find('[data-shadow]')?.shadowRoot.querySelector( + '.ember-basic-dropdown-trigger', + ); + + await click(triggerElement); + + assert + .dom('.ember-basic-dropdown-content', find('[data-shadow]').shadowRoot) + .exists('The dropdown is rendered'); + + + assert.dom('#dropdown-is-opened', find('[data-shadow]').shadowRoot).exists('The dropdown is opened'); + + await click(find('[data-shadow]').shadowRoot.getElementById('dropdown-is-opened')); + + assert.dom('#dropdown-is-opened', find('[data-shadow]').shadowRoot).exists('The dropdown stays opened when clicking content'); + + await click(triggerElement); + + assert + .dom('#dropdown-is-opened', find('[data-shadow]').shadowRoot) + .doesNotExist('The dropdown is closed again'); + + await click(triggerElement); + + assert.dom('#dropdown-is-opened', find('[data-shadow]').shadowRoot).exists('The dropdown is opened 2d time'); + + await click(find('[data-shadow]').shadowRoot.getElementById('dropdown-is-opened')); + + assert.dom('#dropdown-is-opened', find('[data-shadow]').shadowRoot).exists('The dropdown stays opened when clicking content after 2d open'); + }); + test('Shadow dom: Its `toggle` action opens and closes the dropdown when wormhole is inside shadow dom', async function (assert) { await render(hbs` @@ -1406,7 +1454,7 @@ module('Integration | Component | basic-dropdown', function (hooks) { - +
`);