This isn't ideal, basically some browsers interact with keypress/keydown in different ways so this is a workaround but it's not perma

pull/1616/head
John McLear 2013-03-14 13:51:23 -03:00
parent 12107859bb
commit 34c2cf40fa
5 changed files with 35 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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

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