mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-03 03:55:26 +03:00
cb59388c5b
no issue - adds `eslint-plugin-sort-imports-es6-autofix` dependency - implements ESLint's base `sort-imports` rule but has a distinction in that `import {foo} from 'bar';` is considered `multiple` rather than `single` - fixes ESLint's autofix behaviour so `eslint --fix` will actually fix the sort order - updates all unordered import rules by using `eslint --fix` With the increased number of `import` statements since Ember+ecosystem started moving towards es6 modules I've found it frustrating at times trying to search through randomly ordered import statements. Recently I've been sorting imports manually when I've added new code or touched old code so I thought I'd add an ESLint rule to codify it.
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
/* jshint expr:true */
|
|
import Pretender from 'pretender';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import run from 'ember-runloop';
|
|
import wait from 'ember-test-helpers/wait';
|
|
import {describe, it} from 'mocha';
|
|
import {expect} from 'chai';
|
|
import {setupComponentTest} from 'ember-mocha';
|
|
|
|
describe('Integration: Component: gh-search-input', function () {
|
|
setupComponentTest('gh-search-input', {
|
|
integration: true
|
|
});
|
|
|
|
let server;
|
|
|
|
beforeEach(function () {
|
|
server = new Pretender();
|
|
});
|
|
|
|
afterEach(function () {
|
|
server.shutdown();
|
|
});
|
|
|
|
it('renders', function () {
|
|
// renders the component on the page
|
|
this.render(hbs`{{gh-search-input}}`);
|
|
|
|
expect(this.$('.ember-power-select-search input')).to.have.length(1);
|
|
});
|
|
|
|
it('opens the dropdown on text entry', function (done) {
|
|
this.render(hbs`{{gh-search-input}}`);
|
|
|
|
// enter text to trigger search
|
|
run(() => {
|
|
this.$('input[type="search"]').val('test').trigger('input');
|
|
});
|
|
|
|
wait().then(() => {
|
|
expect(this.$('.ember-basic-dropdown-content').length).to.equal(1);
|
|
done();
|
|
});
|
|
});
|
|
});
|