Remove JavaScriptTests page - not compatible with scripts-at-the-bottom - will be replaced with proper library as we go
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/528c4021 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/528c4021 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/528c4021 Branch: refs/heads/5.4-js-rewrite Commit: 528c40213838474be91433e64a0eebafec4342b8 Parents: 6b83c0a Author: Howard M. Lewis Ship <[email protected]> Authored: Thu Jun 28 15:28:59 2012 -0700 Committer: Howard M. Lewis Ship <[email protected]> Committed: Thu Jun 28 15:28:59 2012 -0700 ---------------------------------------------------------------------- .../tapestry5/integration/app1/pages/Index.java | 2 - .../integration/app1/pages/JavaScriptTests.java | 9 - .../integration/app1/pages/JavaScriptTests.tml | 147 --------------- .../integration/app1/pages/js-testing.css | 30 --- .../tapestry5/integration/app1/pages/js-testing.js | 122 ------------ 5 files changed, 0 insertions(+), 310 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/528c4021/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java index 32534d1..030cd7b 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java @@ -91,8 +91,6 @@ public class Index new Item("DynamicExpansionsDemo", "Expansions in Dynamic Templates", "Expansions inside Dynamic component content and attributes"), - new Item("JavaScriptTests", "JavaScript Unit Tests", "Unit tests for client-side JavaScript"), - new Item("PACAnnotationDemo", "PageActivationContext Demo", "Shows that @PageActivationContext fields are set before calls to the activate event handler."), http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/528c4021/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.java deleted file mode 100644 index 40b6f8d..0000000 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.apache.tapestry5.integration.app1.pages; - -import org.apache.tapestry5.annotations.Import; - -@Import(library = "js-testing.js", stylesheet = "js-testing.css") -public class JavaScriptTests -{ - -} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/528c4021/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml deleted file mode 100644 index 15843e9..0000000 --- a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml +++ /dev/null @@ -1,147 +0,0 @@ -<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> - -<h1>JavaScript Tests</h1> - -<p> - This page executes a number of JavaScript tests. -</p> - -<div id="tests"> - -<h2>Publish / Subscribe</h2> - - -<div> - <p> Ensure that the message object passed to pub() is delivered to the listener.</p> - <pre> - var message = { } - var rcvd; - - sub("foo", document, function(m) { rcvd = m; }) - - pub("foo", document, message) - - assertSame(rcvd, message) - </pre> -</div> - -<div> - <p> Ensure that the second object to a listener is the source object.</p> - <pre> - var unsub = sub("foo", null, function(message, meta) { assertSame(meta.element, document); }) - - pub("foo", document, null) - - unsub() - </pre> -</div> - -<div> - <p>Check that the function returned from sub() can be used to cancel message receipt.</p> - <pre> - var count = 0; - - pub("foo", document); assertEqual(count, 0) - - var unsub = sub("foo", document, function() { - count++; } ) - - pub("foo", document); - assertEqual(count, 1) - - pub("foo", document); assertEqual(count, 2) - - pub("bar", - document); assertEqual(count, 2) - - unsub() - - pub("foo", document); - assertEqual(count, 2) - </pre> -</div> - -<div> - <p> Ensure that messages are delivered to specific listeners before general listeners. - </p> - <pre> - var pubs = [] - - sub("foo", null, function() { pubs.push("general1") }) - - sub("foo", document, function() { - pubs.push("specific1") }) - - sub("foo", null, function() { pubs.push("general2") }) - - sub("foo", document, function() - { - pubs.push("specific2") - }) - - pub("foo", document, {}) - - assertEqual(pubs, ["specific1", "specific2", - "general1", - "general2"]) - </pre> -</div> - - -<div> - <p>Publish/subscribe via client id rather than element.</p> - - <pre> - var element = new Element("span",{ id: "zaphod" }).update("Published Message Source Zaphod") - - document.body.insert({bottom: - element}) - - var pubs = [] - - sub("bar", "zaphod", - function() { - pubs.push("specific") } ) - - pub("bar", - "zaphod", {}) - - assertEqual(pubs, ["specific"]) - - T5.dom.remove(element) - </pre> -</div> - -<div> - <p>Listeners invocations can be cancelled.</p> - - <pre> - var pubs = [] - - sub("bazz", null, function() { pubs.push("first"); }) - sub("bazz", null, function(message, meta) { pubs.push("second"); meta.cancel(); }) - sub("bazz", null, function() { pubs.push("third"); }) - - pub("bazz", {}) - - assertEqual(pubs, ["first", "second" ]); - </pre> -</div> - -</div> - -<script> - <![CDATA[ - - pub = T5.pub - sub = T5.sub - - - assertEqual = JST.assertEqual - assertSame = JST.assertSame - - JST.runTestSuite("tests"); - ]]> -</script> -</html> - http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/528c4021/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.css ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.css b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.css deleted file mode 100644 index 2fee6f5..0000000 --- a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.css +++ /dev/null @@ -1,30 +0,0 @@ - -DIV.js-results .caption -{ - font-weight: bold; - background-color: #e5e5e5; - color: white; -} - -DIV.js-results DIV.odd -{ - background-color: #e5e5e5; -} - -DIV.js-results .active -{ - font-weight: bold; - background-color: #ffff00; -} - -DIV.js-results .pass { - color: green; -} - -DIV.js-results .fail { - color: red; -} - -DIV.js-results .exception { - font-weight: bold; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/528c4021/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.js ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.js b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.js deleted file mode 100644 index 971927b..0000000 --- a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.js +++ /dev/null @@ -1,122 +0,0 @@ -var JST = (function() { - - var _ = T5._; - - var resultElement; - - var $fail = {}; - - function fail(text) { - resultElement.insert({ - top : "FAIL - ", - after : "<hr>" + text - }).up("div").addClassName("fail").scrollTo(); - - throw $fail; - } - - function toString(value) { - - // Prototype: - return Object.toJSON(value); - } - - function failNotEqual(actual, expected) { - fail(toString(actual) + " !== " + toString(expected)); - } - - function assertSame(actual, expected) { - if (actual !== expected) { - failNotEqual(actual, expected); - } - } - - function assertEqual(actual, expected) { - - if (!_.isEqual(actual, expected)) { - failNotEqual(actual, expected); - } - } - - function doRunTests(elementId) { - - var passCount = 0; - var failCount = 0; - - $(elementId).addClassName("js-results").select("div:odd").each( - function(e) { - e.addClassName("odd"); - }); - - $(elementId).select("div").each( - function(test) { - - test.addClassName("active"); - - resultElement = test.down("p"); - resultNoted = false; - - var testCode = test.down("pre").textContent; - - try { - eval(testCode); - - passCount++; - - resultElement.insert({ - top : "PASS - " - }); - - test.addClassName("pass"); - - } catch (e) { - - Tapestry.error(e) - - failCount++; - - if (e !== $fail) { - resultElement.next().insert( - { - top : "EXCEPTION - ", - after : "<hr><div class='exception'>" - + toString(e) + "</div>" - }); - - test.addClassName("fail").scrollTo(); - } - } - - test.removeClassName("active"); - }); - - $(elementId) - .insert( - { - top : "<p class='caption #{class}'>Results: #{pass} passed / #{fail} failed</p>" - .interpolate({ - class : failCount == 0 ? "pass" - : "fail", - pass : passCount, - fail : failCount - }) - }); - - if (failCount == 0) { - $(elementId).down("p").scrollTo(); - } - } - - function runTestSuite(elementId) { - Tapestry.onDOMLoaded(function() { - doRunTests(elementId); - }); - } - - return { - fail : fail, - assertEqual : assertEqual, - assertSame : assertSame, - runTestSuite : runTestSuite - }; -})(); \ No newline at end of file
