mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 22:23:33 +01:00
915849b319
* lint: low hanging specs/alphabet.js * lint: low hanging specs/authorship_of_editions.js * lint: low hanging specs/bold.js * lint: low hanging specs/caret.js * lint: low hanging specs/change_user_color.js * lint: low hanging specs/change_user_name.js * lint: low hanging specs/chat.js * lint: low hanging specs/chat_load_messages.js * lint: low hanging specs/clear_authorship_colors.js * lint: low hanging specs/delete.js * lint: low hanging specs/drag_and_drop.js * lint: low hanging specs/embed_value.js * lint: low hanging specs/enter.js * lint: low hanging specs/font_type.js * lint: low hanging specs/helper.js * lint: low hanging specs/importexport.js * lint: low hanging specs/importindents.js * lint: low hanging specs/indentation.js * lint: low hanging specs/italic.js * lint: low hanging specs/language.js * lint: low hanging specs/multiple_authors_clear_authorship_colors.js * lint: low hanging specs/ordered_list.js * lint: low hanging specs/pad_modal.js * lint: low hanging specs/redo.js * lint: low hanging specs/responsiveness.js * lint: low hanging specs/select_formatting_buttons.js * lint: low hanging specs/strikethrough.js * lint: low hanging specs/timeslider.js * lint: low hanging specs/timeslider_labels.js * lint: low hanging specs/timeslider_numeric_padID.js * lint: low hanging specs/timeslider_revisions.js * lint: low hanging specs/undo.js * lint: low hanging specs/unordered_list.js * lint: low hanging specs/xxauto_reconnect.js * lint: attempt to do remote_runner.js * lint: helper linting * lint: rate limit linting * use constructor for Event to make eslint happier * for squash: lint fix refinements * for squash: lint fix refinements Co-authored-by: Richard Hansen <rhansen@rhansen.org>
64 lines
2.3 KiB
JavaScript
64 lines
2.3 KiB
JavaScript
'use strict';
|
|
|
|
describe('undo button then redo button', function () {
|
|
beforeEach(function (cb) {
|
|
helper.newPad(cb); // creates a new pad
|
|
this.timeout(60000);
|
|
});
|
|
|
|
it('redo some typing with button', function (done) {
|
|
const inner$ = helper.padInner$;
|
|
const chrome$ = helper.padChrome$;
|
|
|
|
// get the first text element inside the editable space
|
|
const $firstTextElement = inner$('div span').first();
|
|
const originalValue = $firstTextElement.text(); // get the original value
|
|
const newString = 'Foo';
|
|
|
|
$firstTextElement.sendkeys(newString); // send line 1 to the pad
|
|
const modifiedValue = $firstTextElement.text(); // get the modified value
|
|
expect(modifiedValue).not.to.be(originalValue); // expect the value to change
|
|
|
|
// get undo and redo buttons
|
|
const $undoButton = chrome$('.buttonicon-undo');
|
|
const $redoButton = chrome$('.buttonicon-redo');
|
|
// click the buttons
|
|
$undoButton.click(); // removes foo
|
|
$redoButton.click(); // resends foo
|
|
|
|
helper.waitFor(() => inner$('div span').first().text() === newString).done(() => {
|
|
const finalValue = inner$('div').first().text();
|
|
expect(finalValue).to.be(modifiedValue); // expect the value to change
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('redo some typing with keypress', function (done) {
|
|
const inner$ = helper.padInner$;
|
|
|
|
// get the first text element inside the editable space
|
|
const $firstTextElement = inner$('div span').first();
|
|
const originalValue = $firstTextElement.text(); // get the original value
|
|
const newString = 'Foo';
|
|
|
|
$firstTextElement.sendkeys(newString); // send line 1 to the pad
|
|
const modifiedValue = $firstTextElement.text(); // get the modified value
|
|
expect(modifiedValue).not.to.be(originalValue); // expect the value to change
|
|
|
|
let e = inner$.Event(helper.evtType);
|
|
e.ctrlKey = true; // Control key
|
|
e.which = 90; // z
|
|
inner$('#innerdocbody').trigger(e);
|
|
|
|
e = inner$.Event(helper.evtType);
|
|
e.ctrlKey = true; // Control key
|
|
e.which = 121; // y
|
|
inner$('#innerdocbody').trigger(e);
|
|
|
|
helper.waitFor(() => inner$('div span').first().text() === newString).done(() => {
|
|
const finalValue = inner$('div').first().text();
|
|
expect(finalValue).to.be(modifiedValue); // expect the value to change
|
|
done();
|
|
});
|
|
});
|
|
});
|