diff --git a/editions/test/tiddlers/tests/test-wikitext.js b/editions/test/tiddlers/tests/test-wikitext.js new file mode 100644 index 000000000..accfbfab1 --- /dev/null +++ b/editions/test/tiddlers/tests/test-wikitext.js @@ -0,0 +1,38 @@ +/*\ +title: test-wikitext.js +type: application/javascript +tags: [[$:/tags/test-spec]] + +Tests the wikitext rendering pipeline end-to-end. We also need tests that individually test parsers, rendertreenodes etc., but this gets us started. + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +describe("WikiText tests", function() { + + // Create a wiki + var wiki = new $tw.Wiki(); + // Add a couple of tiddlers + wiki.addTiddler({title: "TiddlerOne", text: "The quick brown fox"}); + wiki.addTiddler({title: "TiddlerTwo", text: "The rain in Spain\nfalls mainly on the plain"}); + wiki.addTiddler({title: "TiddlerThree", text: "The speed of sound\n\nThe light of speed"}); + + it("should render tiddlers in plain text", function() { + expect(wiki.renderTiddler("text/plain","TiddlerOne")).toBe("The quick brown fox"); + expect(wiki.renderTiddler("text/plain","TiddlerTwo")).toBe("The rain in Spain\nfalls mainly on the plain"); + expect(wiki.renderTiddler("text/plain","TiddlerThree")).toBe("The speed of soundThe light of speed"); + }); + + it("should render tiddlers in HTML", function() { + expect(wiki.renderTiddler("text/html","TiddlerOne")).toBe("

\nThe quick brown fox

"); + expect(wiki.renderTiddler("text/html","TiddlerTwo")).toBe("

\nThe rain in Spain\nfalls mainly on the plain

"); + expect(wiki.renderTiddler("text/html","TiddlerThree")).toBe("

\nThe speed of sound

\nThe light of speed

"); + }); + +}); + +})(); diff --git a/editions/test/tiddlers/tests/test.js b/editions/test/tiddlers/tests/test.js deleted file mode 100644 index 8ef552e37..000000000 --- a/editions/test/tiddlers/tests/test.js +++ /dev/null @@ -1,21 +0,0 @@ -/*\ -title: test.js -type: application/javascript -tags: [[$:/tags/test-spec]] - -An example test specification - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -describe("WikiParser tests", function() { - it("contains spec with an expectation", function() { - expect(true).toBe(true); - }); -}); - -})();