From ad26dd6be39d3879da30a6d79997fff81d25591a Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 6 Dec 2011 10:40:49 +0000 Subject: [PATCH] Test improvements and associated bug fixes --- js/Utils.js | 4 ++-- js/WikiTextParser.js | 2 +- js/WikiTextRules.js | 8 ++++---- wikitest.js | 21 ++++++++++++--------- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/js/Utils.js b/js/Utils.js index 867ce3cba..259af80d8 100755 --- a/js/Utils.js +++ b/js/Utils.js @@ -57,12 +57,12 @@ utils.convertFromYYYYMMDDHHMMSSMMM = function(d) // Convert & to "&", < to "<", > to ">" and " to """ utils.htmlEncode = function(s) { - return s.replace(/&/mg,"&").replace(//mg,">").replace(/\"/mg,"""); + return s.toString().replace(/&/mg,"&").replace(//mg,">").replace(/\"/mg,"""); }; // Convert "&" to &, "<" to <, ">" to > and """ to " utils.htmlDecode = function(s) { - return s.replace(/</mg,"<").replace(/>/mg,">").replace(/"/mg,"\"").replace(/&/mg,"&"); + return s.toString().replace(/</mg,"<").replace(/>/mg,">").replace(/"/mg,"\"").replace(/&/mg,"&"); }; diff --git a/js/WikiTextParser.js b/js/WikiTextParser.js index 13f244d53..c0c4bc1a5 100644 --- a/js/WikiTextParser.js +++ b/js/WikiTextParser.js @@ -75,7 +75,7 @@ WikiTextParser.prototype.renderAsHtml = function(store,title) { for(var t=0; t>\n' }, { title: 'ThirdTiddler', @@ -44,14 +44,17 @@ wikiTest({ tiddlers: [ { tiddler: 'FirstTiddler', output: [ { type: 'text', value: 'This is the ' }, - { type: 'strong', - children: [ { type: 'text', value: 'text' } ] }, - { type: 'text', - value: ' of the first tiddler, with a link to the ' }, - { type: 'a', - children: [ { type: 'text', value: 'SecondTiddler' } ], - attributes: {href: 'SecondTiddler', className: 'tiddlyLink' } }, - { type: 'text', value: ', too.' } ] }, + { type: 'strong', + children: [ { type: 'text', value: 'text' } ] }, + { type: 'text', value: ' of the first tiddler, with a ' }, + { type: 'span', + children: [ { type: 'text', value: 'link' } ], + attributes: { style: { 'font-size': '8em', color: 'red' } } }, + { type: 'text', value: ' to the ' }, + { type: 'a', + children: [ { type: 'text', value: 'SecondTiddler' } ], + attributes: { href: 'SecondTiddler', className: 'tiddlyLink' } }, + { type: 'text', value: ', too.' } ] }, { tiddler: 'SecondTiddler', output: [ { type: 'h2',