mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-28 11:26:16 -04:00
first version after migration to mocha
This commit is contained in:
parent
876d7db39a
commit
5becf0bd15
13 changed files with 1222 additions and 1613 deletions
54
tests/backend/specs/easysync/testAppendATextToAssembler.js
Normal file
54
tests/backend/specs/easysync/testAppendATextToAssembler.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
|
||||
var Changeset = require("ep_etherpad-lite/static/js/Changeset");
|
||||
var AttributePool = require("ep_etherpad-lite/static/js/AttributePool");
|
||||
var helper = require("./helper.js")
|
||||
var assertEqualStrings = helper.assertEqualStrings;
|
||||
var assertEqualArrays = helper.assertEqualArrays;
|
||||
|
||||
describe("testAppendATextToAssembler",function(){
|
||||
it("testAppendATextToAssembler",function(done){
|
||||
|
||||
testAppendATextToAssembler(1, {
|
||||
text: "\n",
|
||||
attribs: "|1+1"
|
||||
}, "");
|
||||
testAppendATextToAssembler(2, {
|
||||
text: "\n\n",
|
||||
attribs: "|2+2"
|
||||
}, "|1+1");
|
||||
testAppendATextToAssembler(3, {
|
||||
text: "\n\n",
|
||||
attribs: "*x|2+2"
|
||||
}, "*x|1+1");
|
||||
testAppendATextToAssembler(4, {
|
||||
text: "\n\n",
|
||||
attribs: "*x|1+1|1+1"
|
||||
}, "*x|1+1");
|
||||
testAppendATextToAssembler(5, {
|
||||
text: "foo\n",
|
||||
attribs: "|1+4"
|
||||
}, "+3");
|
||||
testAppendATextToAssembler(6, {
|
||||
text: "\nfoo\n",
|
||||
attribs: "|2+5"
|
||||
}, "|1+1+3");
|
||||
testAppendATextToAssembler(7, {
|
||||
text: "\nfoo\n",
|
||||
attribs: "*x|2+5"
|
||||
}, "*x|1+1*x+3");
|
||||
testAppendATextToAssembler(8, {
|
||||
text: "\n\n\nfoo\n",
|
||||
attribs: "|2+2*x|2+5"
|
||||
}, "|2+2*x|1+1*x+3");
|
||||
|
||||
done();
|
||||
})
|
||||
|
||||
})
|
||||
function testAppendATextToAssembler(testId, atext, correctOps) {
|
||||
|
||||
var assem = Changeset.smartOpAssembler();
|
||||
Changeset.appendATextToAssembler(atext, assem);
|
||||
assertEqualStrings(correctOps, assem.toString());
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue