mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
Changeset: Turn textLinesMutator()
into a real class
This commit is contained in:
parent
dab881139d
commit
fba0bb6dff
2 changed files with 143 additions and 163 deletions
|
@ -92,7 +92,7 @@ describe('easysync', function () {
|
|||
const runMutationTest = (testId, origLines, muts, correct) => {
|
||||
it(`runMutationTest#${testId}`, async function () {
|
||||
let lines = origLines.slice();
|
||||
const mu = Changeset.exportedForTestingOnly.textLinesMutator(lines);
|
||||
const mu = new Changeset.exportedForTestingOnly.TextLinesMutator(lines);
|
||||
applyMutations(mu, muts);
|
||||
mu.close();
|
||||
expect(lines).to.eql(correct);
|
||||
|
@ -211,7 +211,7 @@ describe('easysync', function () {
|
|||
const lines = ['1\n', '2\n', '3\n', '4\n'];
|
||||
let mu;
|
||||
|
||||
mu = Changeset.exportedForTestingOnly.textLinesMutator(lines);
|
||||
mu = new Changeset.exportedForTestingOnly.TextLinesMutator(lines);
|
||||
expect(mu.hasMore()).to.be(true);
|
||||
mu.skip(8, 4);
|
||||
expect(mu.hasMore()).to.be(false);
|
||||
|
@ -219,7 +219,7 @@ describe('easysync', function () {
|
|||
expect(mu.hasMore()).to.be(false);
|
||||
|
||||
// still 1,2,3,4
|
||||
mu = Changeset.exportedForTestingOnly.textLinesMutator(lines);
|
||||
mu = new Changeset.exportedForTestingOnly.TextLinesMutator(lines);
|
||||
expect(mu.hasMore()).to.be(true);
|
||||
mu.remove(2, 1);
|
||||
expect(mu.hasMore()).to.be(true);
|
||||
|
@ -235,7 +235,7 @@ describe('easysync', function () {
|
|||
expect(mu.hasMore()).to.be(false);
|
||||
|
||||
// 2,3,4,5 now
|
||||
mu = Changeset.exportedForTestingOnly.textLinesMutator(lines);
|
||||
mu = new Changeset.exportedForTestingOnly.TextLinesMutator(lines);
|
||||
expect(mu.hasMore()).to.be(true);
|
||||
mu.remove(6, 3);
|
||||
expect(mu.hasMore()).to.be(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue