summaryrefslogtreecommitdiffstats
path: root/test/api/selectSpec.js
diff options
context:
space:
mode:
authorVladislav Zarakovsky <vlad.zar@gmail.com>2016-01-28 14:40:59 +0300
committerVladislav Zarakovsky <vlad.zar@gmail.com>2016-01-28 14:40:59 +0300
commit011711c9179bc0b5b906347c2ee273e58ad76521 (patch)
treee9519ee8e384e9d4f23b94e18fb9665cd1956f28 /test/api/selectSpec.js
parent98b4607c8c4c2db9b0cdb4f47a3bbcacc8472fed (diff)
downloadawesomplete-011711c9179bc0b5b906347c2ee273e58ad76521.zip
awesomplete-011711c9179bc0b5b906347c2ee273e58ad76521.tar.gz
awesomplete-011711c9179bc0b5b906347c2ee273e58ad76521.tar.bz2
Big tests cleanup
Diffstat (limited to 'test/api/selectSpec.js')
-rw-r--r--test/api/selectSpec.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/api/selectSpec.js b/test/api/selectSpec.js
index 82b4069..8d8a186 100644
--- a/test/api/selectSpec.js
+++ b/test/api/selectSpec.js
@@ -6,7 +6,6 @@ describe("awesomplete.select", function () {
return new Awesomplete("#plain", { list: ["item1", "item2", "item3"] });
});
- def("firstIndex", function () { return 0 });
def("lastIndex", function () { return this.subject.ul.children.length - 1 });
def("lastLi", function () { return this.subject.ul.children[this.lastIndex] });
@@ -25,7 +24,7 @@ describe("awesomplete.select", function () {
describe("and current item", function () {
beforeEach(function () {
- this.subject.goto(this.firstIndex);
+ this.subject.goto(0);
});
itSelects("item1");
@@ -45,7 +44,12 @@ describe("awesomplete.select", function () {
var handler = $.spyOnEvent(this.subject.input, "awesomplete-select");
this.subject.select(this.selectArgument);
- expect(handler).toHaveBeenCalledWith(jasmine.objectContaining({ text: expectedTxt }));
+ expect(handler).toHaveBeenCalledWith(
+ jasmine.objectContaining({
+ text: expectedTxt,
+ origin: this.selectArgument || this.subject.ul.children[0]
+ })
+ );
});
describe("and awesomplete-select event was not prevented", function () {