mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2026-04-27 15:50:53 -07:00
* remove blks first try * dprint.json seems to be OK, some forgotten functions * add some more space-after-keyword settings * server remove blks * add **/files to dprint exclude * dprint.js fixes a typo * add boot.js and bootprefix.js to dprint exclude * dprint change dprint.json * add dprint fmt as script * remove jslint comments * fix whitespace * fix whitespace * remove function-wrapper from geospatial plugin * fix whitespace * add function wrapper to dyannotate-startup * remove dpring.json
133 lines
2.7 KiB
JavaScript
133 lines
2.7 KiB
JavaScript
/*\
|
|
title: test-tiddlers.js
|
|
type: application/javascript
|
|
tags: [[$:/tags/test-spec]]
|
|
|
|
Tests the tiddler object
|
|
|
|
\*/
|
|
|
|
"use strict";
|
|
|
|
describe("Tiddler tests", function() {
|
|
|
|
function compareTiddlers(fieldsA,fieldsB,excludeFields) {
|
|
var tiddlerA = new $tw.Tiddler(fieldsA),
|
|
tiddlerB = new $tw.Tiddler(fieldsB);
|
|
return tiddlerA.isEqual(tiddlerB,excludeFields);
|
|
}
|
|
|
|
// Our tests
|
|
|
|
it("should compare identical tiddlers", function() {
|
|
expect(compareTiddlers({
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
},{
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
})).toEqual(true);
|
|
});
|
|
|
|
it("should compare different tiddlers", function() {
|
|
expect(compareTiddlers({
|
|
title: "HelloThere2",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
},{
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
})).toEqual(false);
|
|
expect(compareTiddlers({
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","three"]
|
|
},{
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
})).toEqual(false);
|
|
expect(compareTiddlers({
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"],
|
|
caption: "Test"
|
|
},{
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
})).toEqual(false);
|
|
expect(compareTiddlers({
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
},{
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"],
|
|
caption: "Test"
|
|
})).toEqual(false);
|
|
expect(compareTiddlers({
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
},{
|
|
title: "HelloThere",
|
|
text: "one"
|
|
})).toEqual(false);
|
|
});
|
|
|
|
it("should compare different tiddlers with exclusions", function() {
|
|
expect(compareTiddlers({
|
|
title: "HelloThere2",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
},{
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
},["title"])).toEqual(true);
|
|
expect(compareTiddlers({
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","three"]
|
|
},{
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
},["tags"])).toEqual(true);
|
|
expect(compareTiddlers({
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"],
|
|
caption: "Test"
|
|
},{
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
},["caption"])).toEqual(true);
|
|
expect(compareTiddlers({
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
},{
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"],
|
|
caption: "Test"
|
|
},["caption"])).toEqual(true);
|
|
expect(compareTiddlers({
|
|
title: "HelloThere",
|
|
text: "one",
|
|
tags: ["one","two","three"]
|
|
},{
|
|
title: "HelloThere",
|
|
text: "one"
|
|
},["tags"])).toEqual(true);
|
|
});
|
|
|
|
});
|
|
|