-
Notifications
You must be signed in to change notification settings - Fork 6
/
jasmine-all.jst
81 lines (65 loc) · 1.87 KB
/
jasmine-all.jst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
(function(jasmine_all_version){
var
auto_run = true,
element = document;
function init() {
/** jasmine.css **/
(function(cssCode) {
var styleElement = document.createElement("style");
styleElement.type = "text/css";
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = cssCode;
}
else {
styleElement.appendChild(document.createTextNode(cssCode));
}
document.getElementsByTagName("body")[0].appendChild(styleElement);
})('<%= jasmineCss %>');
if (auto_run) {
/** defer, then initialize jasmine runner **/
setTimeout(run, 1);
}
}
function noAutoRun() { auto_run = false; }
function attachTo(dom_element) {
// Jasmine's HTMLReporter takes a *document* object as it's base to build
// on. Unlike a DOM element, several properties are expected.
element = {
body: dom_element,
location: document.location
};
}
function run() {
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 1000;
/** jasmine-jQuery **/
if (window.jQuery != null) { useJasmineJquery(); }
var htmlReporter = new jasmine.HtmlReporter(element);
jasmineEnv.addReporter(htmlReporter);
jasmineEnv.specFilter = function(spec) {
return htmlReporter.specFilter(spec);
};
jasmineEnv.execute();
}
// Export functions
window.jasmineRunner = {
init: init,
noAutoRun: noAutoRun,
attachTo: attachTo,
run: run
};
if(document.addEventListener) {
document.addEventListener('DOMContentLoaded', init, false);
}
else {
document.attachEvent('DOMContentLoaded', init);
}
})('<%= jasmineVersion %>');
/** jasmine.js **/
<%= jasmineCore %>
/** jasmine-html.js **/
<%= jasmineHtmlReporter %>
function useJasmineJquery() {
<%= jasmineJquery %>
}
/* vim:set sw=2 ts=2 et fdm=marker ft=javascript: */