mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-05-03 16:27:24 +00:00
The big purge of the old widget mechanism
Getting rid of the old widget mechanism files finally gives us a payoff for all the refactoring. Still a bit of tidying up to do, and we need to re-introduce the animation mechanisms.
This commit is contained in:
@@ -19,7 +19,7 @@ describe("WikiText parser tests", function() {
|
||||
|
||||
// Define a parsing shortcut
|
||||
var parse = function(text) {
|
||||
return wiki.parseText("text/vnd.tiddlywiki",text).tree;
|
||||
return wiki.new_parseText("text/vnd.tiddlywiki",text).tree;
|
||||
};
|
||||
|
||||
it("should parse tags", function() {
|
||||
@@ -70,7 +70,7 @@ describe("WikiText parser tests", function() {
|
||||
);
|
||||
expect(parse("<$reveal state='$:/temp/search' type='nomatch' text=''>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', children : [ { type : 'element', start : 0, attributes : { state : { start : 8, name : 'state', type : 'string', value : '$:/temp/search', end : 31 }, type : { start : 31, name : 'type', type : 'string', value : 'nomatch', end : 46 }, text : { start : 46, name : 'text', type : 'string', value : '', end : 54 } }, tag : '$reveal', end : 55, children : [ ], isBlock : false } ] } ]
|
||||
[ { type : 'element', tag : 'p', children : [ { type : 'reveal', start : 0, attributes : { state : { start : 8, name : 'state', type : 'string', value : '$:/temp/search', end : 31 }, type : { start : 31, name : 'type', type : 'string', value : 'nomatch', end : 46 }, text : { start : 46, name : 'text', type : 'string', value : '', end : 54 } }, end : 55, isBlock : false, children : [ ] } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div attribute={{TiddlerTitle!!field}}>some text</div>")).toEqual(
|
||||
@@ -93,7 +93,7 @@ describe("WikiText parser tests", function() {
|
||||
it("should parse macro definitions", function() {
|
||||
expect(parse("\\define myMacro()\nnothing\n\\end\n")).toEqual(
|
||||
|
||||
[ { type : 'macrodef', name : 'myMacro', params : [ ], text : 'nothing' } ]
|
||||
[ { type : 'setvariable', name : 'myMacro', params : [ ], text : 'nothing', attributes : { name : { type : 'string', value : 'myMacro' }, value : { type : 'string', value : 'nothing' } }, children : [ ] } ]
|
||||
|
||||
);
|
||||
|
||||
|
||||
@@ -23,30 +23,29 @@ describe("WikiText tests", function() {
|
||||
wiki.addTiddler({title: "TiddlerFour", text: "\\define my-macro(adjective:'groovy')\nThis is my ''amazingly'' $adjective$ macro!\n\\end\n\n<$link to=<<my-macro>>>This is a link</$link>"});
|
||||
|
||||
it("should render tiddlers with no special markup as-is", function() {
|
||||
expect(wiki.renderTiddler("text/plain","TiddlerOne")).toBe("The quick brown fox");
|
||||
expect(wiki.new_renderTiddler("text/plain","TiddlerOne")).toBe("The quick brown fox");
|
||||
});
|
||||
it("should preserve single new lines", function() {
|
||||
expect(wiki.renderTiddler("text/plain","TiddlerTwo")).toBe("The rain in Spain\nfalls mainly on the plain");
|
||||
expect(wiki.new_renderTiddler("text/plain","TiddlerTwo")).toBe("The rain in Spain\nfalls mainly on the plain");
|
||||
});
|
||||
it("should use double new lines to create paragraphs", function() {
|
||||
// The paragraphs are lost in the conversion to plain text
|
||||
expect(wiki.renderTiddler("text/plain","TiddlerThree")).toBe("The speed of soundThe light of speed");
|
||||
expect(wiki.new_renderTiddler("text/plain","TiddlerThree")).toBe("The speed of soundThe light of speed");
|
||||
});
|
||||
|
||||
it("should render plain text tiddlers as a paragraph", function() {
|
||||
expect(wiki.renderTiddler("text/html","TiddlerOne")).toBe("<p>\nThe quick brown fox</p>");
|
||||
expect(wiki.new_renderTiddler("text/html","TiddlerOne")).toBe("<p>\nThe quick brown fox</p>");
|
||||
});
|
||||
it("should preserve single new lines", function() {
|
||||
expect(wiki.renderTiddler("text/html","TiddlerTwo")).toBe("<p>\nThe rain in Spain\nfalls mainly on the plain</p>");
|
||||
expect(wiki.new_renderTiddler("text/html","TiddlerTwo")).toBe("<p>\nThe rain in Spain\nfalls mainly on the plain</p>");
|
||||
});
|
||||
it("should use double new lines to create paragraphs", function() {
|
||||
expect(wiki.renderTiddler("text/html","TiddlerThree")).toBe("<p>\nThe speed of sound</p><p>\nThe light of speed</p>");
|
||||
expect(wiki.new_renderTiddler("text/html","TiddlerThree")).toBe("<p>\nThe speed of sound</p><p>\nThe light of speed</p>");
|
||||
});
|
||||
it("should support attributes specified as macro invocations", function() {
|
||||
expect(wiki.renderTiddler("text/html","TiddlerFour")).toBe("<p>\n<a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing' href='#This%20is%20my%20amazingly%20groovy%20macro!'>\nThis is a link</a></p>");
|
||||
expect(wiki.new_renderTiddler("text/html","TiddlerFour")).toBe("<p>\n<a class=' tw-tiddlylink tw-tiddlylink-missing' href='#This%20is%20my%20amazingly%20groovy%20macro!'>\nThis is a link</a></p>");
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user