2021-02-01 20:23:14 +00:00
|
|
|
'use strict';
|
|
|
|
|
2020-11-23 13:21:51 -05:00
|
|
|
describe('delete keystroke', function () {
|
|
|
|
// create a new pad before each test run
|
2021-03-31 21:14:02 -04:00
|
|
|
beforeEach(async function () {
|
|
|
|
await helper.aNewPad();
|
2012-10-03 20:57:04 +01:00
|
|
|
});
|
|
|
|
|
2021-03-31 21:14:02 -04:00
|
|
|
it('makes text delete', async function () {
|
2020-11-23 13:21:51 -05:00
|
|
|
const inner$ = helper.padInner$;
|
2020-03-24 01:04:24 +01:00
|
|
|
|
2020-11-23 13:21:51 -05:00
|
|
|
// get the first text element out of the inner iframe
|
|
|
|
const $firstTextElement = inner$('div').first();
|
2020-03-24 01:04:24 +01:00
|
|
|
|
2012-10-03 20:57:04 +01:00
|
|
|
// get the original length of this element
|
2020-11-23 13:21:51 -05:00
|
|
|
const elementLength = $firstTextElement.text().length;
|
2012-10-03 20:57:04 +01:00
|
|
|
|
2012-10-03 21:25:31 +01:00
|
|
|
// simulate key presses to delete content
|
2012-10-06 23:38:49 +02:00
|
|
|
$firstTextElement.sendkeys('{leftarrow}'); // simulate a keypress of the left arrow key
|
|
|
|
$firstTextElement.sendkeys('{del}'); // simulate a keypress of delete
|
2012-10-03 20:57:04 +01:00
|
|
|
|
2020-11-23 13:21:51 -05:00
|
|
|
const $newFirstTextElement = inner$('div').first();
|
2020-03-24 01:04:24 +01:00
|
|
|
|
2012-10-03 20:57:04 +01:00
|
|
|
// get the new length of this element
|
2020-11-23 13:21:51 -05:00
|
|
|
const newElementLength = $newFirstTextElement.text().length;
|
2012-10-03 20:57:04 +01:00
|
|
|
|
2020-11-23 13:21:51 -05:00
|
|
|
// expect it to be one char less in length
|
|
|
|
expect(newElementLength).to.be((elementLength - 1));
|
2012-10-03 20:57:04 +01:00
|
|
|
});
|
|
|
|
});
|