Permalink
Browse files

All unit tests now pass in BlackBerry 4.6.1 and 5.0 (mainly QUnit iss…

…ues)
  • Loading branch information...
cowboy committed Jul 20, 2010
1 parent 20265f9 commit f525dae3d72d4473d58ab1c3f81e8c8ba6318746
Showing with 30 additions and 21 deletions.
  1. +1 −0 unit/document-domain.html
  2. +1 −0 unit/ie7-compat.html
  3. +1 −0 unit/index.html
  4. +1 −0 unit/jquery-1.2.6.html
  5. +1 −0 unit/jquery-1.3.2.html
  6. +1 −0 unit/jquery-1.4.1.html
  7. +24 −21 unit/unit.js
@@ -33,6 +33,7 @@ <h2 id="qunit-userAgent"></h2>
<br>To view a unit test page using document.domain; <a href="./document-domain.html">click here</a>. <b>(selected)</b>
</p>
<ol id="qunit-tests"></ol>
+ <h3 id="notice"></h3>
<div style="height:2000px"></div><!-- make sure the page doesn't scroll when the event is first bound -->
</body>
</html>
View
@@ -30,6 +30,7 @@ <h2 id="qunit-userAgent"></h2>
<br>To view a unit test page using document.domain; <a href="./document-domain.html">click here</a>.
</p>
<ol id="qunit-tests"></ol>
+ <h3 id="notice"></h3>
<div style="height:2000px"></div><!-- make sure the page doesn't scroll when the event is first bound -->
</body>
</html>
View
@@ -29,6 +29,7 @@ <h2 id="qunit-userAgent"></h2>
<br>To view a unit test page using document.domain; <a href="./document-domain.html">click here</a>.
</p>
<ol id="qunit-tests"></ol>
+ <h3 id="notice"></h3>
<div style="height:2000px"></div><!-- make sure the page doesn't scroll when the event is first bound -->
</body>
</html>
View
@@ -29,6 +29,7 @@ <h2 id="qunit-userAgent"></h2>
<br>To view a unit test page using document.domain; <a href="./document-domain.html">click here</a>.
</p>
<ol id="qunit-tests"></ol>
+ <h3 id="notice"></h3>
<div style="height:2000px"></div><!-- make sure the page doesn't scroll when the event is first bound -->
</body>
</html>
View
@@ -29,6 +29,7 @@ <h2 id="qunit-userAgent"></h2>
<br>To view a unit test page using document.domain; <a href="./document-domain.html">click here</a>.
</p>
<ol id="qunit-tests"></ol>
+ <h3 id="notice"></h3>
<div style="height:2000px"></div><!-- make sure the page doesn't scroll when the event is first bound -->
</body>
</html>
View
@@ -29,6 +29,7 @@ <h2 id="qunit-userAgent"></h2>
<br>To view a unit test page using document.domain; <a href="./document-domain.html">click here</a>.
</p>
<ol id="qunit-tests"></ol>
+ <h3 id="notice"></h3>
<div style="height:2000px"></div><!-- make sure the page doesn't scroll when the event is first bound -->
</body>
</html>
View
@@ -3,8 +3,9 @@ QUnit.jsDump.HTML = false;
(function($){ // START CLOSURE
-var is_chrome = /chrome/i.test( navigator.userAgent ),
- aps = Array.prototype.slice;
+var back_broken = /(?:chrome|blackberry)/i.test( navigator.userAgent ),
+ aps = Array.prototype.slice,
+ opt = Object.prototype.toString;
function notice( txt ) {
if ( txt ) {
@@ -22,26 +23,27 @@ function run_many_tests() {
result;
function set_result( i, test ) {
- result = {}.toString.call( test ) === '[object Array]' // 1.2.6 didn't have $.toArray()
+ result = opt.call( test ) === '[object Array]' // 1.2.6 didn't have $.isArray()
? func_each.apply( this, test )
: $.isFunction( test )
? test( result )
: '';
};
+ function next(){
+ test && test.func && test.func( result );
+ if ( tests.length ) {
+ set_result( 0, tests.shift() );
+ setTimeout( next, delay );
+ } else {
+ func_done && func_done();
+ start();
+ }
+ };
+
if ( delay ) {
- stop();
-
- (function loopy(){
- test && test.func && test.func( result );
- if ( tests.length ) {
- set_result( 0, tests.shift() );
- setTimeout( loopy, delay );
- } else {
- func_done && func_done();
- start();
- }
- })();
+ QUnit.stop(); // BlackBerry 5 explodes if "stop()" is called by itself.

This comment has been minimized.

Show comment Hide comment
@cowboy

cowboy Jul 20, 2010

Owner

This is the "money shot" btw, in case anyone is interested.

@cowboy

cowboy Jul 20, 2010

Owner

This is the "money shot" btw, in case anyone is interested.

+ next();
} else {
$.each( tests, set_result );
@@ -141,23 +143,24 @@ $(function(){
},
function(result){
- !is_chrome && window.history.go( -1 );
+ !back_broken && history.go( -1 );
},
function(result){
- !is_chrome && window.history.go( -1 );
+ !back_broken && history.go( -1 );
},
function(result){
- !is_chrome && window.history.go( -1 );
+ !back_broken && history.go( -1 );
},
function(result){
- if ( is_chrome ) {
+ if ( back_broken ) {
// Read about this issue here: http://benalman.com/news/2009/09/chrome-browser-history-buggine/
- ok( true, 'history is sporadically broken in chrome, this is a known bug, so this test is skipped in chrome' );
+ // and here: http://supportforums.blackberry.com/t5/Web-Development/Bold-Browser-Broken-history-go-1/td-p/107541
+ ok( true, 'back button support inconsistent in chrome / blackberry (skip test)' );
} else {
- same( arr, ['', 'b', 'a'], 'back button and window.history.go(-1) should work' );
+ same( arr, ['', 'b', 'a'], 'back button and history.go(-1) should work' );
}
$(window).unbind( 'hashchange' );

0 comments on commit f525dae

Please sign in to comment.