Ghost/ghost/admin/tests/integration/components/gh-basic-dropdown-test.js
Kevin Ansfield 983110d931 Switched from ember-cli-shims to new module imports (#779)
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
2017-08-22 14:53:26 +07:00

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;
});
});