forked from kaelzhang/neuron.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathut.html
More file actions
121 lines (95 loc) · 2.38 KB
/
ut.html
File metadata and controls
121 lines (95 loc) · 2.38 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{{> head.html}}
<script type="text/javascript" src="/tools/jasmine/jasmine.js"></script>
<script type="text/javascript" src="/tools/jasmine/jasmine-html.js"></script>
<script>
// tools
function provide(name, loaded){
var args;
name = NR.makeArray(name);
runs(function() {
NR.provide(name, function(NR, Mod) {
args = arguments;
});
});
waitsFor(function() {
return !!args;
});
runs(function() {
loaded.apply(null, args);
});
};
function async(mod, loaded, options, events){
var
EVENTS = ['success', 'error'],
method, res,
need_async = arguments.length === 4,
succeed,
fake_events = {},
event_res = {},
final_event_type;
EVENTS.forEach(function(type) {
fake_events[type] = function() {
event_res[type] = arguments;
final_event_type = type;
};
});
runs(function() {
NR.provide(mod, function(NR, Method) {
method = Method;
});
});
waitsFor(function() {
return !!method;
});
runs(function() {
if(loaded){
loaded(method);
}
if(need_async){
new method(options).on(fake_events).send();
}
});
if(need_async){
waitsFor(function() {
return !!final_event_type;
});
runs(function() {
EVENTS.forEach(function(type) {
var
callback = events[type];
if(type === final_event_type){
callback && callback.apply(null, event_res[type]);
}
});
});
}
};
</script>
<link rel="stylesheet" href="/tools/jasmine/jasmine.css" />
</head>
<body>
{{{page.content}}}
<script type="text/javascript">
(function () {
jasmine.CATCH_EXCEPTIONS = false;
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 1000;
var htmlReporter = new jasmine.HtmlReporter();
jasmineEnv.addReporter(htmlReporter);
jasmineEnv.specFilter = function (spec) {
return htmlReporter.specFilter(spec);
};
var currentWindowOnload = window.onload;
window.onload = function () {
if (currentWindowOnload) {
currentWindowOnload();
}
execJasmine();
};
function execJasmine() {
jasmineEnv.execute();
}
})();
</script>
</body>
</html>