mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-04-27 23:34:49 +00:00
Move the editions into a subfolder
This commit is contained in:
BIN
editions/tw2/source/tiddlywiki/jquery/plugins/test/TiddlySaver.jar
Executable file
BIN
editions/tw2/source/tiddlywiki/jquery/plugins/test/TiddlySaver.jar
Executable file
Binary file not shown.
25
editions/tw2/source/tiddlywiki/jquery/plugins/test/jQuery.twFile.html
Executable file
25
editions/tw2/source/tiddlywiki/jquery/plugins/test/jQuery.twFile.html
Executable file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Tests</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../../test/qunit/testsuite.css">
|
||||
<script src="../../jquery-1.3.2.min.js" type="text/javascript"></script>
|
||||
<!-- test suite -->
|
||||
<script src="../../../test/qunit/testrunner.js" type="text/javascript"></script>
|
||||
<script src="../../../test/qunit/raiseAssertion.js" type="text/javascript"></script>
|
||||
<!-- plugin -->
|
||||
<script src="../jQuery.twFile.js" type="text/javascript"></script>
|
||||
<!-- test code -->
|
||||
<script src="js/jQuery.twFile.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2 id="banner"></h2>
|
||||
<h2 id="userAgent"></h2>
|
||||
<ol id="tests"></ol>
|
||||
<div id="main"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
25
editions/tw2/source/tiddlywiki/jquery/plugins/test/jQuery.twStylesheet.html
Executable file
25
editions/tw2/source/tiddlywiki/jquery/plugins/test/jQuery.twStylesheet.html
Executable file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Tests</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../../test/qunit/testsuite.css">
|
||||
<script src="../../jquery-1.3.2.min.js" type="text/javascript"></script>
|
||||
<!-- test suite -->
|
||||
<script src="../../../test/qunit/testrunner.js" type="text/javascript"></script>
|
||||
<script src="../../../test/qunit/raiseAssertion.js" type="text/javascript"></script>
|
||||
<!-- plugin -->
|
||||
<script src="../jQuery.twStylesheet.js" type="text/javascript"></script>
|
||||
<!-- test code -->
|
||||
<script src="js/jQuery.twStylesheet.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2 id="banner"></h2>
|
||||
<h2 id="userAgent"></h2>
|
||||
<ol id="tests"></ol>
|
||||
<div id="main"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
86
editions/tw2/source/tiddlywiki/jquery/plugins/test/js/jQuery.twFile.js
Executable file
86
editions/tw2/source/tiddlywiki/jquery/plugins/test/js/jQuery.twFile.js
Executable file
@@ -0,0 +1,86 @@
|
||||
jQuery(document).ready(function() {
|
||||
module("jQuery.twFile");
|
||||
|
||||
test("load", function() {
|
||||
var actual, expected, filepath;
|
||||
|
||||
actual = jQuery.twFile.load();
|
||||
expected = null;
|
||||
same(actual, expected, "returns null if no argument is specified");
|
||||
|
||||
filepath = getDocumentPath() + "/sample.txt";
|
||||
actual = jQuery.twFile.load(filepath);
|
||||
expected = "lorem ipsum\n" +
|
||||
"dolor sit amet\n" +
|
||||
"\n" +
|
||||
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n" +
|
||||
"foo bar baz\n";
|
||||
same(actual, expected, "returns contents of specified file");
|
||||
|
||||
filepath = "/null";
|
||||
actual = jQuery.twFile.load(filepath);
|
||||
expected = null;
|
||||
same(actual, expected, "returns null if the specified file does not exist");
|
||||
|
||||
filepath = "sample.txt";
|
||||
actual = jQuery.twFile.load(filepath);
|
||||
expected = null;
|
||||
same(actual, expected, "returns null if specified file path is not absolute");
|
||||
});
|
||||
|
||||
test("save", function() {
|
||||
var actual, expression, expected, str;
|
||||
var filepath = getDocumentPath() + "/savetest.txt";
|
||||
|
||||
/* disabled as browser-level exceptions cannot be trapped
|
||||
expression = function() { jQuery.twFile.save(); };
|
||||
expected = "ReferenceError";
|
||||
raises(expression, expected, "raises exception if no argument is specified");
|
||||
*/
|
||||
|
||||
/* disabled as browser-level exceptions cannot be trapped
|
||||
expression = function() { jQuery.twFile.save(filepath); };
|
||||
expected = "TypeError";
|
||||
raises(expression, expected, "raises exception if no content argument is specified");
|
||||
*/
|
||||
|
||||
/* disabled as browser-level exceptions cannot be trapped
|
||||
expression = function() { jQuery.twFile.save("foo.txt", "sample content"); };
|
||||
expected = "ReferenceError";
|
||||
raises(expression, expected, "raises exception if specified file path is not absolute");
|
||||
*/
|
||||
|
||||
str = "lorem ipsum\n" +
|
||||
"dolor sit amet\n" +
|
||||
"\n" +
|
||||
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n" +
|
||||
//"\xa9\u010d\u010c\n" +
|
||||
"foo bar baz\n" +
|
||||
(new Date).toString();
|
||||
saveAndLoadString(filepath, str, "writes given ANSI text content to specified file");
|
||||
|
||||
//str = "\xa9\u010d\u010c";
|
||||
//saveAndLoadString(filepath, str, "writes given UTF-8 text content to specified file");
|
||||
|
||||
//jQuery.twFile.save(filepath, ""); // teardown: blank file contents (deletion impossible)
|
||||
});
|
||||
|
||||
// helper function to save and load back a string to a file
|
||||
var saveAndLoadString = function(filepath,str,desc) {
|
||||
jQuery.twFile.save(filepath, str);
|
||||
var actual = jQuery.twFile.load(filepath);
|
||||
same(actual, str, desc);
|
||||
}
|
||||
|
||||
// helper function to retrieve current document's file path
|
||||
var getDocumentPath = function() {
|
||||
var path = document.location.pathname;
|
||||
var startpos = 0;
|
||||
var endpos = path.lastIndexOf("/");
|
||||
if(path.charAt(2) == ":") {
|
||||
startpos = 1;
|
||||
path = path.replace(new RegExp("/","g"),"\\")
|
||||
}
|
||||
return unescape(path.substring(startpos, endpos));
|
||||
};
|
||||
});
|
||||
69
editions/tw2/source/tiddlywiki/jquery/plugins/test/js/jQuery.twStylesheet.js
Executable file
69
editions/tw2/source/tiddlywiki/jquery/plugins/test/js/jQuery.twStylesheet.js
Executable file
@@ -0,0 +1,69 @@
|
||||
jQuery(document).ready(function() {
|
||||
module("jQuery.twStylesheet");
|
||||
|
||||
test("apply", function() {
|
||||
var actual, expected, el;
|
||||
|
||||
el = jQuery('<div />').appendTo(document.body);
|
||||
jQuery.twStylesheet("div { overflow: hidden; }");
|
||||
actual = jQuery(el).css("overflow");
|
||||
expected = "hidden";
|
||||
same(actual, expected, "applies style definitions to document");
|
||||
// teardown
|
||||
jQuery(el).remove();
|
||||
jQuery.twStylesheet.remove();
|
||||
|
||||
el = jQuery('<div />').appendTo(document.body);
|
||||
jQuery.twStylesheet("div { font-style: italic; }");
|
||||
actual = jQuery(el).css("font-style");
|
||||
expected = "italic";
|
||||
same(actual, expected, "applies style definitions to newly-created elements");
|
||||
// teardown
|
||||
jQuery(el).remove();
|
||||
jQuery.twStylesheet.remove();
|
||||
|
||||
jQuery.twStylesheet("", { id: "dummyStyleSheet" });
|
||||
actual = jQuery("#dummyStyleSheet").length;
|
||||
expected = 1;
|
||||
same(actual, expected, "generates style element using given ID");
|
||||
// teardown
|
||||
jQuery.twStylesheet.remove({ id: "dummyStyleSheet" });
|
||||
|
||||
// TODO: test for options.doc argument
|
||||
|
||||
});
|
||||
|
||||
test("remove", function() {
|
||||
var actual, expected;
|
||||
|
||||
// setup
|
||||
el = jQuery('<div />').appendTo(document.body);
|
||||
jQuery.twStylesheet("div { overflow: hidden; }");
|
||||
// test
|
||||
jQuery.twStylesheet.remove();
|
||||
actual = jQuery(el).css("overflow");
|
||||
expected = "visible";
|
||||
same(actual, expected, "neutralizes style definitions");
|
||||
// teardown
|
||||
jQuery(el).remove();
|
||||
|
||||
// setup
|
||||
jQuery.twStylesheet("");
|
||||
// test
|
||||
jQuery.twStylesheet.remove();
|
||||
actual = jQuery("#customStyleSheet").length;
|
||||
expected = 0;
|
||||
same(actual, expected, "removes default style sheet if no ID is given");
|
||||
|
||||
// setup
|
||||
jQuery.twStylesheet("", { id: "dummyStyleSheet" });
|
||||
// test
|
||||
jQuery.twStylesheet.remove({ id: "dummyStyleSheet" });
|
||||
actual = jQuery("#dummyStyleSheet").length;
|
||||
expected = 0;
|
||||
same(actual, expected, "removes style element using given ID");
|
||||
|
||||
// TODO: test for options.doc argument
|
||||
|
||||
});
|
||||
});
|
||||
5
editions/tw2/source/tiddlywiki/jquery/plugins/test/sample.txt
Executable file
5
editions/tw2/source/tiddlywiki/jquery/plugins/test/sample.txt
Executable file
@@ -0,0 +1,5 @@
|
||||
lorem ipsum
|
||||
dolor sit amet
|
||||
|
||||
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~
|
||||
foo bar baz
|
||||
Reference in New Issue
Block a user