jasmine-headless-webkit/skel/template.html.erb
2012-09-20 14:13:35 +08:00

78 lines
2.4 KiB
Plaintext

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
<title>Jasmine Test Runner - Generated by jasmine-headless-webkit</title>
<script type="text/javascript" src="<%= Jasmine::Headless.root.join('vendor/assets/javascripts/prolog.js') %>"></script>
<%= files.join("\n") %>
<script type="text/javascript">
if (window.JHW) { HeadlessReporterResult.specLineNumbers = <%= MultiJson.dump(spec_lines) %>; }
</script>
</head>
<body>
<script type="text/javascript">
jasmine.getEnv().console = {
log: function(msg) { JHW.print('stdout', msg + "\n"); }
}
window._onload = window.onload;
window.onload = function() {
if (window._onload && (window._onload != window.onload)) {
window._onload();
}
if (window.JHW) {
<%= jhw_reporters %>
} else {
types = [ 'HtmlReporter', 'TrivialReporter' ];
for (var i = 0, j = types.length; i < j; ++i) {
var type = jasmine[types[i]]
if (type) {
jasmine.getEnv().addReporter(new type());
break;
}
}
var location = window.location.href;
var getLastModified = function(callback) {
var http = new XMLHttpRequest();
var header;
http.open('HEAD', location, true);
http.onreadystatechange = function() {
if(http.readyState === http.DONE) {
callback(http.getResponseHeader('Last-Modified'));
}
};
http.send();
}
getLastModified(function(currentLastModified) {
var checker;
checker = function() {
setTimeout(function() {
getLastModified(function(newLastModified) {
if (currentLastModified != newLastModified) {
setTimeout(function() { window.location.reload(); }, 1000);
} else {
checker();
}
});
}, 3000);
};
checker();
});
}
jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter());
jasmine.getEnv().execute();
}
</script>
</body>
</html>