diff options
author | Marcel Klehr <mklehr@gmx.net> | 2013-03-15 21:43:58 +0100 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2013-03-15 21:43:58 +0100 |
commit | a31605216fe72b8ae213394385aecee0bfb24ff2 (patch) | |
tree | 9c7946c3ea5f8ec75cf7929f122dac6d74f5a28b /tests/frontend/specs | |
parent | 844012864ff4a7ecb5b236983578d3e36b915304 (diff) | |
parent | 54433db47f5083faa921da6050b4e4e4b55dfb20 (diff) | |
download | etherpad-lite-a31605216fe72b8ae213394385aecee0bfb24ff2.zip |
Merge branch 'release/1.2.9'
Diffstat (limited to 'tests/frontend/specs')
-rw-r--r-- | tests/frontend/specs/alphabet.js (renamed from tests/frontend/specs/keystroke_alphabet.js) | 0 | ||||
-rw-r--r-- | tests/frontend/specs/bold.js | 71 | ||||
-rw-r--r-- | tests/frontend/specs/button_bold.js | 36 | ||||
-rw-r--r-- | tests/frontend/specs/button_italic.js | 36 | ||||
-rw-r--r-- | tests/frontend/specs/button_redo.js | 37 | ||||
-rw-r--r-- | tests/frontend/specs/button_undo.js | 33 | ||||
-rw-r--r-- | tests/frontend/specs/chat.js (renamed from tests/frontend/specs/keystroke_chat.js) | 35 | ||||
-rw-r--r-- | tests/frontend/specs/chat_always_on_screen.js | 40 | ||||
-rw-r--r-- | tests/frontend/specs/clear_authorship_colors.js (renamed from tests/frontend/specs/button_clear_authorship_colors.js) | 0 | ||||
-rw-r--r-- | tests/frontend/specs/delete.js (renamed from tests/frontend/specs/keystroke_delete.js) | 0 | ||||
-rw-r--r-- | tests/frontend/specs/enter.js (renamed from tests/frontend/specs/keystroke_enter.js) | 2 | ||||
-rw-r--r-- | tests/frontend/specs/indentation.js (renamed from tests/frontend/specs/button_indentation.js) | 28 | ||||
-rw-r--r-- | tests/frontend/specs/italic.js | 73 | ||||
-rw-r--r-- | tests/frontend/specs/language.js | 3 | ||||
-rw-r--r-- | tests/frontend/specs/ordered_list.js (renamed from tests/frontend/specs/button_ordered_list.js) | 0 | ||||
-rw-r--r-- | tests/frontend/specs/redo.js | 76 | ||||
-rw-r--r-- | tests/frontend/specs/strikethrough.js (renamed from tests/frontend/specs/button_strikethrough.js) | 0 | ||||
-rw-r--r-- | tests/frontend/specs/timeslider.js (renamed from tests/frontend/specs/button_timeslider.js) | 0 | ||||
-rw-r--r-- | tests/frontend/specs/undo.js | 69 | ||||
-rw-r--r-- | tests/frontend/specs/urls_become_clickable.js (renamed from tests/frontend/specs/keystroke_urls_become_clickable.js) | 0 |
20 files changed, 351 insertions, 188 deletions
diff --git a/tests/frontend/specs/keystroke_alphabet.js b/tests/frontend/specs/alphabet.js index 131a81c0..131a81c0 100644 --- a/tests/frontend/specs/keystroke_alphabet.js +++ b/tests/frontend/specs/alphabet.js diff --git a/tests/frontend/specs/bold.js b/tests/frontend/specs/bold.js new file mode 100644 index 00000000..95da7331 --- /dev/null +++ b/tests/frontend/specs/bold.js @@ -0,0 +1,71 @@ +describe("bold button", function(){ + //create a new pad before each test run + beforeEach(function(cb){ + helper.newPad(cb); + this.timeout(60000); + }); + + it("makes text bold on click", function(done) { + 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 <b> element now? + var isBold = $newFirstTextElement.find("b").length === 1; + + //expect it to be bold + expect(isBold).to.be(true); + + //make sure the text hasn't changed + expect($newFirstTextElement.text()).to.eql($firstTextElement.text()); + + done(); + }); + + it("makes text bold on keypress", function(done) { + 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}'); + if(inner$.browser.mozilla){ // if it's a mozilla browser + var evtType = "keypress"; + }else{ + var evtType = "keydown"; + } + + var e = inner$.Event(evtType); + e.ctrlKey = true; // Control key + e.which = 66; // b + inner$("#innerdocbody").trigger(e); + + //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 <b> element now? + var isBold = $newFirstTextElement.find("b").length === 1; + + //expect it to be bold + expect(isBold).to.be(true); + + //make sure the text hasn't changed + expect($newFirstTextElement.text()).to.eql($firstTextElement.text()); + + done(); + }); +}); diff --git a/tests/frontend/specs/button_bold.js b/tests/frontend/specs/button_bold.js deleted file mode 100644 index 1feafe61..00000000 --- a/tests/frontend/specs/button_bold.js +++ /dev/null @@ -1,36 +0,0 @@ -describe("bold button", function(){ - //create a new pad before each test run - beforeEach(function(cb){ - helper.newPad(cb); - this.timeout(60000); - }); - - it("makes text bold", function(done) { - 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 <b> element now? - var isBold = $newFirstTextElement.find("b").length === 1; - - //expect it to be bold - expect(isBold).to.be(true); - - //make sure the text hasn't changed - expect($newFirstTextElement.text()).to.eql($firstTextElement.text()); - - done(); - }); -});
\ No newline at end of file diff --git a/tests/frontend/specs/button_italic.js b/tests/frontend/specs/button_italic.js deleted file mode 100644 index fc2e15a7..00000000 --- a/tests/frontend/specs/button_italic.js +++ /dev/null @@ -1,36 +0,0 @@ -describe("italic button", function(){ - //create a new pad before each test run - beforeEach(function(cb){ - helper.newPad(cb); - this.timeout(60000); - }); - - it("makes text italic", function(done) { - 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 <i> element now? - var isItalic = $newFirstTextElement.find("i").length === 1; - - //expect it to be bold - expect(isItalic).to.be(true); - - //make sure the text hasn't changed - expect($newFirstTextElement.text()).to.eql($firstTextElement.text()); - - done(); - }); -}); diff --git a/tests/frontend/specs/button_redo.js b/tests/frontend/specs/button_redo.js deleted file mode 100644 index 3ce69142..00000000 --- a/tests/frontend/specs/button_redo.js +++ /dev/null @@ -1,37 +0,0 @@ -describe("undo button then redo button", function(){ - beforeEach(function(cb){ - helper.newPad(cb); // creates a new pad - this.timeout(60000); - }); - - it("undo some typing", 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 - var newString = "Foo"; - - $firstTextElement.sendkeys(newString); // send line 1 to the pad - var modifiedValue = $firstTextElement.text(); // get the modified value - expect(modifiedValue).not.to.be(originalValue); // expect the value to change - - // get undo and redo buttons - var $undoButton = chrome$(".buttonicon-undo"); - var $redoButton = chrome$(".buttonicon-redo"); - // click the buttons - $undoButton.click(); // removes foo - $redoButton.click(); // resends foo - - helper.waitFor(function(){ - console.log(inner$("div span").first().text()); - return inner$("div span").first().text() === newString; - }).done(function(){ - var finalValue = inner$("div").first().text(); - expect(finalValue).to.be(modifiedValue); // expect the value to change - done(); - }); - }); -}); - diff --git a/tests/frontend/specs/button_undo.js b/tests/frontend/specs/button_undo.js deleted file mode 100644 index 412b786b..00000000 --- a/tests/frontend/specs/button_undo.js +++ /dev/null @@ -1,33 +0,0 @@ -describe("undo button", function(){ - beforeEach(function(cb){ - helper.newPad(cb); // creates a new pad - this.timeout(60000); - }); - - it("undo some typing", 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 - - $firstTextElement.sendkeys("foo"); // send line 1 to the pad - var modifiedValue = $firstTextElement.text(); // get the modified value - expect(modifiedValue).not.to.be(originalValue); // expect the value to change - - // get clear authorship button as a variable - var $undoButton = chrome$(".buttonicon-undo"); - // click the button - $undoButton.click(); - - helper.waitFor(function(){ - return inner$("div span").first().text() === originalValue; - }).done(function(){ - var finalValue = inner$("div span").first().text(); - expect(finalValue).to.be(originalValue); // expect the value to change - done(); - }); - }); -}); - diff --git a/tests/frontend/specs/keystroke_chat.js b/tests/frontend/specs/chat.js index e4908728..a488193f 100644 --- a/tests/frontend/specs/keystroke_chat.js +++ b/tests/frontend/specs/chat.js @@ -1,4 +1,4 @@ -describe("send chat message", function(){ +describe("Chat messages and UI", function(){ //create a new pad before each test run beforeEach(function(cb){ helper.newPad(cb); @@ -64,5 +64,36 @@ describe("send chat message", function(){ }); }); -}); + it("makes chat stick to right side of the screen", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + + //click on the settings button to make settings visible + var $settingsButton = chrome$(".buttonicon-settings"); + $settingsButton.click(); + + //get the chat selector + var $stickychatCheckbox = chrome$("#options-stickychat"); + + //select chat always on screen and fire change event + $stickychatCheckbox.attr('selected','selected'); + $stickychatCheckbox.change(); + $stickychatCheckbox.click(); + //check if chat changed to get the stickychat Class + var $chatbox = chrome$("#chatbox"); + var hasStickyChatClass = $chatbox.hasClass("stickyChat"); + expect(hasStickyChatClass).to.be(true); + + //select chat always on screen and fire change event + $stickychatCheckbox.attr('selected','selected'); + $stickychatCheckbox.change(); + $stickychatCheckbox.click(); + + //check if chat changed to remove the stickychat Class + var hasStickyChatClass = $chatbox.hasClass("stickyChat"); + expect(hasStickyChatClass).to.be(false); + + done(); + }); +}); diff --git a/tests/frontend/specs/chat_always_on_screen.js b/tests/frontend/specs/chat_always_on_screen.js deleted file mode 100644 index 4873763f..00000000 --- a/tests/frontend/specs/chat_always_on_screen.js +++ /dev/null @@ -1,40 +0,0 @@ -describe("chat always ons creen select", function(){ - //create a new pad before each test run - beforeEach(function(cb){ - helper.newPad(cb); - this.timeout(60000); - }); - - it("makes chat stick to right side of the screen", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; - - //click on the settings button to make settings visible - var $settingsButton = chrome$(".buttonicon-settings"); - $settingsButton.click(); - - //get the chat selector - var $stickychatCheckbox = chrome$("#options-stickychat"); - - //select chat always on screen and fire change event - $stickychatCheckbox.attr('selected','selected'); - $stickychatCheckbox.change(); - $stickychatCheckbox.click(); - - //check if chat changed to get the stickychat Class - var $chatbox = chrome$("#chatbox"); - var hasStickyChatClass = $chatbox.hasClass("stickyChat"); - expect(hasStickyChatClass).to.be(true); - - //select chat always on screen and fire change event - $stickychatCheckbox.attr('selected','selected'); - $stickychatCheckbox.change(); - $stickychatCheckbox.click(); - - //check if chat changed to remove the stickychat Class - var hasStickyChatClass = $chatbox.hasClass("stickyChat"); - expect(hasStickyChatClass).to.be(false); - - done(); - }); -}); diff --git a/tests/frontend/specs/button_clear_authorship_colors.js b/tests/frontend/specs/clear_authorship_colors.js index 5db35612..5db35612 100644 --- a/tests/frontend/specs/button_clear_authorship_colors.js +++ b/tests/frontend/specs/clear_authorship_colors.js diff --git a/tests/frontend/specs/keystroke_delete.js b/tests/frontend/specs/delete.js index 86e76f56..86e76f56 100644 --- a/tests/frontend/specs/keystroke_delete.js +++ b/tests/frontend/specs/delete.js diff --git a/tests/frontend/specs/keystroke_enter.js b/tests/frontend/specs/enter.js index e46b1d2f..baafeded 100644 --- a/tests/frontend/specs/keystroke_enter.js +++ b/tests/frontend/specs/enter.js @@ -5,7 +5,7 @@ describe("enter keystroke", function(){ this.timeout(60000); }); - it("creates a enw line & puts cursor onto a new line", function(done) { + it("creates a new line & puts cursor onto a new line", function(done) { var inner$ = helper.padInner$; var chrome$ = helper.padChrome$; diff --git a/tests/frontend/specs/button_indentation.js b/tests/frontend/specs/indentation.js index 9c8e317e..9692120a 100644 --- a/tests/frontend/specs/button_indentation.js +++ b/tests/frontend/specs/indentation.js @@ -5,7 +5,32 @@ describe("indentation button", function(){ this.timeout(60000); }); - it("indent text", function(done){ + it("indent text with keypress", function(done){ + 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}'); + + if(inner$.browser.mozilla){ // if it's a mozilla browser + var evtType = "keypress"; + }else{ + var evtType = "keydown"; + } + + var e = inner$.Event(evtType); + e.keyCode = 9; // tab :| + inner$("#innerdocbody").trigger(e); + + helper.waitFor(function(){ + return inner$("div").first().find("ul li").length === 1; + }).done(done); + }); + + it("indent text with button", function(done){ var inner$ = helper.padInner$; var chrome$ = helper.padChrome$; @@ -176,4 +201,5 @@ describe("indentation button", function(){ expect(isLI).to.be(true); },1000); });*/ + }); diff --git a/tests/frontend/specs/italic.js b/tests/frontend/specs/italic.js new file mode 100644 index 00000000..29dbae59 --- /dev/null +++ b/tests/frontend/specs/italic.js @@ -0,0 +1,73 @@ +describe("italic some text", function(){ + //create a new pad before each test run + beforeEach(function(cb){ + helper.newPad(cb); + this.timeout(60000); + }); + + it("makes text italic using button", function(done) { + 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 <i> element now? + var isItalic = $newFirstTextElement.find("i").length === 1; + + //expect it to be bold + expect(isItalic).to.be(true); + + //make sure the text hasn't changed + expect($newFirstTextElement.text()).to.eql($firstTextElement.text()); + + done(); + }); + + it("makes text italic using keypress", function(done) { + 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}'); + + if(inner$.browser.mozilla){ // if it's a mozilla browser + var evtType = "keypress"; + }else{ + var evtType = "keydown"; + } + + var e = inner$.Event(evtType); + e.ctrlKey = true; // Control key + e.which = 105; // i + inner$("#innerdocbody").trigger(e); + + //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 <i> element now? + var isItalic = $newFirstTextElement.find("i").length === 1; + + //expect it to be bold + expect(isItalic).to.be(true); + + //make sure the text hasn't changed + expect($newFirstTextElement.text()).to.eql($firstTextElement.text()); + + done(); + }); + +}); diff --git a/tests/frontend/specs/language.js b/tests/frontend/specs/language.js index ab7f2b3d..d607ff98 100644 --- a/tests/frontend/specs/language.js +++ b/tests/frontend/specs/language.js @@ -13,7 +13,6 @@ describe("Language select and change", function(){ }); // Destroy language cookies - it("makes text german", function(done) { var inner$ = helper.padInner$; var chrome$ = helper.padChrome$; @@ -92,7 +91,7 @@ describe("Language select and change", function(){ var $languageoption = $language.find("[value=ar]"); //select arabic - $languageoption.attr('selected','selected'); + // $languageoption.attr('selected','selected'); // Breaks the test.. $language.val("ar"); $languageoption.change(); diff --git a/tests/frontend/specs/button_ordered_list.js b/tests/frontend/specs/ordered_list.js index ca7d755e..ca7d755e 100644 --- a/tests/frontend/specs/button_ordered_list.js +++ b/tests/frontend/specs/ordered_list.js diff --git a/tests/frontend/specs/redo.js b/tests/frontend/specs/redo.js new file mode 100644 index 00000000..c2f8a95a --- /dev/null +++ b/tests/frontend/specs/redo.js @@ -0,0 +1,76 @@ +describe("undo button then redo button", function(){ + beforeEach(function(cb){ + helper.newPad(cb); // creates a new pad + this.timeout(60000); + }); + + 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 + var newString = "Foo"; + + $firstTextElement.sendkeys(newString); // send line 1 to the pad + var modifiedValue = $firstTextElement.text(); // get the modified value + expect(modifiedValue).not.to.be(originalValue); // expect the value to change + + // get undo and redo buttons + var $undoButton = chrome$(".buttonicon-undo"); + var $redoButton = chrome$(".buttonicon-redo"); + // click the buttons + $undoButton.click(); // removes foo + $redoButton.click(); // resends foo + + helper.waitFor(function(){ + console.log(inner$("div span").first().text()); + return inner$("div span").first().text() === newString; + }).done(function(){ + var finalValue = inner$("div").first().text(); + expect(finalValue).to.be(modifiedValue); // expect the value to change + done(); + }); + }); + + it("redo some typing with keypress", 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 + var newString = "Foo"; + + $firstTextElement.sendkeys(newString); // send line 1 to the pad + var modifiedValue = $firstTextElement.text(); // get the modified value + expect(modifiedValue).not.to.be(originalValue); // expect the value to change + + if(inner$.browser.mozilla){ // if it's a mozilla browser + var evtType = "keypress"; + }else{ + var evtType = "keydown"; + } + + var e = inner$.Event(evtType); + e.ctrlKey = true; // Control key + e.which = 90; // z + inner$("#innerdocbody").trigger(e); + + var e = inner$.Event(evtType); + e.ctrlKey = true; // Control key + e.which = 121; // y + inner$("#innerdocbody").trigger(e); + + helper.waitFor(function(){ + console.log(inner$("div span").first().text()); + return inner$("div span").first().text() === newString; + }).done(function(){ + var finalValue = inner$("div").first().text(); + expect(finalValue).to.be(modifiedValue); // expect the value to change + done(); + }); + }); +}); + diff --git a/tests/frontend/specs/button_strikethrough.js b/tests/frontend/specs/strikethrough.js index 9afcea0f..9afcea0f 100644 --- a/tests/frontend/specs/button_strikethrough.js +++ b/tests/frontend/specs/strikethrough.js diff --git a/tests/frontend/specs/button_timeslider.js b/tests/frontend/specs/timeslider.js index cb37bacb..cb37bacb 100644 --- a/tests/frontend/specs/button_timeslider.js +++ b/tests/frontend/specs/timeslider.js diff --git a/tests/frontend/specs/undo.js b/tests/frontend/specs/undo.js new file mode 100644 index 00000000..0c58c9b8 --- /dev/null +++ b/tests/frontend/specs/undo.js @@ -0,0 +1,69 @@ +describe("undo button", function(){ + beforeEach(function(cb){ + helper.newPad(cb); // creates a new pad + this.timeout(60000); + }); + +/* + 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 + + $firstTextElement.sendkeys("foo"); // send line 1 to the pad + var modifiedValue = $firstTextElement.text(); // get the modified value + expect(modifiedValue).not.to.be(originalValue); // expect the value to change + + // get clear authorship button as a variable + var $undoButton = chrome$(".buttonicon-undo"); + // click the button + $undoButton.click(); + + helper.waitFor(function(){ + return inner$("div span").first().text() === originalValue; + }).done(function(){ + var finalValue = inner$("div span").first().text(); + expect(finalValue).to.be(originalValue); // expect the value to change + done(); + }); + }); +*/ + + it("undo some typing using a keypress", 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 + + $firstTextElement.sendkeys("foo"); // send line 1 to the pad + var modifiedValue = $firstTextElement.text(); // get the modified value + expect(modifiedValue).not.to.be(originalValue); // expect the value to change + + if(inner$.browser.mozilla){ // if it's a mozilla browser + var evtType = "keypress"; + }else{ + var evtType = "keydown"; + } + + var e = inner$.Event(evtType); + e.ctrlKey = true; // Control key + e.which = 90; // z + inner$("#innerdocbody").trigger(e); + + helper.waitFor(function(){ + return inner$("div span").first().text() === originalValue; + }).done(function(){ + var finalValue = inner$("div span").first().text(); + expect(finalValue).to.be(originalValue); // expect the value to change + done(); + }); + }); + + +}); + diff --git a/tests/frontend/specs/keystroke_urls_become_clickable.js b/tests/frontend/specs/urls_become_clickable.js index 8c72d748..8c72d748 100644 --- a/tests/frontend/specs/keystroke_urls_become_clickable.js +++ b/tests/frontend/specs/urls_become_clickable.js |