Skip to content

Commit 18c376a

Browse files
committed
Adjusts unit test regarding exception in injected scripts so that it accounts for the exception being thrown in an event loop for remote scripts
1 parent 7cc629d commit 18c376a

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

test/unit/manipulation.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,17 +2050,21 @@ test( "Ensure oldIE creates a new set on appendTo (#8894)", function() {
20502050

20512051
test( "html() - script exceptions bubble (#11743)", function() {
20522052

2053-
expect( 2 );
2054-
2055-
raises(function() {
2056-
jQuery("#qunit-fixture").html("<script>undefined(); ok( false, 'error not thrown' );</script>");
2057-
ok( false, "error ignored" );
2058-
}, "exception bubbled from inline script" );
2053+
expect( 3 );
20592054

20602055
raises(function() {
2061-
jQuery("#qunit-fixture").html("<script src='data/badcall.js'></script>");
2062-
ok( false, "error ignored" );
2063-
}, "exception bubbled from remote script" );
2056+
jQuery("#qunit-fixture").html("<script>undefined(); ok( false, 'Exception not thrown' );</script>");
2057+
ok( false, "Exception ignored" );
2058+
}, "Exception bubbled from inline script" );
2059+
2060+
var onerror = window.onerror;
2061+
window.onerror = function() {
2062+
ok( true, "Exception thrown in remote script" );
2063+
window.onerror = onerror;
2064+
};
2065+
2066+
jQuery("#qunit-fixture").html("<script src='data/badcall.js'></script>");
2067+
ok( true, "Exception ignored" );
20642068
});
20652069

20662070
test( "checked state is cloned with clone()", function() {

0 commit comments

Comments
 (0)