1 /* Copyright (c) 2013 IndexData ApS. http://indexdata.com
3 * jQuery test with DOM/windows object
8 var fs = require("fs");
9 var utils = require("./mkws_utils.js");
12 * simple test with string matching of the HTML page
16 function html_check (file, tags_array, ignore_doctype) {
17 var html = fs.readFileSync(file, "utf-8");
18 var tags = utils.flat_list(tags_array);
20 describe("index-full.html string test for " + file, function() {
21 it("html test", function() {
22 expect(html).toBeDefined();
24 // forgotten doctype declaration
25 if (!ignore_doctype) {
26 expect(html).toMatch(/<html.*?>/);
27 expect(html).toMatch(/<\/html.*?>/);
29 expect(html).toMatch(/<head.*?>/);
30 expect(html).toMatch(/<body.*?>/);
31 expect(html).toMatch(/<\/head.*?>/);
32 expect(html).toMatch(/<\/body.*?>/);
34 expect(html).toMatch(/<meta .*?charset=utf-8/i);
35 expect(html).toMatch(/<title>.+<\/title>/i);
36 expect(html).toMatch(/<link .*?type="text\/css" href=".*?\/?mkwsStyle.css"/);
39 for(var i = 0, data = ""; i < tags.length; i++) {
40 data = '<div id="' + tags[i] + '">';
42 expect(html).toMatch(data);
48 html_check('../examples/htdocs/index-full.html', [utils.tags.required, utils.tags.optional, utils.tags.optional2]);
49 html_check('../examples/htdocs/index-mobile.html', [utils.tags.required, utils.tags.optional]);
50 html_check('../examples/htdocs/index-popup.html', [], true);
51 html_check('../examples/htdocs/index-jquery.html', []);
52 html_check('../examples/htdocs/index-mike.html', [utils.tags.required, utils.tags.optional], true);