mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 08:56:17 -04:00
Changeset: Migrate from OpIter
to deserializeOps()
This commit is contained in:
parent
0eca0251f2
commit
89fe40e080
16 changed files with 147 additions and 179 deletions
|
@ -31,17 +31,15 @@ const randInt = (maxValue) => Math.floor(Math.random() * maxValue);
|
|||
describe('easysync', function () {
|
||||
it('throughIterator', async function () {
|
||||
const x = '-c*3*4+6|3=az*asdf0*1*2*3+1=1-1+1*0+1=1-1+1|c=c-1';
|
||||
const iter = Changeset.opIterator(x);
|
||||
const assem = Changeset.opAssembler();
|
||||
while (iter.hasNext()) assem.append(iter.next());
|
||||
for (const op of Changeset.deserializeOps(x)) assem.append(op);
|
||||
expect(assem.toString()).to.equal(x);
|
||||
});
|
||||
|
||||
it('throughSmartAssembler', async function () {
|
||||
const x = '-c*3*4+6|3=az*asdf0*1*2*3+1=1-1+1*0+1=1-1+1|c=c-1';
|
||||
const iter = Changeset.opIterator(x);
|
||||
const assem = Changeset.smartOpAssembler();
|
||||
while (iter.hasNext()) assem.append(iter.next());
|
||||
for (const op of Changeset.deserializeOps(x)) assem.append(op);
|
||||
assem.endDocument();
|
||||
expect(assem.toString()).to.equal(x);
|
||||
});
|
||||
|
@ -730,7 +728,7 @@ describe('easysync', function () {
|
|||
p.putAttrib(['name', 'david']);
|
||||
p.putAttrib(['color', 'green']);
|
||||
|
||||
const stringOp = (str) => Changeset.opIterator(str).next();
|
||||
const stringOp = (str) => Changeset.deserializeOps(str).next().value;
|
||||
|
||||
expect(Changeset.opAttributeValue(stringOp('*0*1+1'), 'name', p)).to.equal('david');
|
||||
expect(Changeset.opAttributeValue(stringOp('*0+1'), 'name', p)).to.equal('david');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue