-/* Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com
+/* Copyright (c) 2013-2014 Index Data ApS. http://indexdata.com
*
* perform papzpar2 / pz2.js search & retrieve request in the browser
*
waitsFor(function () {
return $("div.mkwsFacet[data-mkws-facet='author'] div.mkwsTerm").length >= 2 ? true : false;
- }, "At least one author link displayed", 4 * jasmine_config.second);
+ }, "At least two author link displayed", 4 * jasmine_config.second);
runs(function () {
expect($("div.mkwsFacet[data-mkws-facet='author'] div.mkwsTerm").length).toBeGreaterThan(1);
var list = [];
var terms = $("div.mkwsRecords > div.mkwsSummary > a");
for (var i = 0; i < terms.length; i++) {
- var term = $(terms[i]).text();
+ var term = $(terms[i]).text().trim();
list.push(term);
// debug(prefix + "title: " + term);
}
var title_list_new = title_list("yyy ");
var diff_flag = 0;
for (var i = 0; i < title_list_old.length; i++) {
- debug(title_list_old[i] + " :: " + title_list_new[i]);
+ debug((i+1) + ". " + title_list_old[i] + " :: " + title_list_new[i]);
if (title_list_old[i] != title_list_new[i]) {
diff_flag++;
});
});
+describe("Check async widget discovery", function () {
+ var $ = mkws.$;
+ it("initialises a new widget", function() {
+ $("div.mkwsSearch").after('<div id="asyncSearch"><div class="mkwsSearch mkwsTeam_async"></div></div>');
+ mkws.init("Another search box", "#asyncSearch");
+ waitsFor(function () {
+ return $("#asyncSearch input").length >= 1 ? true : false;
+ }, "Call init() to build an .mkwsSearch", 750);
+ runs(function () {
+ var numInput = $("div.mkwsSearch input").length;
+ debug("Input elements present: " + numInput);
+ expect(numInput).toBe(4);
+ var numRec = $("div.mkwsRecords > div.mkwsSummary > a").length;
+ debug("Records should still be present. There are: " + numRec);
+ expect(numRec).toBeGreaterThan(0);
+ });
+ });
+});
/* done */
describe("All tests are done", function () {