Unit tests
----------
+Tests are based on jasmine. a general description of jasmine is on
+http://jasmine.github.io/1.3/introduction.html
+
If you want understand the test than you can look at mkws/test/spec/mkws-config.js
and mkws/test/spec/mkws-pazpar2.js . See also mkws/test/README.txt
+The test scripts are included from the test page, for example
+mkws/examples/htdocs/jasmine-popup.html has
+<script type="text/javascript" src="test/spec/mkws-pazpar2.js"></script>
+
+
Structure of mkws.js
});
});
+describe("Check MOTD before search", function () {
+ // Check that the MOTD has been moved into its container, and
+ // is visible before the search.
+ // the mkwsMOTD div was originally inside a testMOTD div, which should
+ // now be emtpy
+ // Note that the testMOTD is a regular div, and uses #testMOTD,
+ // since the automagic class-making does not apply to it.
+ it("MOTD is hidden", function () {
+ expect($(".mkwsMOTD").length).toBe(1);
+ expect($("#testMOTD").length).toBe(1);
+ expect($("#testMOTD").text()).toMatch("^ *$");
+ });
+
+ it("mkwsMOTDContainer has received the text", function () {
+ expect($(".mkwsMOTDContainer").length).toBe(1);
+ expect($(".mkwsMOTDContainer").text()).toMatch(/MOTD/);
+ });
+
+
+});
+
describe("Check pazpar2 search", function () {
it("pazpar2 was successfully initialized", function () {
expect(mkws_config.error).toBe(undefined);
});
});
+describe("Check MOTD after search", function () {
+ it("MOTD is hidden", function () {
+ expect($(".mkwsMOTD").length).toBe(1);
+ expect($(".mkwsMOTD").is(":hidden")).toBe(true);
+ debug("motd " + $(".mkwsMOTD") );
+ debug("motd t=" + $(".mkwsMOTD").text() );
+ debug("motd v=" + $(".mkwsMOTD").is(":visible") );
+ //expect($("div.mkwsBytarget").is(":visible")).toBe(true);
+ });
+});
+
+
/*
* This part runs in background. It should be rewritten with