summaryrefslogtreecommitdiff
path: root/tests/frontend/specs/enter.js
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2013-03-13 15:00:04 -0300
committerJohn McLear <john@mclear.co.uk>2013-03-13 15:00:04 -0300
commitb4ec07312b8926f29623f23548dfc0b2b6554902 (patch)
tree16357d96a4918cc0222502d5b08dbd96acf0b693 /tests/frontend/specs/enter.js
parentacb4b4ebafd366c85662cf5de2a9b15df7eb170b (diff)
downloadetherpad-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.js34
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();
+ });
+ });
+});