tests: use helper for evttype to reduce duplicate code

This commit is contained in:
John McLear 2020-03-23 10:53:58 +00:00 committed by muxator
parent be9afc7955
commit 675c839d92
10 changed files with 27 additions and 117 deletions

View file

@ -56,6 +56,22 @@ var helper = {};
window.document.cookie = "";
}
// Functionality for knowing what key event type is required for tests
var evtType = "keydown";
// if it's IE require keypress
if(window.navigator.userAgent.indexOf("MSIE") > -1){
evtType = "keypress";
}
// Edge also requires keypress.
if(window.navigator.userAgent.indexOf("Edge") > -1){
evtType = "keypress";
}
// Opera also requires keypress.
if(window.navigator.userAgent.indexOf("OPR") > -1){
evtType = "keypress";
}
helper.evtType = evtType;
helper.newPad = function(cb, padName){
//build opts object
var opts = {clearCookies: true}
@ -216,4 +232,4 @@ var helper = {};
_it(name, func);
}
})()
})()