1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-28 19:10:28 +00:00
TiddlyWiki5/tw2/source/tiddlywiki/test/js/TW21Saver.js
Jeremy Ruston a1c8ac624f Added first pass at support for building TiddlyWiki 2.6.x with TW5
There are still some whitespace and attribute ordering issues, but the
result runs correctly.
2012-05-29 22:02:38 +01:00

52 lines
1.6 KiB
JavaScript
Executable File

jQuery(document).ready(function(){
module("TW21Saver");
test("Saving tests", function() {
var store = new TiddlyWiki();
var saver = store.getSaver();
var tiddler = new Tiddler("test");
tiddler.text = "";
tiddler.created = version.date;
tiddler.modified = tiddler.created;
var actual = saver.externalizeTiddler(store,tiddler);
var expected = "<div title=\"test\">\n<pre></pre>\n</div>";
ok(actual==expected,'Saving empty tiddler with no dates');
delete tiddler;
tiddler = new Tiddler("test");
tiddler.text = "";
tiddler.created = new Date(Date.UTC(2008,3,16,12,34));
tiddler.modified = tiddler.created;
actual = saver.externalizeTiddler(store,tiddler);
expected = "<div title=\"test\" created=\"200804161234\">\n<pre></pre>\n</div>";
ok(actual==expected,'Saving empty tiddler with created date');
delete tiddler;
tiddler = new Tiddler("test");
tiddler.text = "";
tiddler.created = new Date(Date.UTC(2008,3,16,12,34));
tiddler.modified = new Date(Date.UTC(2008,3,17,12,34));
actual = saver.externalizeTiddler(store,tiddler);
expected = "<div title=\"test\" created=\"200804161234\" modified=\"200804171234\">\n<pre></pre>\n</div>";
ok(actual==expected,'Saving empty tiddler with created and modified dates');
delete tiddler;
tiddler = new Tiddler("test");
tiddler.text = "text";
tiddler.created = version.date;
tiddler.modified = tiddler.created;
actual = saver.externalizeTiddler(store,tiddler);
expected = "<div title=\"test\">\n<pre>text</pre>\n</div>";
ok(actual==expected,'Saving tiddler with text');
});
});