mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
Merge pull request #1616 from ether/ff-key-tests
fix tests in firefox as firefox fires on keypress not down
This commit is contained in:
commit
dab82ca380
5 changed files with 35 additions and 6 deletions
|
@ -43,8 +43,13 @@ describe("bold button", function(){
|
|||
|
||||
//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("keydown");
|
||||
var e = inner$.Event(evtType);
|
||||
e.ctrlKey = true; // Control key
|
||||
e.which = 66; // b
|
||||
inner$("#innerdocbody").trigger(e);
|
||||
|
|
|
@ -15,7 +15,13 @@ describe("indentation button", function(){
|
|||
//select this text element
|
||||
$firstTextElement.sendkeys('{selectall}');
|
||||
|
||||
var e = inner$.Event("keydown");
|
||||
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);
|
||||
|
||||
|
|
|
@ -44,7 +44,13 @@ describe("italic some text", function(){
|
|||
//select this text element
|
||||
$firstTextElement.sendkeys('{selectall}');
|
||||
|
||||
var e = inner$.Event("keydown");
|
||||
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);
|
||||
|
|
|
@ -47,12 +47,18 @@ 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("keydown");
|
||||
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("keydown");
|
||||
var e = inner$.Event(evtType);
|
||||
e.ctrlKey = true; // Control key
|
||||
e.which = 121; // y
|
||||
inner$("#innerdocbody").trigger(e);
|
||||
|
|
|
@ -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.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);
|
||||
|
|
Loading…
Reference in a new issue