diff options
author | John McLear <john@mclear.co.uk> | 2013-03-14 13:51:23 -0300 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2013-03-14 13:51:23 -0300 |
commit | 34c2cf40faae53ef33980378ca7f5e704b91be07 (patch) | |
tree | 86cea7e0aff8230e81c3fe4abcbcd4f2ecbe3efb /tests/frontend | |
parent | 12107859bb2325c5ba7b7bf0efeaa76682b5edb7 (diff) | |
download | etherpad-lite-34c2cf40faae53ef33980378ca7f5e704b91be07.zip |
This isn't ideal, basically some browsers interact with keypress/keydown in different ways so this is a workaround but it's not perma
Diffstat (limited to 'tests/frontend')
-rw-r--r-- | tests/frontend/specs/bold.js | 8 | ||||
-rw-r--r-- | tests/frontend/specs/indentation.js | 8 | ||||
-rw-r--r-- | tests/frontend/specs/italic.js | 8 | ||||
-rw-r--r-- | tests/frontend/specs/redo.js | 8 | ||||
-rw-r--r-- | tests/frontend/specs/undo.js | 8 |
5 files changed, 35 insertions, 5 deletions
diff --git a/tests/frontend/specs/bold.js b/tests/frontend/specs/bold.js index 010d6901..7c04835e 100644 --- a/tests/frontend/specs/bold.js +++ b/tests/frontend/specs/bold.js @@ -44,7 +44,13 @@ describe("bold button", function(){ //select this text element $firstTextElement.sendkeys('{selectall}'); - var e = inner$.Event("keypress"); + if(!inner$.browser.chrome){ + 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); diff --git a/tests/frontend/specs/indentation.js b/tests/frontend/specs/indentation.js index 6b9b432d..6e5b3c1a 100644 --- a/tests/frontend/specs/indentation.js +++ b/tests/frontend/specs/indentation.js @@ -15,7 +15,13 @@ describe("indentation button", function(){ //select this text element $firstTextElement.sendkeys('{selectall}'); - var e = inner$.Event("keypress"); + if(!inner$.browser.chrome){ + var evtType = "keypress"; + }else{ + var evtType = "keydown"; + } + + var e = inner$.Event(evtType); e.keyCode = 9; // tab :| inner$("#innerdocbody").trigger(e); diff --git a/tests/frontend/specs/italic.js b/tests/frontend/specs/italic.js index 15976f29..9bee72dc 100644 --- a/tests/frontend/specs/italic.js +++ b/tests/frontend/specs/italic.js @@ -44,7 +44,13 @@ describe("italic some text", function(){ //select this text element $firstTextElement.sendkeys('{selectall}'); - var e = inner$.Event("keypress"); + if(!inner$.browser.chrome){ + 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); diff --git a/tests/frontend/specs/redo.js b/tests/frontend/specs/redo.js index d72b5a09..059e9711 100644 --- a/tests/frontend/specs/redo.js +++ b/tests/frontend/specs/redo.js @@ -47,7 +47,13 @@ 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 - var e = inner$.Event("keypress"); + if(!inner$.browser.chrome){ + 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); diff --git a/tests/frontend/specs/undo.js b/tests/frontend/specs/undo.js index 8ba752ac..4e9dd0d5 100644 --- a/tests/frontend/specs/undo.js +++ b/tests/frontend/specs/undo.js @@ -44,7 +44,13 @@ describe("undo button", function(){ var modifiedValue = $firstTextElement.text(); // get the modified value expect(modifiedValue).not.to.be(originalValue); // expect the value to change - var e = inner$.Event("keydown"); + if(!inner$.browser.chrome){ + 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); |