mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
Couple of changes into angular.scenario runner: - add autotest config (runs tests when document ready) - update ObjectModel (forwards events) - use only one ObjectModel instance for all outputters - expose error msg and line number in ObjectModel.Spec and ObjectModel.Step - fix generating spec.ids - fix 'html' output so that it does not mutate ObjectModel Couple of changes into docs / generator: - rename copy -> copyTpl - move docs/static into docs/examples (to avoid conflict with jstd proxy) Running all docs e2e tests: ======================================================== 1/ compile angular-scenario, jstd-scenario-adapter >> rake compile 2/ build docs >> rake docs 3/ start jstd server >> ./server-scenario.sh 4/ capture some browser 5/ run node server to serve static content >> node ../lib/nodeserver/server.js 6/ run tests >> ./test-scenario.sh
59 lines
1.7 KiB
JavaScript
59 lines
1.7 KiB
JavaScript
(function(previousOnLoad){
|
|
var prefix = (function(){
|
|
var filename = /(.*\/)angular-bootstrap.js(#(.*))?/;
|
|
var scripts = document.getElementsByTagName("script");
|
|
for(var j = 0; j < scripts.length; j++) {
|
|
var src = scripts[j].src;
|
|
if (src && src.match(filename)) {
|
|
var parts = src.match(filename);
|
|
return parts[1];
|
|
}
|
|
}
|
|
})();
|
|
|
|
function addScript(path) {
|
|
document.write('<script type="text/javascript" src="' + prefix + path + '"></script>');
|
|
}
|
|
|
|
function addCSS(path) {
|
|
document.write('<link rel="stylesheet" type="text/css" href="' + prefix + path + '"/>');
|
|
}
|
|
|
|
window.onload = function(){
|
|
try {
|
|
if (previousOnLoad) previousOnLoad();
|
|
} catch(e) {}
|
|
var config = angularJsConfig(document);
|
|
if (config.autotest) angular.scenario.setUpAndRun(config);
|
|
};
|
|
|
|
addCSS("../../css/angular-scenario.css");
|
|
addScript("../../lib/jquery/jquery-1.4.2.js");
|
|
document.write(
|
|
'<script type="text/javascript">' +
|
|
'var _jQuery = jQuery.noConflict(true);' +
|
|
'</script>'
|
|
);
|
|
addScript("../angular-bootstrap.js");
|
|
|
|
addScript("Scenario.js");
|
|
addScript("Application.js");
|
|
addScript("Describe.js");
|
|
addScript("Future.js");
|
|
addScript("Runner.js");
|
|
addScript("SpecRunner.js");
|
|
addScript("dsl.js");
|
|
addScript("matchers.js");
|
|
addScript("ObjectModel.js");
|
|
addScript("output/Html.js");
|
|
addScript("output/Json.js");
|
|
addScript("output/Object.js");
|
|
addScript("output/Xml.js");
|
|
|
|
// Create the runner (which also sets up the global API)
|
|
document.write(
|
|
'<script type="text/javascript">' +
|
|
' var $runner = new angular.scenario.Runner(window);' +
|
|
'</script>');
|
|
|
|
})(window.onload);
|