1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-04 17:16:18 +00:00
TiddlyWiki5/editions/tw2/source/tiddlywiki/test/js/Options.js
2012-11-16 21:20:27 +00:00

29 lines
835 B
JavaScript
Executable File

jQuery(document).ready(function(){
var numSaves, _autoSaveChanges;
module("TiddlyWiki options", {
setup: function() {
config.options.chkAutoSave = true;
systemSettingSave = 0;
_autoSaveChanges = autoSaveChanges;
numSaves = 0;
autoSaveChanges = function() {
numSaves += 1;
return _autoSaveChanges.apply(this, arguments);
}
},
teardown: function() {
numSaves = null;
config.options.chkAutoSave = false;
autoSaveChanges = _autoSaveChanges;
}
});
test("save multiple system settings", function() {
saveSystemSetting("foo", true);
saveSystemSetting("foo", false);
saveSystemSetting("foo", true);
strictEqual(numSaves, 0, "The save is asynchronous so no saves have yet been made");
strictEqual(systemSettingSave > 0, true, "However there should be a timeout in progress");
});
});