2016-04-19 18:55:10 +03:00
|
|
|
/* jshint expr:true */
|
|
|
|
import { expect } from 'chai';
|
|
|
|
import {
|
|
|
|
describeComponent,
|
|
|
|
it
|
|
|
|
} from 'ember-mocha';
|
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
2016-06-30 13:21:47 +03:00
|
|
|
import run from 'ember-runloop';
|
2016-07-05 17:29:05 +03:00
|
|
|
import wait from 'ember-test-helpers/wait';
|
2016-04-19 18:55:10 +03:00
|
|
|
|
|
|
|
describeComponent(
|
|
|
|
'gh-search-input',
|
|
|
|
'Integration: Component: gh-search-input',
|
|
|
|
{
|
|
|
|
integration: true
|
|
|
|
},
|
|
|
|
function () {
|
|
|
|
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);
|
|
|
|
});
|
2016-07-05 17:29:05 +03:00
|
|
|
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
});
|
2016-04-19 18:55:10 +03:00
|
|
|
}
|
|
|
|
);
|