Rewrite of globalEval. Uses window.execScript or window.eval with a trick to ensure proper context. Unit tests added.
This commit is contained in:
parent
4552d135f4
commit
f3c6077da0
2 changed files with 30 additions and 17 deletions
|
@ -172,6 +172,26 @@ test("selector state", function() {
|
|||
);
|
||||
});
|
||||
|
||||
test( "globalEval", function() {
|
||||
|
||||
expect( 3 );
|
||||
|
||||
jQuery.globalEval( "var globalEvalTest = true;" );
|
||||
ok( window.globalEvalTest, "Test variable declarations are global" );
|
||||
|
||||
window.globalEvalTest = false;
|
||||
|
||||
jQuery.globalEval( "globalEvalTest = true;" );
|
||||
ok( window.globalEvalTest, "Test variable assignments are global" );
|
||||
|
||||
window.globalEvalTest = false;
|
||||
|
||||
jQuery.globalEval( "this.globalEvalTest = true;" );
|
||||
ok( window.globalEvalTest, "Test context (this) is the window object" );
|
||||
|
||||
window.globalEvalTest = undefined;
|
||||
});
|
||||
|
||||
if ( !isLocal ) {
|
||||
test("browser", function() {
|
||||
stop();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue