mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-22 15:26:14 +01:00
69c7033a86
* don't include sendkeys in index.html as it's included in helper.init mocha opts: add default timeout and replace ignoreLeaks with checkLeaks, as the former is deprecated * introduce helper.edit to write to a pad * add test to check if helper.edit() supports line numbers * helper tests: waitFor/waitForPromise seem to be a little bit faster sometimes * tests: refactor chat.js * tests: refactor timeslider_numeric_padID * tests: refactor timeslider_labels * tests: refactor timeslider_follow * ensure followContents is enabled, although it should be by default * timeslider_follow: increase number of revision for Edge * make textLines() depend on linesDiv() Co-authored-by: Richard Hansen <rhansen@rhansen.org> * make linesDiv return standard Array * use `contain` instead of `indexOf` * more fixes from the review * review fixes * align waitFor and waitForPromise behaviour * timeslider_follow: check if it's following to the correct lines * lower expected waitFor/waitForPromise interval check * disable responsivness and regression test in timeslider_follow * timeslider_follow: fix Range detection * more explicit test for linesDiv Co-authored-by: Richard Hansen <rhansen@rhansen.org>
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
describe("delete keystroke", function(){
|
|
//create a new pad before each test run
|
|
beforeEach(function(cb){
|
|
helper.newPad(cb);
|
|
this.timeout(60000);
|
|
});
|
|
|
|
it("makes text delete", function(done) {
|
|
var inner$ = helper.padInner$;
|
|
var chrome$ = helper.padChrome$;
|
|
|
|
//get the first text element out of the inner iframe
|
|
var $firstTextElement = inner$("div").first();
|
|
|
|
// get the original length of this element
|
|
var elementLength = $firstTextElement.text().length;
|
|
|
|
// get the original string value minus the last char
|
|
var originalTextValue = $firstTextElement.text();
|
|
var originalTextValueMinusFirstChar = originalTextValue.substring(1, originalTextValue.length );
|
|
|
|
// simulate key presses to delete content
|
|
$firstTextElement.sendkeys('{leftarrow}'); // simulate a keypress of the left arrow key
|
|
$firstTextElement.sendkeys('{del}'); // simulate a keypress of delete
|
|
|
|
//ace creates a new dom element when you press a keystroke, so just get the first text element again
|
|
var $newFirstTextElement = inner$("div").first();
|
|
|
|
// get the new length of this element
|
|
var newElementLength = $newFirstTextElement.text().length;
|
|
|
|
//expect it to be one char less in length
|
|
expect(newElementLength).to.be((elementLength-1));
|
|
|
|
done();
|
|
});
|
|
});
|