From fa7669bcd5606d30ad38e5eb3f26d7b2b2b2718b Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 6 Dec 2011 17:26:29 +0000 Subject: [PATCH] Improved wikification test rig Now it checks the HTML and plain text representations too. --- wikitest.js | 114 +++++++++++++++++++++++++++++----------------------- 1 file changed, 64 insertions(+), 50 deletions(-) diff --git a/wikitest.js b/wikitest.js index 894d01589..0dd7c4fd6 100644 --- a/wikitest.js +++ b/wikitest.js @@ -9,29 +9,32 @@ var Tiddler = require("./js/Tiddler.js").Tiddler, util = require("util"); var wikiTest = function(spec) { +// console.error(util.inspect(spec,false,99)); var t, store = new TiddlyWiki(), w; for(t=0; ttext of the first tiddler, with a link to the SecondTiddler, too.', + plain: 'This is the text of the first tiddler, with a link to the SecondTiddler, too.' } }, { tiddler: 'SecondTiddler', output: - [ { type: 'h2', - children: [ { type: 'text', value: 'Heading' } ] }, - { type: 'text', - value: 'This is the second tiddler. It has a list:' }, - { type: 'br' }, - { type: 'ul', - children: - [ { type: 'li', - children: [ { type: 'text', value: ' Item one' } ] }, - { type: 'li', - children: [ { type: 'text', value: ' Item two' } ] }, - { type: 'li', - children: [ { type: 'text', value: ' Item three' } ] } ] }, - { type: 'text', value: 'And a ' }, - { type: 'macro', name: 'macro', params: 'invocation' }, - { type: 'br' } ] }, + { tree: + [ { type: 'h2', children: [ { type: 'text', value: 'Heading' } ] }, + { type: 'text', + value: 'This is the second tiddler. It has a list:' }, + { type: 'br' }, + { type: 'ul', + children: + [ { type: 'li', + children: [ { type: 'text', value: ' Item one' } ] }, + { type: 'li', + children: [ { type: 'text', value: ' Item two' } ] }, + { type: 'li', + children: [ { type: 'text', value: ' Item three' } ] } ] }, + { type: 'text', value: 'And a ' }, + { type: 'macro', name: 'macro', params: 'invocation' }, + { type: 'br' } ], + html: '

Heading

This is the second tiddler. It has a list:
And a
', + plain: 'HeadingThis is the second tiddler. It has a list: Item one Item two Item threeAnd a ' } }, { tiddler: 'ThirdTiddler', output: - [ { type: 'text', value: 'An explicit link ' }, - { type: 'a', - children: [ { type: 'text', value: 'Fourth Tiddler' } ], - attributes: { href: 'Fourth Tiddler', className: 'tiddlyLink' } }, - { type: 'text', value: ' and ' }, - { type: 'a', - children: [ { type: 'text', value: 'a pretty link' } ], - attributes: { href: 'Fourth Tiddler', className: 'tiddlyLink' } } ] }, + { tree: + [ { type: 'text', value: 'An explicit link ' }, + { type: 'a', + children: [ { type: 'text', value: 'Fourth Tiddler' } ], + attributes: { href: 'Fourth Tiddler', className: 'tiddlyLink' } }, + { type: 'text', value: ' and ' }, + { type: 'a', + children: [ { type: 'text', value: 'a pretty link' } ], + attributes: { href: 'Fourth Tiddler', className: 'tiddlyLink' } } ], + html: 'An explicit link Fourth Tiddler and a pretty link', + plain: 'An explicit link Fourth Tiddler and a pretty link' } }, { tiddler: 'Fourth Tiddler', output: - [ { type: 'text', value: 'An image ' }, - { type: 'img', attributes: {src: 'Something.jpg' } } ] } ] } + { tree: + [ { type: 'text', value: 'An image ' }, + { type: 'img', attributes: { src: 'Something.jpg' } } ], + html: 'An image ', + plain: 'An image ' } } ] } );