Compare commits

...

1 Commits

Author SHA1 Message Date
webzwo0i 947e663de3 some debug logs 2020-09-29 02:55:08 +02:00
2 changed files with 19 additions and 11 deletions

View File

@ -57,7 +57,8 @@ describe('Responsiveness of Editor', function() {
return inner$('div').text().length > length; return inner$('div').text().length > length;
}).done(function(){ }).done(function(){
expect( inner$('div').text().length ).to.be.greaterThan( length ); // has the text changed? var oldLength = inner$('body')[0].textContent.length;
console.log(oldLength)
var start = Date.now(); // get the start time var start = Date.now(); // get the start time
// send some new text to the screen (ensure all 3 key events are sent) // send some new text to the screen (ensure all 3 key events are sent)
@ -72,17 +73,18 @@ describe('Responsiveness of Editor', function() {
} }
helper.waitFor(function(){ // Wait for the ability to process helper.waitFor(function(){ // Wait for the ability to process
console.log(inner$('body')[0].textContent.length)
var el = inner$('body'); var el = inner$('body');
if(el[0].textContent.length > amount) return true; if(el[0].textContent.length > oldLength) return true;
}).done(function(){ }, 5000).done(function(){
var end = Date.now(); // get the current time var end = Date.now(); // get the current time
var delay = end - start; // get the delay as the current time minus the start time var delay = end - start; // get the delay as the current time minus the start time
expect(delay).to.be.below(600); expect(delay).to.be.below(600);
done(); done();
}, 5000); });
}, 10000); });
}); });
}); });

View File

@ -105,8 +105,9 @@ describe("select formatting buttons when selection has style applied", function(
applyStyleOnLineAndSelectIt(FIRST_LINE, style, done); applyStyleOnLineAndSelectIt(FIRST_LINE, style, done);
}); });
after(function () { after(function (done) {
undo(); undo();
done();
}); });
testIfFormattingButtonIsSelected(style); testIfFormattingButtonIsSelected(style);
@ -118,8 +119,9 @@ describe("select formatting buttons when selection has style applied", function(
applyStyleOnLineAndPlaceCaretOnit(FIRST_LINE, style, done); applyStyleOnLineAndPlaceCaretOnit(FIRST_LINE, style, done);
}); });
after(function () { after(function (done) {
undo(); undo();
done();
}); });
testIfFormattingButtonIsSelected(style) testIfFormattingButtonIsSelected(style)
@ -128,13 +130,15 @@ describe("select formatting buttons when selection has style applied", function(
context('when user applies a style and the selection does not change', function() { context('when user applies a style and the selection does not change', function() {
var style = STYLES[0]; // italic var style = STYLES[0]; // italic
before(function () { before(function (done) {
applyStyleOnLine(style, FIRST_LINE); applyStyleOnLine(style, FIRST_LINE);
done();
}); });
// clean the style applied // clean the style applied
after(function () { after(function (done) {
applyStyleOnLine(style, FIRST_LINE); applyStyleOnLine(style, FIRST_LINE);
done();
}); });
it('selects the style button', function (done) { it('selects the style button', function (done) {
@ -146,15 +150,17 @@ describe("select formatting buttons when selection has style applied", function(
SHORTCUT_KEYS.forEach(function(key, index){ SHORTCUT_KEYS.forEach(function(key, index){
var styleOfTheShortcut = STYLES[index]; // italic, bold, ... var styleOfTheShortcut = STYLES[index]; // italic, bold, ...
context('when user presses CMD + ' + key, function() { context('when user presses CMD + ' + key, function() {
before(function () { before(function (done) {
pressFormattingShortcutOnSelection(key); pressFormattingShortcutOnSelection(key);
done();
}); });
testIfFormattingButtonIsSelected(styleOfTheShortcut); testIfFormattingButtonIsSelected(styleOfTheShortcut);
context('and user presses CMD + ' + key + ' again', function() { context('and user presses CMD + ' + key + ' again', function() {
before(function () { before(function (done) {
pressFormattingShortcutOnSelection(key); pressFormattingShortcutOnSelection(key);
done();
}); });
testIfFormattingButtonIsDeselected(styleOfTheShortcut); testIfFormattingButtonIsDeselected(styleOfTheShortcut);