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:
John McLear 2013-03-14 13:34:22 -07:00
commit dab82ca380
5 changed files with 35 additions and 6 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);