evergreen 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -0
- data/bin/evergreen +18 -0
- data/lib/evergreen.rb +44 -0
- data/lib/evergreen/cli.rb +23 -0
- data/lib/evergreen/evergreen.js +3 -0
- data/lib/evergreen/runner.rb +56 -0
- data/lib/evergreen/server.rb +31 -0
- data/lib/evergreen/spec.rb +60 -0
- data/lib/evergreen/version.rb +3 -0
- data/lib/evergreen/views/list.erb +6 -0
- data/lib/evergreen/views/spec.erb +37 -0
- data/lib/jasmine/MIT.LICENSE +20 -0
- data/lib/jasmine/README.markdown +489 -0
- data/lib/jasmine/Rakefile +146 -0
- data/lib/jasmine/cruise_config.rb +21 -0
- data/lib/jasmine/doc/files.html +460 -0
- data/lib/jasmine/doc/index.html +322 -0
- data/lib/jasmine/doc/symbols/_global_.html +918 -0
- data/lib/jasmine/doc/symbols/jasmine.Block.html +417 -0
- data/lib/jasmine/doc/symbols/jasmine.Clock.html +678 -0
- data/lib/jasmine/doc/symbols/jasmine.Env.html +1169 -0
- data/lib/jasmine/doc/symbols/jasmine.JsApiReporter.html +822 -0
- data/lib/jasmine/doc/symbols/jasmine.Matchers.html +1474 -0
- data/lib/jasmine/doc/symbols/jasmine.MultiReporter.html +394 -0
- data/lib/jasmine/doc/symbols/jasmine.NestedResults.html +710 -0
- data/lib/jasmine/doc/symbols/jasmine.Reporter.html +574 -0
- data/lib/jasmine/doc/symbols/jasmine.Runner.html +710 -0
- data/lib/jasmine/doc/symbols/jasmine.Spec.html +1253 -0
- data/lib/jasmine/doc/symbols/jasmine.Spy.html +855 -0
- data/lib/jasmine/doc/symbols/jasmine.Suite.html +705 -0
- data/lib/jasmine/doc/symbols/jasmine.html +1345 -0
- data/lib/jasmine/doc/symbols/jasmine.util.html +535 -0
- data/lib/jasmine/doc/symbols/src/lib_TrivialReporter.js.html +124 -0
- data/lib/jasmine/doc/symbols/src/src_Block.js.html +29 -0
- data/lib/jasmine/doc/symbols/src/src_Env.js.html +248 -0
- data/lib/jasmine/doc/symbols/src/src_JsApiReporter.js.html +111 -0
- data/lib/jasmine/doc/symbols/src/src_Matchers.js.html +344 -0
- data/lib/jasmine/doc/symbols/src/src_MultiReporter.js.html +36 -0
- data/lib/jasmine/doc/symbols/src/src_NestedResults.js.html +88 -0
- data/lib/jasmine/doc/symbols/src/src_PrettyPrinter.js.html +130 -0
- data/lib/jasmine/doc/symbols/src/src_Queue.js.html +102 -0
- data/lib/jasmine/doc/symbols/src/src_Reporter.js.html +35 -0
- data/lib/jasmine/doc/symbols/src/src_Reporters.js.html +51 -0
- data/lib/jasmine/doc/symbols/src/src_Runner.js.html +75 -0
- data/lib/jasmine/doc/symbols/src/src_Spec.js.html +214 -0
- data/lib/jasmine/doc/symbols/src/src_Suite.js.html +77 -0
- data/lib/jasmine/doc/symbols/src/src_WaitsBlock.js.html +21 -0
- data/lib/jasmine/doc/symbols/src/src_WaitsForBlock.js.html +45 -0
- data/lib/jasmine/doc/symbols/src/src_base.js.html +585 -0
- data/lib/jasmine/doc/symbols/src/src_mock-timeout.js.html +185 -0
- data/lib/jasmine/doc/symbols/src/src_util.js.html +75 -0
- data/lib/jasmine/example/example_runner.html +22 -0
- data/lib/jasmine/example/spec/example_suite.js +11 -0
- data/lib/jasmine/images/fail-16.png +0 -0
- data/lib/jasmine/images/fail.png +0 -0
- data/lib/jasmine/images/go-16.png +0 -0
- data/lib/jasmine/images/go.png +0 -0
- data/lib/jasmine/images/pending-16.png +0 -0
- data/lib/jasmine/images/pending.png +0 -0
- data/lib/jasmine/images/question-bk.png +0 -0
- data/lib/jasmine/images/questionbk-16.png +0 -0
- data/lib/jasmine/images/spinner.gif +0 -0
- data/lib/jasmine/lib/TrivialReporter.js +171 -0
- data/lib/jasmine/lib/consolex.js +28 -0
- data/lib/jasmine/lib/jasmine-0.10.4.js +2371 -0
- data/lib/jasmine/lib/jasmine.css +166 -0
- data/lib/jasmine/lib/json2.js +478 -0
- data/lib/jasmine/spec/jasmine_helper.rb +44 -0
- data/lib/jasmine/spec/jasmine_spec.rb +31 -0
- data/lib/jasmine/spec/runner.html +80 -0
- data/lib/jasmine/spec/saucelabs.yml +24 -0
- data/lib/jasmine/spec/suites/CustomMatchersSpec.js +112 -0
- data/lib/jasmine/spec/suites/EnvSpec.js +158 -0
- data/lib/jasmine/spec/suites/ExceptionsSpec.js +107 -0
- data/lib/jasmine/spec/suites/JsApiReporterSpec.js +96 -0
- data/lib/jasmine/spec/suites/MatchersSpec.js +709 -0
- data/lib/jasmine/spec/suites/MockClockSpec.js +34 -0
- data/lib/jasmine/spec/suites/MultiReporterSpec.js +30 -0
- data/lib/jasmine/spec/suites/NestedResultsSpec.js +54 -0
- data/lib/jasmine/spec/suites/PrettyPrintSpec.js +93 -0
- data/lib/jasmine/spec/suites/QueueSpec.js +23 -0
- data/lib/jasmine/spec/suites/ReporterSpec.js +60 -0
- data/lib/jasmine/spec/suites/RunnerSpec.js +267 -0
- data/lib/jasmine/spec/suites/SpecRunningSpec.js +1195 -0
- data/lib/jasmine/spec/suites/SpecSpec.js +110 -0
- data/lib/jasmine/spec/suites/SpySpec.js +201 -0
- data/lib/jasmine/spec/suites/SuiteSpec.js +120 -0
- data/lib/jasmine/spec/suites/TrivialReporterSpec.js +158 -0
- data/lib/jasmine/spec/suites/UtilSpec.js +40 -0
- data/lib/jasmine/spec/suites/WaitsForBlockSpec.js +88 -0
- data/lib/jasmine/src/Block.js +22 -0
- data/lib/jasmine/src/Env.js +263 -0
- data/lib/jasmine/src/JsApiReporter.js +104 -0
- data/lib/jasmine/src/Matchers.js +336 -0
- data/lib/jasmine/src/MultiReporter.js +28 -0
- data/lib/jasmine/src/NestedResults.js +80 -0
- data/lib/jasmine/src/PrettyPrinter.js +122 -0
- data/lib/jasmine/src/Queue.js +94 -0
- data/lib/jasmine/src/Reporter.js +27 -0
- data/lib/jasmine/src/Reporters.js +43 -0
- data/lib/jasmine/src/Runner.js +77 -0
- data/lib/jasmine/src/Spec.js +206 -0
- data/lib/jasmine/src/Suite.js +82 -0
- data/lib/jasmine/src/WaitsBlock.js +13 -0
- data/lib/jasmine/src/WaitsForBlock.js +37 -0
- data/lib/jasmine/src/base.js +586 -0
- data/lib/jasmine/src/mock-timeout.js +177 -0
- data/lib/jasmine/src/util.js +67 -0
- data/lib/jasmine/src/version.json +5 -0
- metadata +238 -0
@@ -0,0 +1,185 @@
|
|
1
|
+
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
|
2
|
+
.KEYW {color: #933;}
|
3
|
+
.COMM {color: #bbb; font-style: italic;}
|
4
|
+
.NUMB {color: #393;}
|
5
|
+
.STRN {color: #393;}
|
6
|
+
.REGX {color: #339;}
|
7
|
+
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
8
|
+
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">// Mock setTimeout, clearTimeout</span><span class="WHIT">
|
9
|
+
<span class='line'> 2</span> </span><span class="COMM">// Contributed by Pivotal Computer Systems, www.pivotalsf.com</span><span class="WHIT">
|
10
|
+
<span class='line'> 3</span>
|
11
|
+
<span class='line'> 4</span> </span><span class="NAME">jasmine.FakeTimer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
12
|
+
<span class='line'> 5</span> </span><span class="WHIT"> </span><span class="NAME">this.reset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
13
|
+
<span class='line'> 6</span>
|
14
|
+
<span class='line'> 7</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
|
15
|
+
<span class='line'> 8</span> </span><span class="WHIT"> </span><span class="NAME">self.setTimeout</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">funcToCall</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
16
|
+
<span class='line'> 9</span> </span><span class="WHIT"> </span><span class="NAME">self.timeoutsMade</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="WHIT">
|
17
|
+
<span class='line'> 10</span> </span><span class="WHIT"> </span><span class="NAME">self.scheduleFunction</span><span class="PUNC">(</span><span class="NAME">self.timeoutsMade</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">funcToCall</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
18
|
+
<span class='line'> 11</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self.timeoutsMade</span><span class="PUNC">;</span><span class="WHIT">
|
19
|
+
<span class='line'> 12</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
20
|
+
<span class='line'> 13</span>
|
21
|
+
<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="NAME">self.setInterval</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">funcToCall</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
22
|
+
<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="NAME">self.timeoutsMade</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="WHIT">
|
23
|
+
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="NAME">self.scheduleFunction</span><span class="PUNC">(</span><span class="NAME">self.timeoutsMade</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">funcToCall</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
24
|
+
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self.timeoutsMade</span><span class="PUNC">;</span><span class="WHIT">
|
25
|
+
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
26
|
+
<span class='line'> 19</span>
|
27
|
+
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="NAME">self.clearTimeout</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">timeoutKey</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
28
|
+
<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="NAME">self.scheduledFunctions</span><span class="PUNC">[</span><span class="NAME">timeoutKey</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.undefined</span><span class="PUNC">;</span><span class="WHIT">
|
29
|
+
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
30
|
+
<span class='line'> 23</span>
|
31
|
+
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="NAME">self.clearInterval</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">timeoutKey</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
32
|
+
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="NAME">self.scheduledFunctions</span><span class="PUNC">[</span><span class="NAME">timeoutKey</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.undefined</span><span class="PUNC">;</span><span class="WHIT">
|
33
|
+
<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
34
|
+
<span class='line'> 27</span>
|
35
|
+
<span class='line'> 28</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
36
|
+
<span class='line'> 29</span>
|
37
|
+
<span class='line'> 30</span> </span><span class="NAME">jasmine.FakeTimer.prototype.reset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
38
|
+
<span class='line'> 31</span> </span><span class="WHIT"> </span><span class="NAME">this.timeoutsMade</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
39
|
+
<span class='line'> 32</span> </span><span class="WHIT"> </span><span class="NAME">this.scheduledFunctions</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
40
|
+
<span class='line'> 33</span> </span><span class="WHIT"> </span><span class="NAME">this.nowMillis</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
41
|
+
<span class='line'> 34</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
42
|
+
<span class='line'> 35</span>
|
43
|
+
<span class='line'> 36</span> </span><span class="NAME">jasmine.FakeTimer.prototype.tick</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">millis</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
44
|
+
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oldMillis</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.nowMillis</span><span class="PUNC">;</span><span class="WHIT">
|
45
|
+
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">newMillis</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oldMillis</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">;</span><span class="WHIT">
|
46
|
+
<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="NAME">this.runFunctionsWithinRange</span><span class="PUNC">(</span><span class="NAME">oldMillis</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">newMillis</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
47
|
+
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="NAME">this.nowMillis</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">newMillis</span><span class="PUNC">;</span><span class="WHIT">
|
48
|
+
<span class='line'> 41</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
49
|
+
<span class='line'> 42</span>
|
50
|
+
<span class='line'> 43</span> </span><span class="NAME">jasmine.FakeTimer.prototype.runFunctionsWithinRange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oldMillis</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nowMillis</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
51
|
+
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">scheduledFunc</span><span class="PUNC">;</span><span class="WHIT">
|
52
|
+
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">funcsToRun</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
53
|
+
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">timeoutKey</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">this.scheduledFunctions</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
54
|
+
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="NAME">scheduledFunc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.scheduledFunctions</span><span class="PUNC">[</span><span class="NAME">timeoutKey</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
55
|
+
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">scheduledFunc</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">jasmine.undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
|
56
|
+
<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="NAME">scheduledFunc.runAtMillis</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">oldMillis</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
|
57
|
+
<span class='line'> 50</span> </span><span class="WHIT"> </span><span class="NAME">scheduledFunc.runAtMillis</span><span class="WHIT"> </span><span class="PUNC"><=</span><span class="WHIT"> </span><span class="NAME">nowMillis</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
58
|
+
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="NAME">funcsToRun.push</span><span class="PUNC">(</span><span class="NAME">scheduledFunc</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
59
|
+
<span class='line'> 52</span> </span><span class="WHIT"> </span><span class="NAME">this.scheduledFunctions</span><span class="PUNC">[</span><span class="NAME">timeoutKey</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.undefined</span><span class="PUNC">;</span><span class="WHIT">
|
60
|
+
<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
61
|
+
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
62
|
+
<span class='line'> 55</span>
|
63
|
+
<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">funcsToRun.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
64
|
+
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="NAME">funcsToRun.sort</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">b</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
65
|
+
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">a.runAtMillis</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">b.runAtMillis</span><span class="PUNC">;</span><span class="WHIT">
|
66
|
+
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
67
|
+
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">funcsToRun.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
68
|
+
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
69
|
+
<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">funcToRun</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">funcsToRun</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
70
|
+
<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="NAME">this.nowMillis</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">funcToRun.runAtMillis</span><span class="PUNC">;</span><span class="WHIT">
|
71
|
+
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="NAME">funcToRun.funcToCall</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
72
|
+
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">funcToRun.recurring</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
73
|
+
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="NAME">this.scheduleFunction</span><span class="PUNC">(</span><span class="NAME">funcToRun.timeoutKey</span><span class="PUNC">,</span><span class="WHIT">
|
74
|
+
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="NAME">funcToRun.funcToCall</span><span class="PUNC">,</span><span class="WHIT">
|
75
|
+
<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="NAME">funcToRun.millis</span><span class="PUNC">,</span><span class="WHIT">
|
76
|
+
<span class='line'> 69</span> </span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
77
|
+
<span class='line'> 70</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
78
|
+
<span class='line'> 71</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
79
|
+
<span class='line'> 72</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
80
|
+
<span class='line'> 73</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
81
|
+
<span class='line'> 74</span> </span><span class="WHIT"> </span><span class="NAME">this.runFunctionsWithinRange</span><span class="PUNC">(</span><span class="NAME">oldMillis</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nowMillis</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
82
|
+
<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
83
|
+
<span class='line'> 76</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
84
|
+
<span class='line'> 77</span>
|
85
|
+
<span class='line'> 78</span> </span><span class="NAME">jasmine.FakeTimer.prototype.scheduleFunction</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">timeoutKey</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">funcToCall</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">recurring</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
86
|
+
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="NAME">this.scheduledFunctions</span><span class="PUNC">[</span><span class="NAME">timeoutKey</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
87
|
+
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="NAME">runAtMillis</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.nowMillis</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">,</span><span class="WHIT">
|
88
|
+
<span class='line'> 81</span> </span><span class="WHIT"> </span><span class="NAME">funcToCall</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">funcToCall</span><span class="PUNC">,</span><span class="WHIT">
|
89
|
+
<span class='line'> 82</span> </span><span class="WHIT"> </span><span class="NAME">recurring</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">recurring</span><span class="PUNC">,</span><span class="WHIT">
|
90
|
+
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="NAME">timeoutKey</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">timeoutKey</span><span class="PUNC">,</span><span class="WHIT">
|
91
|
+
<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="WHIT">
|
92
|
+
<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
93
|
+
<span class='line'> 86</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
94
|
+
<span class='line'> 87</span>
|
95
|
+
<span class='line'> 88</span> </span><span class="COMM">/**
|
96
|
+
<span class='line'> 89</span> * @namespace
|
97
|
+
<span class='line'> 90</span> */</span><span class="WHIT">
|
98
|
+
<span class='line'> 91</span> </span><span class="NAME">jasmine.Clock</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
99
|
+
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="NAME">defaultFakeTimer</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">jasmine.FakeTimer</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
100
|
+
<span class='line'> 93</span>
|
101
|
+
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="NAME">reset</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
102
|
+
<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.assertInstalled</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
103
|
+
<span class='line'> 96</span> </span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.defaultFakeTimer.reset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
104
|
+
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
105
|
+
<span class='line'> 98</span>
|
106
|
+
<span class='line'> 99</span> </span><span class="WHIT"> </span><span class="NAME">tick</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">millis</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
107
|
+
<span class='line'>100</span> </span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.assertInstalled</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
108
|
+
<span class='line'>101</span> </span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.defaultFakeTimer.tick</span><span class="PUNC">(</span><span class="NAME">millis</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
109
|
+
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
110
|
+
<span class='line'>103</span>
|
111
|
+
<span class='line'>104</span> </span><span class="WHIT"> </span><span class="NAME">runFunctionsWithinRange</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oldMillis</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nowMillis</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
112
|
+
<span class='line'>105</span> </span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange</span><span class="PUNC">(</span><span class="NAME">oldMillis</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nowMillis</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
113
|
+
<span class='line'>106</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
114
|
+
<span class='line'>107</span>
|
115
|
+
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="NAME">scheduleFunction</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">timeoutKey</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">funcToCall</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">recurring</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
116
|
+
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.defaultFakeTimer.scheduleFunction</span><span class="PUNC">(</span><span class="NAME">timeoutKey</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">funcToCall</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">recurring</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
117
|
+
<span class='line'>110</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
118
|
+
<span class='line'>111</span>
|
119
|
+
<span class='line'>112</span> </span><span class="WHIT"> </span><span class="NAME">useMock</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
120
|
+
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">spec</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.getEnv</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">currentSpec</span><span class="PUNC">;</span><span class="WHIT">
|
121
|
+
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="NAME">spec.after</span><span class="PUNC">(</span><span class="NAME">jasmine.Clock.uninstallMock</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
122
|
+
<span class='line'>115</span>
|
123
|
+
<span class='line'>116</span> </span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.installMock</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
124
|
+
<span class='line'>117</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
125
|
+
<span class='line'>118</span>
|
126
|
+
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="NAME">installMock</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
127
|
+
<span class='line'>120</span> </span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.installed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.defaultFakeTimer</span><span class="PUNC">;</span><span class="WHIT">
|
128
|
+
<span class='line'>121</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
129
|
+
<span class='line'>122</span>
|
130
|
+
<span class='line'>123</span> </span><span class="WHIT"> </span><span class="NAME">uninstallMock</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
131
|
+
<span class='line'>124</span> </span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.assertInstalled</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
132
|
+
<span class='line'>125</span> </span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.installed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.real</span><span class="PUNC">;</span><span class="WHIT">
|
133
|
+
<span class='line'>126</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
134
|
+
<span class='line'>127</span>
|
135
|
+
<span class='line'>128</span> </span><span class="WHIT"> </span><span class="NAME">real</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
136
|
+
<span class='line'>129</span> </span><span class="WHIT"> </span><span class="NAME">setTimeout</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">window.setTimeout</span><span class="PUNC">,</span><span class="WHIT">
|
137
|
+
<span class='line'>130</span> </span><span class="WHIT"> </span><span class="NAME">clearTimeout</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">window.clearTimeout</span><span class="PUNC">,</span><span class="WHIT">
|
138
|
+
<span class='line'>131</span> </span><span class="WHIT"> </span><span class="NAME">setInterval</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">window.setInterval</span><span class="PUNC">,</span><span class="WHIT">
|
139
|
+
<span class='line'>132</span> </span><span class="WHIT"> </span><span class="NAME">clearInterval</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">window.clearInterval</span><span class="WHIT">
|
140
|
+
<span class='line'>133</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
141
|
+
<span class='line'>134</span>
|
142
|
+
<span class='line'>135</span> </span><span class="WHIT"> </span><span class="NAME">assertInstalled</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
143
|
+
<span class='line'>136</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">jasmine.Clock.installed</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.defaultFakeTimer</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
144
|
+
<span class='line'>137</span> </span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">"Mock clock is not installed, use jasmine.Clock.useMock()"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
145
|
+
<span class='line'>138</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
146
|
+
<span class='line'>139</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
147
|
+
<span class='line'>140</span>
|
148
|
+
<span class='line'>141</span> </span><span class="WHIT"> </span><span class="NAME">installed</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT">
|
149
|
+
<span class='line'>142</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
150
|
+
<span class='line'>143</span> </span><span class="NAME">jasmine.Clock.installed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.real</span><span class="PUNC">;</span><span class="WHIT">
|
151
|
+
<span class='line'>144</span>
|
152
|
+
<span class='line'>145</span> </span><span class="COMM">//else for IE support</span><span class="WHIT">
|
153
|
+
<span class='line'>146</span> </span><span class="NAME">window.setTimeout</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">funcToCall</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
154
|
+
<span class='line'>147</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">jasmine.Clock.installed.setTimeout.apply</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
155
|
+
<span class='line'>148</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.installed.setTimeout.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
156
|
+
<span class='line'>149</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
157
|
+
<span class='line'>150</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.installed.setTimeout</span><span class="PUNC">(</span><span class="NAME">funcToCall</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
158
|
+
<span class='line'>151</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
159
|
+
<span class='line'>152</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
160
|
+
<span class='line'>153</span>
|
161
|
+
<span class='line'>154</span> </span><span class="NAME">window.setInterval</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">funcToCall</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
162
|
+
<span class='line'>155</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">jasmine.Clock.installed.setInterval.apply</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
163
|
+
<span class='line'>156</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.installed.setInterval.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
164
|
+
<span class='line'>157</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
165
|
+
<span class='line'>158</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.installed.setInterval</span><span class="PUNC">(</span><span class="NAME">funcToCall</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">millis</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
166
|
+
<span class='line'>159</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
167
|
+
<span class='line'>160</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
168
|
+
<span class='line'>161</span>
|
169
|
+
<span class='line'>162</span> </span><span class="NAME">window.clearTimeout</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">timeoutKey</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
170
|
+
<span class='line'>163</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">jasmine.Clock.installed.clearTimeout.apply</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
171
|
+
<span class='line'>164</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.installed.clearTimeout.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
172
|
+
<span class='line'>165</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
173
|
+
<span class='line'>166</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.installed.clearTimeout</span><span class="PUNC">(</span><span class="NAME">timeoutKey</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
174
|
+
<span class='line'>167</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
175
|
+
<span class='line'>168</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
176
|
+
<span class='line'>169</span>
|
177
|
+
<span class='line'>170</span> </span><span class="NAME">window.clearInterval</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">timeoutKey</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
178
|
+
<span class='line'>171</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">jasmine.Clock.installed.clearTimeout.apply</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
179
|
+
<span class='line'>172</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.installed.clearInterval.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
180
|
+
<span class='line'>173</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
181
|
+
<span class='line'>174</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jasmine.Clock.installed.clearInterval</span><span class="PUNC">(</span><span class="NAME">timeoutKey</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
182
|
+
<span class='line'>175</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
183
|
+
<span class='line'>176</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
184
|
+
<span class='line'>177</span>
|
185
|
+
<span class='line'>178</span> </span></pre></body></html>
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
|
2
|
+
.KEYW {color: #933;}
|
3
|
+
.COMM {color: #bbb; font-style: italic;}
|
4
|
+
.NUMB {color: #393;}
|
5
|
+
.STRN {color: #393;}
|
6
|
+
.REGX {color: #339;}
|
7
|
+
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
8
|
+
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/**
|
9
|
+
<span class='line'> 2</span> * @namespace
|
10
|
+
<span class='line'> 3</span> */</span><span class="WHIT">
|
11
|
+
<span class='line'> 4</span> </span><span class="NAME">jasmine.util</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
12
|
+
<span class='line'> 5</span>
|
13
|
+
<span class='line'> 6</span> </span><span class="COMM">/**
|
14
|
+
<span class='line'> 7</span> * Declare that a child class inherit it's prototype from the parent class.
|
15
|
+
<span class='line'> 8</span> *
|
16
|
+
<span class='line'> 9</span> * @private
|
17
|
+
<span class='line'> 10</span> * @param {Function} childClass
|
18
|
+
<span class='line'> 11</span> * @param {Function} parentClass
|
19
|
+
<span class='line'> 12</span> */</span><span class="WHIT">
|
20
|
+
<span class='line'> 13</span> </span><span class="NAME">jasmine.util.inherit</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">childClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">parentClass</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
21
|
+
<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
22
|
+
<span class='line'> 15</span> * @private
|
23
|
+
<span class='line'> 16</span> */</span><span class="WHIT">
|
24
|
+
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">subclass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
25
|
+
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
26
|
+
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="NAME">subclass.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parentClass.prototype</span><span class="PUNC">;</span><span class="WHIT">
|
27
|
+
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="NAME">childClass.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">subclass</span><span class="PUNC">;</span><span class="WHIT">
|
28
|
+
<span class='line'> 21</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
29
|
+
<span class='line'> 22</span>
|
30
|
+
<span class='line'> 23</span> </span><span class="NAME">jasmine.util.formatException</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
31
|
+
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">lineNumber</span><span class="PUNC">;</span><span class="WHIT">
|
32
|
+
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e.line</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
33
|
+
<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="NAME">lineNumber</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.line</span><span class="PUNC">;</span><span class="WHIT">
|
34
|
+
<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
35
|
+
<span class='line'> 28</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e.lineNumber</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
36
|
+
<span class='line'> 29</span> </span><span class="WHIT"> </span><span class="NAME">lineNumber</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.lineNumber</span><span class="PUNC">;</span><span class="WHIT">
|
37
|
+
<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
38
|
+
<span class='line'> 31</span>
|
39
|
+
<span class='line'> 32</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">file</span><span class="PUNC">;</span><span class="WHIT">
|
40
|
+
<span class='line'> 33</span>
|
41
|
+
<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e.sourceURL</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
42
|
+
<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.sourceURL</span><span class="PUNC">;</span><span class="WHIT">
|
43
|
+
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
44
|
+
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e.fileName</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
45
|
+
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.fileName</span><span class="PUNC">;</span><span class="WHIT">
|
46
|
+
<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
47
|
+
<span class='line'> 40</span>
|
48
|
+
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">message</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e.name</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">e.message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e.name</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">': '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">e.message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">e.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
49
|
+
<span class='line'> 42</span>
|
50
|
+
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">lineNumber</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
51
|
+
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="NAME">message</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">' in '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">' (line '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">lineNumber</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">')'</span><span class="PUNC">;</span><span class="WHIT">
|
52
|
+
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
53
|
+
<span class='line'> 46</span>
|
54
|
+
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">;</span><span class="WHIT">
|
55
|
+
<span class='line'> 48</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
56
|
+
<span class='line'> 49</span>
|
57
|
+
<span class='line'> 50</span> </span><span class="NAME">jasmine.util.htmlEscape</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
58
|
+
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">;</span><span class="WHIT">
|
59
|
+
<span class='line'> 52</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">str.replace</span><span class="PUNC">(</span><span class="REGX">/&/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'&'</span><span class="PUNC">)</span><span class="WHIT">
|
60
|
+
<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/</g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'<'</span><span class="PUNC">)</span><span class="WHIT">
|
61
|
+
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/>/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'>'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
62
|
+
<span class='line'> 55</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
63
|
+
<span class='line'> 56</span>
|
64
|
+
<span class='line'> 57</span> </span><span class="NAME">jasmine.util.argsToArray</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">args</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
65
|
+
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">arrayOfArgs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
66
|
+
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">args.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">arrayOfArgs.push</span><span class="PUNC">(</span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
67
|
+
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">arrayOfArgs</span><span class="PUNC">;</span><span class="WHIT">
|
68
|
+
<span class='line'> 61</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
69
|
+
<span class='line'> 62</span>
|
70
|
+
<span class='line'> 63</span> </span><span class="NAME">jasmine.util.extend</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">destination</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
71
|
+
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">property</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">destination</span><span class="PUNC">[</span><span class="NAME">property</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">[</span><span class="NAME">property</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
72
|
+
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">destination</span><span class="PUNC">;</span><span class="WHIT">
|
73
|
+
<span class='line'> 66</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
74
|
+
<span class='line'> 67</span>
|
75
|
+
<span class='line'> 68</span> </span></pre></body></html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>Jasmine Test Runner</title>
|
6
|
+
<link rel="stylesheet" type="text/css" href="../lib/jasmine.css">
|
7
|
+
<script type="text/javascript" src="../lib/jasmine-0.10.4.js"></script>
|
8
|
+
<script type="text/javascript" src="../lib/TrivialReporter.js"></script>
|
9
|
+
<script type="text/javascript" src="../lib/consolex.js"></script>
|
10
|
+
<script type="text/javascript" src="spec/example_suite.js"></script>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<script type="text/javascript">
|
14
|
+
var jasmineEnv = jasmine.getEnv();
|
15
|
+
jasmineEnv.reporter = new jasmine.TrivialReporter();
|
16
|
+
jasmineEnv.execute();
|
17
|
+
</script>
|
18
|
+
|
19
|
+
</body>
|
20
|
+
</html>
|
21
|
+
|
22
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
describe('ExampleSuite', function () {
|
2
|
+
it('should have a passing test', function() {
|
3
|
+
expect(true).toEqual(true);
|
4
|
+
});
|
5
|
+
|
6
|
+
describe('Nested Describe', function () {
|
7
|
+
it('should also have a passing test', function () {
|
8
|
+
expect(true).toEqual(true);
|
9
|
+
});
|
10
|
+
});
|
11
|
+
});
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,171 @@
|
|
1
|
+
jasmine.TrivialReporter = function(doc) {
|
2
|
+
this.document = doc || document;
|
3
|
+
this.suiteDivs = {};
|
4
|
+
};
|
5
|
+
|
6
|
+
jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
|
7
|
+
var el = document.createElement(type);
|
8
|
+
|
9
|
+
for (var i = 2; i < arguments.length; i++) {
|
10
|
+
var child = arguments[i];
|
11
|
+
|
12
|
+
if (typeof child === 'string') {
|
13
|
+
el.appendChild(document.createTextNode(child));
|
14
|
+
} else {
|
15
|
+
if (child) { el.appendChild(child); }
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
for (var attr in attrs) {
|
20
|
+
if (attr == "className") {
|
21
|
+
el[attr] = attrs[attr];
|
22
|
+
} else {
|
23
|
+
el.setAttribute(attr, attrs[attr]);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
return el;
|
28
|
+
};
|
29
|
+
|
30
|
+
jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
|
31
|
+
var showPassed, showSkipped;
|
32
|
+
|
33
|
+
this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
|
34
|
+
this.createDom('div', { className: 'banner' },
|
35
|
+
this.createDom('div', { className: 'logo' },
|
36
|
+
"Jasmine",
|
37
|
+
this.createDom('span', { className: 'version' }, runner.env.versionString())),
|
38
|
+
this.createDom('div', { className: 'options' },
|
39
|
+
"Show ",
|
40
|
+
showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
|
41
|
+
this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
|
42
|
+
showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
|
43
|
+
this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
|
44
|
+
)
|
45
|
+
),
|
46
|
+
|
47
|
+
this.runnerDiv = this.createDom('div', { className: 'runner running' },
|
48
|
+
this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
|
49
|
+
this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
|
50
|
+
this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
|
51
|
+
);
|
52
|
+
|
53
|
+
this.document.body.appendChild(this.outerDiv);
|
54
|
+
|
55
|
+
var suites = runner.suites();
|
56
|
+
for (var i = 0; i < suites.length; i++) {
|
57
|
+
var suite = suites[i];
|
58
|
+
var suiteDiv = this.createDom('div', { className: 'suite' },
|
59
|
+
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
|
60
|
+
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
|
61
|
+
this.suiteDivs[suite.getFullName()] = suiteDiv;
|
62
|
+
var parentDiv = this.outerDiv;
|
63
|
+
if (suite.parentSuite) {
|
64
|
+
parentDiv = this.suiteDivs[suite.parentSuite.getFullName()];
|
65
|
+
}
|
66
|
+
parentDiv.appendChild(suiteDiv);
|
67
|
+
}
|
68
|
+
|
69
|
+
this.startedAt = new Date();
|
70
|
+
|
71
|
+
var self = this;
|
72
|
+
showPassed.onchange = function(evt) {
|
73
|
+
if (evt.target.checked) {
|
74
|
+
self.outerDiv.className += ' show-passed';
|
75
|
+
} else {
|
76
|
+
self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
|
77
|
+
}
|
78
|
+
};
|
79
|
+
|
80
|
+
showSkipped.onchange = function(evt) {
|
81
|
+
if (evt.target.checked) {
|
82
|
+
self.outerDiv.className += ' show-skipped';
|
83
|
+
} else {
|
84
|
+
self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
|
85
|
+
}
|
86
|
+
};
|
87
|
+
};
|
88
|
+
|
89
|
+
jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
|
90
|
+
var results = runner.results();
|
91
|
+
var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
|
92
|
+
this.runnerDiv.setAttribute("class", className);
|
93
|
+
//do it twice for IE
|
94
|
+
this.runnerDiv.setAttribute("className", className);
|
95
|
+
var specs = runner.specs();
|
96
|
+
var specCount = 0;
|
97
|
+
for (var i = 0; i < specs.length; i++) {
|
98
|
+
if (this.specFilter(specs[i])) {
|
99
|
+
specCount++;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
|
103
|
+
message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
|
104
|
+
this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
|
105
|
+
|
106
|
+
this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
|
107
|
+
};
|
108
|
+
|
109
|
+
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
110
|
+
var results = suite.results();
|
111
|
+
var status = results.passed() ? 'passed' : 'failed';
|
112
|
+
if (results.totalCount == 0) { // todo: change this to check results.skipped
|
113
|
+
status = 'skipped';
|
114
|
+
}
|
115
|
+
this.suiteDivs[suite.getFullName()].className += " " + status;
|
116
|
+
};
|
117
|
+
|
118
|
+
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
|
119
|
+
var results = spec.results();
|
120
|
+
var status = results.passed() ? 'passed' : 'failed';
|
121
|
+
if (results.skipped) {
|
122
|
+
status = 'skipped';
|
123
|
+
}
|
124
|
+
var specDiv = this.createDom('div', { className: 'spec ' + status },
|
125
|
+
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
|
126
|
+
this.createDom('a', {
|
127
|
+
className: 'description',
|
128
|
+
href: '?spec=' + encodeURIComponent(spec.getFullName()),
|
129
|
+
title: spec.getFullName()
|
130
|
+
}, spec.description));
|
131
|
+
|
132
|
+
|
133
|
+
var resultItems = results.getItems();
|
134
|
+
var messagesDiv = this.createDom('div', { className: 'messages' });
|
135
|
+
for (var i = 0; i < resultItems.length; i++) {
|
136
|
+
var result = resultItems[i];
|
137
|
+
if (result.passed && !result.passed()) {
|
138
|
+
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
|
139
|
+
|
140
|
+
if (result.trace.stack) {
|
141
|
+
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
if (messagesDiv.childNodes.length > 0) {
|
147
|
+
specDiv.appendChild(messagesDiv);
|
148
|
+
}
|
149
|
+
|
150
|
+
this.suiteDivs[spec.suite.getFullName()].appendChild(specDiv);
|
151
|
+
};
|
152
|
+
|
153
|
+
jasmine.TrivialReporter.prototype.log = function() {
|
154
|
+
console.log.apply(console, arguments);
|
155
|
+
};
|
156
|
+
|
157
|
+
jasmine.TrivialReporter.prototype.getLocation = function() {
|
158
|
+
return this.document.location;
|
159
|
+
};
|
160
|
+
|
161
|
+
jasmine.TrivialReporter.prototype.specFilter = function(spec) {
|
162
|
+
var paramMap = {};
|
163
|
+
var params = this.getLocation().search.substring(1).split('&');
|
164
|
+
for (var i = 0; i < params.length; i++) {
|
165
|
+
var p = params[i].split('=');
|
166
|
+
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
|
167
|
+
}
|
168
|
+
|
169
|
+
if (!paramMap["spec"]) return true;
|
170
|
+
return spec.getFullName().indexOf(paramMap["spec"]) == 0;
|
171
|
+
};
|