[Jifty-commit] r4751 -
jifty/branches/cssquery-refactor/t/TestApp-JiftyJS/share/web/static/js-test
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Dec 20 04:41:05 EST 2007
Author: gugod
Date: Thu Dec 20 04:41:04 2007
New Revision: 4751
Modified:
jifty/branches/cssquery-refactor/t/TestApp-JiftyJS/share/web/static/js-test/01.behaviour.html
Log:
Add more tests.
Modified: jifty/branches/cssquery-refactor/t/TestApp-JiftyJS/share/web/static/js-test/01.behaviour.html
==============================================================================
--- jifty/branches/cssquery-refactor/t/TestApp-JiftyJS/share/web/static/js-test/01.behaviour.html (original)
+++ jifty/branches/cssquery-refactor/t/TestApp-JiftyJS/share/web/static/js-test/01.behaviour.html Thu Dec 20 04:41:04 2007
@@ -12,6 +12,8 @@
<script type="text/javascript" src="/static/js/behaviour.js" charset="UTF-8"></script>
<script type="text/javascript">
+var nonexists_applied = false;
+
Behaviour.register({
'#foo': function(element) {
element.innerHTML = "FOO is HERE";
@@ -19,6 +21,12 @@
'#bar': function(element) {
element.innerHTML = "BAR is HERE";
+ },
+ '.nonexists': function(element) {
+ nonexists_applied = true;
+ document.body.appendChild(
+ document.createTextNode("Foo")
+ );
}
});
@@ -34,11 +42,12 @@
<body>
<div id="foo"></div>
+ <div id="foo2"></div>
<pre id="test"></pre>
<script type="text/javascript"><!--
JSAN.use('Test.More');
- plan({ tests: 2 });
+ plan({ tests: 4 });
async_id = beginAsync();
setTimeout(function() {
@@ -46,9 +55,13 @@
add_bar();
+ Behaviour.apply("#foo2");
+ is( document.getElementById("bar").innerHTML, "", "#bar rule is not applied because that's not under #foo2");
+
Behaviour.apply();
-
is( document.getElementById("bar").innerHTML, "BAR is HERE", "#bar rule is applied manually");
+
+ is (nonexists_applied, false, ".nonexists rule never applied.");
endAsync(async_id);
}, 1000);
//--></script>
More information about the Jifty-commit
mailing list