diff options
author | Oleg Gaidarenko <markelog@gmail.com> | 2014-12-07 13:01:16 +0300 |
---|---|---|
committer | Oleg Gaidarenko <markelog@gmail.com> | 2014-12-08 09:26:15 +0300 |
commit | dd596ccf729b2f39d44b73bc54b53bd41c880146 (patch) | |
tree | fc7fb41672d8d42f0388fba3b9b98f89c905273e /test/unit/manipulation.js | |
parent | 4467ed606ab0a9b28ed495e682576910937fa5e0 (diff) | |
download | jquery-dd596ccf729b2f39d44b73bc54b53bd41c880146.tar.gz jquery-dd596ccf729b2f39d44b73bc54b53bd41c880146.zip |
Manipulation: improve test for data-URI
Some environments do not support data-uri in "src" attribute of script element.
Mitigate it with equality assertion
Ref a467f8653a6fab2903148df80ab0ce9f5f4fd04f
Diffstat (limited to 'test/unit/manipulation.js')
-rw-r--r-- | test/unit/manipulation.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index ca3b8b548..12f5d14df 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -2437,9 +2437,25 @@ test( "Validate creation of multiple quantities of certain elements (#13818)", 4 asyncTest( "Insert script with data-URI (gh-1887)", 1, function() { Globals.register( "testFoo" ); - jQuery( "#qunit-fixture" ).append( "<script src=\"data:text/javascript,testFoo = 'foo';\"></script>" ); + Globals.register( "testSrcFoo" ); + + var script = document.createElement( "script" ), + fixture = document.getElementById( "qunit-fixture" ); + + script.src = "data:text/javascript,testSrcFoo = 'foo';"; + + fixture.appendChild( script ); + + jQuery( fixture ).append( "<script src=\"data:text/javascript,testFoo = 'foo';\"></script>" ); + setTimeout(function() { - strictEqual( window[ "testFoo" ], "foo", "data-URI script executed" ); + if ( window[ "testSrcFoo" ] === "foo" ) { + strictEqual( window[ "testFoo" ], window[ "testSrcFoo" ], "data-URI script executed" ); + + } else { + ok( true, "data-URI script is not supported by this environment" ); + } + start(); - }, 100 ); + }); }); |