tests: remove more edge settimeout issues (#4060)

This commit is contained in:
John McLear 2020-05-29 20:07:27 +01:00 committed by GitHub
parent be2ba34d3c
commit 174e68d468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 9 deletions

View File

@ -63,18 +63,22 @@ describe("select formatting buttons when selection has style applied", function(
}
var applyStyleOnLineOnFullLineAndRemoveSelection = function(line, style, selectTarget, cb) {
// see if line html has changed
var inner$ = helper.padInner$;
var oldLineHTML = inner$.find("div")[line];
applyStyleOnLine(style, line);
// we have to give some time to Etherpad detects the selection changed
setTimeout(function() {
helper.waitFor(function(){
var lineHTML = inner$.find("div")[line];
return lineHTML !== oldLineHTML;
});
// remove selection from previous line
selectLine(line + 1);
setTimeout(function() {
// select the text or place the caret on a position that
// has the formatting text applied previously
selectTarget(line);
cb();
}, 1000);
selectLine(line + 1);
setTimeout(function() {
// select the text or place the caret on a position that
// has the formatting text applied previously
selectTarget(line);
cb();
}, 1000);
}