diff options
Diffstat (limited to 'test/unit/support.js')
-rw-r--r-- | test/unit/support.js | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/test/unit/support.js b/test/unit/support.js index 80242257e..6d97fa6f8 100644 --- a/test/unit/support.js +++ b/test/unit/support.js @@ -1,4 +1,4 @@ -module( "support", { teardown: moduleTeardown } ); +QUnit.module( "support", { teardown: moduleTeardown } ); function getComputedSupport( support ) { var prop, @@ -17,48 +17,56 @@ function getComputedSupport( support ) { var computedSupport = getComputedSupport( jQuery.support ); -test( "zoom of doom (#13089)", function() { - expect( 1 ); +QUnit.test( "zoom of doom (#13089)", function( assert ) { + assert.expect( 1 ); - ok( !document.body.style.zoom, "No zoom added to the body" ); + assert.ok( !document.body.style.zoom, "No zoom added to the body" ); } ); 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 + ")" ); - stop(); + QUnit.stop(); - // Run doc ready tests as well - jQuery( function() { - deepEqual( jQuery.extend( {}, support ), computedSupport, "Same support properties" ); - start(); - } ); - } ); + // Run doc ready tests as well + jQuery( function() { + assert.deepEqual( jQuery.extend( {}, support ), computedSupport, "Same support properties" ); + QUnit.start(); + } ); + } + ); } -testIframeWithCallback( "A background on the testElement does not cause IE8 to crash (#9823)", "support/testElementCrash.html", function() { - expect( 1 ); - ok( true, "IE8 does not crash" ); -} ); +testIframeWithCallback( + "A background on the testElement does not cause IE8 to crash (#9823)", + "support/testElementCrash.html", function( assert ) { + assert.expect( 1 ); + assert.ok( true, "IE8 does not crash" ); + } +); // 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 ); } ); } @@ -470,7 +478,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; @@ -478,15 +486,15 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec j++; } - expect( j ); + assert.expect( j ); for ( i in expected ) { 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 + "']" ); } } } ); |