Ghost/ghost/admin/tests/integration/components/gh-basic-dropdown-test.js
Kevin Ansfield a85f5fae35 Switch to eslint-plugin-ghost extending plugin:ghost/ember
no issue
- fix lint errors in lib/gh-koenig
- fix ghost:base eslint errors
- update ember plugin refs, remove ember-suave plugin refs
- remove old jshint refs
- add `lint:js` script
- switch to `eslint-plugin-ghost` extending `plugin:ghost/ember`
2018-01-12 12:17:56 +00: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;
});
});