-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathPlaceSearch.tests.js
35 lines (27 loc) · 1.12 KB
/
PlaceSearch.tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */
import { chai } from 'meteor/practicalmeteor:chai';
import { Template } from 'meteor/templating';
import { $ } from 'meteor/jquery';
import { ensureElement, ensureCallbackOnElementChange, withRenderedTemplate } from '../../../test-helpers.js';
import '../PlaceSearch.js';
describe('PlaceSearch component', function() {
it('has a "keyword" input', function() {
ensureElement('PlaceSearch', {}, 'input[name=keyword]');
});
it('has a "type" dropdown', function() {
ensureElement('PlaceSearch', {}, 'select[name=type]');
});
it('calls "onQueryChanged" when keyword has changed', function(done) {
ensureCallbackOnElementChange('PlaceSearch', {}, 'input[name=keyword]', { onQueryChanged(query) {
chai.assert.equal(query.keyword, 'test');
done();
}}, 'test');
});
it('calls "onQueryChanged" when type has changed', function(done) {
ensureCallbackOnElementChange('PlaceSearch', {}, 'select[name=type]', { onQueryChanged(query) {
chai.assert.equal(query.type, 'airport');
done();
}}, 'airport');
});
});