From b185ea6d84262b492e83f3359d51cf17b88966d5 Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Wed, 21 Aug 2013 18:15:07 +0200 Subject: [PATCH] indent --- test/js/mkws-jasmine-run.js | 7 ++-- test/spec/jquery.spec.js | 28 +++++++------- test/spec/jsdom.spec.js | 42 ++++++++++----------- test/spec/mkws-config.js | 70 +++++++++++++++++------------------ test/spec/mkws-index-jsdom.spec.js | 52 +++++++++++++------------- test/spec/mkws-index-simple.spec.js | 58 ++++++++++++++--------------- test/spec/mkws_utils.js | 34 ++++++++--------- test/spec/sample.spec.js | 42 ++++++++++----------- test/spec/true.spec.js | 8 ++-- 9 files changed, 170 insertions(+), 171 deletions(-) diff --git a/test/js/mkws-jasmine-run.js b/test/js/mkws-jasmine-run.js index 3b9b29e..1aec289 100644 --- a/test/js/mkws-jasmine-run.js +++ b/test/js/mkws-jasmine-run.js @@ -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 */ - diff --git a/test/spec/jquery.spec.js b/test/spec/jquery.spec.js index e5c34e2..2f3baa8 100644 --- a/test/spec/jquery.spec.js +++ b/test/spec/jquery.spec.js @@ -4,29 +4,29 @@ * */ -describe("jQuery suite simple", function() { +describe("jQuery suite simple", function () { var $ = require('jquery'); - it("jQuery append test", function() { - $("body").append("

test passes h1

"); - expect( $("body").html() ).toMatch(/

/); - $("

this is a paragraph

").appendTo("h1"); - expect( $("body").html() ).toMatch(/this is a paragraph/); + it("jQuery append test", function () { + $("body").append("

test passes h1

"); + expect($("body").html()).toMatch(/

/); + $("

this is a paragraph

").appendTo("h1"); + expect($("body").html()).toMatch(/this is a paragraph/); }); - it("$ append test", function() { + it("$ append test", function () { $("

test passes h2

").appendTo("body"); - expect( $("body").html() ).toMatch(/

/); + expect($("body").html()).toMatch(/

/); $("

this is a second paragraph

").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/); }); }); diff --git a/test/spec/jsdom.spec.js b/test/spec/jsdom.spec.js index 4edf683..725d052 100644 --- a/test/spec/jsdom.spec.js +++ b/test/spec/jsdom.spec.js @@ -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("

test passes h1

").appendTo("body"); - expect( jQuery("body").html() ).toMatch(/

/); - }); + it("jQuery append test", function () { + jQuery("

test passes h1

").appendTo("body"); + expect(jQuery("body").html()).toMatch(/

/); + }); - it("$ append test", function() { - $("

test passes h2

").appendTo("body"); - expect( $("body").html() ).toMatch(/

/); - }); + it("$ append test", function () { + $("

test passes h2

").appendTo("body"); + expect($("body").html()).toMatch(/

/); + }); - it("jq append test", function() { - jq("

test passes h2

").appendTo("body"); - expect( jq("body").html() ).toMatch(/

/); - }); + it("jq append test", function () { + jq("

test passes h2

").appendTo("body"); + expect(jq("body").html()).toMatch(/

/); + }); - it("window test", function() { - expect(myWindow).toBeDefined(); - }); + it("window test", function () { + expect(myWindow).toBeDefined(); + }); }); diff --git a/test/spec/mkws-config.js b/test/spec/mkws-config.js index 8837b0a..e5189c0 100644 --- a/test/spec/mkws-config.js +++ b/test/spec/mkws-config.js @@ -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); + }); }); diff --git a/test/spec/mkws-index-jsdom.spec.js b/test/spec/mkws-index-jsdom.spec.js index 5b49cf3..8106441 100644 --- a/test/spec/mkws-index-jsdom.spec.js +++ b/test/spec/mkws-index-jsdom.spec.js @@ -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]); diff --git a/test/spec/mkws-index-simple.spec.js b/test/spec/mkws-index-simple.spec.js index 7fd542f..50ebd65 100644 --- a/test/spec/mkws-index-simple.spec.js +++ b/test/spec/mkws-index-simple.spec.js @@ -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(//); - expect(html).toMatch(/<\/html.*?>/); - } - expect(html).toMatch(//); - expect(html).toMatch(//); - expect(html).toMatch(/<\/head.*?>/); - expect(html).toMatch(/<\/body.*?>/); - - expect(html).toMatch(/.+<\/title>/i); - expect(html).toMatch(/'; - // 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(//); + expect(html).toMatch(/<\/html.*?>/); + } + expect(html).toMatch(//); + expect(html).toMatch(//); + expect(html).toMatch(/<\/head.*?>/); + expect(html).toMatch(/<\/body.*?>/); + + expect(html).toMatch(/.+<\/title>/i); + expect(html).toMatch(/'; + // console.log(data) + expect(html).toMatch(data); + } + }); }); - }); } html_check('../examples/htdocs/index-full.html', [utils.tags.required, utils.tags.optional, utils.tags.optional2]); diff --git a/test/spec/mkws_utils.js b/test/spec/mkws_utils.js index 6622f73..e837fa1 100644 --- a/test/spec/mkws_utils.js +++ b/test/spec/mkws_utils.js @@ -10,34 +10,34 @@ * */ 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 }; diff --git a/test/spec/sample.spec.js b/test/spec/sample.spec.js index cad1b90..8979206 100644 --- a/test/spec/sample.spec.js +++ b/test/spec/sample.spec.js @@ -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'); + }); }); diff --git a/test/spec/true.spec.js b/test/spec/true.spec.js index 5a201dd..b515c06 100644 --- a/test/spec/true.spec.js +++ b/test/spec/true.spec.js @@ -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); + }); }); -- 1.7.10.4