diff options
author | John McLear <john@mclear.co.uk> | 2013-03-13 15:00:04 -0300 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2013-03-13 15:00:04 -0300 |
commit | b4ec07312b8926f29623f23548dfc0b2b6554902 (patch) | |
tree | 16357d96a4918cc0222502d5b08dbd96acf0b693 /tests/frontend/specs/enter.js | |
parent | acb4b4ebafd366c85662cf5de2a9b15df7eb170b (diff) | |
download | etherpad-lite-b4ec07312b8926f29623f23548dfc0b2b6554902.zip |
add keystroke tests for relevant buttonpresses and change naming schema to something more sane
Diffstat (limited to 'tests/frontend/specs/enter.js')
-rw-r--r-- | tests/frontend/specs/enter.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/frontend/specs/enter.js b/tests/frontend/specs/enter.js new file mode 100644 index 00000000..e46b1d2f --- /dev/null +++ b/tests/frontend/specs/enter.js @@ -0,0 +1,34 @@ +describe("enter keystroke", function(){ + //create a new pad before each test run + beforeEach(function(cb){ + helper.newPad(cb); + this.timeout(60000); + }); + + it("creates a enw line & puts cursor onto a new line", 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(); + + // get the original string value minus the last char + var originalTextValue = $firstTextElement.text(); + + // simulate key presses to enter content + $firstTextElement.sendkeys('{enter}'); + + //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(){ + var $newSecondLine = inner$("div").first().next(); + var newFirstTextElementValue = inner$("div").first().text(); + expect(newFirstTextElementValue).to.be(""); // expect the first line to be blank + expect($newSecondLine.text()).to.be(originalTextValue); // expect the second line to be the same as the original first line. + done(); + }); + }); +}); |