123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <script>
- // allow sauce to query for the jasmine report
- // because we have to load the page before starting the test, so the thing
- // sauce queries for might not be setup yet
- var JASMINE;
- if(Object.defineProperty) {
- Object.defineProperty(window, 'jasmine', {
- get: function() { return JASMINE; },
- set: function(jsm) {
- JASMINE = jsm || {};
- if(!JASMINE.getJSReport || typeof JASMINE.getJSReport !== 'function') {
- JASMINE.getJSReport = function() { };
- }
- }
- });
- }
- else {
- window.jasmine = { getJSReport: function() { } };
- }
- </script>
-
- <title>Jasmine Spec Runner</title>
- <!-- generate script tags for tests -->
- <% var generateScriptTags = function(allScripts) { allScripts.forEach(function(script){ %>
- <script src="<%= script %>"></script>
- <% }); }; %>
- <!-- generate script tags for tests -->
- <% var toArray = function(scripts) {
- %>[<%
- scripts.forEach(function(scriptUrl, index){
- %>"<%= scriptUrl %>"<%
- if (index !== scripts.length -1) {
- %>,<%
- }
- });
- %>]<%
- }; %>
- <!-- for each test, generate CSS/LESS link tags -->
- <% scripts.src.forEach(function(fullLessName) {
- var pathParts = fullLessName.split('/');
- var fullCssName = fullLessName.replace(/less/g, 'css');
- var lessName = pathParts[pathParts.length - 1];
- var name = lessName.split('.')[0]; %>
- <!-- the tags to be generated -->
- <link id="original-less:test-less-<%= name %>" title="test-less-<%= name %>" rel="stylesheet/less" type="text/css" href="<%= fullLessName %>">
- <link id="expected-less:test-less-<%= name %>" rel="stylesheet" type="text/css" href="<%= fullCssName %>">
- <% }); %>
- <!-- generate grunt-contrib-jasmine link tags -->
- <% css.forEach(function(style){ %>
- <link rel="stylesheet" type="text/css" href="<%= style %>">
- <% }) %>
- <script>
- function loadScript(url,callback){
- var script = document.createElement('script');
- if(document.documentMode === 8){
- script.onreadystatechange = function(){
- if (script.readyState === 'loaded'){
- if (callback){callback()};
- };
- };
- } else {
- script.onload = function(){
- if (callback){callback()};
- };
- };
- script.src = url;
- document.body.appendChild(script);
- };
- var jasmine = <% toArray([].concat(scripts.polyfills, scripts.jasmine, scripts.boot)) %>,
- helpers = <% toArray(scripts.helpers) %>,
- vendor = <% toArray(scripts.vendor) %>,
- specs = <% toArray(scripts.specs) %>,
- reporters = <% toArray([].concat(scripts.reporters)) %>,
- setupScripts = jasmine.concat(helpers).concat(vendor),
- runScripts = specs.concat(reporters);
- </script>
- <% generateScriptTags(scripts.polyfills); %>
- <% generateScriptTags(scripts.jasmine); %>
- <% generateScriptTags(scripts.boot); %>
- <% generateScriptTags(scripts.helpers); %>
- <% generateScriptTags(scripts.vendor); %>
- <script>
- setTimeout(function() {
- function addNextScript() {
- // for sauce, see above. Additional step needed between loading jasmine and loading
- // the js reporter
- if (runScripts.length) {
- var scriptSrc = runScripts.shift();
- loadScript(scriptSrc, addNextScript);
- } else {
- window.onload();
- }
- }
- addNextScript();
- },1000);
- </script>
- </head>
- <body>
- <!-- content -->
- </body>
- </html>
|