2017-08-13 08:34:50 -04:00
|
|
|
|
import componentTest from 'helpers/component-test';
|
|
|
|
|
|
2017-08-15 18:41:56 -04:00
|
|
|
|
moduleForComponent('select-box', { integration: true });
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
2017-08-15 18:41:56 -04:00
|
|
|
|
componentTest('updating the content refreshes the list', {
|
|
|
|
|
template: '{{select-box value=1 content=content}}',
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
|
|
|
|
beforeEach() {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
this.set("content", [{ id: 1, text: "robin" }]);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
click(".select-box-header");
|
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
assert.equal(find(".select-box-row .text").html().trim(), "robin");
|
|
|
|
|
this.set("content", [{ id: 1, text: "regis" }]);
|
|
|
|
|
assert.equal(find(".select-box-row .text").html().trim(), "regis");
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('accepts a value by reference', {
|
2017-08-15 18:41:56 -04:00
|
|
|
|
template: '{{select-box value=value content=content}}',
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
|
this.set("value", 1);
|
2017-08-15 20:34:43 -04:00
|
|
|
|
this.set("content", [{ id: 1, text: "robin" }, { id: 2, text: "regis" }]);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
click(".select-box-header");
|
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
assert.equal(
|
2017-09-10 13:12:03 -04:00
|
|
|
|
find(".select-box-row.is-selected .text").html().trim(), "robin",
|
2017-08-15 20:34:43 -04:00
|
|
|
|
"it highlights the row corresponding to the value"
|
|
|
|
|
);
|
2017-08-15 18:41:56 -04:00
|
|
|
|
});
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
2017-08-15 20:34:43 -04:00
|
|
|
|
click(".select-box-row[title='robin']");
|
|
|
|
|
|
2017-08-15 18:41:56 -04:00
|
|
|
|
andThen(() => {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
assert.equal(this.get("value"), 1, "it mutates the value");
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('select-box can be filtered', {
|
2017-08-15 18:41:56 -04:00
|
|
|
|
template: '{{select-box filterable=true value=1 content=content}}',
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
|
|
|
|
beforeEach() {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
this.set("content", [{ id: 1, text: "robin"}, { id: 2, text: "regis" }]);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
click(".select-box-header");
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
2017-08-15 20:34:43 -04:00
|
|
|
|
andThen(() => assert.equal(find(".filter-query").length, 1, "it has a search input"));
|
|
|
|
|
|
|
|
|
|
fillIn(".filter-query", "regis");
|
|
|
|
|
triggerEvent('.filter-query', 'keyup');
|
|
|
|
|
|
|
|
|
|
andThen(() => assert.equal(find(".select-box-row").length, 1, "it filters results"));
|
|
|
|
|
|
|
|
|
|
fillIn(".filter-query", "");
|
|
|
|
|
triggerEvent('.filter-query', 'keyup');
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
2017-08-15 18:41:56 -04:00
|
|
|
|
andThen(() => {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
assert.equal(
|
|
|
|
|
find(".select-box-row").length, 2,
|
|
|
|
|
"it returns to original content when filter is empty"
|
|
|
|
|
);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('no default icon', {
|
|
|
|
|
template: '{{select-box}}',
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
assert.equal(find(".select-box-header .icon").length, 0, "it doesn’t have an icon if not specified");
|
2017-08-13 08:34:50 -04:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('customisable icon', {
|
|
|
|
|
template: '{{select-box icon="shower"}}',
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
2017-08-25 13:56:57 -04:00
|
|
|
|
assert.equal(find(".select-box-header .icon").hasClass("d-icon-shower"), true, "it has a the correct icon");
|
2017-08-13 08:34:50 -04:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('default search icon', {
|
|
|
|
|
template: '{{select-box filterable=true}}',
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
click(".select-box-header");
|
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
assert.equal(find(".select-box-filter .d-icon-search").length, 1, "it has a the correct icon");
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('with no search icon', {
|
|
|
|
|
template: '{{select-box filterable=true searchIcon=null}}',
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
click(".select-box-header");
|
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
assert.equal(find(".search-icon").length, 0, "it has no icon");
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('custom search icon', {
|
|
|
|
|
template: '{{select-box filterable=true filterIcon="shower"}}',
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
click(".select-box-header");
|
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
assert.equal(find(".select-box-filter .d-icon-shower").length, 1, "it has a the correct icon");
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('not filterable by default', {
|
|
|
|
|
template: '{{select-box}}',
|
|
|
|
|
test(assert) {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
click(".select-box-header");
|
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
assert.equal(find(".select-box-filter").length, 0);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentTest('select-box is expandable', {
|
|
|
|
|
template: '{{select-box}}',
|
|
|
|
|
test(assert) {
|
|
|
|
|
click(".select-box-header");
|
2017-08-15 20:34:43 -04:00
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
assert.equal(find(".select-box").hasClass("is-expanded"), true);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
click(".select-box-header");
|
2017-08-15 20:34:43 -04:00
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
assert.equal(find(".select-box").hasClass("is-expanded"), false);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('accepts custom id/text keys', {
|
2017-08-15 18:41:56 -04:00
|
|
|
|
template: '{{select-box value=value content=content idKey="identifier" textKey="name"}}',
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
|
this.set("value", 1);
|
2017-08-15 20:34:43 -04:00
|
|
|
|
this.set("content", [{ identifier: 1, name: "robin" }]);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
click(".select-box-header");
|
2017-08-15 20:34:43 -04:00
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-09-10 13:12:03 -04:00
|
|
|
|
assert.equal(find(".select-box-row.is-selected .text").html().trim(), "robin");
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('doesn’t render collection content before first expand', {
|
2017-08-15 18:41:56 -04:00
|
|
|
|
template: '{{select-box value=1 content=content idKey="identifier" textKey="name"}}',
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
|
|
|
|
beforeEach() {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
this.set("content", [{ identifier: 1, name: "robin" }]);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
assert.equal(find(".select-box-body .collection").length, 0);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
2017-08-24 10:04:47 -04:00
|
|
|
|
click(".select-box-header");
|
2017-08-15 20:34:43 -04:00
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
assert.equal(find(".select-box-body .collection").length, 1);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('persists filter state when expandind/collapsing', {
|
2017-08-15 18:41:56 -04:00
|
|
|
|
template: '{{select-box value=1 content=content filterable=true}}',
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
|
|
|
|
beforeEach() {
|
2017-08-15 18:41:56 -04:00
|
|
|
|
this.set("content", [{id:1, text:"robin"}, {id:2, text:"régis"}]);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
click(".select-box-header");
|
2017-08-15 20:34:43 -04:00
|
|
|
|
fillIn('.filter-query', 'rob');
|
|
|
|
|
triggerEvent('.filter-query', 'keyup');
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
|
|
|
|
andThen(() => {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
assert.equal(find(".select-box-row").length, 1);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
|
2017-08-24 10:04:47 -04:00
|
|
|
|
click(".select-box-header");
|
2017-08-15 20:34:43 -04:00
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
assert.equal(find(".select-box").hasClass("is-expanded"), false);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
|
2017-08-24 10:04:47 -04:00
|
|
|
|
click(".select-box-header");
|
2017-08-15 20:34:43 -04:00
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
assert.equal(find(".select-box-row").length, 1);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('supports options to limit size', {
|
2017-09-06 10:58:00 -04:00
|
|
|
|
template: '{{select-box collectionHeight=20 content=content}}',
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
|
|
|
|
beforeEach() {
|
2017-08-15 20:34:43 -04:00
|
|
|
|
this.set("content", [{ id: 1, text: "robin" }]);
|
2017-08-13 08:34:50 -04:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
2017-08-24 10:04:47 -04:00
|
|
|
|
click(".select-box-header");
|
|
|
|
|
|
|
|
|
|
andThen(() => {
|
2017-08-30 15:32:58 -04:00
|
|
|
|
assert.equal(parseInt(find(".select-box-body").height()), 20, "it limits the height");
|
2017-08-24 10:04:47 -04:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('supports custom row template', {
|
2017-08-29 06:25:54 -04:00
|
|
|
|
template: '{{select-box content=content templateForRow=templateForRow}}',
|
2017-08-13 08:34:50 -04:00
|
|
|
|
|
2017-08-24 10:04:47 -04:00
|
|
|
|
beforeEach() {
|
|
|
|
|
this.set("content", [{ id: 1, text: "robin" }]);
|
2017-08-29 06:25:54 -04:00
|
|
|
|
this.set("templateForRow", (rowComponent) => {
|
|
|
|
|
return `<b>${rowComponent.get("content.text")}</b>`;
|
2017-08-24 10:04:47 -04:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
|
click(".select-box-header");
|
|
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-row").html().trim(), "<b>robin</b>");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('supports converting select value to integer', {
|
2017-08-29 06:25:54 -04:00
|
|
|
|
template: '{{select-box value=value content=content castInteger=true}}',
|
2017-08-24 10:04:47 -04:00
|
|
|
|
|
|
|
|
|
beforeEach() {
|
2017-08-29 06:25:54 -04:00
|
|
|
|
this.set("value", 2);
|
2017-08-24 10:04:47 -04:00
|
|
|
|
this.set("content", [{ id: "1", text: "robin"}, {id: "2", text: "régis" }]);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
|
click(".select-box-header");
|
2017-08-15 20:34:43 -04:00
|
|
|
|
|
2017-08-13 08:34:50 -04:00
|
|
|
|
andThen(() => {
|
2017-09-10 13:12:03 -04:00
|
|
|
|
assert.equal(find(".select-box-row.is-selected .text").text(), "régis");
|
2017-08-13 08:34:50 -04:00
|
|
|
|
});
|
2017-08-29 06:25:54 -04:00
|
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
|
this.set("value", 3);
|
|
|
|
|
this.set("content", [{ id: "3", text: "jeff" }]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
andThen(() => {
|
2017-09-10 13:12:03 -04:00
|
|
|
|
assert.equal(find(".select-box-row.is-selected .text").text(), "jeff", "it works with dynamic content");
|
2017-08-29 06:25:54 -04:00
|
|
|
|
});
|
2017-08-13 08:34:50 -04:00
|
|
|
|
}
|
|
|
|
|
});
|
2017-08-24 12:31:33 -04:00
|
|
|
|
|
|
|
|
|
componentTest('dynamic headerText', {
|
|
|
|
|
template: '{{select-box value=1 content=content}}',
|
|
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
|
this.set("content", [{ id: 1, text: "robin" }, { id: 2, text: "regis" }]);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
|
click(".select-box-header");
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-header .current-selection").html().trim(), "robin");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
click(".select-box-row[title='regis']");
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-header .current-selection").html().trim(), "regis", "it changes header text");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
componentTest('static headerText', {
|
|
|
|
|
template: '{{select-box value=1 content=content dynamicHeaderText=false headerText=headerText}}',
|
|
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
|
this.set("content", [{ id: 1, text: "robin" }, { id: 2, text: "regis" }]);
|
|
|
|
|
this.set("headerText", "Choose...");
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
|
click(".select-box-header");
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-header .current-selection").html().trim(), "Choose...");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
click(".select-box-row[title='regis']");
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-header .current-selection").html().trim(), "Choose...", "it doesn’t change header text");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
2017-08-28 08:34:04 -04:00
|
|
|
|
|
2017-08-29 06:25:54 -04:00
|
|
|
|
componentTest('supports custom row title', {
|
|
|
|
|
template: '{{select-box content=content titleForRow=titleForRow}}',
|
|
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
|
this.set("content", [{ id: 1, text: "robin" }]);
|
|
|
|
|
this.set("titleForRow", () => "sam" );
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
|
click(".select-box-header");
|
|
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-row:first").attr("title"), "sam");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
2017-09-10 13:12:03 -04:00
|
|
|
|
|
|
|
|
|
componentTest('supports keyboard events', {
|
2017-09-10 18:38:32 -04:00
|
|
|
|
template: '{{select-box content=content filterable=true}}',
|
2017-09-10 13:12:03 -04:00
|
|
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
|
this.set("content", [{ id: 1, text: "robin" }, { id: 2, text: "regis" }]);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
test(assert) {
|
|
|
|
|
const arrowDownEvent = () => {
|
|
|
|
|
const event = jQuery.Event("keydown");
|
|
|
|
|
event.keyCode = 40;
|
|
|
|
|
find(".select-box").trigger(event);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const arrowUpEvent = () => {
|
|
|
|
|
const event = jQuery.Event("keydown");
|
|
|
|
|
event.keyCode = 38;
|
|
|
|
|
find(".select-box").trigger(event);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const escapeEvent = () => {
|
|
|
|
|
const event = jQuery.Event("keydown");
|
|
|
|
|
event.keyCode = 27;
|
|
|
|
|
find(".select-box").trigger(event);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const enterEvent = () => {
|
|
|
|
|
const event = jQuery.Event("keydown");
|
|
|
|
|
event.keyCode = 13;
|
|
|
|
|
find(".select-box").trigger(event);
|
|
|
|
|
};
|
|
|
|
|
|
2017-09-10 18:38:32 -04:00
|
|
|
|
const tabEvent = () => {
|
|
|
|
|
const event = jQuery.Event("keydown");
|
|
|
|
|
event.keyCode = 9;
|
|
|
|
|
find(".select-box").trigger(event);
|
|
|
|
|
};
|
|
|
|
|
|
2017-09-10 13:12:03 -04:00
|
|
|
|
click(".select-box-header");
|
|
|
|
|
|
|
|
|
|
andThen(() => arrowDownEvent() );
|
|
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-row.is-highlighted").attr("title"), "robin", "it highlights the first row");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
andThen(() => arrowDownEvent() );
|
|
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-row.is-highlighted").attr("title"), "regis", "it highlights the next row");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
andThen(() => arrowDownEvent() );
|
|
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-row.is-highlighted").attr("title"), "regis", "it keeps highlighting the last row when reaching the end");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
andThen(() => arrowUpEvent() );
|
|
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-row.is-highlighted").attr("title"), "robin", "it highlights the previous row");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
andThen(() => enterEvent() );
|
|
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-row.is-selected").attr("title"), "robin", "it selects the row when pressing enter");
|
|
|
|
|
assert.equal(find(".select-box").hasClass("is-expanded"), false, "it collapses the select box when selecting a row");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
click(".select-box-header");
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box").hasClass("is-expanded"), true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
andThen(() => escapeEvent() );
|
|
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box").hasClass("is-expanded"), false, "it collapses the select box");
|
|
|
|
|
});
|
2017-09-10 18:38:32 -04:00
|
|
|
|
|
|
|
|
|
click(".select-box-header");
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box").hasClass("is-expanded"), true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
fillIn(".filter-query", "regis");
|
|
|
|
|
triggerEvent('.filter-query', 'keyup');
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-row.is-highlighted").attr("title"), "regis", "it highlights the first result");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
andThen(() => tabEvent() );
|
|
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
|
assert.equal(find(".select-box-row.is-selected").attr("title"), "regis", "it selects the row when pressing tab");
|
|
|
|
|
assert.equal(find(".select-box").hasClass("is-expanded"), false, "it collapses the select box when selecting a row");
|
|
|
|
|
});
|
2017-09-10 13:12:03 -04:00
|
|
|
|
}
|
|
|
|
|
});
|