indent
authorWolfram Schneider <wosch@indexdata.dk>
Wed, 21 Aug 2013 16:15:07 +0000 (18:15 +0200)
committerWolfram Schneider <wosch@indexdata.dk>
Wed, 21 Aug 2013 16:15:07 +0000 (18:15 +0200)
test/js/mkws-jasmine-run.js
test/spec/jquery.spec.js
test/spec/jsdom.spec.js
test/spec/mkws-config.js
test/spec/mkws-index-jsdom.spec.js
test/spec/mkws-index-simple.spec.js
test/spec/mkws_utils.js
test/spec/sample.spec.js
test/spec/true.spec.js

index 3b9b29e..1aec289 100644 (file)
@@ -7,12 +7,12 @@
 function mkws_jasmine_init(delay) {
     var currentWindowOnload = window.onload;
 
-    window.onload = function() {
+    window.onload = function () {
         if (currentWindowOnload) {
             currentWindowOnload();
         }
         if (delay) {
-            setTimeout(function() {
+            setTimeout(function () {
                 execJasmine()
             }, delay);
         } else {
@@ -27,7 +27,7 @@ function mkws_jasmine_init(delay) {
         var htmlReporter = new jasmine.HtmlReporter();
         jasmineEnv.addReporter(htmlReporter);
 
-        jasmineEnv.specFilter = function(spec) {
+        jasmineEnv.specFilter = function (spec) {
             return htmlReporter.specFilter(spec);
         };
 
@@ -36,4 +36,3 @@ function mkws_jasmine_init(delay) {
 };
 
 /* EOF */
-
index e5c34e2..2f3baa8 100644 (file)
@@ -4,29 +4,29 @@
  *
  */
 
-describe("jQuery suite simple", function() {
+describe("jQuery suite simple", function () {
     var $ = require('jquery');
 
-    it("jQuery append test", function() {
-      $("body").append("<h1>test passes h1</h1>");
-      expect( $("body").html() ).toMatch(/<h1>/);
-      $("<p>this is a paragraph</p>").appendTo("h1");
-      expect( $("body").html() ).toMatch(/this is a paragraph/);
+    it("jQuery append test", function () {
+        $("body").append("<h1>test passes h1</h1>");
+        expect($("body").html()).toMatch(/<h1>/);
+        $("<p>this is a paragraph</p>").appendTo("h1");
+        expect($("body").html()).toMatch(/this is a paragraph/);
     });
 
-    it("$ append test", function() {
+    it("$ append test", function () {
         $("<h2>test passes h2</h2>").appendTo("body");
-        expect( $("body").html() ).toMatch(/<h2>/);
+        expect($("body").html()).toMatch(/<h2>/);
 
         $("<p>this is a second paragraph</p>").appendTo("h1");
-        expect( $("body").html() ).toMatch(/this is a paragraph/);
+        expect($("body").html()).toMatch(/this is a paragraph/);
     });
 
-    it("more jquery tests", function() {
+    it("more jquery tests", function () {
         // other tests
-        expect( $("h2").html() ).toMatch(/test passes h2/);
-        expect( $("h1").html() ).toMatch(/test passes h1/);
-        expect( $("h1").html() ).not.toMatch(/^$/);
-        expect( $("h1").html() ).not.toMatch(/foobar/);
+        expect($("h2").html()).toMatch(/test passes h2/);
+        expect($("h1").html()).toMatch(/test passes h1/);
+        expect($("h1").html()).not.toMatch(/^$/);
+        expect($("h1").html()).not.toMatch(/foobar/);
     });
 });
index 4edf683..725d052 100644 (file)
@@ -4,30 +4,30 @@
  *
  */
 
-describe("jQuery suite", function() {
-  var jsdom = require('jsdom').jsdom;
-  var myWindow = jsdom().createWindow();
+describe("jQuery suite", function () {
+    var jsdom = require('jsdom').jsdom;
+    var myWindow = jsdom().createWindow();
 
-  var $ = require('jquery');
-  var jq = require('jquery').create();
-  var jQuery = require('jquery').create(myWindow);
+    var $ = require('jquery');
+    var jq = require('jquery').create();
+    var jQuery = require('jquery').create(myWindow);
 
-  it("jQuery append test", function() {
-    jQuery("<h1>test passes h1</h1>").appendTo("body");
-    expect( jQuery("body").html() ).toMatch(/<h1>/);
-  });
+    it("jQuery append test", function () {
+        jQuery("<h1>test passes h1</h1>").appendTo("body");
+        expect(jQuery("body").html()).toMatch(/<h1>/);
+    });
 
-  it("$ append test", function() {
-    $("<h2>test passes h2</h2>").appendTo("body");
-    expect( $("body").html() ).toMatch(/<h2>/);
-  });
+    it("$ append test", function () {
+        $("<h2>test passes h2</h2>").appendTo("body");
+        expect($("body").html()).toMatch(/<h2>/);
+    });
 
-  it("jq append test", function() {
-    jq("<h2>test passes h2</h2>").appendTo("body");
-    expect( jq("body").html() ).toMatch(/<h2>/);
-  });
+    it("jq append test", function () {
+        jq("<h2>test passes h2</h2>").appendTo("body");
+        expect(jq("body").html()).toMatch(/<h2>/);
+    });
 
-  it("window test", function() {
-    expect(myWindow).toBeDefined();
-  });
+    it("window test", function () {
+        expect(myWindow).toBeDefined();
+    });
 });
index 8837b0a..e5189c0 100644 (file)
@@ -4,47 +4,47 @@
  *
  */
 
-describe("Check mkws_config object", function() {
-  it("mkws_config exists", function() {
-    expect(mkws_config).not.toBe(undefined);
-  });
-
-  it("mkws_config service proxy config", function() {
-    expect(mkws_config.service_proxy_url).toBe(undefined);
-  });
-
-  it("mkws_config locale check German", function() {
-    expect(mkws_locale_lang.de.Authors).toMatch(/^Autoren$/);
-    expect(mkws_locale_lang.de.Location).toMatch(/^Ort$/);
-  });
-  it("mkws_config locale check Danish", function() {
-    expect(mkws_locale_lang.da.Authors).toMatch(/^Forfattere$/);
-    expect(mkws_locale_lang.da.Location).toMatch(/^Lokation$/);
-  });
-
-  it("mkws_config service proxy enabled", function() {
-    expect(mkws_config.use_service_proxy).toBe(true);
-  });
+describe("Check mkws_config object", function () {
+    it("mkws_config exists", function () {
+        expect(mkws_config).not.toBe(undefined);
+    });
+
+    it("mkws_config service proxy config", function () {
+        expect(mkws_config.service_proxy_url).toBe(undefined);
+    });
+
+    it("mkws_config locale check German", function () {
+        expect(mkws_locale_lang.de.Authors).toMatch(/^Autoren$/);
+        expect(mkws_locale_lang.de.Location).toMatch(/^Ort$/);
+    });
+    it("mkws_config locale check Danish", function () {
+        expect(mkws_locale_lang.da.Authors).toMatch(/^Forfattere$/);
+        expect(mkws_locale_lang.da.Location).toMatch(/^Lokation$/);
+    });
+
+    it("mkws_config service proxy enabled", function () {
+        expect(mkws_config.use_service_proxy).toBe(true);
+    });
 
 });
 
 
-describe("Check pazpar2 config", function() {
-  it("pazpar2path is a path or an full URL", function() {
-    expect(pazpar2path).toMatch(/^(\/|http:\/\/)/)
-  });
+describe("Check pazpar2 config", function () {
+    it("pazpar2path is a path or an full URL", function () {
+        expect(pazpar2path).toMatch(/^(\/|http:\/\/)/)
+    });
 
-  it("usesessions false", function() {
-    expect(usesessions).toBe(false);
-  });
+    it("usesessions false", function () {
+        expect(usesessions).toBe(false);
+    });
 
-  it("my_paz is defined", function() {
-    expect(my_paz).not.toBe(undefined);
-  });
+    it("my_paz is defined", function () {
+        expect(my_paz).not.toBe(undefined);
+    });
 });
 
-describe("Check pazpar2 runtime", function() {
-  it("pazpar2 was successfully initialize", function() {
-    expect(mkws_config.error).toBe(undefined);
-  });
+describe("Check pazpar2 runtime", function () {
+    it("pazpar2 was successfully initialize", function () {
+        expect(mkws_config.error).toBe(undefined);
+    });
 });
index 5b49cf3..8106441 100644 (file)
@@ -13,41 +13,41 @@ var utils = require("./mkws_utils.js");
  *
  */
 
-function jsdom_check (file, tags_array, ignore_doctype) {
-  var html = fs.readFileSync(file, "utf-8");
-  var tags = utils.flat_list(tags_array);
+function jsdom_check(file, tags_array, ignore_doctype) {
+    var html = fs.readFileSync(file, "utf-8");
+    var tags = utils.flat_list(tags_array);
 
-  describe("index-full.html jsdom + jquery for " + file, function() {
-    var window = require('jsdom').jsdom(html, null, {
-      FetchExternalResources: false,
-      ProcessExternalResources: false,
-      MutationEvents: false,
-      QuerySelector: false
-    }).createWindow();
+    describe("index-full.html jsdom + jquery for " + file, function () {
+        var window = require('jsdom').jsdom(html, null, {
+            FetchExternalResources: false,
+            ProcessExternalResources: false,
+            MutationEvents: false,
+            QuerySelector: false
+        }).createWindow();
 
-    /* apply jquery to the window */
-    var $ = require('jquery').create(window);
+        /* apply jquery to the window */
+        var $ = require('jquery').create(window);
 
 
-    it("html jquery test", function() {
-      expect(html).toBeDefined();
+        it("html jquery test", function () {
+            expect(html).toBeDefined();
 
-      expect($("body").length == 0).toEqual(false);
-      expect($("body").length == 1).toEqual(true);
-      expect($("head").length == 1).toEqual(true);
+            expect($("body").length == 0).toEqual(false);
+            expect($("body").length == 1).toEqual(true);
+            expect($("head").length == 1).toEqual(true);
 
-      for(var i = 0; i < tags.length; i++) {
-        expect($("#" + tags[i]).length == 1).toEqual(true);
-      }
-    });
+            for (var i = 0; i < tags.length; i++) {
+                expect($("#" + tags[i]).length == 1).toEqual(true);
+            }
+        });
 
-    it("html jquery fail test", function() {
-      expect(html).toBeDefined();
+        it("html jquery fail test", function () {
+            expect(html).toBeDefined();
 
-      expect($("body_does_not_exists").length == 1).toEqual(false);
-      expect($("#body_does_not_exists").length == 1).toEqual(false);
+            expect($("body_does_not_exists").length == 1).toEqual(false);
+            expect($("#body_does_not_exists").length == 1).toEqual(false);
+        });
     });
-  });
 }
 
 jsdom_check('../examples/htdocs/index-full.html', [utils.tags.required, utils.tags.optional, utils.tags.optional2]);
index 7fd542f..50ebd65 100644 (file)
@@ -13,36 +13,36 @@ var utils = require("./mkws_utils.js");
  *
  */
 
-function html_check (file, tags_array, ignore_doctype) {
-  var html = fs.readFileSync(file, "utf-8");
-  var tags = utils.flat_list(tags_array);
-
-  describe("index-full.html string test for " + file, function() {
-    it("html test", function() {
-      expect(html).toBeDefined();
-
-      // forgotten doctype declaration
-      if (!ignore_doctype) {
-        expect(html).toMatch(/<html.*?>/);
-        expect(html).toMatch(/<\/html.*?>/);
-      }
-      expect(html).toMatch(/<head.*?>/);
-      expect(html).toMatch(/<body.*?>/);
-      expect(html).toMatch(/<\/head.*?>/);
-      expect(html).toMatch(/<\/body.*?>/);
-
-      expect(html).toMatch(/<meta .*?charset=utf-8/i);
-      expect(html).toMatch(/<title>.+<\/title>/i);
-      expect(html).toMatch(/<link .*?type="text\/css" href=".*?\/?mkwsStyle.css"/);
-
-
-      for(var i = 0, data = ""; i < tags.length; i++) {
-        data = '<div id="' + tags[i] + '">';
-        // console.log(data)
-        expect(html).toMatch(data);
-      }
+function html_check(file, tags_array, ignore_doctype) {
+    var html = fs.readFileSync(file, "utf-8");
+    var tags = utils.flat_list(tags_array);
+
+    describe("index-full.html string test for " + file, function () {
+        it("html test", function () {
+            expect(html).toBeDefined();
+
+            // forgotten doctype declaration
+            if (!ignore_doctype) {
+                expect(html).toMatch(/<html.*?>/);
+                expect(html).toMatch(/<\/html.*?>/);
+            }
+            expect(html).toMatch(/<head.*?>/);
+            expect(html).toMatch(/<body.*?>/);
+            expect(html).toMatch(/<\/head.*?>/);
+            expect(html).toMatch(/<\/body.*?>/);
+
+            expect(html).toMatch(/<meta .*?charset=utf-8/i);
+            expect(html).toMatch(/<title>.+<\/title>/i);
+            expect(html).toMatch(/<link .*?type="text\/css" href=".*?\/?mkwsStyle.css"/);
+
+
+            for (var i = 0, data = ""; i < tags.length; i++) {
+                data = '<div id="' + tags[i] + '">';
+                // console.log(data)
+                expect(html).toMatch(data);
+            }
+        });
     });
-  });
 }
 
 html_check('../examples/htdocs/index-full.html', [utils.tags.required, utils.tags.optional, utils.tags.optional2]);
index 6622f73..e837fa1 100644 (file)
  *
  */
 var flat_list = function (list) {
-  var data = [];
+        var data = [];
 
-  for(var i = 0; i < list.length; i++) {
-      if (typeof list[i] == 'object') {
-        for(var j = 0; j < list[i].length; j++) {
-          data.push(list[i][j]);
-        }
+        for (var i = 0; i < list.length; i++) {
+            if (typeof list[i] == 'object') {
+                for (var j = 0; j < list[i].length; j++) {
+                    data.push(list[i][j]);
+                }
 
-      } else {
-        data.push(list[i]);
-      }
-  }
+            } else {
+                data.push(list[i]);
+            }
+        }
 
-  return data;
-};
+        return data;
+    };
 
 /*
  * list of div id to check
  *
  */
 var tags = {
-       required: ["mkwsSearch", "mkwsResults"],
-       optional: ["mkwsSwitch", "mkwsLang", "mkwsTargets"],
-       optional2: ["mkwsMOTD", "mkwsStat", "footer"]
+    required: ["mkwsSearch", "mkwsResults"],
+    optional: ["mkwsSwitch", "mkwsLang", "mkwsTargets"],
+    optional2: ["mkwsMOTD", "mkwsStat", "footer"]
 };
 
 // node.js exports
 module.exports = {
-       flat_list: flat_list,
-       tags: tags
+    flat_list: flat_list,
+    tags: tags
 };
index cad1b90..8979206 100644 (file)
@@ -4,28 +4,28 @@
  *
  */
 
-describe('jasmine-node', function(){
+describe('jasmine-node', function () {
 
-  it('should pass', function(){
-    expect(1+2).toEqual(3);
-  });
+    it('should pass', function () {
+        expect(1 + 2).toEqual(3);
+    });
 
-  it('shows asynchronous test', function(){
-    setTimeout(function(){
-      expect('second').toEqual('second');
-      asyncSpecDone();
-    }, 1);
-    expect('first').toEqual('first');
-    asyncSpecWait();
-  });
+    it('shows asynchronous test', function () {
+        setTimeout(function () {
+            expect('second').toEqual('second');
+            asyncSpecDone();
+        }, 1);
+        expect('first').toEqual('first');
+        asyncSpecWait();
+    });
 
-  it('shows asynchronous test node-style', function(done){
-    setTimeout(function(){
-      expect('second').toEqual('second');
-      // If you call done() with an argument, it will fail the spec
-      // so you can use it as a handler for many async node calls
-      done();
-    }, 1);
-    expect('first').toEqual('first');
-  });
+    it('shows asynchronous test node-style', function (done) {
+        setTimeout(function () {
+            expect('second').toEqual('second');
+            // If you call done() with an argument, it will fail the spec
+            // so you can use it as a handler for many async node calls
+            done();
+        }, 1);
+        expect('first').toEqual('first');
+    });
 });
index 5a201dd..b515c06 100644 (file)
@@ -3,8 +3,8 @@
  * dummy test
  *
  */
-describe("A suite", function() {
-  it("contains spec with an expectation", function() {
-    expect(true).toBe(true);
-  });
+describe("A suite", function () {
+    it("contains spec with an expectation", function () {
+        expect(true).toBe(true);
+    });
 });