mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-03 03:55:26 +03:00
983110d931
no issue - add eslint-plugin-ember, configure no-old-shims rule - run `eslint --fix` on `app`, `lib`, `mirage`, and `tests` to move imports to the new module imports - further cleanup of Ember globals usage - remove event-dispatcher initializer now that `canDispatchToEventManager` is deprecated
37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
import $ from 'jquery';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import {clickTrigger} from '../../helpers/ember-basic-dropdown';
|
|
import {describe, it} from 'mocha';
|
|
import {expect} from 'chai';
|
|
import {find} from 'ember-native-dom-helpers';
|
|
import {run} from '@ember/runloop';
|
|
import {setupComponentTest} from 'ember-mocha';
|
|
|
|
describe('Integration: Component: gh-basic-dropdown', function() {
|
|
setupComponentTest('gh-basic-dropdown', {
|
|
integration: true
|
|
});
|
|
|
|
it('closes when dropdown service fires close event', function() {
|
|
let dropdownService = this.container.lookup('service:dropdown');
|
|
|
|
this.render(hbs`
|
|
{{#gh-basic-dropdown as |dropdown|}}
|
|
<button class="ember-basic-dropdown-trigger" onclick={{dropdown.actions.toggle}}></button>
|
|
{{#if dropdown.isOpen}}
|
|
<div id="dropdown-is-opened"></div>
|
|
{{/if}}
|
|
{{/gh-basic-dropdown}}
|
|
`);
|
|
|
|
clickTrigger();
|
|
expect($(find('#dropdown-is-opened'))).to.exist;
|
|
|
|
run(() => {
|
|
dropdownService.closeDropdowns();
|
|
});
|
|
|
|
expect($(find('#dropdown-is-opened'))).to.not.exist;
|
|
});
|
|
});
|