Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

first pages commit

  • Loading branch information...
commit 988200446bc66807fc9f7cfffe7fe568d6844dac 0 parents
Sean Hess authored

Showing 1,116 changed files with 65,301 additions and 0 deletions. Show diff stats Hide diff stats

  1. +6 0 .dotcloud/config
  2. +14,401 0 components/AngularJS/angular.js
  3. +13 0 components/AngularJS/component.json
  4. +1,741 0 components/angular-modules/angular-mocks.js
  5. +6 0 components/angular-modules/component.json
  6. +163 0 components/angular-modules/cookies.js
  7. +249 0 components/angular-modules/loader.js
  8. +429 0 components/angular-modules/resource.js
  9. +395 0 components/angular-modules/sanitize.js
  10. +1 0  components/components
  11. +2 0  components/fjs/.gitignore
  12. +4 0 components/fjs/.travis.yml
  13. +106 0 components/fjs/README.md
  14. +15 0 components/fjs/component.json
  15. +1 0  components/fjs/fjs.min.js
  16. +240 0 components/fjs/index.coffee
  17. +25 0 components/fjs/package.json
  18. +312 0 components/fjs/test.coffee
  19. +13 0 components/jquery/component.json
  20. +9,301 0 components/jquery/jquery.js
  21. +7 0 components/requirejs/.gitignore
  22. +58 0 components/requirejs/LICENSE
  23. +51 0 components/requirejs/README.md
  24. +6 0 components/requirejs/component.json
  25. +30 0 components/requirejs/dist/Markdown-License.text
  26. +1,450 0 components/requirejs/dist/Markdown.pl
  27. +72 0 components/requirejs/dist/README.md
  28. +42 0 components/requirejs/dist/dist-build.sh
  29. +131 0 components/requirejs/dist/dist-site.js
  30. +227 0 components/requirejs/dist/file.js
  31. BIN  components/requirejs/dist/fonts/Inconsolata.ttf
  32. BIN  components/requirejs/dist/fonts/PT-Sans/PT_Sans.ttf
  33. BIN  components/requirejs/dist/fonts/PT-Sans/PT_Sans_Bold.ttf
  34. BIN  components/requirejs/dist/fonts/PT-Sans/PT_Sans_Bold_Italic.ttf
  35. BIN  components/requirejs/dist/fonts/PT-Sans/PT_Sans_Caption.ttf
  36. BIN  components/requirejs/dist/fonts/PT-Sans/PT_Sans_Caption_Bold.ttf
  37. BIN  components/requirejs/dist/fonts/PT-Sans/PT_Sans_Italic.ttf
  38. BIN  components/requirejs/dist/fonts/PT-Sans/PT_Sans_Narrow.ttf
  39. BIN  components/requirejs/dist/fonts/PT-Sans/PT_Sans_Narrow_Bold.ttf
  40. +26 0 components/requirejs/dist/fonts/PT-Sans/Paratype PT Sans Free Font License.txt
  41. +28 0 components/requirejs/dist/init.js
  42. +10 0 components/requirejs/dist/post.html
  43. +176 0 components/requirejs/dist/pre.html
  44. +1,199 0 components/requirejs/docs/api.html
  45. +99 0 components/requirejs/docs/commonjs.html
  46. +56 0 components/requirejs/docs/contributing.html
  47. +3 0  components/requirejs/docs/design/packages.md
  48. +28 0 components/requirejs/docs/dojo.html
  49. +270 0 components/requirejs/docs/download.html
  50. +208 0 components/requirejs/docs/errors.html
  51. +136 0 components/requirejs/docs/faq-advanced.html
  52. +55 0 components/requirejs/docs/faq-optimization.html
  53. +8 0 components/requirejs/docs/faq.html
  54. +28 0 components/requirejs/docs/history.html
  55. +177 0 components/requirejs/docs/jquery.html
  56. +181 0 components/requirejs/docs/node.html
  57. +426 0 components/requirejs/docs/optimization.html
  58. +330 0 components/requirejs/docs/plugins.html
  59. +116 0 components/requirejs/docs/requirements.html
  60. +109 0 components/requirejs/docs/start.html
  61. +217 0 components/requirejs/docs/why.html
  62. +386 0 components/requirejs/docs/whyamd.html
  63. +21 0 components/requirejs/index.html
  64. +5 0 components/requirejs/package.json
  65. +2,041 0 components/requirejs/require.js
  66. +42 0 components/requirejs/tasks.txt
  67. +11 0 components/requirejs/testBaseUrl.js
  68. +32 0 components/requirejs/tests/NAMESPACE.html
  69. +39 0 components/requirejs/tests/README.md
  70. +96 0 components/requirejs/tests/afterload.html
  71. +2 0  components/requirejs/tests/afterloadreadystate.js
  72. +83 0 components/requirejs/tests/all-server.js
  73. +154 0 components/requirejs/tests/all.js
  74. +1 0  components/requirejs/tests/allj.sh
  75. +1 0  components/requirejs/tests/alln.sh
  76. +7 0 components/requirejs/tests/anon/a.js
  77. +52 0 components/requirejs/tests/anon/anon-tests.js
  78. +14 0 components/requirejs/tests/anon/anonSimple.html
  79. +5 0 components/requirejs/tests/anon/blue.js
  80. +7 0 components/requirejs/tests/anon/c.js
  81. +3 0  components/requirejs/tests/anon/green.js
  82. +16 0 components/requirejs/tests/anon/magenta.js
  83. +1 0  components/requirejs/tests/anon/message.txt
  84. +5 0 components/requirejs/tests/anon/red.js
  85. +3 0  components/requirejs/tests/anon/sub/b.js
  86. +3 0  components/requirejs/tests/anon/yellow.js
  87. +5 0 components/requirejs/tests/bar
  88. +13 0 components/requirejs/tests/baseUrl.html
  89. +5 0 components/requirejs/tests/browsertests/appendbeforeload/one.dphpd
  90. +49 0 components/requirejs/tests/browsertests/appendbeforeload/test.html
  91. +1 0  components/requirejs/tests/browsertests/appendbeforeload/two.js
  92. +94 0 components/requirejs/tests/browsertests/async/async.php
  93. +5 0 components/requirejs/tests/browsertests/async/one.php
  94. +1 0  components/requirejs/tests/browsertests/async/two.js
  95. +47 0 components/requirejs/tests/browsertests/common.js
  96. +28 0 components/requirejs/tests/browsertests/docwritenested/index.html
  97. +7 0 components/requirejs/tests/browsertests/docwritenested/one.js
  98. +3 0  components/requirejs/tests/browsertests/docwritenested/two.js
  99. +49 0 components/requirejs/tests/browsertests/functionToString.html
  100. +86 0 components/requirejs/tests/browsertests/noload/index.html
  101. +26 0 components/requirejs/tests/browsertests/noload/server.js
  102. +74 0 components/requirejs/tests/browsertests/onerror/index.html
  103. +1 0  components/requirejs/tests/browsertests/onerror/ok.js
  104. +4 0 components/requirejs/tests/browsertests/onerror/parseError.js
  105. +4 0 components/requirejs/tests/browsertests/onerror/scriptError.js
  106. +1 0  components/requirejs/tests/browsertests/scriptload/eight.js
  107. +1 0  components/requirejs/tests/browsertests/scriptload/five.js
  108. +2,520 0 components/requirejs/tests/browsertests/scriptload/four.js
  109. +98 0 components/requirejs/tests/browsertests/scriptload/index.html
  110. +1 0  components/requirejs/tests/browsertests/scriptload/nine.js
  111. +1 0  components/requirejs/tests/browsertests/scriptload/one.js
  112. +1 0  components/requirejs/tests/browsertests/scriptload/seven.js
  113. +1 0  components/requirejs/tests/browsertests/scriptload/six.js
  114. +1 0  components/requirejs/tests/browsertests/scriptload/three.js
  115. +4 0 components/requirejs/tests/browsertests/scriptload/two.js
  116. +5 0 components/requirejs/tests/browsertests/scriptloadinteractive/eight.js
  117. +5 0 components/requirejs/tests/browsertests/scriptloadinteractive/five.js
  118. +2,524 0 components/requirejs/tests/browsertests/scriptloadinteractive/four.js
  119. +2,527 0 components/requirejs/tests/browsertests/scriptloadinteractive/four.php
  120. +149 0 components/requirejs/tests/browsertests/scriptloadinteractive/index-php.html
  121. +149 0 components/requirejs/tests/browsertests/scriptloadinteractive/index.html
  122. +5 0 components/requirejs/tests/browsertests/scriptloadinteractive/nine.js
  123. +5 0 components/requirejs/tests/browsertests/scriptloadinteractive/one.js
  124. +5 0 components/requirejs/tests/browsertests/scriptloadinteractive/seven.js
  125. +5 0 components/requirejs/tests/browsertests/scriptloadinteractive/six.js
  126. +9 0 components/requirejs/tests/browsertests/scriptloadinteractive/six.php
  127. +5 0 components/requirejs/tests/browsertests/scriptloadinteractive/three.js
  128. +5 0 components/requirejs/tests/browsertests/scriptloadinteractive/two.js
  129. +5 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/eight.js
  130. +5 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/five.js
  131. +2,524 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/four.js
  132. +2,527 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/four.php
  133. +149 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/index-php.html
  134. +153 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/index.html
  135. +5 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/nine.js
  136. +5 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/one.js
  137. +5 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/seven.js
  138. +5 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/six.js
  139. +9 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/six.php
  140. +5 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/three.js
  141. +5 0 components/requirejs/tests/browsertests/scriptloadinteractiveattach/two.js
  142. +9 0 components/requirejs/tests/browsertests/vardefine/define.js
  143. +13 0 components/requirejs/tests/browsertests/vardefine/four.js
  144. +47 0 components/requirejs/tests/browsertests/vardefine/index.html
  145. +4 0 components/requirejs/tests/browsertests/vardefine/one.js
  146. +3 0  components/requirejs/tests/browsertests/vardefine/three.js
  147. +7 0 components/requirejs/tests/browsertests/vardefine/two.js
  148. +31 0 components/requirejs/tests/circular-tests.js
  149. +14 0 components/requirejs/tests/circular.html
  150. +4 0 components/requirejs/tests/circular/a.js
  151. +4 0 components/requirejs/tests/circular/b.js
  152. +4 0 components/requirejs/tests/circular/c.js
  153. +18 0 components/requirejs/tests/circular/circularPlugin-tests.js
  154. +19 0 components/requirejs/tests/circular/circularPlugin.html
  155. +21 0 components/requirejs/tests/circular/complexPlugin/complexPlugin-tests.js
  156. +20 0 components/requirejs/tests/circular/complexPlugin/complexPlugin.html
  157. +6 0 components/requirejs/tests/circular/complexPlugin/helper.js
  158. +6 0 components/requirejs/tests/circular/complexPlugin/main.js
  159. +289 0 components/requirejs/tests/circular/complexPlugin/slowText.js
  160. +1 0  components/requirejs/tests/circular/complexPlugin/toolbar.html
  161. +6 0 components/requirejs/tests/circular/complexPlugin/toolbar.js
  162. +1 0  components/requirejs/tests/circular/complexPlugin/viewport.html
  163. +7 0 components/requirejs/tests/circular/complexPlugin/viewport.js
  164. +5 0 components/requirejs/tests/circular/plugin.js
  165. +9 0 components/requirejs/tests/cjsSpace/a.js
  166. +3 0  components/requirejs/tests/cjsSpace/b.js
  167. +9 0 components/requirejs/tests/cjsSpace/c.js
  168. +18 0 components/requirejs/tests/cjsSpace/cjsDotRequire-tests.js
  169. +16 0 components/requirejs/tests/cjsSpace/cjsDotRequire.html
  170. +17 0 components/requirejs/tests/cjsSpace/cjsSpace-tests.js
  171. +16 0 components/requirejs/tests/cjsSpace/cjsSpace.html
  172. +4 0 components/requirejs/tests/commonjs/tests/modules/1.0/absolute/b.js
  173. +20 0 components/requirejs/tests/commonjs/tests/modules/1.0/absolute/program.html
  174. +8 0 components/requirejs/tests/commonjs/tests/modules/1.0/absolute/program.js
  175. +6 0 components/requirejs/tests/commonjs/tests/modules/1.0/absolute/submodule/a.js
  176. +18 0 components/requirejs/tests/commonjs/tests/modules/1.0/absolute/test.js
  177. +22 0 components/requirejs/tests/commonjs/tests/modules/1.0/all.html
  178. +7 0 components/requirejs/tests/commonjs/tests/modules/1.0/cyclic/a.js
  179. +7 0 components/requirejs/tests/commonjs/tests/modules/1.0/cyclic/b.js
  180. +20 0 components/requirejs/tests/commonjs/tests/modules/1.0/cyclic/program.html
  181. +13 0 components/requirejs/tests/commonjs/tests/modules/1.0/cyclic/program.js
  182. +18 0 components/requirejs/tests/commonjs/tests/modules/1.0/cyclic/test.js
  183. +20 0 components/requirejs/tests/commonjs/tests/modules/1.0/determinism/program.html
  184. +6 0 components/requirejs/tests/commonjs/tests/modules/1.0/determinism/program.js
  185. +12 0 components/requirejs/tests/commonjs/tests/modules/1.0/determinism/submodule/a.js
  186. +5 0 components/requirejs/tests/commonjs/tests/modules/1.0/determinism/submodule/b.js
  187. +18 0 components/requirejs/tests/commonjs/tests/modules/1.0/determinism/test.js
  188. +6 0 components/requirejs/tests/commonjs/tests/modules/1.0/exactExports/a.js
  189. +20 0 components/requirejs/tests/commonjs/tests/modules/1.0/exactExports/program.html
  190. +7 0 components/requirejs/tests/commonjs/tests/modules/1.0/exactExports/program.js
  191. +18 0 components/requirejs/tests/commonjs/tests/modules/1.0/exactExports/test.js
  192. +3 0  components/requirejs/tests/commonjs/tests/modules/1.0/hasOwnProperty/hasOwnProperty.js
  193. +20 0 components/requirejs/tests/commonjs/tests/modules/1.0/hasOwnProperty/program.html
  194. +7 0 components/requirejs/tests/commonjs/tests/modules/1.0/hasOwnProperty/program.js
  195. +18 0 components/requirejs/tests/commonjs/tests/modules/1.0/hasOwnProperty/test.js
  196. +3 0  components/requirejs/tests/commonjs/tests/modules/1.0/hasOwnProperty/toString.js
  197. +15 0 components/requirejs/tests/commonjs/tests/modules/1.0/method/a.js
  198. +20 0 components/requirejs/tests/commonjs/tests/modules/1.0/method/program.html
  199. +11 0 components/requirejs/tests/commonjs/tests/modules/1.0/method/program.js
  200. +18 0 components/requirejs/tests/commonjs/tests/modules/1.0/method/test.js
  201. +20 0 components/requirejs/tests/commonjs/tests/modules/1.0/missing/program.html
  202. +11 0 components/requirejs/tests/commonjs/tests/modules/1.0/missing/program.js
  203. +18 0 components/requirejs/tests/commonjs/tests/modules/1.0/missing/test.js
  204. +4 0 components/requirejs/tests/commonjs/tests/modules/1.0/monkeys/a.js
  205. +20 0 components/requirejs/tests/commonjs/tests/modules/1.0/monkeys/program.html
  206. +7 0 components/requirejs/tests/commonjs/tests/modules/1.0/monkeys/program.js
  207. +18 0 components/requirejs/tests/commonjs/tests/modules/1.0/monkeys/test.js
  208. +6 0 components/requirejs/tests/commonjs/tests/modules/1.0/nested/a/b/c/d.js
  209. +20 0 components/requirejs/tests/commonjs/tests/modules/1.0/nested/program.html
  210. +6 0 components/requirejs/tests/commonjs/tests/modules/1.0/nested/program.js
  211. +18 0 components/requirejs/tests/commonjs/tests/modules/1.0/nested/test.js
  212. +20 0 components/requirejs/tests/commonjs/tests/modules/1.0/relative/program.html
  213. +8 0 components/requirejs/tests/commonjs/tests/modules/1.0/relative/program.js
  214. +4 0 components/requirejs/tests/commonjs/tests/modules/1.0/relative/submodule/a.js
  215. +5 0 components/requirejs/tests/commonjs/tests/modules/1.0/relative/submodule/b.js
  216. +18 0 components/requirejs/tests/commonjs/tests/modules/1.0/relative/test.js
  217. +8 0 components/requirejs/tests/commonjs/tests/modules/1.0/system.js
  218. +18 0 components/requirejs/tests/commonjs/tests/modules/1.0/test.js
  219. +4 0 components/requirejs/tests/commonjs/tests/modules/1.0/transitive/a.js
  220. +4 0 components/requirejs/tests/commonjs/tests/modules/1.0/transitive/b.js
  221. +6 0 components/requirejs/tests/commonjs/tests/modules/1.0/transitive/c.js
  222. +20 0 components/requirejs/tests/commonjs/tests/modules/1.0/transitive/program.html
  223. +6 0 components/requirejs/tests/commonjs/tests/modules/1.0/transitive/program.js
  224. +18 0 components/requirejs/tests/commonjs/tests/modules/1.0/transitive/test.js
  225. +44 0 components/requirejs/tests/config.html
  226. +49 0 components/requirejs/tests/configRequirejs.html
  227. +4 0 components/requirejs/tests/dataMain/baseUrl/a.js
  228. +23 0 components/requirejs/tests/dataMain/baseUrl/dataMainBaseUrl.html
  229. +11 0 components/requirejs/tests/dataMain/baseUrl/src/main.js
  230. +13 0 components/requirejs/tests/dataMain/dataMain.html
  231. +16 0 components/requirejs/tests/dataMain/dataMain.js
  232. +23 0 components/requirejs/tests/dataMain/dataMainIndex/dataMainIndex.html
  233. +15 0 components/requirejs/tests/dataMain/dataMainIndex/index.js
  234. +3 0  components/requirejs/tests/definedSpecified/a.js
  235. +3 0  components/requirejs/tests/definedSpecified/b.js
  236. +37 0 components/requirejs/tests/definedSpecified/definedSpecified-tests.js
  237. +16 0 components/requirejs/tests/definedSpecified/definedSpecified.html
  238. +54 0 components/requirejs/tests/delayedDefine/delayedDefine-tests.js
  239. +16 0 components/requirejs/tests/delayedDefine/delayedDefine.html
  240. +15 0 components/requirejs/tests/depoverlap.html
  241. +35 0 components/requirejs/tests/depoverlap.js
  242. +8 0 components/requirejs/tests/dimple.js
  243. +195 0 components/requirejs/tests/doh/LICENSE
  244. +12 0 components/requirejs/tests/doh/README
  245. +855 0 components/requirejs/tests/doh/_browserRunner.js
  246. +20 0 components/requirejs/tests/doh/_nodeRunner.js
  247. +17 0 components/requirejs/tests/doh/_rhinoRunner.js
  248. +10 0 components/requirejs/tests/doh/_sounds/LICENSE
  249. BIN  components/requirejs/tests/doh/_sounds/doh.wav
  250. BIN  components/requirejs/tests/doh/_sounds/dohaaa.wav
  251. BIN  components/requirejs/tests/doh/_sounds/woohoo.wav
  252. +315 0 components/requirejs/tests/doh/runner.html
  253. +1,499 0 components/requirejs/tests/doh/runner.js
  254. +3 0  components/requirejs/tests/doh/runner.sh
  255. BIN  components/requirejs/tests/doh/small_logo.png
  256. +43 0 components/requirejs/tests/domReady/domReady-tests.js
  257. +14 0 components/requirejs/tests/domReady/domReady.html
  258. +41 0 components/requirejs/tests/domReady/domReadyExtraConfig-tests.js
  259. +17 0 components/requirejs/tests/domReady/domReadyExtraConfig.html
  260. +8 0 components/requirejs/tests/domReady/one.js
  261. +8 0 components/requirejs/tests/domReady/two.js
  262. +13 0 components/requirejs/tests/dos.js
  263. +3 0  components/requirejs/tests/error/a.js
  264. +4 0 components/requirejs/tests/error/b.js
  265. +6 0 components/requirejs/tests/error/c.js
  266. +7 0 components/requirejs/tests/error/d.js
  267. +6 0 components/requirejs/tests/error/defineError.js
  268. +68 0 components/requirejs/tests/error/defineErrorLocal.html
  269. +61 0 components/requirejs/tests/error/errorContinue.html
  270. +58 0 components/requirejs/tests/error/errorContinueLocal.html
  271. +12 0 components/requirejs/tests/error/plug.js
  272. +65 0 components/requirejs/tests/error/pluginErrorContinue.html
  273. +55 0 components/requirejs/tests/error/pluginErrorContinueLocal.html
  274. +13 0 components/requirejs/tests/exports/am.js
  275. +5 0 components/requirejs/tests/exports/assign.js
  276. +4 0 components/requirejs/tests/exports/assign2.js
  277. +6 0 components/requirejs/tests/exports/bm.js
  278. +6 0 components/requirejs/tests/exports/cm.js
  279. +26 0 components/requirejs/tests/exports/exports-tests.js
  280. +14 0 components/requirejs/tests/exports/exports.html
  281. +5 0 components/requirejs/tests/exports/funcSet.js
  282. +7 0 components/requirejs/tests/exports/implicitModule.js
  283. +18 0 components/requirejs/tests/exports/moduleAndExports-tests.js
  284. +14 0 components/requirejs/tests/exports/moduleAndExports.html
  285. +10 0 components/requirejs/tests/exports/simpleReturn.js
  286. +3 0  components/requirejs/tests/exports/usethis.js
  287. +5 0 components/requirejs/tests/exports/vanilla.js
  288. +5 0 components/requirejs/tests/foo
  289. +7 0 components/requirejs/tests/func.js
  290. +14 0 components/requirejs/tests/funcFour.js
  291. +15 0 components/requirejs/tests/funcOne.js
  292. +14 0 components/requirejs/tests/funcThree.js
  293. +15 0 components/requirejs/tests/funcTwo.js
  294. +51 0 components/requirejs/tests/i18n/common.html
  295. +3 0  components/requirejs/tests/i18n/commonA.js
  296. +3 0  components/requirejs/tests/i18n/commonB.js
  297. +82 0 components/requirejs/tests/i18n/i18n.html
  298. +17 0 components/requirejs/tests/i18n/nls/colors.js
  299. +6 0 components/requirejs/tests/i18n/nls/en-us-surfer/colors.js
  300. +4 0 components/requirejs/tests/i18n/nls/fr/colors.js
  301. +5 0 components/requirejs/tests/i18n/testModule.js
  302. +12 0 components/requirejs/tests/index.html
  303. +5 0 components/requirejs/tests/isBrowser/a.js
  304. +17 0 components/requirejs/tests/isBrowser/isBrowser-tests.js
  305. +16 0 components/requirejs/tests/isBrowser/isBrowser.html
  306. +14 0 components/requirejs/tests/issue379/issue379.html
  307. +31 0 components/requirejs/tests/issue379/issue379.js
  308. +33 0 components/requirejs/tests/jquery/jquery.html
  309. +38 0 components/requirejs/tests/jquery/jqueryDynamic.html
  310. +45 0 components/requirejs/tests/jquery/jqueryDynamic2.html
  311. +1 0  components/requirejs/tests/jquery/scripts/app.js
  312. +18 0 components/requirejs/tests/jquery/scripts/dynamicApp.js
  313. +9,266 0 components/requirejs/tests/jquery/scripts/jquery-1.7.1.js
Sorry, we could not display the entire diff because too many files (1,116) changed.
6 .dotcloud/config
... ... @@ -0,0 +1,6 @@
  1 +{
  2 + "push_branch": null,
  3 + "application": "rockets",
  4 + "version": "0.9.1",
  5 + "push_protocol": "rsync"
  6 +}
14,401 components/AngularJS/angular.js
14,401 additions, 0 deletions not shown
13 components/AngularJS/component.json
... ... @@ -0,0 +1,13 @@
  1 +{
  2 + "name": "AngularJS",
  3 + "version": "1.0.2",
  4 + "main": "./angular.js",
  5 + "dependencies": {},
  6 + "_id": "AngularJS@1.0.2",
  7 + "readme": "ERROR: No README.md file found!",
  8 + "description": "ERROR: No README.md file found!",
  9 + "repository": {
  10 + "type": "git",
  11 + "url": "git://github.com/angular/bower-angular.git"
  12 + }
  13 +}
1,741 components/angular-modules/angular-mocks.js
... ... @@ -0,0 +1,1741 @@
  1 +
  2 +/**
  3 + * @license AngularJS v"NG_VERSION_FULL"
  4 + * (c) 2010-2012 Google, Inc. http://angularjs.org
  5 + * License: MIT
  6 + *
  7 + * TODO(vojta): wrap whole file into closure during build
  8 + */
  9 +
  10 +/**
  11 + * @ngdoc overview
  12 + * @name angular.mock
  13 + * @description
  14 + *
  15 + * Namespace from 'angular-mocks.js' which contains testing related code.
  16 + */
  17 +angular.mock = {};
  18 +
  19 +/**
  20 + * ! This is a private undocumented service !
  21 + *
  22 + * @name ngMock.$browser
  23 + *
  24 + * @description
  25 + * This service is a mock implementation of {@link ng.$browser}. It provides fake
  26 + * implementation for commonly used browser apis that are hard to test, e.g. setTimeout, xhr,
  27 + * cookies, etc...
  28 + *
  29 + * The api of this service is the same as that of the real {@link ng.$browser $browser}, except
  30 + * that there are several helper methods available which can be used in tests.
  31 + */
  32 +angular.mock.$BrowserProvider = function() {
  33 + this.$get = function(){
  34 + return new angular.mock.$Browser();
  35 + };
  36 +};
  37 +
  38 +angular.mock.$Browser = function() {
  39 + var self = this;
  40 +
  41 + this.isMock = true;
  42 + self.$$url = "http://server/";
  43 + self.$$lastUrl = self.$$url; // used by url polling fn
  44 + self.pollFns = [];
  45 +
  46 + // TODO(vojta): remove this temporary api
  47 + self.$$completeOutstandingRequest = angular.noop;
  48 + self.$$incOutstandingRequestCount = angular.noop;
  49 +
  50 +
  51 + // register url polling fn
  52 +
  53 + self.onUrlChange = function(listener) {
  54 + self.pollFns.push(
  55 + function() {
  56 + if (self.$$lastUrl != self.$$url) {
  57 + self.$$lastUrl = self.$$url;
  58 + listener(self.$$url);
  59 + }
  60 + }
  61 + );
  62 +
  63 + return listener;
  64 + };
  65 +
  66 + self.cookieHash = {};
  67 + self.lastCookieHash = {};
  68 + self.deferredFns = [];
  69 + self.deferredNextId = 0;
  70 +
  71 + self.defer = function(fn, delay) {
  72 + delay = delay || 0;
  73 + self.deferredFns.push({time:(self.defer.now + delay), fn:fn, id: self.deferredNextId});
  74 + self.deferredFns.sort(function(a,b){ return a.time - b.time;});
  75 + return self.deferredNextId++;
  76 + };
  77 +
  78 +
  79 + self.defer.now = 0;
  80 +
  81 +
  82 + self.defer.cancel = function(deferId) {
  83 + var fnIndex;
  84 +
  85 + angular.forEach(self.deferredFns, function(fn, index) {
  86 + if (fn.id === deferId) fnIndex = index;
  87 + });
  88 +
  89 + if (fnIndex !== undefined) {
  90 + self.deferredFns.splice(fnIndex, 1);
  91 + return true;
  92 + }
  93 +
  94 + return false;
  95 + };
  96 +
  97 +
  98 + /**
  99 + * @name ngMock.$browser#defer.flush
  100 + * @methodOf ngMock.$browser
  101 + *
  102 + * @description
  103 + * Flushes all pending requests and executes the defer callbacks.
  104 + *
  105 + * @param {number=} number of milliseconds to flush. See {@link #defer.now}
  106 + */
  107 + self.defer.flush = function(delay) {
  108 + if (angular.isDefined(delay)) {
  109 + self.defer.now += delay;
  110 + } else {
  111 + if (self.deferredFns.length) {
  112 + self.defer.now = self.deferredFns[self.deferredFns.length-1].time;
  113 + } else {
  114 + throw Error('No deferred tasks to be flushed');
  115 + }
  116 + }
  117 +
  118 + while (self.deferredFns.length && self.deferredFns[0].time <= self.defer.now) {
  119 + self.deferredFns.shift().fn();
  120 + }
  121 + };
  122 + /**
  123 + * @name ngMock.$browser#defer.now
  124 + * @propertyOf ngMock.$browser
  125 + *
  126 + * @description
  127 + * Current milliseconds mock time.
  128 + */
  129 +
  130 + self.$$baseHref = '';
  131 + self.baseHref = function() {
  132 + return this.$$baseHref;
  133 + };
  134 +};
  135 +angular.mock.$Browser.prototype = {
  136 +
  137 +/**
  138 + * @name ngMock.$browser#poll
  139 + * @methodOf ngMock.$browser
  140 + *
  141 + * @description
  142 + * run all fns in pollFns
  143 + */
  144 + poll: function poll() {
  145 + angular.forEach(this.pollFns, function(pollFn){
  146 + pollFn();
  147 + });
  148 + },
  149 +
  150 + addPollFn: function(pollFn) {
  151 + this.pollFns.push(pollFn);
  152 + return pollFn;
  153 + },
  154 +
  155 + url: function(url, replace) {
  156 + if (url) {
  157 + this.$$url = url;
  158 + return this;
  159 + }
  160 +
  161 + return this.$$url;
  162 + },
  163 +
  164 + cookies: function(name, value) {
  165 + if (name) {
  166 + if (value == undefined) {
  167 + delete this.cookieHash[name];
  168 + } else {
  169 + if (angular.isString(value) && //strings only
  170 + value.length <= 4096) { //strict cookie storage limits
  171 + this.cookieHash[name] = value;
  172 + }
  173 + }
  174 + } else {
  175 + if (!angular.equals(this.cookieHash, this.lastCookieHash)) {
  176 + this.lastCookieHash = angular.copy(this.cookieHash);
  177 + this.cookieHash = angular.copy(this.cookieHash);
  178 + }
  179 + return this.cookieHash;
  180 + }
  181 + },
  182 +
  183 + notifyWhenNoOutstandingRequests: function(fn) {
  184 + fn();
  185 + }
  186 +};
  187 +
  188 +
  189 +/**
  190 + * @ngdoc object
  191 + * @name ngMock.$exceptionHandlerProvider
  192 + *
  193 + * @description
  194 + * Configures the mock implementation of {@link ng.$exceptionHandler} to rethrow or to log errors passed
  195 + * into the `$exceptionHandler`.
  196 + */
  197 +
  198 +/**
  199 + * @ngdoc object
  200 + * @name ngMock.$exceptionHandler
  201 + *
  202 + * @description
  203 + * Mock implementation of {@link ng.$exceptionHandler} that rethrows or logs errors passed
  204 + * into it. See {@link ngMock.$exceptionHandlerProvider $exceptionHandlerProvider} for configuration
  205 + * information.
  206 + */
  207 +
  208 +angular.mock.$ExceptionHandlerProvider = function() {
  209 + var handler;
  210 +
  211 + /**
  212 + * @ngdoc method
  213 + * @name ngMock.$exceptionHandlerProvider#mode
  214 + * @methodOf ngMock.$exceptionHandlerProvider
  215 + *
  216 + * @description
  217 + * Sets the logging mode.
  218 + *
  219 + * @param {string} mode Mode of operation, defaults to `rethrow`.
  220 + *
  221 + * - `rethrow`: If any errors are are passed into the handler in tests, it typically
  222 + * means that there is a bug in the application or test, so this mock will
  223 + * make these tests fail.
  224 + * - `log`: Sometimes it is desirable to test that an error is throw, for this case the `log` mode stores the
  225 + * error and allows later assertion of it.
  226 + * See {@link ngMock.$log#assertEmpty assertEmpty()} and
  227 + * {@link ngMock.$log#reset reset()}
  228 + */
  229 + this.mode = function(mode) {
  230 + switch(mode) {
  231 + case 'rethrow':
  232 + handler = function(e) {
  233 + throw e;
  234 + };
  235 + break;
  236 + case 'log':
  237 + var errors = [];
  238 +
  239 + handler = function(e) {
  240 + if (arguments.length == 1) {
  241 + errors.push(e);
  242 + } else {
  243 + errors.push([].slice.call(arguments, 0));
  244 + }
  245 + };
  246 +
  247 + handler.errors = errors;
  248 + break;
  249 + default:
  250 + throw Error("Unknown mode '" + mode + "', only 'log'/'rethrow' modes are allowed!");
  251 + }
  252 + };
  253 +
  254 + this.$get = function() {
  255 + return handler;
  256 + };
  257 +
  258 + this.mode('rethrow');
  259 +};
  260 +
  261 +
  262 +/**
  263 + * @ngdoc service
  264 + * @name ngMock.$log
  265 + *
  266 + * @description
  267 + * Mock implementation of {@link ng.$log} that gathers all logged messages in arrays
  268 + * (one array per logging level). These arrays are exposed as `logs` property of each of the
  269 + * level-specific log function, e.g. for level `error` the array is exposed as `$log.error.logs`.
  270 + *
  271 + */
  272 +angular.mock.$LogProvider = function() {
  273 +
  274 + function concat(array1, array2, index) {
  275 + return array1.concat(Array.prototype.slice.call(array2, index));
  276 + }
  277 +
  278 +
  279 + this.$get = function () {
  280 + var $log = {
  281 + log: function() { $log.log.logs.push(concat([], arguments, 0)); },
  282 + warn: function() { $log.warn.logs.push(concat([], arguments, 0)); },
  283 + info: function() { $log.info.logs.push(concat([], arguments, 0)); },
  284 + error: function() { $log.error.logs.push(concat([], arguments, 0)); }
  285 + };
  286 +
  287 + /**
  288 + * @ngdoc method
  289 + * @name ngMock.$log#reset
  290 + * @methodOf ngMock.$log
  291 + *
  292 + * @description
  293 + * Reset all of the logging arrays to empty.
  294 + */
  295 + $log.reset = function () {
  296 + /**
  297 + * @ngdoc property
  298 + * @name ngMock.$log#log.logs
  299 + * @propertyOf ngMock.$log
  300 + *
  301 + * @description
  302 + * Array of logged messages.
  303 + */
  304 + $log.log.logs = [];
  305 + /**
  306 + * @ngdoc property
  307 + * @name ngMock.$log#warn.logs
  308 + * @propertyOf ngMock.$log
  309 + *
  310 + * @description
  311 + * Array of logged messages.
  312 + */
  313 + $log.warn.logs = [];
  314 + /**
  315 + * @ngdoc property
  316 + * @name ngMock.$log#info.logs
  317 + * @propertyOf ngMock.$log
  318 + *
  319 + * @description
  320 + * Array of logged messages.
  321 + */
  322 + $log.info.logs = [];
  323 + /**
  324 + * @ngdoc property
  325 + * @name ngMock.$log#error.logs
  326 + * @propertyOf ngMock.$log
  327 + *
  328 + * @description
  329 + * Array of logged messages.
  330 + */
  331 + $log.error.logs = [];
  332 + };
  333 +
  334 + /**
  335 + * @ngdoc method
  336 + * @name ngMock.$log#assertEmpty
  337 + * @methodOf ngMock.$log
  338 + *
  339 + * @description
  340 + * Assert that the all of the logging methods have no logged messages. If messages present, an exception is thrown.
  341 + */
  342 + $log.assertEmpty = function() {
  343 + var errors = [];
  344 + angular.forEach(['error', 'warn', 'info', 'log'], function(logLevel) {
  345 + angular.forEach($log[logLevel].logs, function(log) {
  346 + angular.forEach(log, function (logItem) {
  347 + errors.push('MOCK $log (' + logLevel + '): ' + String(logItem) + '\n' + (logItem.stack || ''));
  348 + });
  349 + });
  350 + });
  351 + if (errors.length) {
  352 + errors.unshift("Expected $log to be empty! Either a message was logged unexpectedly, or an expected " +
  353 + "log message was not checked and removed:");
  354 + errors.push('');
  355 + throw new Error(errors.join('\n---------\n'));
  356 + }
  357 + };
  358 +
  359 + $log.reset();
  360 + return $log;
  361 + };
  362 +};
  363 +
  364 +
  365 +(function() {
  366 + var R_ISO8061_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?:\:?(\d\d)(?:\:?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/;
  367 +
  368 + function jsonStringToDate(string){
  369 + var match;
  370 + if (match = string.match(R_ISO8061_STR)) {
  371 + var date = new Date(0),
  372 + tzHour = 0,
  373 + tzMin = 0;
  374 + if (match[9]) {
  375 + tzHour = int(match[9] + match[10]);
  376 + tzMin = int(match[9] + match[11]);
  377 + }
  378 + date.setUTCFullYear(int(match[1]), int(match[2]) - 1, int(match[3]));
  379 + date.setUTCHours(int(match[4]||0) - tzHour, int(match[5]||0) - tzMin, int(match[6]||0), int(match[7]||0));
  380 + return date;
  381 + }
  382 + return string;
  383 + }
  384 +
  385 + function int(str) {
  386 + return parseInt(str, 10);
  387 + }
  388 +
  389 + function padNumber(num, digits, trim) {
  390 + var neg = '';
  391 + if (num < 0) {
  392 + neg = '-';
  393 + num = -num;
  394 + }
  395 + num = '' + num;
  396 + while(num.length < digits) num = '0' + num;
  397 + if (trim)
  398 + num = num.substr(num.length - digits);
  399 + return neg + num;
  400 + }
  401 +
  402 +
  403 + /**
  404 + * @ngdoc object
  405 + * @name angular.mock.TzDate
  406 + * @description
  407 + *
  408 + * *NOTE*: this is not an injectable instance, just a globally available mock class of `Date`.
  409 + *
  410 + * Mock of the Date type which has its timezone specified via constroctor arg.
  411 + *
  412 + * The main purpose is to create Date-like instances with timezone fixed to the specified timezone
  413 + * offset, so that we can test code that depends on local timezone settings without dependency on
  414 + * the time zone settings of the machine where the code is running.
  415 + *
  416 + * @param {number} offset Offset of the *desired* timezone in hours (fractions will be honored)
  417 + * @param {(number|string)} timestamp Timestamp representing the desired time in *UTC*
  418 + *
  419 + * @example
  420 + * !!!! WARNING !!!!!
  421 + * This is not a complete Date object so only methods that were implemented can be called safely.
  422 + * To make matters worse, TzDate instances inherit stuff from Date via a prototype.
  423 + *
  424 + * We do our best to intercept calls to "unimplemented" methods, but since the list of methods is
  425 + * incomplete we might be missing some non-standard methods. This can result in errors like:
  426 + * "Date.prototype.foo called on incompatible Object".
  427 + *
  428 + * <pre>
  429 + * var newYearInBratislava = new TzDate(-1, '2009-12-31T23:00:00Z');
  430 + * newYearInBratislava.getTimezoneOffset() => -60;
  431 + * newYearInBratislava.getFullYear() => 2010;
  432 + * newYearInBratislava.getMonth() => 0;
  433 + * newYearInBratislava.getDate() => 1;
  434 + * newYearInBratislava.getHours() => 0;
  435 + * newYearInBratislava.getMinutes() => 0;
  436 + * </pre>
  437 + *
  438 + */
  439 + angular.mock.TzDate = function (offset, timestamp) {
  440 + var self = new Date(0);
  441 + if (angular.isString(timestamp)) {
  442 + var tsStr = timestamp;
  443 +
  444 + self.origDate = jsonStringToDate(timestamp);
  445 +
  446 + timestamp = self.origDate.getTime();
  447 + if (isNaN(timestamp))
  448 + throw {
  449 + name: "Illegal Argument",
  450 + message: "Arg '" + tsStr + "' passed into TzDate constructor is not a valid date string"
  451 + };
  452 + } else {
  453 + self.origDate = new Date(timestamp);
  454 + }
  455 +
  456 + var localOffset = new Date(timestamp).getTimezoneOffset();
  457 + self.offsetDiff = localOffset*60*1000 - offset*1000*60*60;
  458 + self.date = new Date(timestamp + self.offsetDiff);
  459 +
  460 + self.getTime = function() {
  461 + return self.date.getTime() - self.offsetDiff;
  462 + };
  463 +
  464 + self.toLocaleDateString = function() {
  465 + return self.date.toLocaleDateString();
  466 + };
  467 +
  468 + self.getFullYear = function() {
  469 + return self.date.getFullYear();
  470 + };
  471 +
  472 + self.getMonth = function() {
  473 + return self.date.getMonth();
  474 + };
  475 +
  476 + self.getDate = function() {
  477 + return self.date.getDate();
  478 + };
  479 +
  480 + self.getHours = function() {
  481 + return self.date.getHours();
  482 + };
  483 +
  484 + self.getMinutes = function() {
  485 + return self.date.getMinutes();
  486 + };
  487 +
  488 + self.getSeconds = function() {
  489 + return self.date.getSeconds();
  490 + };
  491 +
  492 + self.getTimezoneOffset = function() {
  493 + return offset * 60;
  494 + };
  495 +
  496 + self.getUTCFullYear = function() {
  497 + return self.origDate.getUTCFullYear();
  498 + };
  499 +
  500 + self.getUTCMonth = function() {
  501 + return self.origDate.getUTCMonth();
  502 + };
  503 +
  504 + self.getUTCDate = function() {
  505 + return self.origDate.getUTCDate();
  506 + };
  507 +
  508 + self.getUTCHours = function() {
  509 + return self.origDate.getUTCHours();
  510 + };
  511 +
  512 + self.getUTCMinutes = function() {
  513 + return self.origDate.getUTCMinutes();
  514 + };
  515 +
  516 + self.getUTCSeconds = function() {
  517 + return self.origDate.getUTCSeconds();
  518 + };
  519 +
  520 + self.getUTCMilliseconds = function() {
  521 + return self.origDate.getUTCMilliseconds();
  522 + };
  523 +
  524 + self.getDay = function() {
  525 + return self.date.getDay();
  526 + };
  527 +
  528 + // provide this method only on browsers that already have it
  529 + if (self.toISOString) {
  530 + self.toISOString = function() {
  531 + return padNumber(self.origDate.getUTCFullYear(), 4) + '-' +
  532 + padNumber(self.origDate.getUTCMonth() + 1, 2) + '-' +
  533 + padNumber(self.origDate.getUTCDate(), 2) + 'T' +
  534 + padNumber(self.origDate.getUTCHours(), 2) + ':' +
  535 + padNumber(self.origDate.getUTCMinutes(), 2) + ':' +
  536 + padNumber(self.origDate.getUTCSeconds(), 2) + '.' +
  537 + padNumber(self.origDate.getUTCMilliseconds(), 3) + 'Z'
  538 + }
  539 + }
  540 +
  541 + //hide all methods not implemented in this mock that the Date prototype exposes
  542 + var unimplementedMethods = ['getMilliseconds', 'getUTCDay',
  543 + 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds',
  544 + 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear',
  545 + 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds',
  546 + 'setYear', 'toDateString', 'toGMTString', 'toJSON', 'toLocaleFormat', 'toLocaleString',
  547 + 'toLocaleTimeString', 'toSource', 'toString', 'toTimeString', 'toUTCString', 'valueOf'];
  548 +
  549 + angular.forEach(unimplementedMethods, function(methodName) {
  550 + self[methodName] = function() {
  551 + throw Error("Method '" + methodName + "' is not implemented in the TzDate mock");
  552 + };
  553 + });
  554 +
  555 + return self;
  556 + };
  557 +
  558 + //make "tzDateInstance instanceof Date" return true
  559 + angular.mock.TzDate.prototype = Date.prototype;
  560 +})();
  561 +
  562 +
  563 +/**
  564 + * @ngdoc function
  565 + * @name angular.mock.debug
  566 + * @description
  567 + *
  568 + * *NOTE*: this is not an injectable instance, just a globally available function.
  569 + *
  570 + * Method for serializing common angular objects (scope, elements, etc..) into strings, useful for debugging.
  571 + *
  572 + * This method is also available on window, where it can be used to display objects on debug console.
  573 + *
  574 + * @param {*} object - any object to turn into string.
  575 + * @return {string} a serialized string of the argument
  576 + */
  577 +angular.mock.dump = function(object) {
  578 + return serialize(object);
  579 +
  580 + function serialize(object) {
  581 + var out;
  582 +
  583 + if (angular.isElement(object)) {
  584 + object = angular.element(object);
  585 + out = angular.element('<div></div>');
  586 + angular.forEach(object, function(element) {
  587 + out.append(angular.element(element).clone());
  588 + });
  589 + out = out.html();
  590 + } else if (angular.isArray(object)) {
  591 + out = [];
  592 + angular.forEach(object, function(o) {
  593 + out.push(serialize(o));
  594 + });
  595 + out = '[ ' + out.join(', ') + ' ]';
  596 + } else if (angular.isObject(object)) {
  597 + if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) {
  598 + out = serializeScope(object);
  599 + } else if (object instanceof Error) {
  600 + out = object.stack || ('' + object.name + ': ' + object.message);
  601 + } else {
  602 + out = angular.toJson(object, true);
  603 + }
  604 + } else {
  605 + out = String(object);
  606 + }
  607 +
  608 + return out;
  609 + }
  610 +
  611 + function serializeScope(scope, offset) {
  612 + offset = offset || ' ';
  613 + var log = [offset + 'Scope(' + scope.$id + '): {'];
  614 + for ( var key in scope ) {
  615 + if (scope.hasOwnProperty(key) && !key.match(/^(\$|this)/)) {
  616 + log.push(' ' + key + ': ' + angular.toJson(scope[key]));
  617 + }
  618 + }
  619 + var child = scope.$$childHead;
  620 + while(child) {
  621 + log.push(serializeScope(child, offset + ' '));
  622 + child = child.$$nextSibling;
  623 + }
  624 + log.push('}');
  625 + return log.join('\n' + offset);
  626 + }
  627 +};
  628 +
  629 +/**
  630 + * @ngdoc object
  631 + * @name ngMock.$httpBackend
  632 + * @description
  633 + * Fake HTTP backend implementation suitable for unit testing application that use the
  634 + * {@link ng.$http $http service}.
  635 + *
  636 + * *Note*: For fake http backend implementation suitable for end-to-end testing or backend-less
  637 + * development please see {@link ngMockE2E.$httpBackend e2e $httpBackend mock}.
  638 + *
  639 + * During unit testing, we want our unit tests to run quickly and have no external dependencies so
  640 + * we don’t want to send {@link https://developer.mozilla.org/en/xmlhttprequest XHR} or
  641 + * {@link http://en.wikipedia.org/wiki/JSONP JSONP} requests to a real server. All we really need is
  642 + * to verify whether a certain request has been sent or not, or alternatively just let the
  643 + * application make requests, respond with pre-trained responses and assert that the end result is
  644 + * what we expect it to be.
  645 + *
  646 + * This mock implementation can be used to respond with static or dynamic responses via the
  647 + * `expect` and `when` apis and their shortcuts (`expectGET`, `whenPOST`, etc).
  648 + *
  649 + * When an Angular application needs some data from a server, it calls the $http service, which
  650 + * sends the request to a real server using $httpBackend service. With dependency injection, it is
  651 + * easy to inject $httpBackend mock (which has the same API as $httpBackend) and use it to verify
  652 + * the requests and respond with some testing data without sending a request to real server.
  653 + *
  654 + * There are two ways to specify what test data should be returned as http responses by the mock
  655 + * backend when the code under test makes http requests:
  656 + *
  657 + * - `$httpBackend.expect` - specifies a request expectation
  658 + * - `$httpBackend.when` - specifies a backend definition
  659 + *
  660 + *
  661 + * # Request Expectations vs Backend Definitions
  662 + *
  663 + * Request expectations provide a way to make assertions about requests made by the application and
  664 + * to define responses for those requests. The test will fail if the expected requests are not made
  665 + * or they are made in the wrong order.
  666 + *
  667 + * Backend definitions allow you to define a fake backend for your application which doesn't assert
  668 + * if a particular request was made or not, it just returns a trained response if a request is made.
  669 + * The test will pass whether or not the request gets made during testing.
  670 + *
  671 + *
  672 + * <table class="table">
  673 + * <tr><th width="220px"></th><th>Request expectations</th><th>Backend definitions</th></tr>
  674 + * <tr>
  675 + * <th>Syntax</th>
  676 + * <td>.expect(...).respond(...)</td>
  677 + * <td>.when(...).respond(...)</td>
  678 + * </tr>
  679 + * <tr>
  680 + * <th>Typical usage</th>
  681 + * <td>strict unit tests</td>
  682 + * <td>loose (black-box) unit testing</td>
  683 + * </tr>
  684 + * <tr>
  685 + * <th>Fulfills multiple requests</th>
  686 + * <td>NO</td>
  687 + * <td>YES</td>
  688 + * </tr>
  689 + * <tr>
  690 + * <th>Order of requests matters</th>
  691 + * <td>YES</td>
  692 + * <td>NO</td>
  693 + * </tr>
  694 + * <tr>
  695 + * <th>Request required</th>
  696 + * <td>YES</td>
  697 + * <td>NO</td>
  698 + * </tr>
  699 + * <tr>
  700 + * <th>Response required</th>
  701 + * <td>optional (see below)</td>
  702 + * <td>YES</td>
  703 + * </tr>
  704 + * </table>
  705 + *
  706 + * In cases where both backend definitions and request expectations are specified during unit
  707 + * testing, the request expectations are evaluated first.
  708 + *
  709 + * If a request expectation has no response specified, the algorithm will search your backend
  710 + * definitions for an appropriate response.
  711 + *
  712 + * If a request didn't match any expectation or if the expectation doesn't have the response
  713 + * defined, the backend definitions are evaluated in sequential order to see if any of them match
  714 + * the request. The response from the first matched definition is returned.
  715 + *
  716 + *
  717 + * # Flushing HTTP requests
  718 + *
  719 + * The $httpBackend used in production, always responds to requests with responses asynchronously.
  720 + * If we preserved this behavior in unit testing, we'd have to create async unit tests, which are
  721 + * hard to write, follow and maintain. At the same time the testing mock, can't respond
  722 + * synchronously because that would change the execution of the code under test. For this reason the
  723 + * mock $httpBackend has a `flush()` method, which allows the test to explicitly flush pending
  724 + * requests and thus preserving the async api of the backend, while allowing the test to execute
  725 + * synchronously.
  726 + *
  727 + *
  728 + * # Unit testing with mock $httpBackend
  729 + *
  730 + * <pre>
  731 + // controller
  732 + function MyController($scope, $http) {
  733 + $http.get('/auth.py').success(function(data) {
  734 + $scope.user = data;
  735 + });
  736 +
  737 + this.saveMessage = function(message) {
  738 + $scope.status = 'Saving...';
  739 + $http.post('/add-msg.py', message).success(function(response) {
  740 + $scope.status = '';
  741 + }).error(function() {
  742 + $scope.status = 'ERROR!';
  743 + });
  744 + };
  745 + }
  746 +
  747 + // testing controller
  748 + var $http;
  749 +
  750 + beforeEach(inject(function($injector) {
  751 + $httpBackend = $injector.get('$httpBackend');
  752 +
  753 + // backend definition common for all tests
  754 + $httpBackend.when('GET', '/auth.py').respond({userId: 'userX'}, {'A-Token': 'xxx'});
  755 + }));
  756 +
  757 +
  758 + afterEach(function() {
  759 + $httpBackend.verifyNoOutstandingExpectation();
  760 + $httpBackend.verifyNoOutstandingRequest();
  761 + });
  762 +
  763 +
  764 + it('should fetch authentication token', function() {
  765 + $httpBackend.expectGET('/auth.py');
  766 + var controller = scope.$new(MyController);
  767 + $httpBackend.flush();
  768 + });
  769 +
  770 +
  771 + it('should send msg to server', function() {
  772 + // now you don’t care about the authentication, but
  773 + // the controller will still send the request and
  774 + // $httpBackend will respond without you having to
  775 + // specify the expectation and response for this request
  776 + $httpBackend.expectPOST('/add-msg.py', 'message content').respond(201, '');
  777 +
  778 + var controller = scope.$new(MyController);
  779 + $httpBackend.flush();
  780 + controller.saveMessage('message content');
  781 + expect(controller.status).toBe('Saving...');
  782 + $httpBackend.flush();
  783 + expect(controller.status).toBe('');
  784 + });
  785 +
  786 +
  787 + it('should send auth header', function() {
  788 + $httpBackend.expectPOST('/add-msg.py', undefined, function(headers) {
  789 + // check if the header was send, if it wasn't the expectation won't
  790 + // match the request and the test will fail
  791 + return headers['Authorization'] == 'xxx';
  792 + }).respond(201, '');
  793 +
  794 + var controller = scope.$new(MyController);
  795 + controller.saveMessage('whatever');
  796 + $httpBackend.flush();
  797 + });
  798 + </pre>
  799 + */
  800 +angular.mock.$HttpBackendProvider = function() {
  801 + this.$get = [createHttpBackendMock];
  802 +};
  803 +
  804 +/**
  805 + * General factory function for $httpBackend mock.
  806 + * Returns instance for unit testing (when no arguments specified):
  807 + * - passing through is disabled
  808 + * - auto flushing is disabled
  809 + *
  810 + * Returns instance for e2e testing (when `$delegate` and `$browser` specified):
  811 + * - passing through (delegating request to real backend) is enabled
  812 + * - auto flushing is enabled
  813 + *
  814 + * @param {Object=} $delegate Real $httpBackend instance (allow passing through if specified)
  815 + * @param {Object=} $browser Auto-flushing enabled if specified
  816 + * @return {Object} Instance of $httpBackend mock
  817 + */
  818 +function createHttpBackendMock($delegate, $browser) {
  819 + var definitions = [],
  820 + expectations = [],
  821 + responses = [],
  822 + responsesPush = angular.bind(responses, responses.push);
  823 +
  824 + function createResponse(status, data, headers) {
  825 + if (angular.isFunction(status)) return status;
  826 +
  827 + return function() {
  828 + return angular.isNumber(status)
  829 + ? [status, data, headers]
  830 + : [200, status, data];
  831 + };
  832 + }
  833 +
  834 + // TODO(vojta): change params to: method, url, data, headers, callback
  835 + function $httpBackend(method, url, data, callback, headers) {
  836 + var xhr = new MockXhr(),
  837 + expectation = expectations[0],
  838 + wasExpected = false;
  839 +
  840 + function prettyPrint(data) {
  841 + return (angular.isString(data) || angular.isFunction(data) || data instanceof RegExp)
  842 + ? data
  843 + : angular.toJson(data);
  844 + }
  845 +
  846 + if (expectation && expectation.match(method, url)) {
  847 + if (!expectation.matchData(data))
  848 + throw Error('Expected ' + expectation + ' with different data\n' +
  849 + 'EXPECTED: ' + prettyPrint(expectation.data) + '\nGOT: ' + data);
  850 +
  851 + if (!expectation.matchHeaders(headers))
  852 + throw Error('Expected ' + expectation + ' with different headers\n' +
  853 + 'EXPECTED: ' + prettyPrint(expectation.headers) + '\nGOT: ' +
  854 + prettyPrint(headers));
  855 +
  856 + expectations.shift();
  857 +
  858 + if (expectation.response) {
  859 + responses.push(function() {
  860 + var response = expectation.response(method, url, data, headers);
  861 + xhr.$$respHeaders = response[2];
  862 + callback(response[0], response[1], xhr.getAllResponseHeaders());
  863 + });
  864 + return;
  865 + }
  866 + wasExpected = true;
  867 + }
  868 +
  869 + var i = -1, definition;
  870 + while ((definition = definitions[++i])) {
  871 + if (definition.match(method, url, data, headers || {})) {
  872 + if (definition.response) {
  873