diff options
Diffstat (limited to 'test/unit/support.js')
-rw-r--r-- | test/unit/support.js | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/test/unit/support.js b/test/unit/support.js index d62c8b988..d1e3a4661 100644 --- a/test/unit/support.js +++ b/test/unit/support.js @@ -1,4 +1,4 @@ -module("support", { teardown: moduleTeardown }); +QUnit.module("support", { teardown: moduleTeardown }); var computedSupport = getComputedSupport( jQuery.support ); @@ -18,30 +18,35 @@ function getComputedSupport( support ) { } if ( jQuery.css ) { - testIframeWithCallback( "body background is not lost if set prior to loading jQuery (#9239)", "support/bodyBackground.html", function( color, support ) { - expect( 2 ); - var okValue = { - "#000000": true, - "rgb(0, 0, 0)": true - }; - ok( okValue[ color ], "color was not reset (" + color + ")" ); + testIframeWithCallback( + "body background is not lost if set prior to loading jQuery (#9239)", + "support/bodyBackground.html", + function( color, support, assert ) { + assert.expect( 2 ); + var okValue = { + "#000000": true, + "rgb(0, 0, 0)": true + }; + assert.ok( okValue[ color ], "color was not reset (" + color + ")" ); - deepEqual( jQuery.extend( {}, support ), computedSupport, "Same support properties" ); - }); + assert.deepEqual( jQuery.extend( {}, support ), computedSupport, "Same support properties" ); + } + ); } // This test checks CSP only for browsers with "Content-Security-Policy" header support // i.e. no old WebKit or old Firefox -testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Security/CSP) restrictions", +testIframeWithCallback( + "Check CSP (https://developer.mozilla.org/en-US/docs/Security/CSP) restrictions", "support/csp.php", - function( support ) { - expect( 2 ); - deepEqual( jQuery.extend( {}, support ), computedSupport, "No violations of CSP polices" ); + function( support, assert ) { + assert.expect( 2 ); + assert.deepEqual( jQuery.extend( {}, support ), computedSupport, "No violations of CSP polices" ); - stop(); + QUnit.stop(); supportjQuery.get( "data/support/csp.log" ).done(function( data ) { - equal( data, "", "No log request should be sent" ); + assert.equal( data, "", "No log request should be sent" ); supportjQuery.get( "data/support/csp-clean.php" ).done( start ); }); } @@ -254,7 +259,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec } if ( expected ) { - test( "Verify that the support tests resolve as expected per browser", function() { + QUnit.test( "Verify that the support tests resolve as expected per browser", function( assert ) { var i, prop, j = 0; @@ -262,16 +267,16 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec j++; } - expect( j ); + assert.expect( j ); for ( i in expected ) { // TODO check for all modules containing support properties if ( jQuery.ajax || i !== "ajax" && i !== "cors" ) { - equal( computedSupport[ i ], expected[ i ], + assert.equal( computedSupport[ i ], expected[ i ], "jQuery.support['" + i + "']: " + computedSupport[ i ] + ", expected['" + i + "']: " + expected[ i ]); } else { - ok( true, "no ajax; skipping jQuery.support[' " + i + " ']" ); + assert.ok( true, "no ajax; skipping jQuery.support[' " + i + " ']" ); } } }); |