Created
October 23, 2012 17:57
-
-
Save gcpantazis/3940361 to your computer and use it in GitHub Desktop.
QUnit Module, Showing Iframe Loading / Destruction Calls.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tests : Example | |
var i, // testing iframe. | |
w; // testing iframe's window object. | |
module("Backbone Routers", { | |
setup: function() { | |
// Async, hold tests until iframe loads. | |
stop(); | |
iframeLoad('/', function(iframe){ | |
i = iframe; | |
w = i.contentWindow; | |
w.qunits = {}; | |
// Initialize the app in the context of the iframe window. | |
w.require(['app-global'], function(AppGlobal) { | |
AppGlobal.init(); | |
w.qunits.AppRouter = new AppGlobal.routers.AppRouter(); | |
}); | |
// Async, continue now that we're loaded and initialized. | |
start(); | |
}); | |
}, | |
teardown: function() { | |
// Destroy iframe after every test. | |
iframeUnload(i); | |
} | |
}); | |
test("AppRouter Exists", function() { | |
equal( typeof w.qunits.AppRouter, "object" ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment