1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <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);
- };
- // 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
- window.jasmine = { getJSReport: function() { } };
- setTimeout(function() {
- 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)) %>,
- allScripts = jasmine.concat(helpers).concat(vendor).concat(specs).concat(reporters);
- function addNextScript() {
- // for sauce, see above. Additional step needed between loading jasmine and loading
- // the js reporter
- if (!jasmine.getJSReport) {
- jasmine.getJSReport = function() {};
- }
- if (allScripts.length) {
- var scriptSrc = allScripts.shift();
- loadScript(scriptSrc, addNextScript);
- } else {
- window.onload();
- }
- }
- addNextScript();
- },1000);
- </script>
- </head>
- <body>
- <!-- content -->
- </body>
- </html>
|