diff options
-rw-r--r-- | karma.conf.js | 1 | ||||
-rw-r--r-- | test/api/closeSpec.js | 5 | ||||
-rw-r--r-- | test/api/evaluateSpec.js | 37 | ||||
-rw-r--r-- | test/api/gotoSpec.js | 15 | ||||
-rw-r--r-- | test/api/nextSpec.js | 11 | ||||
-rw-r--r-- | test/api/openSpec.js | 47 | ||||
-rw-r--r-- | test/api/previousSpec.js | 11 | ||||
-rw-r--r-- | test/api/selectSpec.js | 10 | ||||
-rw-r--r-- | test/awesompleteShared.js | 45 | ||||
-rw-r--r-- | test/awesompleteSpec.js | 117 | ||||
-rw-r--r-- | test/events/blurSpec.js | 7 | ||||
-rw-r--r-- | test/events/inputSpec.js | 7 | ||||
-rw-r--r-- | test/events/keydownSpec.js | 2 | ||||
-rw-r--r-- | test/events/mousedownSpec.js | 24 | ||||
-rw-r--r-- | test/events/submitSpec.js | 11 | ||||
-rw-r--r-- | test/init/htmlSpec.js | 2 | ||||
-rw-r--r-- | test/init/listSpec.js | 4 | ||||
-rw-r--r-- | test/init/optionsSpec.js | 4 | ||||
-rw-r--r-- | test/static/filterContainsSpec.js | 4 | ||||
-rw-r--r-- | test/static/filterStartsWithSpec.js | 4 | ||||
-rw-r--r-- | test/static/sortByLengthSpec.js | 4 |
21 files changed, 114 insertions, 258 deletions
diff --git a/karma.conf.js b/karma.conf.js index 0ccdd13..f4146f4 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -15,7 +15,6 @@ module.exports = function(config) { pattern: 'test/fixtures/**/*.html', watched: true, included: true, served: true }, - 'test/**/*Shared.js', 'test/**/*Spec.js' ], diff --git a/test/api/closeSpec.js b/test/api/closeSpec.js index b1de6bc..e22fe2f 100644 --- a/test/api/closeSpec.js +++ b/test/api/closeSpec.js @@ -2,9 +2,10 @@ describe("awesomplete.close", function () { $.fixture("plain"); - subject(function () { return new Awesomplete("#plain") }); + subject(function () { return new Awesomplete("#plain", { list: ["item1", "item2", "item3"] }) }); beforeEach(function () { + $.type(this.subject.input, "ite"); this.subject.open(); this.subject.next(); }); @@ -16,8 +17,6 @@ describe("awesomplete.close", function () { it("makes no item selected", function () { this.subject.close(); - - expect(this.subject.selected).toBe(false); expect(this.subject.index).toBe(-1); }); diff --git a/test/api/evaluateSpec.js b/test/api/evaluateSpec.js index cc064b6..011835e 100644 --- a/test/api/evaluateSpec.js +++ b/test/api/evaluateSpec.js @@ -49,9 +49,44 @@ describe("awesomplete.evaluate", function () { expect(this.subject.ul.children.length).toBe(3); }); + it("shows no more than maxItems", function () { + this.subject.maxItems = 2; + this.subject.evaluate(); + expect(this.subject.ul.children.length).toBe(2); + }); + + it("makes no item selected", function () { + this.subject.evaluate(); + expect(this.subject.index).toBe(-1); + }); + }); + + describe("with minChars: 0", function () { + beforeEach(function () { + this.subject.minChars = 0; + }); + + it("opens completer", function () { + spyOn(this.subject, "open"); + this.subject.evaluate(); + + expect(this.subject.open).toHaveBeenCalled(); + }); + + it("fills completer with all items", function () { + this.subject.evaluate(); + expect(this.subject.ul.children.length).toBe(3); + }); + + it("shows no more than maxItems", function () { + this.subject.maxItems = 2; + this.subject.evaluate(); + expect(this.subject.ul.children.length).toBe(2); + }); + it("makes no item selected", function () { this.subject.evaluate(); - expect(this.subject.selected).toBe(false); + expect(this.subject.index).toBe(-1); }); }); }); diff --git a/test/api/gotoSpec.js b/test/api/gotoSpec.js index da96cf0..fd7c242 100644 --- a/test/api/gotoSpec.js +++ b/test/api/gotoSpec.js @@ -6,7 +6,6 @@ describe("awesomplete.goto", function () { return new Awesomplete("#plain", { list: ["item1", "item2", "item3"] }); }); - def("firstIndex", function () { return 0 }); def("lastIndex", function () { return this.subject.ul.children.length - 1 }); beforeEach(function () { @@ -14,15 +13,15 @@ describe("awesomplete.goto", function () { }); it("clears previous aria-selected", function () { - this.subject.goto(this.firstIndex); + this.subject.goto(0); this.subject.goto(this.lastIndex); - expect(this.subject.ul.children[this.firstIndex].getAttribute("aria-selected")).toBe("false"); + expect(this.subject.ul.children[0].getAttribute("aria-selected")).toBe("false"); }); it("goes to first item", function () { - this.subject.goto(this.firstIndex); - expect(this.subject.index).toBe(this.firstIndex); + this.subject.goto(0); + expect(this.subject.index).toBe(0); }); it("goes to last item", function () { @@ -39,11 +38,11 @@ describe("awesomplete.goto", function () { describe("with item index > -1", function () { beforeEach(function () { - this.subject.goto(this.firstIndex); + this.subject.goto(0); }); it("sets aria-selected", function () { - expect(this.subject.ul.children[this.firstIndex].getAttribute("aria-selected")).toBe("true"); + expect(this.subject.ul.children[0].getAttribute("aria-selected")).toBe("true"); }); it("updates status", function () { @@ -53,7 +52,7 @@ describe("awesomplete.goto", function () { describe("with item index = -1", function () { beforeEach(function () { - this.subject.goto(this.firstIndex); + this.subject.goto(0); this.subject.goto(-1); }); diff --git a/test/api/nextSpec.js b/test/api/nextSpec.js index bef3134..8b308e9 100644 --- a/test/api/nextSpec.js +++ b/test/api/nextSpec.js @@ -6,7 +6,6 @@ describe("awesomplete.next", function () { return new Awesomplete("#plain", { list: ["item1", "item2", "item3"] }); }); - def("firstIndex", function () { return 0 }); def("lastIndex", function () { return this.subject.ul.children.length - 1 }); describe("without any items found", function () { @@ -17,7 +16,7 @@ describe("awesomplete.next", function () { it("does not select any item", function () { this.subject.next(); - expect(this.subject.selected).toBe(false); + expect(this.subject.index).toBe(-1); }); }); @@ -30,15 +29,15 @@ describe("awesomplete.next", function () { describe("and no item was already selected", function () { it("selects the first item ", function () { this.subject.next(); - expect(this.subject.index).toBe(this.firstIndex); + expect(this.subject.index).toBe(0); }); }); describe("and some item was already selected", function () { it("selects the second item", function () { - this.subject.goto(this.firstIndex); + this.subject.goto(0); this.subject.next(); - expect(this.subject.index).toBe(this.firstIndex + 1); + expect(this.subject.index).toBe(1); }); it("selects the last item", function () { @@ -50,7 +49,7 @@ describe("awesomplete.next", function () { it("selects no item after reaching the end", function () { this.subject.goto(this.lastIndex); this.subject.next(); - expect(this.subject.selected).toBe(false); + expect(this.subject.index).toBe(-1); }); }); }); diff --git a/test/api/openSpec.js b/test/api/openSpec.js index 848b960..1bfc467 100644 --- a/test/api/openSpec.js +++ b/test/api/openSpec.js @@ -2,49 +2,58 @@ describe("awesomplete.open", function () { $.fixture("plain"); - subject(function () { return new Awesomplete("#plain", this.options) }); - - it("opens completer", function () { - this.subject.open(); - expect(this.subject.ul.hasAttribute("hidden")).toBe(false); - }); + subject(function () { return new Awesomplete("#plain", { list: ["item1", "item2", "item3"] }) }); // Exposes this bug https://github.com/LeaVerou/awesomplete/pull/16740 // FIXME better fix is probably required as discussed in PR above xit("fills in the list on creation", function () { $("#plain").value = "ite"; - this.options = { list: "item1, item2" }; this.subject.open(); - expect(this.subject.ul.children.length).toBe(2); + expect(this.subject.ul.children.length).toBe(3); }); - it("fires awesomplete-open event", function () { - var handler = $.spyOnEvent(this.subject.input, "awesomplete-open"); + it("opens completer", function () { this.subject.open(); - - expect(handler).toHaveBeenCalled(); + expect(this.subject.ul.hasAttribute("hidden")).toBe(false); }); describe("with autoFirst: true", function () { - def("options", function () { return { autoFirst: true } }); - - it("automatically selects first item", function () { + beforeEach(function () { + this.subject.autoFirst = true; spyOn(this.subject, "goto"); + }); + + it("selects first item if wasn't seleted before", function () { this.subject.open(); expect(this.subject.goto).toHaveBeenCalledWith(0); }); + + it("does not select any item if was seleted before", function () { + this.subject.index = 0; + this.subject.open(); + + expect(this.subject.goto).not.toHaveBeenCalled(); + }); }); describe("with autoFirst: false", function () { - def("options", function () { return { autoFirst: false } }); - it("does not select any item", function () { + this.subject.autoFirst = false; + spyOn(this.subject, "goto"); + this.subject.open(); - expect(this.subject.selected).toBe(false); - expect(this.subject.index).toBe(-1); + expect(this.subject.goto).not.toHaveBeenCalled(); }); }); + + it("fires awesomplete-open event", function () { + var handler = $.spyOnEvent(this.subject.input, "awesomplete-open"); + + this.subject.open(); + + expect(handler).toHaveBeenCalled(); + }); }); diff --git a/test/api/previousSpec.js b/test/api/previousSpec.js index c1d7daf..f325eaf 100644 --- a/test/api/previousSpec.js +++ b/test/api/previousSpec.js @@ -6,7 +6,6 @@ describe("awesomplete.previous", function () { return new Awesomplete("#plain", { list: ["item1", "item2", "item3"] }); }); - def("firstIndex", function () { return 0 }); def("lastIndex", function () { return this.subject.ul.children.length - 1 }); describe("without any items found", function () { @@ -17,7 +16,7 @@ describe("awesomplete.previous", function () { it("does not select any item", function () { this.subject.previous(); - expect(this.subject.selected).toBe(false); + expect(this.subject.index).toBe(-1); }); }); @@ -42,15 +41,15 @@ describe("awesomplete.previous", function () { }); it("selects the first item", function () { - this.subject.goto(this.firstIndex + 1); + this.subject.goto(1); this.subject.previous(); - expect(this.subject.index).toBe(this.firstIndex); + expect(this.subject.index).toBe(0); }); it("selects no item after reaching the start", function () { - this.subject.goto(this.firstIndex); + this.subject.goto(0); this.subject.previous(); - expect(this.subject.selected).toBe(false); + expect(this.subject.index).toBe(-1); }); }); }); 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 () { diff --git a/test/awesompleteShared.js b/test/awesompleteShared.js deleted file mode 100644 index 64d53f4..0000000 --- a/test/awesompleteShared.js +++ /dev/null @@ -1,45 +0,0 @@ -var shared = { - expectMinCharsToBe: function(num){ - return function(){ - expect(shared.awesompleter.minChars).toBe(num); - } - }, - expectMaxItemsToBe: function(num){ - return function(){ - expect(shared.awesompleter.maxItems).toBe(num); - } - }, - expectNumSuggestionsWith: function(num, val){ - return function(){ - shared.awesompleter.input.value = val; - shared.awesompleter.evaluate(); - expect(shared.awesompleter.ul.children.length).toBe(num); - } - }, - expectListLengthToBe: function(num){ - return function(){ - expect(shared.awesompleter._list.length).toBe(num); - } - }, - expectSelectingFirstSuggestionToWorkWith: function(val){ - return function(){ - var li; - shared.awesompleter.input.value = val; - shared.awesompleter.evaluate(); - li = shared.awesompleter.ul.children[0]; - shared.awesompleter.select(li); - expect(shared.awesompleter.input.value).toBe(li.textContent); - } - }, - expectAutoFirstToWorkWith: function(val){ - return function(){ - var li; - shared.awesompleter.input.value = val; - shared.awesompleter.evaluate(); - shared.awesompleter.open(); - li = shared.awesompleter.ul.children[0]; - expect(li.getAttribute('aria-selected')).toBe('true'); - expect(shared.awesompleter.status.textContent).toBe(li.textContent); - } - } -}; diff --git a/test/awesompleteSpec.js b/test/awesompleteSpec.js deleted file mode 100644 index 601bf9d..0000000 --- a/test/awesompleteSpec.js +++ /dev/null @@ -1,117 +0,0 @@ -describe("awesomplete",function(){
-
- var awesompleter;
- var dummyInput;
-
- beforeEach(function(){
- var dummyBody = document.createElement('body');
- dummyInput = document.createElement('input');
- dummyBody.appendChild(dummyInput);
- awesompleter = new Awesomplete(dummyInput);
- shared.awesompleter = awesompleter;
- })
-
- describe("default object",function(){
- it("should have an empty list", shared.expectListLengthToBe(0));
-
- it("should have 2 min chars", shared.expectMinCharsToBe(2));
-
- it("should have 10 max items", shared.expectMaxItemsToBe(10));
- })
-
- describe("data-list", function(){
- beforeEach(function(){
- var dummyBody = document.createElement('body');
- dummyInput = document.createElement('input');
- dummyBody.appendChild(dummyInput);
- dummyInput.setAttribute('data-list', 'test1, test2, test3, test4, test5, test6, testtest1, testtest2, testtest3, testtest4, testtest5, testtest6');
- awesompleter = new Awesomplete(dummyInput);
- shared.awesompleter = awesompleter;
- })
-
- it("should have a non-empty list", shared.expectListLengthToBe(12));
-
- it("should have 2 min chars", shared.expectMinCharsToBe(2));
-
- it("should have 10 max items", shared.expectMaxItemsToBe(10));
-
- it("should not show any suggestions if input length is below min chars", shared.expectNumSuggestionsWith(0, 't'));
-
- it("should not show any suggestions if none match", shared.expectNumSuggestionsWith(0, 'nomatch'));
-
- it("should show up to max items of suggestions if more are available", shared.expectNumSuggestionsWith(10, 'test'));
-
- it("should show all matching suggestions if more are not available", shared.expectNumSuggestionsWith(6, 'testtest'));
-
- it("should autocomplete when a suggestion is selected", shared.expectSelectingFirstSuggestionToWorkWith('test'));
- })
-
- describe("custom object",function(){
- beforeEach(function(){
- var dummyBody = document.createElement('body');
- dummyInput = document.createElement('input');
- dummyBody.appendChild(dummyInput);
- awesompleter = new Awesomplete(dummyInput,{
- minChars:3,
- maxItems:8,
- list: ['test1', 'test2', 'test3', 'test4', 'test5', 'test6', 'testtest1', 'testtest2', 'testtest3', 'testtest4', 'testtest5', 'testtest6'],
- autoFirst: true
- })
- shared.awesompleter = awesompleter;
- })
-
- it("should have a non-empty list", shared.expectListLengthToBe(12));
-
- it("should have 3 min chars", shared.expectMinCharsToBe(3));
-
- it("should have 8 max items", shared.expectMaxItemsToBe(8));
-
- it("should not show any suggestions if input length is below min chars", shared.expectNumSuggestionsWith(0, 'te'));
-
- it("should not show any suggestions if none match", shared.expectNumSuggestionsWith(0, 'nomatch'));
-
- it("should show matching suggestions if input length is above min chars", shared.expectNumSuggestionsWith(8, 'tes'));
-
- it("should show up to max items of suggestions if more are available", shared.expectNumSuggestionsWith(8, 'test'));
-
- it("should show all matching suggestions if more are not available", shared.expectNumSuggestionsWith(6, 'testtest'));
-
- it("should autocomplete when a suggestion is selected", shared.expectSelectingFirstSuggestionToWorkWith('test'));
-
- it("should autocomplete the first suggestion when autoFirst is true", shared.expectAutoFirstToWorkWith('test'));
- })
-});
-
-describe("awesomplete helpers",function(){
-
- describe("$ function",function(){
-
- it("should return null when is called without input",function(){
- var null_selector = Awesomplete.$();
- expect(null_selector).toBe(null);
- })
-
-
- it("should escape regular expression tokens",function(){
- var string_with_tokens = "[^j(a)v?a-sc|ri\\p+t*]";
- var escape_string = Awesomplete.$.regExpEscape(string_with_tokens);
- expect(escape_string).toBe("\\[\\^j\\(a\\)v\\?a\\-sc\\|ri\\\\p\\+t\\*\\]");
- })
- })
-
- describe("$ function spy",function(){
- beforeEach(function(){
- spyOn(Awesomplete,'$');
- Awesomplete.$(null);
- })
-
- it("should call the query selector function",function(){
- expect(Awesomplete.$).toHaveBeenCalled();
- })
-
- it("should have been called with null when called with no args",function(){
- expect(Awesomplete.$).toHaveBeenCalledWith(null);
- })
- })
-
-});
diff --git a/test/events/blurSpec.js b/test/events/blurSpec.js index fd2df8c..2572179 100644 --- a/test/events/blurSpec.js +++ b/test/events/blurSpec.js @@ -2,15 +2,10 @@ describe("blur event", function () { $.fixture("plain"); - subject(function () { - return new Awesomplete("#plain", { list: ["item1", "item2", "item3"] }); - }); + subject(function () { return new Awesomplete("#plain") }); it("closes completer", function () { spyOn(Awesomplete.prototype, "close"); - this.subject.input.focus(); - this.subject.open(); - $.fire(this.subject.input, "blur"); expect(Awesomplete.prototype.close).toHaveBeenCalled(); }); diff --git a/test/events/inputSpec.js b/test/events/inputSpec.js index 7f7282d..b32091e 100644 --- a/test/events/inputSpec.js +++ b/test/events/inputSpec.js @@ -2,15 +2,10 @@ describe("input event", function () { $.fixture("plain"); - subject(function () { - return new Awesomplete("#plain", { list: ["item1", "item2", "item3"] }); - }); + subject(function () { return new Awesomplete("#plain") }); it("rebuilds the list", function () { spyOn(Awesomplete.prototype, "evaluate"); - this.subject.input.focus(); - this.subject.open(); - $.type(this.subject.input, "ite"); expect(Awesomplete.prototype.evaluate).toHaveBeenCalled(); }); diff --git a/test/events/keydownSpec.js b/test/events/keydownSpec.js index 903d638..559d437 100644 --- a/test/events/keydownSpec.js +++ b/test/events/keydownSpec.js @@ -7,8 +7,6 @@ describe("keydown event", function () { }); beforeEach(function () { - this.subject.open(); - this.subject.input.focus(); $.type(this.subject.input, "ite"); }); diff --git a/test/events/mousedownSpec.js b/test/events/mousedownSpec.js index 063ae62..c0f7cf6 100644 --- a/test/events/mousedownSpec.js +++ b/test/events/mousedownSpec.js @@ -6,16 +6,13 @@ describe("mousedown event", function () { return new Awesomplete("#plain", { list: ["item1", "item2", "item3"] }); }); + def("li", function () { return this.subject.ul.children[1] }); + beforeEach(function () { - this.subject.input.focus(); - this.subject.open(); $.type(this.subject.input, "ite"); - spyOn(this.subject, "select"); }); - def("li", function () { return this.subject.ul.children[1] }); - describe("with ul target", function () { def("target", function () { return this.subject.ul }); @@ -47,10 +44,19 @@ describe("mousedown event", function () { describe("with child of li target", function () { def("target", function () { return $("mark", this.li) }); - it("selects item", function () { - var event = $.fire(this.target, "mousedown", { button: 0 }); - expect(this.subject.select).toHaveBeenCalledWith(this.li, this.target); - expect(event.defaultPrevented).toBe(true); + describe("on left click", function () { + it("selects item", function () { + var event = $.fire(this.target, "mousedown", { button: 0 }); + expect(this.subject.select).toHaveBeenCalledWith(this.li, this.target); + expect(event.defaultPrevented).toBe(true); + }); + }); + + describe("on right click", function () { + it("does not select item", function () { + $.fire(this.target, "mousedown", { button: 2 }); + expect(this.subject.select).not.toHaveBeenCalled(); + }); }); }); }); diff --git a/test/events/submitSpec.js b/test/events/submitSpec.js index bacd726..c51a5cf 100644 --- a/test/events/submitSpec.js +++ b/test/events/submitSpec.js @@ -2,19 +2,12 @@ describe("form submit event", function () { $.fixture("options"); - subject(function () { - return new Awesomplete("#inside-form", { list: ["item1", "item2", "item3"] }); - }); + subject(function () { return new Awesomplete("#inside-form") }); - beforeEach(function () { + it("closes completer", function () { spyOn(Awesomplete.prototype, "close"); - this.subject.input.focus(); - this.subject.open(); // prevent full page reload in Firefox, which causes tests to stop running $.on(this.subject.input.form, "submit", function (evt) { evt.preventDefault() }); - }); - - it("closes completer", function () { $.fire(this.subject.input.form, "submit"); expect(Awesomplete.prototype.close).toHaveBeenCalled(); }); diff --git a/test/init/htmlSpec.js b/test/init/htmlSpec.js index 3e0b9c1..25350c6 100644 --- a/test/init/htmlSpec.js +++ b/test/init/htmlSpec.js @@ -28,7 +28,7 @@ describe("Html modifications", function () { expect(this.subject.ul.tagName).toBe("UL"); }); - it("places list inside container", function () { + it("puts list inside container", function () { expect(this.subject.ul.parentNode).toBe(this.subject.container); }); diff --git a/test/init/listSpec.js b/test/init/listSpec.js index ac265aa..6f95ff0 100644 --- a/test/init/listSpec.js +++ b/test/init/listSpec.js @@ -17,7 +17,7 @@ describe("Awesomplete list", function () { }); it("assigns from comma separated list", function () { - this.subject.list = "From,Inline,List"; + this.subject.list = "From, Inline, List"; expect(this.subject._list).toEqual([ "From", "Inline", "List" ]); }); @@ -62,7 +62,7 @@ describe("Awesomplete list", function () { }); it("assigns from comma separated list", function () { - this.options = { list: "From,Inline,List" }; + this.options = { list: "From, Inline, List" }; expect(this.subject._list).toEqual([ "From", "Inline", "List" ]); }); diff --git a/test/init/optionsSpec.js b/test/init/optionsSpec.js index fdbc429..9dab9ae 100644 --- a/test/init/optionsSpec.js +++ b/test/init/optionsSpec.js @@ -41,7 +41,7 @@ describe("Constructor options", function () { def("options", function () { return { minChars: 3, - maxItems: 7, + maxItems: 9, autoFirst: true, filter: $.noop, sort: $.noop, @@ -52,7 +52,7 @@ describe("Constructor options", function () { it("overrides simple default options", function () { expect(this.subject.minChars).toBe(3); - expect(this.subject.maxItems).toBe(7); + expect(this.subject.maxItems).toBe(9); expect(this.subject.autoFirst).toBe(true); }); diff --git a/test/static/filterContainsSpec.js b/test/static/filterContainsSpec.js index f6db514..1cfbbfd 100644 --- a/test/static/filterContainsSpec.js +++ b/test/static/filterContainsSpec.js @@ -2,10 +2,6 @@ describe("Awesomplete.FILTER_CONTAINS", function () { subject(function () { return Awesomplete.FILTER_CONTAINS }); - it("is a function", function () { - expect(this.subject).toEqual(jasmine.any(Function)); - }); - describe("search in a plain string", function () { it("matches at the start", function () { expect(this.subject("Hello world", "Hello")).toBe(true); diff --git a/test/static/filterStartsWithSpec.js b/test/static/filterStartsWithSpec.js index 655ee23..ce30aab 100644 --- a/test/static/filterStartsWithSpec.js +++ b/test/static/filterStartsWithSpec.js @@ -2,10 +2,6 @@ describe("Awesomplete.FILTER_STARTSWITH", function () { subject(function () { return Awesomplete.FILTER_STARTSWITH }); - it("is a function", function () { - expect(this.subject).toEqual(jasmine.any(Function)); - }); - describe("search in plain string", function () { it("matches at the start", function () { expect(this.subject("Hello world", "Hello")).toBe(true); diff --git a/test/static/sortByLengthSpec.js b/test/static/sortByLengthSpec.js index e11d9db..982ae40 100644 --- a/test/static/sortByLengthSpec.js +++ b/test/static/sortByLengthSpec.js @@ -2,10 +2,6 @@ describe("Awesomplete.SORT_BYLENGTH", function () { subject(function () { return Awesomplete.SORT_BYLENGTH }); - it("is a function", function () { - expect(this.subject).toEqual(jasmine.any(Function)); - }); - describe("with strings of different length", function () { it("returns negative number if the first string is shorter", function () { expect(this.subject("a", "aa")).toBe(-1); |