tests: hopefully fixed all tests to be working in edge

This commit is contained in:
John McLear 2020-03-22 18:19:29 +00:00 committed by muxator
parent 4eec68fbdd
commit 58e1e2d16f
8 changed files with 56 additions and 12 deletions

View file

@ -46,9 +46,14 @@ describe("bold button", function(){
if(inner$(window)[0].bowser.modernIE){ // if it's IE if(inner$(window)[0].bowser.modernIE){ // if it's IE
var evtType = "keypress"; var evtType = "keypress";
}else{
// Edge also requires keypress.
if(window.navigator.userAgent.indexOf("Edge") > -1){
var evtType = "keypress";
}else{ }else{
var evtType = "keydown"; var evtType = "keydown";
} }
}
var e = inner$.Event(evtType); var e = inner$.Event(evtType);
e.ctrlKey = true; // Control key e.ctrlKey = true; // Control key

View file

@ -297,11 +297,18 @@ function prepareDocument(n, target){ // generates a random document with random
} }
function keyEvent(target, charCode, ctrl, shift){ // sends a charCode to the window function keyEvent(target, charCode, ctrl, shift){ // sends a charCode to the window
if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's a mozilla or IE if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's IE
var evtType = "keypress";
}else{
// Edge also requires keypress.
if(window.navigator.userAgent.indexOf("Edge") > -1){
var evtType = "keypress"; var evtType = "keypress";
}else{ }else{
var evtType = "keydown"; var evtType = "keydown";
} }
}
var e = target.Event(evtType); var e = target.Event(evtType);
console.log(e); console.log(e);
if(ctrl){ if(ctrl){

View file

@ -17,9 +17,14 @@ describe("indentation button", function(){
if(inner$(window)[0].bowser.modernIE){ // if it's IE if(inner$(window)[0].bowser.modernIE){ // if it's IE
var evtType = "keypress"; var evtType = "keypress";
}else{
// Edge also requires keypress.
if(window.navigator.userAgent.indexOf("Edge") > -1){
var evtType = "keypress";
}else{ }else{
var evtType = "keydown"; var evtType = "keydown";
} }
}
var e = inner$.Event(evtType); var e = inner$.Event(evtType);
e.keyCode = 9; // tab :| e.keyCode = 9; // tab :|

View file

@ -46,9 +46,14 @@ describe("italic some text", function(){
if(inner$(window)[0].bowser.modernIE){ // if it's IE if(inner$(window)[0].bowser.modernIE){ // if it's IE
var evtType = "keypress"; var evtType = "keypress";
}else{
// Edge also requires keypress.
if(window.navigator.userAgent.indexOf("Edge") > -1){
var evtType = "keypress";
}else{ }else{
var evtType = "keydown"; var evtType = "keydown";
} }
}
var e = inner$.Event(evtType); var e = inner$.Event(evtType);
e.ctrlKey = true; // Control key e.ctrlKey = true; // Control key

View file

@ -111,11 +111,16 @@ describe("assign ordered list", function(){
var triggerCtrlShiftShortcut = function(shortcutChar) { var triggerCtrlShiftShortcut = function(shortcutChar) {
var inner$ = helper.padInner$; var inner$ = helper.padInner$;
if(inner$(window)[0].bowser.modernIE) { // if it's IE if(inner$(window)[0].bowser.modernIE){ // if it's IE
var evtType = "keypress";
}else{
// Edge also requires keypress.
if(window.navigator.userAgent.indexOf("Edge") > -1){
var evtType = "keypress"; var evtType = "keypress";
}else{ }else{
var evtType = "keydown"; var evtType = "keydown";
} }
}
var e = inner$.Event(evtType); var e = inner$.Event(evtType);
e.ctrlKey = true; e.ctrlKey = true;
e.shiftKey = true; e.shiftKey = true;

View file

@ -47,11 +47,16 @@ describe("undo button then redo button", function(){
var modifiedValue = $firstTextElement.text(); // get the modified value var modifiedValue = $firstTextElement.text(); // get the modified value
expect(modifiedValue).not.to.be(originalValue); // expect the value to change expect(modifiedValue).not.to.be(originalValue); // expect the value to change
if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's a mozilla or IE if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's IE
var evtType = "keypress";
}else{
// Edge also requires keypress.
if(window.navigator.userAgent.indexOf("Edge") > -1){
var evtType = "keypress"; var evtType = "keypress";
}else{ }else{
var evtType = "keydown"; var evtType = "keydown";
} }
}
var e = inner$.Event(evtType); var e = inner$.Event(evtType);
e.ctrlKey = true; // Control key e.ctrlKey = true; // Control key

View file

@ -513,11 +513,18 @@ describe('scroll when focus line is out of viewport', function () {
var pressKey = function(keyCode, shiftIsPressed){ var pressKey = function(keyCode, shiftIsPressed){
var inner$ = helper.padInner$; var inner$ = helper.padInner$;
var evtType; var evtType;
if(inner$(window)[0].bowser.modernIE){ // if it's IE if(inner$(window)[0].bowser.modernIE){ // if it's IE
evtType = 'keypress'; var evtType = "keypress";
}else{ }else{
evtType = 'keydown'; // Edge also requires keypress.
if(window.navigator.userAgent.indexOf("Edge") > -1){
var evtType = "keypress";
}else{
var evtType = "keydown";
} }
}
var e = inner$.Event(evtType); var e = inner$.Event(evtType);
e.shiftKey = shiftIsPressed; e.shiftKey = shiftIsPressed;
e.keyCode = keyCode; e.keyCode = keyCode;

View file

@ -90,9 +90,14 @@ describe("select formatting buttons when selection has style applied", function(
if(inner$(window)[0].bowser.modernIE){ // if it's IE if(inner$(window)[0].bowser.modernIE){ // if it's IE
var evtType = "keypress"; var evtType = "keypress";
}else{
// Edge also requires keypress.
if(window.navigator.userAgent.indexOf("Edge") > -1){
var evtType = "keypress";
}else{ }else{
var evtType = "keydown"; var evtType = "keydown";
} }
}
var e = inner$.Event(evtType); var e = inner$.Event(evtType);
e.ctrlKey = true; // Control key e.ctrlKey = true; // Control key