Permalink
Browse files

WIP on testcase

  • Loading branch information...
peterbraden committed Aug 20, 2012
1 parent 0268fef commit 41b92c0796c68ddf92234b30181426ac92393d0a
Showing with 29 additions and 1 deletion.
  1. +29 −1 test/test.js
View
@@ -316,6 +316,7 @@ asyncTest("Hash Change Event test", function() {
equals(hashChangeCount, 1)
e.preventDefault();
+ start()
}
@@ -324,7 +325,6 @@ asyncTest("Hash Change Event test", function() {
.hash('foobar')
.unbind('hashchange')
- start()
}, 100)
})
@@ -337,6 +337,34 @@ asyncTest("Prevent Default Test", function(){
}, 20)
})
+asyncTest("Subsequent prevent default should work", function(){
+
+ var hashChangeCount = 0
+
+ setTimeout(function() {
+ var hashChangeFunc = function(e){
+ console.log("!!!", hashChangeCount)
+ hashChangeCount ++;
+ e.preventDefault();
+ }
+
+ $.address.value('/')
+ $.address.change(hashChangeFunc)
+ $.address.hash('foobar')
+ $.address.unbind('hashchange')
+
+ }, 100)
+
+ setTimeout(function(){
+ equals($.address.hash(), '')
+ console.log("!!!>", hashChangeCount == 1, hashChangeCount)
+ equal( hashChangeCount, 1, "Change Happened")
+ console.log("!!!>>", hashChangeCount)
+ start()
+ }, 200)
+
+})
+
setTimeout(function() {
$.address.value('/');

0 comments on commit 41b92c0

Please sign in to comment.