From: Jason Skomorowski Date: Thu, 21 Aug 2014 18:15:18 +0000 (-0400) Subject: Async init() test and example. X-Git-Tag: 1.0.0~39^2~7^2~5 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=2dc4cb56;hp=19777b46905bc25b666eba4e37bacd76ffac91eb;p=mkws-moved-to-github.git Async init() test and example. --- diff --git a/examples/htdocs/async.html b/examples/htdocs/async.html new file mode 100644 index 0000000..e89cf48 --- /dev/null +++ b/examples/htdocs/async.html @@ -0,0 +1,32 @@ + + + + + + MKWS demo: Async feeling. + + + + + + + + +
+ +
+ +
+ +
This would have been four but we're not searching it.
+ + diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index eb25086..2e49726 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -728,6 +728,17 @@ describe("Check SortBy options", function () { }); }); +describe("Check async widget discovery", function () { + var $ = mkws.$; + it("initialises a new widget", function() { + $("div.mkwsSearch").after('
'); + mkws.init("Another search box"); + // mkws.init("Another search box", "#asyncSearch"); + waitsFor(function () { + return $("#asyncSearch input").length >= 1 ? true : false; + }, "Call init() to build an .mkwsSearch", 750); + }); +}); /* done */ describe("All tests are done", function () {