evergreen 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/README.rdoc +4 -0
  2. data/bin/evergreen +18 -0
  3. data/lib/evergreen.rb +44 -0
  4. data/lib/evergreen/cli.rb +23 -0
  5. data/lib/evergreen/evergreen.js +3 -0
  6. data/lib/evergreen/runner.rb +56 -0
  7. data/lib/evergreen/server.rb +31 -0
  8. data/lib/evergreen/spec.rb +60 -0
  9. data/lib/evergreen/version.rb +3 -0
  10. data/lib/evergreen/views/list.erb +6 -0
  11. data/lib/evergreen/views/spec.erb +37 -0
  12. data/lib/jasmine/MIT.LICENSE +20 -0
  13. data/lib/jasmine/README.markdown +489 -0
  14. data/lib/jasmine/Rakefile +146 -0
  15. data/lib/jasmine/cruise_config.rb +21 -0
  16. data/lib/jasmine/doc/files.html +460 -0
  17. data/lib/jasmine/doc/index.html +322 -0
  18. data/lib/jasmine/doc/symbols/_global_.html +918 -0
  19. data/lib/jasmine/doc/symbols/jasmine.Block.html +417 -0
  20. data/lib/jasmine/doc/symbols/jasmine.Clock.html +678 -0
  21. data/lib/jasmine/doc/symbols/jasmine.Env.html +1169 -0
  22. data/lib/jasmine/doc/symbols/jasmine.JsApiReporter.html +822 -0
  23. data/lib/jasmine/doc/symbols/jasmine.Matchers.html +1474 -0
  24. data/lib/jasmine/doc/symbols/jasmine.MultiReporter.html +394 -0
  25. data/lib/jasmine/doc/symbols/jasmine.NestedResults.html +710 -0
  26. data/lib/jasmine/doc/symbols/jasmine.Reporter.html +574 -0
  27. data/lib/jasmine/doc/symbols/jasmine.Runner.html +710 -0
  28. data/lib/jasmine/doc/symbols/jasmine.Spec.html +1253 -0
  29. data/lib/jasmine/doc/symbols/jasmine.Spy.html +855 -0
  30. data/lib/jasmine/doc/symbols/jasmine.Suite.html +705 -0
  31. data/lib/jasmine/doc/symbols/jasmine.html +1345 -0
  32. data/lib/jasmine/doc/symbols/jasmine.util.html +535 -0
  33. data/lib/jasmine/doc/symbols/src/lib_TrivialReporter.js.html +124 -0
  34. data/lib/jasmine/doc/symbols/src/src_Block.js.html +29 -0
  35. data/lib/jasmine/doc/symbols/src/src_Env.js.html +248 -0
  36. data/lib/jasmine/doc/symbols/src/src_JsApiReporter.js.html +111 -0
  37. data/lib/jasmine/doc/symbols/src/src_Matchers.js.html +344 -0
  38. data/lib/jasmine/doc/symbols/src/src_MultiReporter.js.html +36 -0
  39. data/lib/jasmine/doc/symbols/src/src_NestedResults.js.html +88 -0
  40. data/lib/jasmine/doc/symbols/src/src_PrettyPrinter.js.html +130 -0
  41. data/lib/jasmine/doc/symbols/src/src_Queue.js.html +102 -0
  42. data/lib/jasmine/doc/symbols/src/src_Reporter.js.html +35 -0
  43. data/lib/jasmine/doc/symbols/src/src_Reporters.js.html +51 -0
  44. data/lib/jasmine/doc/symbols/src/src_Runner.js.html +75 -0
  45. data/lib/jasmine/doc/symbols/src/src_Spec.js.html +214 -0
  46. data/lib/jasmine/doc/symbols/src/src_Suite.js.html +77 -0
  47. data/lib/jasmine/doc/symbols/src/src_WaitsBlock.js.html +21 -0
  48. data/lib/jasmine/doc/symbols/src/src_WaitsForBlock.js.html +45 -0
  49. data/lib/jasmine/doc/symbols/src/src_base.js.html +585 -0
  50. data/lib/jasmine/doc/symbols/src/src_mock-timeout.js.html +185 -0
  51. data/lib/jasmine/doc/symbols/src/src_util.js.html +75 -0
  52. data/lib/jasmine/example/example_runner.html +22 -0
  53. data/lib/jasmine/example/spec/example_suite.js +11 -0
  54. data/lib/jasmine/images/fail-16.png +0 -0
  55. data/lib/jasmine/images/fail.png +0 -0
  56. data/lib/jasmine/images/go-16.png +0 -0
  57. data/lib/jasmine/images/go.png +0 -0
  58. data/lib/jasmine/images/pending-16.png +0 -0
  59. data/lib/jasmine/images/pending.png +0 -0
  60. data/lib/jasmine/images/question-bk.png +0 -0
  61. data/lib/jasmine/images/questionbk-16.png +0 -0
  62. data/lib/jasmine/images/spinner.gif +0 -0
  63. data/lib/jasmine/lib/TrivialReporter.js +171 -0
  64. data/lib/jasmine/lib/consolex.js +28 -0
  65. data/lib/jasmine/lib/jasmine-0.10.4.js +2371 -0
  66. data/lib/jasmine/lib/jasmine.css +166 -0
  67. data/lib/jasmine/lib/json2.js +478 -0
  68. data/lib/jasmine/spec/jasmine_helper.rb +44 -0
  69. data/lib/jasmine/spec/jasmine_spec.rb +31 -0
  70. data/lib/jasmine/spec/runner.html +80 -0
  71. data/lib/jasmine/spec/saucelabs.yml +24 -0
  72. data/lib/jasmine/spec/suites/CustomMatchersSpec.js +112 -0
  73. data/lib/jasmine/spec/suites/EnvSpec.js +158 -0
  74. data/lib/jasmine/spec/suites/ExceptionsSpec.js +107 -0
  75. data/lib/jasmine/spec/suites/JsApiReporterSpec.js +96 -0
  76. data/lib/jasmine/spec/suites/MatchersSpec.js +709 -0
  77. data/lib/jasmine/spec/suites/MockClockSpec.js +34 -0
  78. data/lib/jasmine/spec/suites/MultiReporterSpec.js +30 -0
  79. data/lib/jasmine/spec/suites/NestedResultsSpec.js +54 -0
  80. data/lib/jasmine/spec/suites/PrettyPrintSpec.js +93 -0
  81. data/lib/jasmine/spec/suites/QueueSpec.js +23 -0
  82. data/lib/jasmine/spec/suites/ReporterSpec.js +60 -0
  83. data/lib/jasmine/spec/suites/RunnerSpec.js +267 -0
  84. data/lib/jasmine/spec/suites/SpecRunningSpec.js +1195 -0
  85. data/lib/jasmine/spec/suites/SpecSpec.js +110 -0
  86. data/lib/jasmine/spec/suites/SpySpec.js +201 -0
  87. data/lib/jasmine/spec/suites/SuiteSpec.js +120 -0
  88. data/lib/jasmine/spec/suites/TrivialReporterSpec.js +158 -0
  89. data/lib/jasmine/spec/suites/UtilSpec.js +40 -0
  90. data/lib/jasmine/spec/suites/WaitsForBlockSpec.js +88 -0
  91. data/lib/jasmine/src/Block.js +22 -0
  92. data/lib/jasmine/src/Env.js +263 -0
  93. data/lib/jasmine/src/JsApiReporter.js +104 -0
  94. data/lib/jasmine/src/Matchers.js +336 -0
  95. data/lib/jasmine/src/MultiReporter.js +28 -0
  96. data/lib/jasmine/src/NestedResults.js +80 -0
  97. data/lib/jasmine/src/PrettyPrinter.js +122 -0
  98. data/lib/jasmine/src/Queue.js +94 -0
  99. data/lib/jasmine/src/Reporter.js +27 -0
  100. data/lib/jasmine/src/Reporters.js +43 -0
  101. data/lib/jasmine/src/Runner.js +77 -0
  102. data/lib/jasmine/src/Spec.js +206 -0
  103. data/lib/jasmine/src/Suite.js +82 -0
  104. data/lib/jasmine/src/WaitsBlock.js +13 -0
  105. data/lib/jasmine/src/WaitsForBlock.js +37 -0
  106. data/lib/jasmine/src/base.js +586 -0
  107. data/lib/jasmine/src/mock-timeout.js +177 -0
  108. data/lib/jasmine/src/util.js +67 -0
  109. data/lib/jasmine/src/version.json +5 -0
  110. metadata +238 -0
@@ -0,0 +1,77 @@
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> * Internal representation of a Jasmine suite.
10
+ <span class='line'> 3</span> *
11
+ <span class='line'> 4</span> * @constructor
12
+ <span class='line'> 5</span> * @param {jasmine.Env} env
13
+ <span class='line'> 6</span> * @param {String} description
14
+ <span class='line'> 7</span> * @param {Function} specDefinitions
15
+ <span class='line'> 8</span> * @param {jasmine.Suite} parentSuite
16
+ <span class='line'> 9</span> */</span><span class="WHIT">
17
+ <span class='line'> 10</span> </span><span class="NAME">jasmine.Suite</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">env</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">description</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">specDefinitions</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">parentSuite</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
18
+ <span class='line'> 11</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">
19
+ <span class='line'> 12</span> </span><span class="WHIT"> </span><span class="NAME">self.id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">env.nextSuiteId</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">env.nextSuiteId</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
20
+ <span class='line'> 13</span> </span><span class="WHIT"> </span><span class="NAME">self.description</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">description</span><span class="PUNC">;</span><span class="WHIT">
21
+ <span class='line'> 14</span> </span><span class="WHIT"> </span><span class="NAME">self.queue</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">jasmine.Queue</span><span class="PUNC">(</span><span class="NAME">env</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
22
+ <span class='line'> 15</span> </span><span class="WHIT"> </span><span class="NAME">self.parentSuite</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parentSuite</span><span class="PUNC">;</span><span class="WHIT">
23
+ <span class='line'> 16</span> </span><span class="WHIT"> </span><span class="NAME">self.env</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">env</span><span class="PUNC">;</span><span class="WHIT">
24
+ <span class='line'> 17</span> </span><span class="WHIT"> </span><span class="NAME">self.before_</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">
25
+ <span class='line'> 18</span> </span><span class="WHIT"> </span><span class="NAME">self.after_</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">
26
+ <span class='line'> 19</span> </span><span class="WHIT"> </span><span class="NAME">self.specs_</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">
27
+ <span class='line'> 20</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
28
+ <span class='line'> 21</span>
29
+ <span class='line'> 22</span> </span><span class="NAME">jasmine.Suite.prototype.getFullName</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">
30
+ <span class='line'> 23</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">fullName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.description</span><span class="PUNC">;</span><span class="WHIT">
31
+ <span class='line'> 24</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">parentSuite</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.parentSuite</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">parentSuite</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">parentSuite</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parentSuite.parentSuite</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">fullName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parentSuite.description</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">fullName</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="WHIT">
34
+ <span class='line'> 27</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">fullName</span><span class="PUNC">;</span><span class="WHIT">
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.Suite.prototype.finish</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">onComplete</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.env.reporter.reportSuiteResults</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
39
+ <span class='line'> 32</span> </span><span class="WHIT"> </span><span class="NAME">this.finished</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
40
+ <span class='line'> 33</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">onComplete</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
41
+ <span class='line'> 34</span> </span><span class="WHIT"> </span><span class="NAME">onComplete</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
42
+ <span class='line'> 35</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
43
+ <span class='line'> 36</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
44
+ <span class='line'> 37</span>
45
+ <span class='line'> 38</span> </span><span class="NAME">jasmine.Suite.prototype.beforeEach</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">beforeEachFunction</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
46
+ <span class='line'> 39</span> </span><span class="WHIT"> </span><span class="NAME">beforeEachFunction.typeName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'beforeEach'</span><span class="PUNC">;</span><span class="WHIT">
47
+ <span class='line'> 40</span> </span><span class="WHIT"> </span><span class="NAME">this.before_.push</span><span class="PUNC">(</span><span class="NAME">beforeEachFunction</span><span class="PUNC">)</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.Suite.prototype.afterEach</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">afterEachFunction</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">afterEachFunction.typeName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'afterEach'</span><span class="PUNC">;</span><span class="WHIT">
52
+ <span class='line'> 45</span> </span><span class="WHIT"> </span><span class="NAME">this.after_.push</span><span class="PUNC">(</span><span class="NAME">afterEachFunction</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
53
+ <span class='line'> 46</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
54
+ <span class='line'> 47</span>
55
+ <span class='line'> 48</span> </span><span class="NAME">jasmine.Suite.prototype.results</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">
56
+ <span class='line'> 49</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.queue.results</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
57
+ <span class='line'> 50</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
58
+ <span class='line'> 51</span>
59
+ <span class='line'> 52</span> </span><span class="NAME">jasmine.Suite.prototype.add</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">block</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
60
+ <span class='line'> 53</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">block</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">jasmine.Suite</span><span class="PUNC">)</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="NAME">this.env.currentRunner</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addSuite</span><span class="PUNC">(</span><span class="NAME">block</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
62
+ <span class='line'> 55</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">
63
+ <span class='line'> 56</span> </span><span class="WHIT"> </span><span class="NAME">this.specs_.push</span><span class="PUNC">(</span><span class="NAME">block</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
64
+ <span class='line'> 57</span> </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="NAME">this.queue.add</span><span class="PUNC">(</span><span class="NAME">block</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
66
+ <span class='line'> 59</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
67
+ <span class='line'> 60</span>
68
+ <span class='line'> 61</span> </span><span class="NAME">jasmine.Suite.prototype.specs</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">
69
+ <span class='line'> 62</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.specs_</span><span class="PUNC">;</span><span class="WHIT">
70
+ <span class='line'> 63</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
71
+ <span class='line'> 64</span>
72
+ <span class='line'> 65</span> </span><span class="NAME">jasmine.Suite.prototype.execute</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">onComplete</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="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">
74
+ <span class='line'> 67</span> </span><span class="WHIT"> </span><span class="NAME">this.queue.start</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
75
+ <span class='line'> 68</span> </span><span class="WHIT"> </span><span class="NAME">self.finish</span><span class="PUNC">(</span><span class="NAME">onComplete</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
76
+ <span class='line'> 69</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
77
+ <span class='line'> 70</span> </span><span class="PUNC">}</span><span class="PUNC">;</span></pre></body></html>
@@ -0,0 +1,21 @@
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="NAME">jasmine.WaitsBlock</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">env</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">timeout</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">spec</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
9
+ <span class='line'> 2</span> </span><span class="WHIT"> </span><span class="NAME">this.timeout</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">timeout</span><span class="PUNC">;</span><span class="WHIT">
10
+ <span class='line'> 3</span> </span><span class="WHIT"> </span><span class="NAME">jasmine.Block.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">env</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">spec</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
11
+ <span class='line'> 4</span> </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="NAME">jasmine.util.inherit</span><span class="PUNC">(</span><span class="NAME">jasmine.WaitsBlock</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">jasmine.Block</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
14
+ <span class='line'> 7</span>
15
+ <span class='line'> 8</span> </span><span class="NAME">jasmine.WaitsBlock.prototype.execute</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">onComplete</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">this.env.reporter.log</span><span class="PUNC">(</span><span class="STRN">'>> Jasmine waiting for '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.timeout</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">' ms...'</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">this.env.setTimeout</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
18
+ <span class='line'> 11</span> </span><span class="WHIT"> </span><span class="NAME">onComplete</span><span class="PUNC">(</span><span class="PUNC">)</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"> </span><span class="NAME">this.timeout</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
20
+ <span class='line'> 13</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
21
+ <span class='line'> 14</span> </span></pre></body></html>
@@ -0,0 +1,45 @@
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="NAME">jasmine.WaitsForBlock</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">env</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">timeout</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">latchFunction</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">spec</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
9
+ <span class='line'> 2</span> </span><span class="WHIT"> </span><span class="NAME">this.timeout</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">timeout</span><span class="PUNC">;</span><span class="WHIT">
10
+ <span class='line'> 3</span> </span><span class="WHIT"> </span><span class="NAME">this.latchFunction</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">latchFunction</span><span class="PUNC">;</span><span class="WHIT">
11
+ <span class='line'> 4</span> </span><span class="WHIT"> </span><span class="NAME">this.message</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">;</span><span class="WHIT">
12
+ <span class='line'> 5</span> </span><span class="WHIT"> </span><span class="NAME">this.totalTimeSpentWaitingForLatch</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">
13
+ <span class='line'> 6</span> </span><span class="WHIT"> </span><span class="NAME">jasmine.Block.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">env</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">spec</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
14
+ <span class='line'> 7</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
15
+ <span class='line'> 8</span>
16
+ <span class='line'> 9</span> </span><span class="NAME">jasmine.util.inherit</span><span class="PUNC">(</span><span class="NAME">jasmine.WaitsForBlock</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">jasmine.Block</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
17
+ <span class='line'> 10</span>
18
+ <span class='line'> 11</span> </span><span class="NAME">jasmine.WaitsForBlock.TIMEOUT_INCREMENT</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">100</span><span class="PUNC">;</span><span class="WHIT">
19
+ <span class='line'> 12</span>
20
+ <span class='line'> 13</span> </span><span class="NAME">jasmine.WaitsForBlock.prototype.execute</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">onComplete</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="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">
22
+ <span class='line'> 15</span> </span><span class="WHIT"> </span><span class="NAME">self.env.reporter.log</span><span class="PUNC">(</span><span class="STRN">'>> Jasmine waiting for '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">self.message</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'something to happen'</span><span class="PUNC">)</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="KEYW">var</span><span class="WHIT"> </span><span class="NAME">latchFunctionResult</span><span class="PUNC">;</span><span class="WHIT">
24
+ <span class='line'> 17</span> </span><span class="WHIT"> </span><span class="KEYW">try</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="NAME">latchFunctionResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.latchFunction.apply</span><span class="PUNC">(</span><span class="NAME">self.spec</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="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </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">
27
+ <span class='line'> 20</span> </span><span class="WHIT"> </span><span class="NAME">self.spec.fail</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
28
+ <span class='line'> 21</span> </span><span class="WHIT"> </span><span class="NAME">onComplete</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
29
+ <span class='line'> 22</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
30
+ <span class='line'> 23</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
31
+ <span class='line'> 24</span>
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">latchFunctionResult</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">onComplete</span><span class="PUNC">(</span><span class="PUNC">)</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"> </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">self.totalTimeSpentWaitingForLatch</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">self.timeout</span><span class="PUNC">)</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">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="STRN">'timed out after '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">self.timeout</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">' msec waiting for '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">self.message</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'something to happen'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
36
+ <span class='line'> 29</span> </span><span class="WHIT"> </span><span class="NAME">self.spec.fail</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
37
+ <span class='line'> 30</span> </span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'timeout'</span><span class="PUNC">,</span><span class="WHIT">
38
+ <span class='line'> 31</span> </span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">message</span><span class="WHIT">
39
+ <span class='line'> 32</span> </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">self.spec._next</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
41
+ <span class='line'> 34</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">
42
+ <span class='line'> 35</span> </span><span class="WHIT"> </span><span class="NAME">self.totalTimeSpentWaitingForLatch</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.WaitsForBlock.TIMEOUT_INCREMENT</span><span class="PUNC">;</span><span class="WHIT">
43
+ <span class='line'> 36</span> </span><span class="WHIT"> </span><span class="NAME">self.env.setTimeout</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">self.execute</span><span class="PUNC">(</span><span class="NAME">onComplete</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">jasmine.WaitsForBlock.TIMEOUT_INCREMENT</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
44
+ <span class='line'> 37</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
45
+ <span class='line'> 38</span> </span><span class="PUNC">}</span><span class="PUNC">;</span></pre></body></html>
@@ -0,0 +1,585 @@
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> * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
10
+ <span class='line'> 3</span> *
11
+ <span class='line'> 4</span> * @namespace
12
+ <span class='line'> 5</span> */</span><span class="WHIT">
13
+ <span class='line'> 6</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">jasmine</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">
14
+ <span class='line'> 7</span>
15
+ <span class='line'> 8</span> </span><span class="COMM">/**
16
+ <span class='line'> 9</span> * @private
17
+ <span class='line'> 10</span> */</span><span class="WHIT">
18
+ <span class='line'> 11</span> </span><span class="NAME">jasmine.unimplementedMethod_</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">
19
+ <span class='line'> 12</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">"unimplemented method"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
20
+ <span class='line'> 13</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
21
+ <span class='line'> 14</span>
22
+ <span class='line'> 15</span> </span><span class="COMM">/**
23
+ <span class='line'> 16</span> * Use &lt;code>jasmine.undefined&lt;/code> instead of &lt;code>undefined&lt;/code>, since &lt;code>undefined&lt;/code is just
24
+ <span class='line'> 17</span> * a plain old variable and may be redefined by somebody else.
25
+ <span class='line'> 18</span> *
26
+ <span class='line'> 19</span> * @private
27
+ <span class='line'> 20</span> */</span><span class="WHIT">
28
+ <span class='line'> 21</span> </span><span class="NAME">jasmine.undefined</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>
30
+ <span class='line'> 23</span> </span><span class="COMM">/**
31
+ <span class='line'> 24</span> * Default interval for event loop yields. Small values here may result in slow test running. Zero means no updates until all tests have completed.
32
+ <span class='line'> 25</span> *
33
+ <span class='line'> 26</span> */</span><span class="WHIT">
34
+ <span class='line'> 27</span> </span><span class="NAME">jasmine.DEFAULT_UPDATE_INTERVAL</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">250</span><span class="PUNC">;</span><span class="WHIT">
35
+ <span class='line'> 28</span>
36
+ <span class='line'> 29</span> </span><span class="COMM">/**
37
+ <span class='line'> 30</span> * Allows for bound functions to be compared. Internal use only.
38
+ <span class='line'> 31</span> *
39
+ <span class='line'> 32</span> * @ignore
40
+ <span class='line'> 33</span> * @private
41
+ <span class='line'> 34</span> * @param base {Object} bound 'this' for the function
42
+ <span class='line'> 35</span> * @param name {Function} function to find
43
+ <span class='line'> 36</span> */</span><span class="WHIT">
44
+ <span class='line'> 37</span> </span><span class="NAME">jasmine.bindOriginal_</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">base</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</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="KEYW">var</span><span class="WHIT"> </span><span class="NAME">original</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">base</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
46
+ <span class='line'> 39</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">original.apply</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
47
+ <span class='line'> 40</span> </span><span class="WHIT"> </span><span class="KEYW">return</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">
48
+ <span class='line'> 41</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">original.apply</span><span class="PUNC">(</span><span class="NAME">base</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">
49
+ <span class='line'> 42</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
50
+ <span class='line'> 43</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">
51
+ <span class='line'> 44</span> </span><span class="WHIT"> </span><span class="COMM">// IE support</span><span class="WHIT">
52
+ <span class='line'> 45</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">window</span><span class="PUNC">[</span><span class="NAME">name</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="PUNC">}</span><span class="WHIT">
54
+ <span class='line'> 47</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
55
+ <span class='line'> 48</span>
56
+ <span class='line'> 49</span> </span><span class="NAME">jasmine.setTimeout</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.bindOriginal_</span><span class="PUNC">(</span><span class="NAME">window</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'setTimeout'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
57
+ <span class='line'> 50</span> </span><span class="NAME">jasmine.clearTimeout</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.bindOriginal_</span><span class="PUNC">(</span><span class="NAME">window</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'clearTimeout'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
58
+ <span class='line'> 51</span> </span><span class="NAME">jasmine.setInterval</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.bindOriginal_</span><span class="PUNC">(</span><span class="NAME">window</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'setInterval'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
59
+ <span class='line'> 52</span> </span><span class="NAME">jasmine.clearInterval</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.bindOriginal_</span><span class="PUNC">(</span><span class="NAME">window</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'clearInterval'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
60
+ <span class='line'> 53</span>
61
+ <span class='line'> 54</span> </span><span class="NAME">jasmine.MessageResult</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">text</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
62
+ <span class='line'> 55</span> </span><span class="WHIT"> </span><span class="NAME">this.type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'MessageResult'</span><span class="PUNC">;</span><span class="WHIT">
63
+ <span class='line'> 56</span> </span><span class="WHIT"> </span><span class="NAME">this.text</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">text</span><span class="PUNC">;</span><span class="WHIT">
64
+ <span class='line'> 57</span> </span><span class="WHIT"> </span><span class="NAME">this.trace</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">Error</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// todo: test better</span><span class="WHIT">
65
+ <span class='line'> 58</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
66
+ <span class='line'> 59</span>
67
+ <span class='line'> 60</span> </span><span class="NAME">jasmine.ExpectationResult</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">params</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="NAME">this.type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'ExpectationResult'</span><span class="PUNC">;</span><span class="WHIT">
69
+ <span class='line'> 62</span> </span><span class="WHIT"> </span><span class="NAME">this.matcherName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params.matcherName</span><span class="PUNC">;</span><span class="WHIT">
70
+ <span class='line'> 63</span> </span><span class="WHIT"> </span><span class="NAME">this.passed_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params.passed</span><span class="PUNC">;</span><span class="WHIT">
71
+ <span class='line'> 64</span> </span><span class="WHIT"> </span><span class="NAME">this.expected</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params.expected</span><span class="PUNC">;</span><span class="WHIT">
72
+ <span class='line'> 65</span> </span><span class="WHIT"> </span><span class="NAME">this.actual</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params.actual</span><span class="PUNC">;</span><span class="WHIT">
73
+ <span class='line'> 66</span>
74
+ <span class='line'> 67</span> </span><span class="WHIT"> </span><span class="COMM">/** @deprecated */</span><span class="WHIT">
75
+ <span class='line'> 68</span> </span><span class="WHIT"> </span><span class="NAME">this.details</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params.details</span><span class="PUNC">;</span><span class="WHIT">
76
+ <span class='line'> 69</span>
77
+ <span class='line'> 70</span> </span><span class="WHIT"> </span><span class="NAME">this.message</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.passed_</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'Passed.'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">params.message</span><span class="PUNC">;</span><span class="WHIT">
78
+ <span class='line'> 71</span> </span><span class="WHIT"> </span><span class="NAME">this.trace</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.passed_</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="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="NAME">this.message</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
79
+ <span class='line'> 72</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
80
+ <span class='line'> 73</span>
81
+ <span class='line'> 74</span> </span><span class="NAME">jasmine.ExpectationResult.prototype.passed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
82
+ <span class='line'> 75</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.passed_</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="COMM">/**
86
+ <span class='line'> 79</span> * Getter for the Jasmine environment. Ensures one gets created
87
+ <span class='line'> 80</span> */</span><span class="WHIT">
88
+ <span class='line'> 81</span> </span><span class="NAME">jasmine.getEnv</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">
89
+ <span class='line'> 82</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jasmine.currentEnv_</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.currentEnv_</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">jasmine.Env</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
90
+ <span class='line'> 83</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
91
+ <span class='line'> 84</span>
92
+ <span class='line'> 85</span> </span><span class="COMM">/**
93
+ <span class='line'> 86</span> * @ignore
94
+ <span class='line'> 87</span> * @private
95
+ <span class='line'> 88</span> * @param value
96
+ <span class='line'> 89</span> * @returns {Boolean}
97
+ <span class='line'> 90</span> */</span><span class="WHIT">
98
+ <span class='line'> 91</span> </span><span class="NAME">jasmine.isArray_</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">value</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="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jasmine.isA_</span><span class="PUNC">(</span><span class="STRN">"Array"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
100
+ <span class='line'> 93</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
101
+ <span class='line'> 94</span>
102
+ <span class='line'> 95</span> </span><span class="COMM">/**
103
+ <span class='line'> 96</span> * @ignore
104
+ <span class='line'> 97</span> * @private
105
+ <span class='line'> 98</span> * @param value
106
+ <span class='line'> 99</span> * @returns {Boolean}
107
+ <span class='line'>100</span> */</span><span class="WHIT">
108
+ <span class='line'>101</span> </span><span class="NAME">jasmine.isString_</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">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
109
+ <span class='line'>102</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jasmine.isA_</span><span class="PUNC">(</span><span class="STRN">"String"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
110
+ <span class='line'>103</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
111
+ <span class='line'>104</span>
112
+ <span class='line'>105</span> </span><span class="COMM">/**
113
+ <span class='line'>106</span> * @ignore
114
+ <span class='line'>107</span> * @private
115
+ <span class='line'>108</span> * @param value
116
+ <span class='line'>109</span> * @returns {Boolean}
117
+ <span class='line'>110</span> */</span><span class="WHIT">
118
+ <span class='line'>111</span> </span><span class="NAME">jasmine.isNumber_</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">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
119
+ <span class='line'>112</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">jasmine.isA_</span><span class="PUNC">(</span><span class="STRN">"Number"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
120
+ <span class='line'>113</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
121
+ <span class='line'>114</span>
122
+ <span class='line'>115</span> </span><span class="COMM">/**
123
+ <span class='line'>116</span> * @ignore
124
+ <span class='line'>117</span> * @private
125
+ <span class='line'>118</span> * @param {String} typeName
126
+ <span class='line'>119</span> * @param value
127
+ <span class='line'>120</span> * @returns {Boolean}
128
+ <span class='line'>121</span> */</span><span class="WHIT">
129
+ <span class='line'>122</span> </span><span class="NAME">jasmine.isA_</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">typeName</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
130
+ <span class='line'>123</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Object.prototype.toString.apply</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'[object '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">typeName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">']'</span><span class="PUNC">;</span><span class="WHIT">
131
+ <span class='line'>124</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
132
+ <span class='line'>125</span>
133
+ <span class='line'>126</span> </span><span class="COMM">/**
134
+ <span class='line'>127</span> * Pretty printer for expecations. Takes any object and turns it into a human-readable string.
135
+ <span class='line'>128</span> *
136
+ <span class='line'>129</span> * @param value {Object} an object to be outputted
137
+ <span class='line'>130</span> * @returns {String}
138
+ <span class='line'>131</span> */</span><span class="WHIT">
139
+ <span class='line'>132</span> </span><span class="NAME">jasmine.pp</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">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
140
+ <span class='line'>133</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">stringPrettyPrinter</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">jasmine.StringPrettyPrinter</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
141
+ <span class='line'>134</span> </span><span class="WHIT"> </span><span class="NAME">stringPrettyPrinter.format</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
142
+ <span class='line'>135</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">stringPrettyPrinter.string</span><span class="PUNC">;</span><span class="WHIT">
143
+ <span class='line'>136</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
144
+ <span class='line'>137</span>
145
+ <span class='line'>138</span> </span><span class="COMM">/**
146
+ <span class='line'>139</span> * Returns true if the object is a DOM Node.
147
+ <span class='line'>140</span> *
148
+ <span class='line'>141</span> * @param {Object} obj object to check
149
+ <span class='line'>142</span> * @returns {Boolean}
150
+ <span class='line'>143</span> */</span><span class="WHIT">
151
+ <span class='line'>144</span> </span><span class="NAME">jasmine.isDomNode</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">obj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
152
+ <span class='line'>145</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">[</span><span class="STRN">'nodeType'</span><span class="PUNC">]</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">
153
+ <span class='line'>146</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
154
+ <span class='line'>147</span>
155
+ <span class='line'>148</span> </span><span class="COMM">/**
156
+ <span class='line'>149</span> * Returns a matchable 'generic' object of the class type. For use in expecations of type when values don't matter.
157
+ <span class='line'>150</span> *
158
+ <span class='line'>151</span> * @example
159
+ <span class='line'>152</span> * // don't care about which function is passed in, as long as it's a function
160
+ <span class='line'>153</span> * expect(mySpy).wasCalledWith(jasmine.any(Function));
161
+ <span class='line'>154</span> *
162
+ <span class='line'>155</span> * @param {Class} clazz
163
+ <span class='line'>156</span> * @returns matchable object of the type clazz
164
+ <span class='line'>157</span> */</span><span class="WHIT">
165
+ <span class='line'>158</span> </span><span class="NAME">jasmine.any</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">clazz</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
166
+ <span class='line'>159</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">jasmine.Matchers.Any</span><span class="PUNC">(</span><span class="NAME">clazz</span><span class="PUNC">)</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="COMM">/**
170
+ <span class='line'>163</span> * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
171
+ <span class='line'>164</span> *
172
+ <span class='line'>165</span> * Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine
173
+ <span class='line'>166</span> * expectation syntax. Spies can be checked if they were called or not and what the calling params were.
174
+ <span class='line'>167</span> *
175
+ <span class='line'>168</span> * A Spy has the following mehtod: wasCalled, callCount, mostRecentCall, and argsForCall (see docs)
176
+ <span class='line'>169</span> * Spies are torn down at the end of every spec.
177
+ <span class='line'>170</span> *
178
+ <span class='line'>171</span> * Note: Do &lt;b>not&lt;/b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
179
+ <span class='line'>172</span> *
180
+ <span class='line'>173</span> * @example
181
+ <span class='line'>174</span> * // a stub
182
+ <span class='line'>175</span> * var myStub = jasmine.createSpy('myStub'); // can be used anywhere
183
+ <span class='line'>176</span> *
184
+ <span class='line'>177</span> * // spy example
185
+ <span class='line'>178</span> * var foo = {
186
+ <span class='line'>179</span> * not: function(bool) { return !bool; }
187
+ <span class='line'>180</span> * }
188
+ <span class='line'>181</span> *
189
+ <span class='line'>182</span> * // actual foo.not will not be called, execution stops
190
+ <span class='line'>183</span> * spyOn(foo, 'not');
191
+ <span class='line'>184</span>
192
+ <span class='line'>185</span> // foo.not spied upon, execution will continue to implementation
193
+ <span class='line'>186</span> * spyOn(foo, 'not').andCallThrough();
194
+ <span class='line'>187</span> *
195
+ <span class='line'>188</span> * // fake example
196
+ <span class='line'>189</span> * var foo = {
197
+ <span class='line'>190</span> * not: function(bool) { return !bool; }
198
+ <span class='line'>191</span> * }
199
+ <span class='line'>192</span> *
200
+ <span class='line'>193</span> * // foo.not(val) will return val
201
+ <span class='line'>194</span> * spyOn(foo, 'not').andCallFake(function(value) {return value;});
202
+ <span class='line'>195</span> *
203
+ <span class='line'>196</span> * // mock example
204
+ <span class='line'>197</span> * foo.not(7 == 7);
205
+ <span class='line'>198</span> * expect(foo.not).wasCalled();
206
+ <span class='line'>199</span> * expect(foo.not).wasCalledWith(true);
207
+ <span class='line'>200</span> *
208
+ <span class='line'>201</span> * @constructor
209
+ <span class='line'>202</span> * @see spyOn, jasmine.createSpy, jasmine.createSpyObj
210
+ <span class='line'>203</span> * @param {String} name
211
+ <span class='line'>204</span> */</span><span class="WHIT">
212
+ <span class='line'>205</span> </span><span class="NAME">jasmine.Spy</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">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
213
+ <span class='line'>206</span> </span><span class="WHIT"> </span><span class="COMM">/**
214
+ <span class='line'>207</span> * The name of the spy, if provided.
215
+ <span class='line'>208</span> */</span><span class="WHIT">
216
+ <span class='line'>209</span> </span><span class="WHIT"> </span><span class="NAME">this.identity</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'unknown'</span><span class="PUNC">;</span><span class="WHIT">
217
+ <span class='line'>210</span> </span><span class="WHIT"> </span><span class="COMM">/**
218
+ <span class='line'>211</span> * Is this Object a spy?
219
+ <span class='line'>212</span> */</span><span class="WHIT">
220
+ <span class='line'>213</span> </span><span class="WHIT"> </span><span class="NAME">this.isSpy</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
221
+ <span class='line'>214</span> </span><span class="WHIT"> </span><span class="COMM">/**
222
+ <span class='line'>215</span> * The actual function this spy stubs.
223
+ <span class='line'>216</span> */</span><span class="WHIT">
224
+ <span class='line'>217</span> </span><span class="WHIT"> </span><span class="NAME">this.plan</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">
225
+ <span class='line'>218</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
226
+ <span class='line'>219</span> </span><span class="WHIT"> </span><span class="COMM">/**
227
+ <span class='line'>220</span> * Tracking of the most recent call to the spy.
228
+ <span class='line'>221</span> * @example
229
+ <span class='line'>222</span> * var mySpy = jasmine.createSpy('foo');
230
+ <span class='line'>223</span> * mySpy(1, 2);
231
+ <span class='line'>224</span> * mySpy.mostRecentCall.args = [1, 2];
232
+ <span class='line'>225</span> */</span><span class="WHIT">
233
+ <span class='line'>226</span> </span><span class="WHIT"> </span><span class="NAME">this.mostRecentCall</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">
234
+ <span class='line'>227</span>
235
+ <span class='line'>228</span> </span><span class="WHIT"> </span><span class="COMM">/**
236
+ <span class='line'>229</span> * Holds arguments for each call to the spy, indexed by call count
237
+ <span class='line'>230</span> * @example
238
+ <span class='line'>231</span> * var mySpy = jasmine.createSpy('foo');
239
+ <span class='line'>232</span> * mySpy(1, 2);
240
+ <span class='line'>233</span> * mySpy(7, 8);
241
+ <span class='line'>234</span> * mySpy.mostRecentCall.args = [7, 8];
242
+ <span class='line'>235</span> * mySpy.argsForCall[0] = [1, 2];
243
+ <span class='line'>236</span> * mySpy.argsForCall[1] = [7, 8];
244
+ <span class='line'>237</span> */</span><span class="WHIT">
245
+ <span class='line'>238</span> </span><span class="WHIT"> </span><span class="NAME">this.argsForCall</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">
246
+ <span class='line'>239</span> </span><span class="WHIT"> </span><span class="NAME">this.calls</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">
247
+ <span class='line'>240</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
248
+ <span class='line'>241</span>
249
+ <span class='line'>242</span> </span><span class="COMM">/**
250
+ <span class='line'>243</span> * Tells a spy to call through to the actual implemenatation.
251
+ <span class='line'>244</span> *
252
+ <span class='line'>245</span> * @example
253
+ <span class='line'>246</span> * var foo = {
254
+ <span class='line'>247</span> * bar: function() { // do some stuff }
255
+ <span class='line'>248</span> * }
256
+ <span class='line'>249</span> *
257
+ <span class='line'>250</span> * // defining a spy on an existing property: foo.bar
258
+ <span class='line'>251</span> * spyOn(foo, 'bar').andCallThrough();
259
+ <span class='line'>252</span> */</span><span class="WHIT">
260
+ <span class='line'>253</span> </span><span class="NAME">jasmine.Spy.prototype.andCallThrough</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">
261
+ <span class='line'>254</span> </span><span class="WHIT"> </span><span class="NAME">this.plan</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.originalValue</span><span class="PUNC">;</span><span class="WHIT">
262
+ <span class='line'>255</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
263
+ <span class='line'>256</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
264
+ <span class='line'>257</span>
265
+ <span class='line'>258</span> </span><span class="COMM">/**
266
+ <span class='line'>259</span> * For setting the return value of a spy.
267
+ <span class='line'>260</span> *
268
+ <span class='line'>261</span> * @example
269
+ <span class='line'>262</span> * // defining a spy from scratch: foo() returns 'baz'
270
+ <span class='line'>263</span> * var foo = jasmine.createSpy('spy on foo').andReturn('baz');
271
+ <span class='line'>264</span> *
272
+ <span class='line'>265</span> * // defining a spy on an existing property: foo.bar() returns 'baz'
273
+ <span class='line'>266</span> * spyOn(foo, 'bar').andReturn('baz');
274
+ <span class='line'>267</span> *
275
+ <span class='line'>268</span> * @param {Object} value
276
+ <span class='line'>269</span> */</span><span class="WHIT">
277
+ <span class='line'>270</span> </span><span class="NAME">jasmine.Spy.prototype.andReturn</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">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
278
+ <span class='line'>271</span> </span><span class="WHIT"> </span><span class="NAME">this.plan</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">
279
+ <span class='line'>272</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
280
+ <span class='line'>273</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
281
+ <span class='line'>274</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
282
+ <span class='line'>275</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
283
+ <span class='line'>276</span>
284
+ <span class='line'>277</span> </span><span class="COMM">/**
285
+ <span class='line'>278</span> * For throwing an exception when a spy is called.
286
+ <span class='line'>279</span> *
287
+ <span class='line'>280</span> * @example
288
+ <span class='line'>281</span> * // defining a spy from scratch: foo() throws an exception w/ message 'ouch'
289
+ <span class='line'>282</span> * var foo = jasmine.createSpy('spy on foo').andThrow('baz');
290
+ <span class='line'>283</span> *
291
+ <span class='line'>284</span> * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch'
292
+ <span class='line'>285</span> * spyOn(foo, 'bar').andThrow('baz');
293
+ <span class='line'>286</span> *
294
+ <span class='line'>287</span> * @param {String} exceptionMsg
295
+ <span class='line'>288</span> */</span><span class="WHIT">
296
+ <span class='line'>289</span> </span><span class="NAME">jasmine.Spy.prototype.andThrow</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">exceptionMsg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
297
+ <span class='line'>290</span> </span><span class="WHIT"> </span><span class="NAME">this.plan</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">
298
+ <span class='line'>291</span> </span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="NAME">exceptionMsg</span><span class="PUNC">;</span><span class="WHIT">
299
+ <span class='line'>292</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
300
+ <span class='line'>293</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
301
+ <span class='line'>294</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
302
+ <span class='line'>295</span>
303
+ <span class='line'>296</span> </span><span class="COMM">/**
304
+ <span class='line'>297</span> * Calls an alternate implementation when a spy is called.
305
+ <span class='line'>298</span> *
306
+ <span class='line'>299</span> * @example
307
+ <span class='line'>300</span> * var baz = function() {
308
+ <span class='line'>301</span> * // do some stuff, return something
309
+ <span class='line'>302</span> * }
310
+ <span class='line'>303</span> * // defining a spy from scratch: foo() calls the function baz
311
+ <span class='line'>304</span> * var foo = jasmine.createSpy('spy on foo').andCall(baz);
312
+ <span class='line'>305</span> *
313
+ <span class='line'>306</span> * // defining a spy on an existing property: foo.bar() calls an anonymnous function
314
+ <span class='line'>307</span> * spyOn(foo, 'bar').andCall(function() { return 'baz';} );
315
+ <span class='line'>308</span> *
316
+ <span class='line'>309</span> * @param {Function} fakeFunc
317
+ <span class='line'>310</span> */</span><span class="WHIT">
318
+ <span class='line'>311</span> </span><span class="NAME">jasmine.Spy.prototype.andCallFake</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">fakeFunc</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
319
+ <span class='line'>312</span> </span><span class="WHIT"> </span><span class="NAME">this.plan</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">fakeFunc</span><span class="PUNC">;</span><span class="WHIT">
320
+ <span class='line'>313</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
321
+ <span class='line'>314</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
322
+ <span class='line'>315</span>
323
+ <span class='line'>316</span> </span><span class="COMM">/**
324
+ <span class='line'>317</span> * Resets all of a spy's the tracking variables so that it can be used again.
325
+ <span class='line'>318</span> *
326
+ <span class='line'>319</span> * @example
327
+ <span class='line'>320</span> * spyOn(foo, 'bar');
328
+ <span class='line'>321</span> *
329
+ <span class='line'>322</span> * foo.bar();
330
+ <span class='line'>323</span> *
331
+ <span class='line'>324</span> * expect(foo.bar.callCount).toEqual(1);
332
+ <span class='line'>325</span> *
333
+ <span class='line'>326</span> * foo.bar.reset();
334
+ <span class='line'>327</span> *
335
+ <span class='line'>328</span> * expect(foo.bar.callCount).toEqual(0);
336
+ <span class='line'>329</span> */</span><span class="WHIT">
337
+ <span class='line'>330</span> </span><span class="NAME">jasmine.Spy.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">
338
+ <span class='line'>331</span> </span><span class="WHIT"> </span><span class="NAME">this.wasCalled</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
339
+ <span class='line'>332</span> </span><span class="WHIT"> </span><span class="NAME">this.callCount</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">
340
+ <span class='line'>333</span> </span><span class="WHIT"> </span><span class="NAME">this.argsForCall</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">
341
+ <span class='line'>334</span> </span><span class="WHIT"> </span><span class="NAME">this.calls</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">
342
+ <span class='line'>335</span> </span><span class="WHIT"> </span><span class="NAME">this.mostRecentCall</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">
343
+ <span class='line'>336</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
344
+ <span class='line'>337</span>
345
+ <span class='line'>338</span> </span><span class="NAME">jasmine.createSpy</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">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
346
+ <span class='line'>339</span>
347
+ <span class='line'>340</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">spyObj</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">
348
+ <span class='line'>341</span> </span><span class="WHIT"> </span><span class="NAME">spyObj.wasCalled</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
349
+ <span class='line'>342</span> </span><span class="WHIT"> </span><span class="NAME">spyObj.callCount</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="WHIT">
350
+ <span class='line'>343</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.util.argsToArray</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
351
+ <span class='line'>344</span> </span><span class="WHIT"> </span><span class="NAME">spyObj.mostRecentCall.object</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">
352
+ <span class='line'>345</span> </span><span class="WHIT"> </span><span class="NAME">spyObj.mostRecentCall.args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">;</span><span class="WHIT">
353
+ <span class='line'>346</span> </span><span class="WHIT"> </span><span class="NAME">spyObj.argsForCall.push</span><span class="PUNC">(</span><span class="NAME">args</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
354
+ <span class='line'>347</span> </span><span class="WHIT"> </span><span class="NAME">spyObj.calls.push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">object</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
355
+ <span class='line'>348</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">spyObj.plan.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">
356
+ <span class='line'>349</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
357
+ <span class='line'>350</span>
358
+ <span class='line'>351</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">spy</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">jasmine.Spy</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
359
+ <span class='line'>352</span>
360
+ <span class='line'>353</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">prop</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">spy</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
361
+ <span class='line'>354</span> </span><span class="WHIT"> </span><span class="NAME">spyObj</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">spy</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
362
+ <span class='line'>355</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
363
+ <span class='line'>356</span>
364
+ <span class='line'>357</span> </span><span class="WHIT"> </span><span class="NAME">spyObj.reset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
365
+ <span class='line'>358</span>
366
+ <span class='line'>359</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">spyObj</span><span class="PUNC">;</span><span class="WHIT">
367
+ <span class='line'>360</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
368
+ <span class='line'>361</span>
369
+ <span class='line'>362</span> </span><span class="COMM">/**
370
+ <span class='line'>363</span> * Determines whether an object is a spy.
371
+ <span class='line'>364</span> *
372
+ <span class='line'>365</span> * @param {jasmine.Spy|Object} putativeSpy
373
+ <span class='line'>366</span> * @returns {Boolean}
374
+ <span class='line'>367</span> */</span><span class="WHIT">
375
+ <span class='line'>368</span> </span><span class="NAME">jasmine.isSpy</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">putativeSpy</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
376
+ <span class='line'>369</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">putativeSpy</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">putativeSpy.isSpy</span><span class="PUNC">;</span><span class="WHIT">
377
+ <span class='line'>370</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
378
+ <span class='line'>371</span>
379
+ <span class='line'>372</span> </span><span class="COMM">/**
380
+ <span class='line'>373</span> * Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something
381
+ <span class='line'>374</span> * large in one call.
382
+ <span class='line'>375</span> *
383
+ <span class='line'>376</span> * @param {String} baseName name of spy class
384
+ <span class='line'>377</span> * @param {Array} methodNames array of names of methods to make spies
385
+ <span class='line'>378</span> */</span><span class="WHIT">
386
+ <span class='line'>379</span> </span><span class="NAME">jasmine.createSpyObj</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">baseName</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">methodNames</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
387
+ <span class='line'>380</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">jasmine.isArray_</span><span class="PUNC">(</span><span class="NAME">methodNames</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">methodNames.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">
388
+ <span class='line'>381</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">'createSpyObj requires a non-empty array of method names to create spies for'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
389
+ <span class='line'>382</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
390
+ <span class='line'>383</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">obj</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">
391
+ <span class='line'>384</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">&lt;</span><span class="WHIT"> </span><span class="NAME">methodNames.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="PUNC">{</span><span class="WHIT">
392
+ <span class='line'>385</span> </span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">[</span><span class="NAME">methodNames</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jasmine.createSpy</span><span class="PUNC">(</span><span class="NAME">baseName</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">methodNames</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">
393
+ <span class='line'>386</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
394
+ <span class='line'>387</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">;</span><span class="WHIT">
395
+ <span class='line'>388</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
396
+ <span class='line'>389</span>
397
+ <span class='line'>390</span> </span><span class="NAME">jasmine.log</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">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
398
+ <span class='line'>391</span> </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.log</span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
399
+ <span class='line'>392</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
400
+ <span class='line'>393</span>
401
+ <span class='line'>394</span> </span><span class="COMM">/**
402
+ <span class='line'>395</span> * Function that installs a spy on an existing object's method name. Used within a Spec to create a spy.
403
+ <span class='line'>396</span> *
404
+ <span class='line'>397</span> * @example
405
+ <span class='line'>398</span> * // spy example
406
+ <span class='line'>399</span> * var foo = {
407
+ <span class='line'>400</span> * not: function(bool) { return !bool; }
408
+ <span class='line'>401</span> * }
409
+ <span class='line'>402</span> * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops
410
+ <span class='line'>403</span> *
411
+ <span class='line'>404</span> * @see jasmine.createSpy
412
+ <span class='line'>405</span> * @param obj
413
+ <span class='line'>406</span> * @param methodName
414
+ <span class='line'>407</span> * @returns a Jasmine spy that can be chained with all spy methods
415
+ <span class='line'>408</span> */</span><span class="WHIT">
416
+ <span class='line'>409</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">spyOn</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">obj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">methodName</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
417
+ <span class='line'>410</span> </span><span class="WHIT"> </span><span class="KEYW">return</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.spyOn</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">methodName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
418
+ <span class='line'>411</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
419
+ <span class='line'>412</span>
420
+ <span class='line'>413</span> </span><span class="COMM">/**
421
+ <span class='line'>414</span> * Creates a Jasmine spec that will be added to the current suite.
422
+ <span class='line'>415</span> *
423
+ <span class='line'>416</span> * // TODO: pending tests
424
+ <span class='line'>417</span> *
425
+ <span class='line'>418</span> * @example
426
+ <span class='line'>419</span> * it('should be true', function() {
427
+ <span class='line'>420</span> * expect(true).toEqual(true);
428
+ <span class='line'>421</span> * });
429
+ <span class='line'>422</span> *
430
+ <span class='line'>423</span> * @param {String} desc description of this specification
431
+ <span class='line'>424</span> * @param {Function} func defines the preconditions and expectations of the spec
432
+ <span class='line'>425</span> */</span><span class="WHIT">
433
+ <span class='line'>426</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">it</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">desc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">func</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
434
+ <span class='line'>427</span> </span><span class="WHIT"> </span><span class="KEYW">return</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">it</span><span class="PUNC">(</span><span class="NAME">desc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">func</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
435
+ <span class='line'>428</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
436
+ <span class='line'>429</span>
437
+ <span class='line'>430</span> </span><span class="COMM">/**
438
+ <span class='line'>431</span> * Creates a &lt;em>disabled&lt;/em> Jasmine spec.
439
+ <span class='line'>432</span> *
440
+ <span class='line'>433</span> * A convenience method that allows existing specs to be disabled temporarily during development.
441
+ <span class='line'>434</span> *
442
+ <span class='line'>435</span> * @param {String} desc description of this specification
443
+ <span class='line'>436</span> * @param {Function} func defines the preconditions and expectations of the spec
444
+ <span class='line'>437</span> */</span><span class="WHIT">
445
+ <span class='line'>438</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">xit</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">desc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">func</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
446
+ <span class='line'>439</span> </span><span class="WHIT"> </span><span class="KEYW">return</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">xit</span><span class="PUNC">(</span><span class="NAME">desc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">func</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
447
+ <span class='line'>440</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
448
+ <span class='line'>441</span>
449
+ <span class='line'>442</span> </span><span class="COMM">/**
450
+ <span class='line'>443</span> * Starts a chain for a Jasmine expectation.
451
+ <span class='line'>444</span> *
452
+ <span class='line'>445</span> * It is passed an Object that is the actual value and should chain to one of the many
453
+ <span class='line'>446</span> * jasmine.Matchers functions.
454
+ <span class='line'>447</span> *
455
+ <span class='line'>448</span> * @param {Object} actual Actual value to test against and expected value
456
+ <span class='line'>449</span> */</span><span class="WHIT">
457
+ <span class='line'>450</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">expect</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">actual</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
458
+ <span class='line'>451</span> </span><span class="WHIT"> </span><span class="KEYW">return</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.expect</span><span class="PUNC">(</span><span class="NAME">actual</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
459
+ <span class='line'>452</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
460
+ <span class='line'>453</span>
461
+ <span class='line'>454</span> </span><span class="COMM">/**
462
+ <span class='line'>455</span> * Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs.
463
+ <span class='line'>456</span> *
464
+ <span class='line'>457</span> * @param {Function} func Function that defines part of a jasmine spec.
465
+ <span class='line'>458</span> */</span><span class="WHIT">
466
+ <span class='line'>459</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">runs</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">func</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
467
+ <span class='line'>460</span> </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.runs</span><span class="PUNC">(</span><span class="NAME">func</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
468
+ <span class='line'>461</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
469
+ <span class='line'>462</span>
470
+ <span class='line'>463</span> </span><span class="COMM">/**
471
+ <span class='line'>464</span> * Waits for a timeout before moving to the next runs()-defined block.
472
+ <span class='line'>465</span> * @param {Number} timeout
473
+ <span class='line'>466</span> */</span><span class="WHIT">
474
+ <span class='line'>467</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">waits</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">timeout</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
475
+ <span class='line'>468</span> </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.waits</span><span class="PUNC">(</span><span class="NAME">timeout</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
476
+ <span class='line'>469</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
477
+ <span class='line'>470</span>
478
+ <span class='line'>471</span> </span><span class="COMM">/**
479
+ <span class='line'>472</span> * Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
480
+ <span class='line'>473</span> *
481
+ <span class='line'>474</span> * @param {Number} timeout
482
+ <span class='line'>475</span> * @param {Function} latchFunction
483
+ <span class='line'>476</span> * @param {String} message
484
+ <span class='line'>477</span> */</span><span class="WHIT">
485
+ <span class='line'>478</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">waitsFor</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">timeout</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">latchFunction</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
486
+ <span class='line'>479</span> </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.waitsFor</span><span class="PUNC">(</span><span class="NAME">timeout</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">latchFunction</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
487
+ <span class='line'>480</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
488
+ <span class='line'>481</span>
489
+ <span class='line'>482</span> </span><span class="COMM">/**
490
+ <span class='line'>483</span> * A function that is called before each spec in a suite.
491
+ <span class='line'>484</span> *
492
+ <span class='line'>485</span> * Used for spec setup, including validating assumptions.
493
+ <span class='line'>486</span> *
494
+ <span class='line'>487</span> * @param {Function} beforeEachFunction
495
+ <span class='line'>488</span> */</span><span class="WHIT">
496
+ <span class='line'>489</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">beforeEach</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">beforeEachFunction</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
497
+ <span class='line'>490</span> </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">beforeEach</span><span class="PUNC">(</span><span class="NAME">beforeEachFunction</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
498
+ <span class='line'>491</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
499
+ <span class='line'>492</span>
500
+ <span class='line'>493</span> </span><span class="COMM">/**
501
+ <span class='line'>494</span> * A function that is called after each spec in a suite.
502
+ <span class='line'>495</span> *
503
+ <span class='line'>496</span> * Used for restoring any state that is hijacked during spec execution.
504
+ <span class='line'>497</span> *
505
+ <span class='line'>498</span> * @param {Function} afterEachFunction
506
+ <span class='line'>499</span> */</span><span class="WHIT">
507
+ <span class='line'>500</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">afterEach</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">afterEachFunction</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
508
+ <span class='line'>501</span> </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">afterEach</span><span class="PUNC">(</span><span class="NAME">afterEachFunction</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
509
+ <span class='line'>502</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
510
+ <span class='line'>503</span>
511
+ <span class='line'>504</span> </span><span class="COMM">/**
512
+ <span class='line'>505</span> * Defines a suite of specifications.
513
+ <span class='line'>506</span> *
514
+ <span class='line'>507</span> * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared
515
+ <span class='line'>508</span> * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization
516
+ <span class='line'>509</span> * of setup in some tests.
517
+ <span class='line'>510</span> *
518
+ <span class='line'>511</span> * @example
519
+ <span class='line'>512</span> * // TODO: a simple suite
520
+ <span class='line'>513</span> *
521
+ <span class='line'>514</span> * // TODO: a simple suite with a nested describe block
522
+ <span class='line'>515</span> *
523
+ <span class='line'>516</span> * @param {String} description A string, usually the class under test.
524
+ <span class='line'>517</span> * @param {Function} specDefinitions function that defines several specs.
525
+ <span class='line'>518</span> */</span><span class="WHIT">
526
+ <span class='line'>519</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">describe</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">description</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">specDefinitions</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
527
+ <span class='line'>520</span> </span><span class="WHIT"> </span><span class="KEYW">return</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">describe</span><span class="PUNC">(</span><span class="NAME">description</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">specDefinitions</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
528
+ <span class='line'>521</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
529
+ <span class='line'>522</span>
530
+ <span class='line'>523</span> </span><span class="COMM">/**
531
+ <span class='line'>524</span> * Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development.
532
+ <span class='line'>525</span> *
533
+ <span class='line'>526</span> * @param {String} description A string, usually the class under test.
534
+ <span class='line'>527</span> * @param {Function} specDefinitions function that defines several specs.
535
+ <span class='line'>528</span> */</span><span class="WHIT">
536
+ <span class='line'>529</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">xdescribe</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">description</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">specDefinitions</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
537
+ <span class='line'>530</span> </span><span class="WHIT"> </span><span class="KEYW">return</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">xdescribe</span><span class="PUNC">(</span><span class="NAME">description</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">specDefinitions</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
538
+ <span class='line'>531</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
539
+ <span class='line'>532</span>
540
+ <span class='line'>533</span>
541
+ <span class='line'>534</span> </span><span class="COMM">// Provide the XMLHttpRequest class for IE 5.x-6.x:</span><span class="WHIT">
542
+ <span class='line'>535</span> </span><span class="NAME">jasmine.XmlHttpRequest</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">XMLHttpRequest</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</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">
543
+ <span class='line'>536</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
544
+ <span class='line'>537</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="STRN">"Msxml2.XMLHTTP.6.0"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
545
+ <span class='line'>538</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">
546
+ <span class='line'>539</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
547
+ <span class='line'>540</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
548
+ <span class='line'>541</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="STRN">"Msxml2.XMLHTTP.3.0"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
549
+ <span class='line'>542</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">
550
+ <span class='line'>543</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
551
+ <span class='line'>544</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
552
+ <span class='line'>545</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="STRN">"Msxml2.XMLHTTP"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
553
+ <span class='line'>546</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">
554
+ <span class='line'>547</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
555
+ <span class='line'>548</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
556
+ <span class='line'>549</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="STRN">"Microsoft.XMLHTTP"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
557
+ <span class='line'>550</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">
558
+ <span class='line'>551</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
559
+ <span class='line'>552</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">"This browser does not support XMLHttpRequest."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
560
+ <span class='line'>553</span> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">XMLHttpRequest</span><span class="PUNC">;</span><span class="WHIT">
561
+ <span class='line'>554</span>
562
+ <span class='line'>555</span> </span><span class="COMM">/**
563
+ <span class='line'>556</span> * Adds suite files to an HTML document so that they are executed, thus adding them to the current
564
+ <span class='line'>557</span> * Jasmine environment.
565
+ <span class='line'>558</span> *
566
+ <span class='line'>559</span> * @param {String} url path to the file to include
567
+ <span class='line'>560</span> * @param {Boolean} opt_global
568
+ <span class='line'>561</span> */</span><span class="WHIT">
569
+ <span class='line'>562</span> </span><span class="NAME">jasmine.include</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">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opt_global</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
570
+ <span class='line'>563</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">opt_global</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
571
+ <span class='line'>564</span> </span><span class="WHIT"> </span><span class="NAME">document.write</span><span class="PUNC">(</span><span class="STRN">'&lt;script type="text/javascript" src="'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'">&lt;/'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'script>'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
572
+ <span class='line'>565</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">
573
+ <span class='line'>566</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">xhr</span><span class="PUNC">;</span><span class="WHIT">
574
+ <span class='line'>567</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
575
+ <span class='line'>568</span> </span><span class="WHIT"> </span><span class="NAME">xhr</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">jasmine.XmlHttpRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
576
+ <span class='line'>569</span> </span><span class="WHIT"> </span><span class="NAME">xhr.open</span><span class="PUNC">(</span><span class="STRN">"GET"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</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">
577
+ <span class='line'>570</span> </span><span class="WHIT"> </span><span class="NAME">xhr.send</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
578
+ <span class='line'>571</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">
579
+ <span class='line'>572</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">"couldn't fetch "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">url</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</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
580
+ <span class='line'>573</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
581
+ <span class='line'>574</span>
582
+ <span class='line'>575</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">eval</span><span class="PUNC">(</span><span class="NAME">xhr.responseText</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
583
+ <span class='line'>576</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
584
+ <span class='line'>577</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
585
+ <span class='line'>578</span> </span></pre></body></html>