bugfix: Allow selection to start/end before line marker

This commit is contained in:
John McLear 2021-09-24 16:46:53 +01:00 committed by Richard Hansen
parent 37a33042d2
commit c361df52d2
2 changed files with 29 additions and 5 deletions

View file

@ -1,9 +1,11 @@
'use strict';
describe('clear authorship colors button', function () {
let padId;
// create a new pad before each test run
beforeEach(async function () {
await helper.aNewPad();
padId = await helper.aNewPad();
});
it('makes text clear authorship colors', async function () {
@ -98,4 +100,26 @@ describe('clear authorship colors button', function () {
await helper.waitForPromise(
() => chrome$('div.disconnected').attr('class').indexOf('visible') === -1);
});
// Test for https://github.com/ether/etherpad-lite/issues/5128
it('clears authorship when first line has line attributes', async function () {
// override the confirm dialogue function
helper.padChrome$.window.confirm = () => true;
// Make sure there is text with author info. The first line must have a line attribute.
await helper.clearPad();
await helper.edit('Hello');
helper.padChrome$('.buttonicon-insertunorderedlist').click();
await helper.waitForPromise(() => helper.padInner$('[class*="author-"]').length > 0);
const nCommits = helper.commits.length;
helper.padChrome$('.buttonicon-clearauthorship').click();
await helper.waitForPromise(() => helper.padInner$('[class*="author-"]').length === 0);
// Make sure the change was actually accepted by reloading the pad and looking for authorship.
// Before the pad can be reloaded the server might need some time to accept the change.
await helper.waitForPromise(() => helper.commits.length > nCommits);
await helper.aNewPad({id: padId});
expect(helper.padInner$('[class*="author-"]').length).to.be(0);
});
});