From 04e9fc3a2f8fa5d2d370d90003f25b642635cf82 Mon Sep 17 00:00:00 2001 From: muxator Date: Tue, 24 Mar 2020 01:04:24 +0100 Subject: [PATCH] formatting: bulk remove trailing whitespaces on frontend tests This is a followup on 312c72c3640b, which did the same on the main code base, and is preliminary work for tidying up John's changes in the following commits. No functional changes. Command: find tests/frontend -name '*.js' -type f -print0 | xargs -0 sed --in-place 's/[[:space:]]*$//' --- tests/frontend/lib/expect.js | 18 +++---- tests/frontend/lib/mocha.js | 46 ++++++++--------- tests/frontend/lib/sendkeys.js | 4 +- tests/frontend/runner.js | 6 +-- tests/frontend/specs/alphabet.js | 8 +-- tests/frontend/specs/bold.js | 10 ++-- tests/frontend/specs/caret.js | 14 +++--- tests/frontend/specs/change_user_name.js | 4 +- tests/frontend/specs/chat.js | 16 +++--- tests/frontend/specs/chat_load_messages.js | 18 +++---- .../frontend/specs/clear_authorship_colors.js | 6 +-- tests/frontend/specs/delete.js | 10 ++-- tests/frontend/specs/embed_value.js | 22 ++++---- tests/frontend/specs/enter.js | 10 ++-- tests/frontend/specs/font_type.js | 4 +- tests/frontend/specs/importexport.js | 6 +-- tests/frontend/specs/importindents.js | 4 +- tests/frontend/specs/italic.js | 10 ++-- tests/frontend/specs/redo.js | 4 +- tests/frontend/specs/strikethrough.js | 10 ++-- tests/frontend/specs/timeslider.js | 2 +- tests/frontend/specs/timeslider_labels.js | 18 +++---- tests/frontend/specs/timeslider_revisions.js | 50 +++++++++---------- tests/frontend/specs/undo.js | 2 +- tests/frontend/specs/unordered_list.js | 2 +- 25 files changed, 152 insertions(+), 152 deletions(-) diff --git a/tests/frontend/lib/expect.js b/tests/frontend/lib/expect.js index ab5a1eea3..c647cf2be 100644 --- a/tests/frontend/lib/expect.js +++ b/tests/frontend/lib/expect.js @@ -65,7 +65,7 @@ var name = $flags[i] , assertion = new Assertion(this.obj, name, this) - + if ('function' == typeof Assertion.prototype[name]) { // clone the function, make sure we dont touch the prot reference var old = this[name]; @@ -148,7 +148,7 @@ if ('object' == typeof fn && not) { // in the presence of a matcher, ensure the `not` only applies to // the matching. - this.flags.not = false; + this.flags.not = false; } var name = this.obj.name || 'fn'; @@ -219,7 +219,7 @@ }; /** - * Assert within start to finish (inclusive). + * Assert within start to finish (inclusive). * * @param {Number} start * @param {Number} finish @@ -298,7 +298,7 @@ , function(){ return 'expected ' + i(this.obj) + ' to be above ' + n }); return this; }; - + /** * Assert string value matches _regexp_. * @@ -359,13 +359,13 @@ } catch (e) { hasProp = undefined !== this.obj[name] } - + this.assert( hasProp , function(){ return 'expected ' + i(this.obj) + ' to have a property ' + i(name) } , function(){ return 'expected ' + i(this.obj) + ' to not have a property ' + i(name) }); } - + if (undefined !== val) { this.assert( val === this.obj[name] @@ -537,7 +537,7 @@ return html; } }; - + // Returns true if object is a DOM element. var isDOMElement = function (object) { if (typeof HTMLElement === 'object') { @@ -843,9 +843,9 @@ expect.eql = function eql (actual, expected) { // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { + if (actual === expected) { return true; - } else if ('undefined' != typeof Buffer + } else if ('undefined' != typeof Buffer && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { if (actual.length != expected.length) return false; diff --git a/tests/frontend/lib/mocha.js b/tests/frontend/lib/mocha.js index 5f2da0139..0b1e89486 100644 --- a/tests/frontend/lib/mocha.js +++ b/tests/frontend/lib/mocha.js @@ -32,11 +32,11 @@ require.register = function (path, fn){ require.relative = function (parent) { return function(p){ if ('.' != p.charAt(0)) return require(p); - + var path = parent.split('/') , segs = p.split('/'); path.pop(); - + for (var i = 0; i < segs.length; i++) { var seg = segs[i]; if ('..' == seg) path.pop(); @@ -52,7 +52,7 @@ require.register("browser/debug.js", function(module, exports, require){ module.exports = function(type){ return function(){ - + } }; }); // module: browser/debug.js @@ -530,7 +530,7 @@ var Suite = require('../suite') /** * BDD-style interface: - * + * * describe('Array', function(){ * describe('#indexOf()', function(){ * it('should return -1 when not present', function(){ @@ -542,7 +542,7 @@ var Suite = require('../suite') * }); * }); * }); - * + * */ module.exports = function(suite){ @@ -587,7 +587,7 @@ module.exports = function(suite){ * and callback `fn` containing nested suites * and/or tests. */ - + context.describe = context.context = function(title, fn){ var suite = Suite.create(suites[0], title); suites.unshift(suite); @@ -667,19 +667,19 @@ var Suite = require('../suite') /** * TDD-style interface: - * + * * exports.Array = { * '#indexOf()': { * 'should return -1 when the value is not present': function(){ - * + * * }, * * 'should return the correct index when the value is present': function(){ - * + * * } * } * }; - * + * */ module.exports = function(suite){ @@ -739,27 +739,27 @@ var Suite = require('../suite') /** * QUnit-style interface: - * + * * suite('Array'); - * + * * test('#length', function(){ * var arr = [1,2,3]; * ok(arr.length == 3); * }); - * + * * test('#indexOf()', function(){ * var arr = [1,2,3]; * ok(arr.indexOf(1) == 0); * ok(arr.indexOf(2) == 1); * ok(arr.indexOf(3) == 2); * }); - * + * * suite('String'); - * + * * test('#length', function(){ * ok('foo'.length == 3); * }); - * + * */ module.exports = function(suite){ @@ -802,7 +802,7 @@ module.exports = function(suite){ /** * Describe a "suite" with the given `title`. */ - + context.suite = function(title){ if (suites.length > 1) suites.shift(); var suite = Suite.create(suites[0], title); @@ -840,7 +840,7 @@ var Suite = require('../suite') * suiteSetup(function(){ * * }); - * + * * test('should return -1 when not present', function(){ * * }); @@ -2689,7 +2689,7 @@ exports = module.exports = Min; function Min(runner) { Base.call(this, runner); - + runner.on('start', function(){ // clear screen process.stdout.write('\u001b[2J'); @@ -3337,7 +3337,7 @@ function XUnit(runner) { runner.on('pass', function(test){ tests.push(test); }); - + runner.on('fail', function(test){ tests.push(test); }); @@ -3354,7 +3354,7 @@ function XUnit(runner) { }, false)); tests.forEach(test); - console.log(''); + console.log(''); }); } @@ -3615,7 +3615,7 @@ Runnable.prototype.run = function(fn){ } return; } - + // sync try { if (!this.pending) this.fn.call(ctx); @@ -4536,7 +4536,7 @@ exports.indexOf = function(arr, obj, start){ /** * Array#reduce (<=IE8) - * + * * @param {Array} array * @param {Function} fn * @param {Object} initial value diff --git a/tests/frontend/lib/sendkeys.js b/tests/frontend/lib/sendkeys.js index b57618476..7550df38f 100644 --- a/tests/frontend/lib/sendkeys.js +++ b/tests/frontend/lib/sendkeys.js @@ -305,11 +305,11 @@ var START_TO_END = 1; var END_TO_END = 2; var END_TO_START = 3; // from the Mozilla documentation, for range.compareBoundaryPoints(how, sourceRange) -// -1, 0, or 1, indicating whether the corresponding boundary-point of range is respectively before, equal to, or after the corresponding boundary-point of sourceRange. +// -1, 0, or 1, indicating whether the corresponding boundary-point of range is respectively before, equal to, or after the corresponding boundary-point of sourceRange. // * Range.END_TO_END compares the end boundary-point of sourceRange to the end boundary-point of range. // * Range.END_TO_START compares the end boundary-point of sourceRange to the start boundary-point of range. // * Range.START_TO_END compares the start boundary-point of sourceRange to the end boundary-point of range. - // * Range.START_TO_START compares the start boundary-point of sourceRange to the start boundary-point of range. + // * Range.START_TO_START compares the start boundary-point of sourceRange to the start boundary-point of range. function w3cstart(rng, constraint){ if (rng.compareBoundaryPoints (START_TO_START, constraint) <= 0) return 0; // at or before the beginning if (rng.compareBoundaryPoints (END_TO_START, constraint) >= 0) return constraint.toString().length; diff --git a/tests/frontend/runner.js b/tests/frontend/runner.js index e77f6707f..1d3ef6415 100644 --- a/tests/frontend/runner.js +++ b/tests/frontend/runner.js @@ -52,7 +52,7 @@ $(function(){ } /* - This reporter wraps the original html reporter plus reports plain text into a hidden div. + This reporter wraps the original html reporter plus reports plain text into a hidden div. This allows the webdriver client to pick up the test results */ var WebdriverAndHtmlReporter = function(html_reporter){ @@ -170,7 +170,7 @@ $(function(){ //get the list of specs and filter it if requested var specs = specs_list.slice(); - + //inject spec scripts into the dom var $body = $('body'); $.each(specs, function(i, spec){ @@ -195,4 +195,4 @@ $(function(){ mocha.run(); }); -}); +}); diff --git a/tests/frontend/specs/alphabet.js b/tests/frontend/specs/alphabet.js index ae9570e41..5d16c983a 100644 --- a/tests/frontend/specs/alphabet.js +++ b/tests/frontend/specs/alphabet.js @@ -8,12 +8,12 @@ describe("All the alphabet works n stuff", function(){ }); it("when you enter any char it appears right", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; - + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + //get the first text element out of the inner iframe var firstTextElement = inner$("div").first(); - + // simulate key presses to delete content firstTextElement.sendkeys('{selectall}'); // select all firstTextElement.sendkeys('{del}'); // clear the first line diff --git a/tests/frontend/specs/bold.js b/tests/frontend/specs/bold.js index 888eb6602..f48b31ef1 100644 --- a/tests/frontend/specs/bold.js +++ b/tests/frontend/specs/bold.js @@ -6,22 +6,22 @@ describe("bold button", function(){ }); it("makes text bold on click", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; //get the first text element out of the inner iframe var $firstTextElement = inner$("div").first(); - + //select this text element $firstTextElement.sendkeys('{selectall}'); //get the bold button and click it var $boldButton = chrome$(".buttonicon-bold"); $boldButton.click(); - + //ace creates a new dom element when you press a button, so just get the first text element again var $newFirstTextElement = inner$("div").first(); - + // is there a element now? var isBold = $newFirstTextElement.find("b").length === 1; diff --git a/tests/frontend/specs/caret.js b/tests/frontend/specs/caret.js index 14ff8d6a6..59180c8f6 100644 --- a/tests/frontend/specs/caret.js +++ b/tests/frontend/specs/caret.js @@ -198,9 +198,9 @@ console.log(inner$); /* it("Creates N rows, changes height of rows, updates UI by caret key events", function(done){ var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + var chrome$ = helper.padChrome$; var numberOfRows = 50; - + //ace creates a new dom element when you press a keystroke, so just get the first text element again var $newFirstTextElement = inner$("div").first(); var originalDivHeight = inner$("div").first().css("height"); @@ -211,7 +211,7 @@ console.log(inner$); }).done(function(){ // Once the DOM has registered the items inner$("div").each(function(index){ // Randomize the item heights (replicates images / headings etc) var random = Math.floor(Math.random() * (50)) + 20; - $(this).css("height", random+"px"); + $(this).css("height", random+"px"); }); console.log(caretPosition(inner$)); @@ -253,7 +253,7 @@ console.log(inner$); keyEvent(inner$, 33, false, false); // doesn't work i++; } - + // Does scrolling back up the pad with the up arrow show the correct contents? helper.waitFor(function(){ // Wait for the new position to be in place try{ @@ -280,7 +280,7 @@ console.log(inner$); helper.waitFor(function(){ // Wait for the new position to be in place return isScrolledIntoView(inner$("div:nth-child(1)"), inner$); // Wait for the DOM to scroll into place }).done(function(){ // Once the DOM has registered the items - expect(true).to.be(true); + expect(true).to.be(true); done(); }); */ @@ -297,7 +297,7 @@ function prepareDocument(n, target){ // generates a random document with random } function keyEvent(target, charCode, ctrl, shift){ // sends a charCode to the window - if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's a mozilla or IE + if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's a mozilla or IE var evtType = "keypress"; }else{ var evtType = "keydown"; @@ -310,7 +310,7 @@ function keyEvent(target, charCode, ctrl, shift){ // sends a charCode to the win if(shift){ e.shiftKey = true; // Shift Key } - e.which = charCode; + e.which = charCode; e.keyCode = charCode; target("#innerdocbody").trigger(e); } diff --git a/tests/frontend/specs/change_user_name.js b/tests/frontend/specs/change_user_name.js index ba089c90b..b0a5df15f 100644 --- a/tests/frontend/specs/change_user_name.js +++ b/tests/frontend/specs/change_user_name.js @@ -12,7 +12,7 @@ describe("change username value", function(){ //click on the settings button to make settings visible var $userButton = chrome$(".buttonicon-showusers"); $userButton.click(); - + var $usernameInput = chrome$("#myusernameedit"); $usernameInput.click(); @@ -45,7 +45,7 @@ describe("change username value", function(){ //click on the settings button to make settings visible var $userButton = chrome$(".buttonicon-showusers"); $userButton.click(); - + var $usernameInput = chrome$("#myusernameedit"); $usernameInput.click(); diff --git a/tests/frontend/specs/chat.js b/tests/frontend/specs/chat.js index 7ebb76fb3..e48dad8b0 100644 --- a/tests/frontend/specs/chat.js +++ b/tests/frontend/specs/chat.js @@ -6,8 +6,8 @@ describe("Chat messages and UI", function(){ }); it("opens chat, sends a message and makes sure it exists on the page", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; var chatValue = "JohnMcLear"; //click on the chat button to make chat visible @@ -39,8 +39,8 @@ describe("Chat messages and UI", function(){ }); it("makes sure that an empty message can't be sent", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; //click on the chat button to make chat visible var $chatButton = chrome$("#chaticon"); @@ -65,8 +65,8 @@ describe("Chat messages and UI", function(){ }); it("makes chat stick to right side of the screen", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; //click on the settings button to make settings visible var $settingsButton = chrome$(".buttonicon-settings"); @@ -98,8 +98,8 @@ describe("Chat messages and UI", function(){ }); it("makes chat stick to right side of the screen then makes it one step smaller", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; //click on the settings button to make settings visible var $settingsButton = chrome$(".buttonicon-settings"); diff --git a/tests/frontend/specs/chat_load_messages.js b/tests/frontend/specs/chat_load_messages.js index 7b09b47e1..29040798d 100644 --- a/tests/frontend/specs/chat_load_messages.js +++ b/tests/frontend/specs/chat_load_messages.js @@ -1,21 +1,21 @@ describe("chat-load-messages", function(){ var padName; - + it("creates a pad", function(done) { padName = helper.newPad(done); this.timeout(60000); }); it("adds a lot of messages", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; var chatButton = chrome$("#chaticon"); chatButton.click(); var chatInput = chrome$("#chatinput"); var chatText = chrome$("#chattext"); - + this.timeout(60000); - + var messages = 140; for(var i=1; i <= messages; i++) { var num = ''+i; @@ -33,7 +33,7 @@ describe("chat-load-messages", function(){ helper.newPad(done, padName); }); }); - + it("checks initial message count", function(done) { var chatText; var expectedCount = 101; @@ -48,7 +48,7 @@ describe("chat-load-messages", function(){ done(); }); }); - + it("loads more messages", function(done) { var expectedCount = 122; var chrome$ = helper.padChrome$; @@ -56,7 +56,7 @@ describe("chat-load-messages", function(){ chatButton.click(); var chatText = chrome$("#chattext"); var loadMsgBtn = chrome$("#chatloadmessagesbutton"); - + loadMsgBtn.click(); helper.waitFor(function(){ return chatText.children("p").length == expectedCount; @@ -65,7 +65,7 @@ describe("chat-load-messages", function(){ done(); }); }); - + it("checks for button vanishing", function(done) { var expectedDisplay = 'none'; var chrome$ = helper.padChrome$; diff --git a/tests/frontend/specs/clear_authorship_colors.js b/tests/frontend/specs/clear_authorship_colors.js index 1417f63c6..d38cbfe9b 100644 --- a/tests/frontend/specs/clear_authorship_colors.js +++ b/tests/frontend/specs/clear_authorship_colors.js @@ -6,8 +6,8 @@ describe("clear authorship colors button", function(){ }); it("makes text clear authorship colors", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; // override the confirm dialogue functioon helper.padChrome$.window.confirm = function(){ @@ -19,7 +19,7 @@ describe("clear authorship colors button", function(){ // Get the original text var originalText = inner$("div").first().text(); - + // Set some new text var sentText = "Hello"; diff --git a/tests/frontend/specs/delete.js b/tests/frontend/specs/delete.js index 86e76f56f..616cd4ddc 100644 --- a/tests/frontend/specs/delete.js +++ b/tests/frontend/specs/delete.js @@ -6,12 +6,12 @@ describe("delete keystroke", function(){ }); it("makes text delete", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; - + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + //get the first text element out of the inner iframe var $firstTextElement = inner$("div").first(); - + // get the original length of this element var elementLength = $firstTextElement.text().length; @@ -25,7 +25,7 @@ describe("delete keystroke", function(){ //ace creates a new dom element when you press a keystroke, so just get the first text element again var $newFirstTextElement = inner$("div").first(); - + // get the new length of this element var newElementLength = $newFirstTextElement.text().length; diff --git a/tests/frontend/specs/embed_value.js b/tests/frontend/specs/embed_value.js index 029f0dd5d..aa031e236 100644 --- a/tests/frontend/specs/embed_value.js +++ b/tests/frontend/specs/embed_value.js @@ -16,9 +16,9 @@ describe("embed links", function(){ var $embediFrame = $(embedCode); //read and check the frame attributes - var width = $embediFrame.attr("width"); - var height = $embediFrame.attr("height"); - var name = $embediFrame.attr("name"); + var width = $embediFrame.attr("width"); + var height = $embediFrame.attr("height"); + var name = $embediFrame.attr("name"); expect(width).to.be('600'); expect(height).to.be('400'); expect(name).to.be(readonly ? "embed_readonly" : "embed_readwrite"); @@ -43,7 +43,7 @@ describe("embed links", function(){ } else { expect(url).to.be(helper.padChrome$.window.location.href); } - + //check if all parts of the url are like expected expect(params).to.eql(expectedParams); } @@ -57,7 +57,7 @@ describe("embed links", function(){ describe("the share link", function(){ it("is the actual pad url", function(done){ - var chrome$ = helper.padChrome$; + var chrome$ = helper.padChrome$; //open share dropdown chrome$(".buttonicon-embed").click(); @@ -73,14 +73,14 @@ describe("embed links", function(){ describe("the embed as iframe code", function(){ it("is an iframe with the the correct url parameters and correct size", function(done){ - var chrome$ = helper.padChrome$; + var chrome$ = helper.padChrome$; //open share dropdown chrome$(".buttonicon-embed").click(); //get the link of the share field + the actual pad url and compare them var embedCode = chrome$("#embedinput").val(); - + checkiFrameCode(embedCode, false) done(); @@ -96,7 +96,7 @@ describe("embed links", function(){ describe("the share link", function(){ it("shows a read only url", function(done){ - var chrome$ = helper.padChrome$; + var chrome$ = helper.padChrome$; //open share dropdown chrome$(".buttonicon-embed").click(); @@ -114,7 +114,7 @@ describe("embed links", function(){ describe("the embed as iframe code", function(){ it("is an iframe with the the correct url parameters and correct size", function(done){ - var chrome$ = helper.padChrome$; + var chrome$ = helper.padChrome$; //open share dropdown chrome$(".buttonicon-embed").click(); @@ -125,9 +125,9 @@ describe("embed links", function(){ //get the link of the share field + the actual pad url and compare them var embedCode = chrome$("#embedinput").val(); - + checkiFrameCode(embedCode, true); - + done(); }); }); diff --git a/tests/frontend/specs/enter.js b/tests/frontend/specs/enter.js index baafeded2..9c3457b02 100644 --- a/tests/frontend/specs/enter.js +++ b/tests/frontend/specs/enter.js @@ -6,12 +6,12 @@ describe("enter keystroke", function(){ }); it("creates a new line & puts cursor onto a new line", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; - + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + //get the first text element out of the inner iframe var $firstTextElement = inner$("div").first(); - + // get the original string value minus the last char var originalTextValue = $firstTextElement.text(); @@ -20,7 +20,7 @@ describe("enter keystroke", function(){ //ace creates a new dom element when you press a keystroke, so just get the first text element again var $newFirstTextElement = inner$("div").first(); - + helper.waitFor(function(){ return inner$("div").first().text() === ""; }).done(function(){ diff --git a/tests/frontend/specs/font_type.js b/tests/frontend/specs/font_type.js index d2c7bc636..9b149873e 100644 --- a/tests/frontend/specs/font_type.js +++ b/tests/frontend/specs/font_type.js @@ -6,8 +6,8 @@ describe("font select", function(){ }); it("makes text monospace", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; //click on the settings button to make settings visible var $settingsButton = chrome$(".buttonicon-settings"); diff --git a/tests/frontend/specs/importexport.js b/tests/frontend/specs/importexport.js index 2dc002ba0..3466f7cfb 100644 --- a/tests/frontend/specs/importexport.js +++ b/tests/frontend/specs/importexport.js @@ -159,7 +159,7 @@ describe("import functionality", function(){ //\n\ //
\n') }) - + var results = exportfunc(helper.padChrome$.window.location.href) expect(results[0][1]).to.be('
') expect(results[1][1]).to.be('\t* bullet line 1\n\t* bullet line 2\n\t\t* bullet2 line 1\n\t\t\t\t* bullet4 line 2\n\t\t\t\t* bullet4 line 2\n\t\t\t\t* bullet4 line 2\n\t\t\t* bullet3 line 1\n\t* bullet2 line 1\n\n') @@ -183,11 +183,11 @@ describe("import functionality", function(){
\n') }) var results = exportfunc(helper.padChrome$.window.location.href) - expect(results[0][1]).to.be('


') + expect(results[0][1]).to.be('


') expect(results[1][1]).to.be('\t* bullet line 1\n\n\t* bullet line 2\n\t\t* bullet2 line 1\n\n\t\t\t\t* bullet4 line 2 bisu\n\t\t\t\t* bullet4 line 2 bs\n\t\t\t\t* bullet4 line 2 uuis\n\t\t\t\t\t\t\t\t* foo\n\t\t\t\t\t\t\t\t* foobar bs\n\t\t\t\t\t* foobar\n\n') done() }) - + xit("import a pad with ordered lists from html", function(done){ var importurl = helper.padChrome$.window.location.href+'/import' var htmlWithBullets = '
  1. number 1 line 1
  1. number 2 line 2
' diff --git a/tests/frontend/specs/importindents.js b/tests/frontend/specs/importindents.js index 326d9e971..284a90f32 100644 --- a/tests/frontend/specs/importindents.js +++ b/tests/frontend/specs/importindents.js @@ -66,7 +66,7 @@ describe("import indents functionality", function(){ expect(results[1][1]).to.be('\tindent line 1\n\tindent line 2\n\t\tindent2 line 1\n\t\tindent2 line 2\n\n') done() }) - + xit("import a pad with indented lists and newlines from html", function(done){ var importurl = helper.padChrome$.window.location.href+'/import' var htmlWithIndents = '

' @@ -104,7 +104,7 @@ describe("import indents functionality", function(){
\n') }) var results = exportfunc(helper.padChrome$.window.location.href) - expect(results[0][1]).to.be('


') + expect(results[0][1]).to.be('


') expect(results[1][1]).to.be('\tindent line 1\n\n\tindent line 2\n\t\tindent2 line 1\n\n\t\t\t\tindent4 line 2 bisu\n\t\t\t\tindent4 line 2 bs\n\t\t\t\tindent4 line 2 uuis\n\t\t\t\t\t\t\t\tfoo\n\t\t\t\t\t\t\t\tfoobar bs\n\t\t\t\t\tfoobar\n\n') done() }) diff --git a/tests/frontend/specs/italic.js b/tests/frontend/specs/italic.js index cecbc1808..177031bec 100644 --- a/tests/frontend/specs/italic.js +++ b/tests/frontend/specs/italic.js @@ -6,22 +6,22 @@ describe("italic some text", function(){ }); it("makes text italic using button", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; //get the first text element out of the inner iframe var $firstTextElement = inner$("div").first(); - + //select this text element $firstTextElement.sendkeys('{selectall}'); //get the bold button and click it var $boldButton = chrome$(".buttonicon-italic"); $boldButton.click(); - + //ace creates a new dom element when you press a button, so just get the first text element again var $newFirstTextElement = inner$("div").first(); - + // is there a element now? var isItalic = $newFirstTextElement.find("i").length === 1; diff --git a/tests/frontend/specs/redo.js b/tests/frontend/specs/redo.js index caa32feec..d99f35ee9 100644 --- a/tests/frontend/specs/redo.js +++ b/tests/frontend/specs/redo.js @@ -7,7 +7,7 @@ describe("undo button then redo button", function(){ it("redo some typing with button", function(done){ var inner$ = helper.padInner$; var chrome$ = helper.padChrome$; - + // get the first text element inside the editable space var $firstTextElement = inner$("div span").first(); var originalValue = $firstTextElement.text(); // get the original value @@ -47,7 +47,7 @@ describe("undo button then redo button", function(){ var modifiedValue = $firstTextElement.text(); // get the modified value expect(modifiedValue).not.to.be(originalValue); // expect the value to change - if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's a mozilla or IE + if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's a mozilla or IE var evtType = "keypress"; }else{ var evtType = "keydown"; diff --git a/tests/frontend/specs/strikethrough.js b/tests/frontend/specs/strikethrough.js index 9afcea0fd..dc37b36f4 100644 --- a/tests/frontend/specs/strikethrough.js +++ b/tests/frontend/specs/strikethrough.js @@ -6,22 +6,22 @@ describe("strikethrough button", function(){ }); it("makes text strikethrough", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; //get the first text element out of the inner iframe var $firstTextElement = inner$("div").first(); - + //select this text element $firstTextElement.sendkeys('{selectall}'); //get the strikethrough button and click it var $strikethroughButton = chrome$(".buttonicon-strikethrough"); $strikethroughButton.click(); - + //ace creates a new dom element when you press a button, so just get the first text element again var $newFirstTextElement = inner$("div").first(); - + // is there a element now? var isstrikethrough = $newFirstTextElement.find("s").length === 1; diff --git a/tests/frontend/specs/timeslider.js b/tests/frontend/specs/timeslider.js index cb37bacb6..bca80ba49 100644 --- a/tests/frontend/specs/timeslider.js +++ b/tests/frontend/specs/timeslider.js @@ -8,7 +8,7 @@ xdescribe("timeslider button takes you to the timeslider of a pad", function(){ it("timeslider contained in URL", function(done){ var inner$ = helper.padInner$; var chrome$ = helper.padChrome$; - + // get the first text element inside the editable space var $firstTextElement = inner$("div span").first(); var originalValue = $firstTextElement.text(); // get the original value diff --git a/tests/frontend/specs/timeslider_labels.js b/tests/frontend/specs/timeslider_labels.js index d39685efe..09213a452 100644 --- a/tests/frontend/specs/timeslider_labels.js +++ b/tests/frontend/specs/timeslider_labels.js @@ -6,9 +6,9 @@ describe("timeslider", function(){ }); it("Shows a date and time in the timeslider and make sure it doesn't include NaN", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; - + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + // make some changes to produce 100 revisions var revs = 10; this.timeout(60000); @@ -18,15 +18,15 @@ describe("timeslider", function(){ inner$("div").first().sendkeys('a'); }, 200); } - + setTimeout(function() { // go to timeslider $('#iframe-container iframe').attr('src', $('#iframe-container iframe').attr('src')+'/timeslider'); - + setTimeout(function() { var timeslider$ = $('#iframe-container iframe')[0].contentWindow.$; var $sliderBar = timeslider$('#ui-slider-bar'); - + var latestContents = timeslider$('#padcontent').text(); // Expect the date and time to be shown @@ -36,17 +36,17 @@ describe("timeslider", function(){ e.clientX = e.pageX = 150; e.clientY = e.pageY = 45; $sliderBar.trigger(e); - + e = new jQuery.Event('mousedown'); e.clientX = e.pageX = 150; e.clientY = e.pageY = 40; $sliderBar.trigger(e); - + e = new jQuery.Event('mousedown'); e.clientX = e.pageX = 150; e.clientY = e.pageY = 50; $sliderBar.trigger(e); - + $sliderBar.trigger('mouseup') setTimeout(function() { diff --git a/tests/frontend/specs/timeslider_revisions.js b/tests/frontend/specs/timeslider_revisions.js index 2afd2e9d3..98794c25a 100644 --- a/tests/frontend/specs/timeslider_revisions.js +++ b/tests/frontend/specs/timeslider_revisions.js @@ -6,9 +6,9 @@ describe("timeslider", function(){ }); it("loads adds a hundred revisions", function(done) { // passes - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; - + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + // make some changes to produce 100 revisions var timePerRev = 900 , revs = 100; @@ -20,15 +20,15 @@ describe("timeslider", function(){ }, timePerRev*i); } chrome$('.buttonicon-savedRevision').click(); - + setTimeout(function() { // go to timeslider $('#iframe-container iframe').attr('src', $('#iframe-container iframe').attr('src')+'/timeslider'); - + setTimeout(function() { var timeslider$ = $('#iframe-container iframe')[0].contentWindow.$; var $sliderBar = timeslider$('#ui-slider-bar'); - + var latestContents = timeslider$('#padcontent').text(); // Click somewhere on the timeslider @@ -36,17 +36,17 @@ describe("timeslider", function(){ e.clientX = e.pageX = 150; e.clientY = e.pageY = 45; $sliderBar.trigger(e); - + e = new jQuery.Event('mousedown'); e.clientX = e.pageX = 150; e.clientY = e.pageY = 40; $sliderBar.trigger(e); - + e = new jQuery.Event('mousedown'); e.clientX = e.pageX = 150; e.clientY = e.pageY = 50; $sliderBar.trigger(e); - + $sliderBar.trigger('mouseup') setTimeout(function() { @@ -56,7 +56,7 @@ describe("timeslider", function(){ expect( starIsVisible ).to.eql( true ); done(); }, 1000); - + }, 6000); }, revs*timePerRev); }); @@ -64,9 +64,9 @@ describe("timeslider", function(){ // Disabled as jquery trigger no longer works properly xit("changes the url when clicking on the timeslider", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; - + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + // make some changes to produce 7 revisions var timePerRev = 1000 , revs = 20; @@ -77,24 +77,24 @@ describe("timeslider", function(){ inner$("div").first().sendkeys('a'); }, timePerRev*i); } - + setTimeout(function() { // go to timeslider $('#iframe-container iframe').attr('src', $('#iframe-container iframe').attr('src')+'/timeslider'); - + setTimeout(function() { var timeslider$ = $('#iframe-container iframe')[0].contentWindow.$; var $sliderBar = timeslider$('#ui-slider-bar'); - + var latestContents = timeslider$('#padcontent').text(); var oldUrl = $('#iframe-container iframe')[0].contentWindow.location.hash; - + // Click somewhere on the timeslider var e = new jQuery.Event('mousedown'); e.clientX = e.pageX = 150; e.clientY = e.pageY = 60; $sliderBar.trigger(e); - + helper.waitFor(function(){ return $('#iframe-container iframe')[0].contentWindow.location.hash != oldUrl; }, 6000).always(function(){ @@ -105,7 +105,7 @@ describe("timeslider", function(){ }, revs*timePerRev); }); it("jumps to a revision given in the url", function(done) { - var inner$ = helper.padInner$; + var inner$ = helper.padInner$; var chrome$ = helper.padChrome$; this.timeout(20000); @@ -118,7 +118,7 @@ describe("timeslider", function(){ expect( oldLength ).to.not.eql( 0 ); inner$("div").first().sendkeys('a'); var timeslider$; - + // wait for our additional revision to be added helper.waitFor(function(){ // newLines takes the new lines into account which are strippen when using @@ -131,7 +131,7 @@ describe("timeslider", function(){ }, 6000).always(function() { // go to timeslider with a specific revision set $('#iframe-container iframe').attr('src', $('#iframe-container iframe').attr('src')+'/timeslider#0'); - + // wait for the timeslider to be loaded helper.waitFor(function(){ try { @@ -149,17 +149,17 @@ describe("timeslider", function(){ }); it("checks the export url", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; this.timeout(11000); inner$("div").first().sendkeys('a'); - + setTimeout(function() { // go to timeslider $('#iframe-container iframe').attr('src', $('#iframe-container iframe').attr('src')+'/timeslider#0'); var timeslider$; var exportLink; - + helper.waitFor(function(){ try{ timeslider$ = $('#iframe-container iframe')[0].contentWindow.$; diff --git a/tests/frontend/specs/undo.js b/tests/frontend/specs/undo.js index 3644734f4..39a19cea4 100644 --- a/tests/frontend/specs/undo.js +++ b/tests/frontend/specs/undo.js @@ -8,7 +8,7 @@ describe("undo button", function(){ it("undo some typing by clicking undo button", function(done){ var inner$ = helper.padInner$; var chrome$ = helper.padChrome$; - + // get the first text element inside the editable space var $firstTextElement = inner$("div span").first(); var originalValue = $firstTextElement.text(); // get the original value diff --git a/tests/frontend/specs/unordered_list.js b/tests/frontend/specs/unordered_list.js index 4ea77b8ac..8a7fdd7a7 100644 --- a/tests/frontend/specs/unordered_list.js +++ b/tests/frontend/specs/unordered_list.js @@ -6,7 +6,7 @@ describe("assign unordered list", function(){ }); it("insert unordered list text then removes by outdent", function(done){ - var inner$ = helper.padInner$; + var inner$ = helper.padInner$; var chrome$ = helper.padChrome$; var originalText = inner$("div").first().text();