Ghost/ghost/admin/tests/integration/components/gh-basic-dropdown-test.js
renovate[bot] 654d373655 Update dependency ember-power-select to v4 (#1528)
* Update dependency ember-power-select to v4
* Fixed trigger component override collision when building

- move the "override" into our own namespace
- update all `<PowerSelect>` usage to explicitly reference our customised trigger component

* Bumped ember-power-datepicker

- bumps `ember-basic-dropdown` sub-dependency
- resolves "Error: Could not find module `ember-compatibility-helpers` imported from `@glimmer/component/index`"
- https://github.com/cibernox/ember-basic-dropdown/issues/551

* Updated trigger to use class syntax

- it's not possible to use `.extend()` on an imported class

* Updated <GhBasicDropdown>

- match updated ember-basic-dropdown code

* Added `autofocus` modifier

- added `ember-modifier` dependency so that we can create our own render modifiers

* Updated <GhSearchInputTrigger> to a glimmer component

* Updated gh-token-input components

* Fixed tests

- wrap `<PowerSelect>` with `<div>` to maintain test selectors
- fixed `<GhBasicDropdown>` not rendering anything due to not having a local template

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
2020-05-17 22:35:53 +01:00

30 lines
1.0 KiB
JavaScript

import hbs from 'htmlbars-inline-precompile';
import {clickTrigger} from 'ember-basic-dropdown/test-support/helpers';
import {describe, it} from 'mocha';
import {expect} from 'chai';
import {find, render, settled} from '@ember/test-helpers';
import {setupRenderingTest} from 'ember-mocha';
describe('Integration: Component: gh-basic-dropdown', function () {
setupRenderingTest();
it('closes when dropdown service fires close event', async function () {
let dropdownService = this.owner.lookup('service:dropdown');
await render(hbs`
<GhBasicDropdown as |dropdown|>
<dropdown.Trigger>Click me!</dropdown.Trigger>
<dropdown.Content><div id="dropdown-is-opened">Content of the trigger</div></dropdown.Content>
</GhBasicDropdown>
`);
await clickTrigger();
expect(find('#dropdown-is-opened')).to.exist;
dropdownService.closeDropdowns();
await settled();
expect(find('#dropdown-is-opened')).to.not.exist;
});
});