tests: some scroll tests fixed

This commit is contained in:
John McLear 2020-03-23 13:03:51 +00:00 committed by muxator
parent fc1d1fca2b
commit 90da21df35

View file

@ -23,7 +23,7 @@ describe('scroll when focus line is out of viewport', function () {
placeCaretInTheBeginningOfLine(lineCloseOfTopOfPad, function(){ // place caret in the 10th line placeCaretInTheBeginningOfLine(lineCloseOfTopOfPad, function(){ // place caret in the 10th line
// warning: even pressing right arrow, the caret does not change of position // warning: even pressing right arrow, the caret does not change of position
// the column where the caret is, it has not importance, only the line // the column where the caret is, it has not importance, only the line
pressAndReleaseRightArrow(); pressAndReleaseRightArrow(); // I don't think this is working in Edge.
done(); done();
}); });
}); });
@ -512,8 +512,14 @@ 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 e = inner$.Event(helper.evtType);
e.shiftKey = shiftIsPressed; /*
* These events use keydown and up, not keypress.
* Do not change. Changing to keypress will break Edge.
*/
var e = inner$.Event("keydown");
e.shiftKey = shiftIsPressed || false;
e.keyCode = keyCode; e.keyCode = keyCode;
e.which = keyCode; // etherpad listens to 'which' e.which = keyCode; // etherpad listens to 'which'
inner$('#innerdocbody').trigger(e); inner$('#innerdocbody').trigger(e);
@ -521,8 +527,13 @@ describe('scroll when focus line is out of viewport', function () {
var releaseKey = function(keyCode){ var releaseKey = function(keyCode){
var inner$ = helper.padInner$; var inner$ = helper.padInner$;
var evtType = 'keyup';
var e = inner$.Event(evtType); /*
* These events use keydown and up, not keypress.
* Do not change. Changing to keypress will break Edge.
*/
var e = inner$.Event("keyup");
e.keyCode = keyCode; e.keyCode = keyCode;
e.which = keyCode; // etherpad listens to 'which' e.which = keyCode; // etherpad listens to 'which'
inner$('#innerdocbody').trigger(e); inner$('#innerdocbody').trigger(e);