diff options
author | John McLear <john@mclear.co.uk> | 2013-03-18 22:14:41 +0000 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2013-03-18 22:14:41 +0000 |
commit | 13ee96dce0adc1a479d1237e7b5aeee406937200 (patch) | |
tree | 9e67ebb81b7c97014265114b86aee7cacc16b61c /tests/frontend | |
parent | ee6a7d0b0c93232ef94de134387a2238062c7b00 (diff) | |
download | etherpad-lite-13ee96dce0adc1a479d1237e7b5aeee406937200.zip |
more tests but still fundamental flaw with arrow keys
Diffstat (limited to 'tests/frontend')
-rw-r--r-- | tests/frontend/specs/caret.js | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/frontend/specs/caret.js b/tests/frontend/specs/caret.js index 7432fda1..9d9da460 100644 --- a/tests/frontend/specs/caret.js +++ b/tests/frontend/specs/caret.js @@ -100,6 +100,85 @@ describe("As the caret is moved is the UI properly updated?", function(){ }); }); + it("Moves caret right a position", function(done){ + var inner$ = helper.padInner$; + var $newFirstTextElement = inner$("div").first(); + var originalCaretPosition = caretPosition(inner$); + var originalPos = originalCaretPosition.x; + var newCaretPos; + keyEvent(inner$, 39, false, false); // arrow right + + helper.waitFor(function(){ // Wait for the DOM to register the new items + var newCaretPosition = caretPosition(inner$); + newCaretPos = newCaretPosition.x; + return (newCaretPos > originalPos); + }).done(function(){ + expect(newCaretPos).to.be.moreThan(originalPos); + done(); + }); + }); + + it("Moves caret left a position", function(done){ + var inner$ = helper.padInner$; + var $newFirstTextElement = inner$("div").first(); + var originalCaretPosition = caretPosition(inner$); + var originalPos = originalCaretPosition.x; + var newCaretPos; + keyEvent(inner$, 33, false, false); // arrow left + + helper.waitFor(function(){ // Wait for the DOM to register the new items + var newCaretPosition = caretPosition(inner$); + newCaretPos = newCaretPosition.x; + return (newCaretPos < originalPos); + }).done(function(){ + expect(newCaretPos).to.be.lessThan(originalPos); + done(); + }); + }); + + it("Moves caret to the next line using right arrow", function(done){ + var inner$ = helper.padInner$; + var $newFirstTextElement = inner$("div").first(); + var originalCaretPosition = caretPosition(inner$); + var originalPos = originalCaretPosition.y; + var newCaretPos; + keyEvent(inner$, 39, false, false); // arrow right + keyEvent(inner$, 39, false, false); // arrow right + keyEvent(inner$, 39, false, false); // arrow right + keyEvent(inner$, 39, false, false); // arrow right + keyEvent(inner$, 39, false, false); // arrow right + keyEvent(inner$, 39, false, false); // arrow right + keyEvent(inner$, 39, false, false); // arrow right + + helper.waitFor(function(){ // Wait for the DOM to register the new items + var newCaretPosition = caretPosition(inner$); + newCaretPos = newCaretPosition.y; + return (newCaretPos > originalPos); + }).done(function(){ + expect(newCaretPos).to.be.moreThan(originalPos); + done(); + }); + }); + + it("Moves caret to the previous line using left arrow", function(done){ + var inner$ = helper.padInner$; + var $newFirstTextElement = inner$("div").first(); + var originalCaretPosition = caretPosition(inner$); + var originalPos = originalCaretPosition.y; + var newCaretPos; + keyEvent(inner$, 33, false, false); // arrow left + + helper.waitFor(function(){ // Wait for the DOM to register the new items + var newCaretPosition = caretPosition(inner$); + newCaretPos = newCaretPosition.y; + return (newCaretPos < originalPos); + }).done(function(){ + expect(newCaretPos).to.be.lessThan(originalPos); + done(); + }); + }); + + /* it("Creates N rows, changes height of rows, updates UI by caret key events", function(done){ |