diff options
Diffstat (limited to 'test/events/submitSpec.js')
-rw-r--r-- | test/events/submitSpec.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/events/submitSpec.js b/test/events/submitSpec.js new file mode 100644 index 0000000..bacd726 --- /dev/null +++ b/test/events/submitSpec.js @@ -0,0 +1,21 @@ +describe("form submit event", function () { + + $.fixture("options"); + + subject(function () { + return new Awesomplete("#inside-form", { list: ["item1", "item2", "item3"] }); + }); + + beforeEach(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(); + }); +}); |