todo_rails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (426) hide show
  1. checksums.yaml +4 -4
  2. data/lib/todo_rails/version.rb +1 -1
  3. data/vendor/assets/bower.json +8 -0
  4. data/vendor/assets/bower_components/angular-animate/README.md +68 -0
  5. data/vendor/assets/bower_components/angular-animate/angular-animate.js +3721 -0
  6. data/vendor/assets/bower_components/angular-animate/angular-animate.min.js +52 -0
  7. data/vendor/assets/bower_components/angular-animate/angular-animate.min.js.map +8 -0
  8. data/vendor/assets/bower_components/angular-animate/bower.json +9 -0
  9. data/vendor/assets/bower_components/angular-animate/index.js +2 -0
  10. data/vendor/assets/bower_components/angular-animate/package.json +26 -0
  11. data/vendor/assets/bower_components/angular-aria/README.md +67 -0
  12. data/vendor/assets/bower_components/angular-aria/angular-aria.js +393 -0
  13. data/vendor/assets/bower_components/angular-aria/angular-aria.min.js +13 -0
  14. data/vendor/assets/bower_components/angular-aria/angular-aria.min.js.map +8 -0
  15. data/vendor/assets/bower_components/angular-aria/bower.json +9 -0
  16. data/vendor/assets/bower_components/angular-aria/index.js +2 -0
  17. data/vendor/assets/bower_components/angular-aria/package.json +27 -0
  18. data/vendor/assets/bower_components/angular-material/CHANGELOG.md +1599 -0
  19. data/vendor/assets/bower_components/angular-material/LICENSE +21 -0
  20. data/vendor/assets/bower_components/angular-material/README.md +211 -0
  21. data/vendor/assets/bower_components/angular-material/angular-material-mocks.js +77 -0
  22. data/vendor/assets/bower_components/angular-material/angular-material.css +7183 -0
  23. data/vendor/assets/bower_components/angular-material/angular-material.js +15406 -0
  24. data/vendor/assets/bower_components/angular-material/angular-material.min.css +6 -0
  25. data/vendor/assets/bower_components/angular-material/angular-material.min.js +14 -0
  26. data/vendor/assets/bower_components/angular-material/bower.json +14 -0
  27. data/vendor/assets/bower_components/angular-material/demos/bottomSheet/demoBasicUsage/img/icons/copy.svg +1 -0
  28. data/vendor/assets/bower_components/angular-material/demos/bottomSheet/demoBasicUsage/img/icons/copy2.svg +1 -0
  29. data/vendor/assets/bower_components/angular-material/demos/bottomSheet/demoBasicUsage/img/icons/facebook.svg +1 -0
  30. data/vendor/assets/bower_components/angular-material/demos/bottomSheet/demoBasicUsage/img/icons/hangout.svg +1 -0
  31. data/vendor/assets/bower_components/angular-material/demos/bottomSheet/demoBasicUsage/img/icons/mail.svg +1 -0
  32. data/vendor/assets/bower_components/angular-material/demos/bottomSheet/demoBasicUsage/img/icons/message.svg +1 -0
  33. data/vendor/assets/bower_components/angular-material/demos/bottomSheet/demoBasicUsage/img/icons/print.svg +1 -0
  34. data/vendor/assets/bower_components/angular-material/demos/bottomSheet/demoBasicUsage/img/icons/share-arrow.svg +1 -0
  35. data/vendor/assets/bower_components/angular-material/demos/bottomSheet/demoBasicUsage/img/icons/twitter.svg +2 -0
  36. data/vendor/assets/bower_components/angular-material/demos/bottomSheet/demoBasicUsage/img/icons/upload.svg +1 -0
  37. data/vendor/assets/bower_components/angular-material/demos/chips/demoBasicUsage/style.scss +39 -0
  38. data/vendor/assets/bower_components/angular-material/demos/chips/demoContactChips/style.scss +47 -0
  39. data/vendor/assets/bower_components/angular-material/demos/gridList/demoBasicUsage/style.scss +75 -0
  40. data/vendor/assets/bower_components/angular-material/demos/gridList/demoDynamicTiles/style.scss +78 -0
  41. data/vendor/assets/bower_components/angular-material/demos/gridList/demoResponsiveUsage/style.scss +0 -0
  42. data/vendor/assets/bower_components/angular-material/demos/icon/demoLoadSvgIconsFromUrl/img/icons/addShoppingCart.svg +1 -0
  43. data/vendor/assets/bower_components/angular-material/demos/icon/demoLoadSvgIconsFromUrl/img/icons/android.svg +1 -0
  44. data/vendor/assets/bower_components/angular-material/demos/icon/demoLoadSvgIconsFromUrl/img/icons/cake.svg +1 -0
  45. data/vendor/assets/bower_components/angular-material/demos/icon/demoSvgIconSets/assets/cake.svg +1 -0
  46. data/vendor/assets/bower_components/angular-material/demos/icon/demoSvgIconSets/assets/core-icons.svg +26 -0
  47. data/vendor/assets/bower_components/angular-material/demos/icon/demoSvgIconSets/assets/social-icons.svg +26 -0
  48. data/vendor/assets/bower_components/angular-material/demos/icon/demoSvgIconsFromURL/img/icons/addShoppingCart.svg +1 -0
  49. data/vendor/assets/bower_components/angular-material/demos/icon/demoSvgIconsFromURL/img/icons/android.svg +1 -0
  50. data/vendor/assets/bower_components/angular-material/demos/icon/demoSvgIconsFromURL/img/icons/cake.svg +1 -0
  51. data/vendor/assets/bower_components/angular-material/demos/icon/demoUsingTemplateCache/assets/android.svg +1 -0
  52. data/vendor/assets/bower_components/angular-material/demos/icon/demoUsingTemplateCache/assets/cake.svg +1 -0
  53. data/vendor/assets/bower_components/angular-material/demos/icon/demoUsingTemplateCache/assets/core-icons.svg +26 -0
  54. data/vendor/assets/bower_components/angular-material/demos/input/demoIcons/icons/ic_email_24px.svg +4 -0
  55. data/vendor/assets/bower_components/angular-material/demos/input/demoIcons/icons/ic_person_24px.svg +4 -0
  56. data/vendor/assets/bower_components/angular-material/demos/input/demoIcons/icons/ic_phone_24px.svg +4 -0
  57. data/vendor/assets/bower_components/angular-material/demos/input/demoIcons/icons/ic_place_24px.svg +4 -0
  58. data/vendor/assets/bower_components/angular-material/demos/input/demoIcons/style.scss +18 -0
  59. data/vendor/assets/bower_components/angular-material/demos/list/demoListControls/img/100-0.jpeg +0 -0
  60. data/vendor/assets/bower_components/angular-material/demos/list/demoListControls/img/100-1.jpeg +0 -0
  61. data/vendor/assets/bower_components/angular-material/demos/list/demoListControls/img/100-2.jpeg +0 -0
  62. data/vendor/assets/bower_components/angular-material/demos/tabs/demoDynamicHeight/style.scss +13 -0
  63. data/vendor/assets/bower_components/angular-material/demos/tabs/demoDynamicTabs/style.scss +44 -0
  64. data/vendor/assets/bower_components/angular-material/demos/tabs/demoStaticTabs/style.scss +25 -0
  65. data/vendor/assets/bower_components/angular-material/demos/toolbar/demoBasicUsage/img/icons/favorite.svg +4 -0
  66. data/vendor/assets/bower_components/angular-material/demos/toolbar/demoBasicUsage/img/icons/menu.svg +4 -0
  67. data/vendor/assets/bower_components/angular-material/demos/toolbar/demoBasicUsage/img/icons/more_vert.svg +4 -0
  68. data/vendor/assets/bower_components/angular-material/index.js +12 -0
  69. data/vendor/assets/bower_components/angular-material/modules/closure/autocomplete/autocomplete-default-theme.css +24 -0
  70. data/vendor/assets/bower_components/angular-material/modules/closure/autocomplete/autocomplete.css +220 -0
  71. data/vendor/assets/bower_components/angular-material/modules/closure/autocomplete/autocomplete.js +951 -0
  72. data/vendor/assets/bower_components/angular-material/modules/closure/backdrop/backdrop-default-theme.css +9 -0
  73. data/vendor/assets/bower_components/angular-material/modules/closure/backdrop/backdrop.css +59 -0
  74. data/vendor/assets/bower_components/angular-material/modules/closure/backdrop/backdrop.js +38 -0
  75. data/vendor/assets/bower_components/angular-material/modules/closure/bottomSheet/bottomSheet-default-theme.css +16 -0
  76. data/vendor/assets/bower_components/angular-material/modules/closure/bottomSheet/bottomSheet.css +170 -0
  77. data/vendor/assets/bower_components/angular-material/modules/closure/bottomSheet/bottomSheet.js +267 -0
  78. data/vendor/assets/bower_components/angular-material/modules/closure/button/button-default-theme.css +94 -0
  79. data/vendor/assets/bower_components/angular-material/modules/closure/button/button.css +158 -0
  80. data/vendor/assets/bower_components/angular-material/modules/closure/button/button.js +135 -0
  81. data/vendor/assets/bower_components/angular-material/modules/closure/card/card-default-theme.css +12 -0
  82. data/vendor/assets/bower_components/angular-material/modules/closure/card/card.css +34 -0
  83. data/vendor/assets/bower_components/angular-material/modules/closure/card/card.js +84 -0
  84. data/vendor/assets/bower_components/angular-material/modules/closure/checkbox/checkbox-default-theme.css +47 -0
  85. data/vendor/assets/bower_components/angular-material/modules/closure/checkbox/checkbox.css +124 -0
  86. data/vendor/assets/bower_components/angular-material/modules/closure/checkbox/checkbox.js +166 -0
  87. data/vendor/assets/bower_components/angular-material/modules/closure/chips/chips-default-theme.css +24 -0
  88. data/vendor/assets/bower_components/angular-material/modules/closure/chips/chips.css +131 -0
  89. data/vendor/assets/bower_components/angular-material/modules/closure/chips/chips.js +949 -0
  90. data/vendor/assets/bower_components/angular-material/modules/closure/content/content-default-theme.css +9 -0
  91. data/vendor/assets/bower_components/angular-material/modules/closure/content/content.css +20 -0
  92. data/vendor/assets/bower_components/angular-material/modules/closure/content/content.js +84 -0
  93. data/vendor/assets/bower_components/angular-material/modules/closure/core/core.css +2594 -0
  94. data/vendor/assets/bower_components/angular-material/modules/closure/core/core.js +3772 -0
  95. data/vendor/assets/bower_components/angular-material/modules/closure/core/default-theme.js +4 -0
  96. data/vendor/assets/bower_components/angular-material/modules/closure/dialog/dialog-default-theme.css +12 -0
  97. data/vendor/assets/bower_components/angular-material/modules/closure/dialog/dialog.css +111 -0
  98. data/vendor/assets/bower_components/angular-material/modules/closure/dialog/dialog.js +713 -0
  99. data/vendor/assets/bower_components/angular-material/modules/closure/divider/divider-default-theme.css +9 -0
  100. data/vendor/assets/bower_components/angular-material/modules/closure/divider/divider.css +14 -0
  101. data/vendor/assets/bower_components/angular-material/modules/closure/divider/divider.js +45 -0
  102. data/vendor/assets/bower_components/angular-material/modules/closure/fabActions/fabActions.js +57 -0
  103. data/vendor/assets/bower_components/angular-material/modules/closure/fabSpeedDial/fabSpeedDial.css +100 -0
  104. data/vendor/assets/bower_components/angular-material/modules/closure/fabSpeedDial/fabSpeedDial.js +236 -0
  105. data/vendor/assets/bower_components/angular-material/modules/closure/fabToolbar/fabToolbar.css +74 -0
  106. data/vendor/assets/bower_components/angular-material/modules/closure/fabToolbar/fabToolbar.js +218 -0
  107. data/vendor/assets/bower_components/angular-material/modules/closure/fabTrigger/fabTrigger.js +54 -0
  108. data/vendor/assets/bower_components/angular-material/modules/closure/gridList/gridList-default-theme.css +6 -0
  109. data/vendor/assets/bower_components/angular-material/modules/closure/gridList/gridList.css +68 -0
  110. data/vendor/assets/bower_components/angular-material/modules/closure/gridList/gridList.js +762 -0
  111. data/vendor/assets/bower_components/angular-material/modules/closure/icon/icon-default-theme.css +15 -0
  112. data/vendor/assets/bower_components/angular-material/modules/closure/icon/icon.css +20 -0
  113. data/vendor/assets/bower_components/angular-material/modules/closure/icon/icon.js +783 -0
  114. data/vendor/assets/bower_components/angular-material/modules/closure/input/input-default-theme.css +46 -0
  115. data/vendor/assets/bower_components/angular-material/modules/closure/input/input.css +162 -0
  116. data/vendor/assets/bower_components/angular-material/modules/closure/input/input.js +371 -0
  117. data/vendor/assets/bower_components/angular-material/modules/closure/list/list-default-theme.css +23 -0
  118. data/vendor/assets/bower_components/angular-material/modules/closure/list/list.css +147 -0
  119. data/vendor/assets/bower_components/angular-material/modules/closure/list/list.js +273 -0
  120. data/vendor/assets/bower_components/angular-material/modules/closure/menu/menu-default-theme.css +11 -0
  121. data/vendor/assets/bower_components/angular-material/modules/closure/menu/menu.css +121 -0
  122. data/vendor/assets/bower_components/angular-material/modules/closure/menu/menu.js +620 -0
  123. data/vendor/assets/bower_components/angular-material/modules/closure/progressCircular/progressCircular-default-theme.css +36 -0
  124. data/vendor/assets/bower_components/angular-material/modules/closure/progressCircular/progressCircular.css +1409 -0
  125. data/vendor/assets/bower_components/angular-material/modules/closure/progressCircular/progressCircular.js +109 -0
  126. data/vendor/assets/bower_components/angular-material/modules/closure/progressLinear/progressLinear-default-theme.css +27 -0
  127. data/vendor/assets/bower_components/angular-material/modules/closure/progressLinear/progressLinear.css +287 -0
  128. data/vendor/assets/bower_components/angular-material/modules/closure/progressLinear/progressLinear.js +126 -0
  129. data/vendor/assets/bower_components/angular-material/modules/closure/radioButton/radioButton-default-theme.css +47 -0
  130. data/vendor/assets/bower_components/angular-material/modules/closure/radioButton/radioButton.css +91 -0
  131. data/vendor/assets/bower_components/angular-material/modules/closure/radioButton/radioButton.js +312 -0
  132. data/vendor/assets/bower_components/angular-material/modules/closure/select/select-default-theme.css +42 -0
  133. data/vendor/assets/bower_components/angular-material/modules/closure/select/select.css +170 -0
  134. data/vendor/assets/bower_components/angular-material/modules/closure/select/select.js +1055 -0
  135. data/vendor/assets/bower_components/angular-material/modules/closure/sidenav/sidenav-default-theme.css +9 -0
  136. data/vendor/assets/bower_components/angular-material/modules/closure/sidenav/sidenav.css +99 -0
  137. data/vendor/assets/bower_components/angular-material/modules/closure/sidenav/sidenav.js +424 -0
  138. data/vendor/assets/bower_components/angular-material/modules/closure/slider/slider-default-theme.css +56 -0
  139. data/vendor/assets/bower_components/angular-material/modules/closure/slider/slider.css +220 -0
  140. data/vendor/assets/bower_components/angular-material/modules/closure/slider/slider.js +403 -0
  141. data/vendor/assets/bower_components/angular-material/modules/closure/sticky/sticky.css +21 -0
  142. data/vendor/assets/bower_components/angular-material/modules/closure/sticky/sticky.js +315 -0
  143. data/vendor/assets/bower_components/angular-material/modules/closure/subheader/subheader-default-theme.css +16 -0
  144. data/vendor/assets/bower_components/angular-material/modules/closure/subheader/subheader.css +63 -0
  145. data/vendor/assets/bower_components/angular-material/modules/closure/subheader/subheader.js +93 -0
  146. data/vendor/assets/bower_components/angular-material/modules/closure/swipe/swipe.js +72 -0
  147. data/vendor/assets/bower_components/angular-material/modules/closure/switch/switch-default-theme.css +33 -0
  148. data/vendor/assets/bower_components/angular-material/modules/closure/switch/switch.css +110 -0
  149. data/vendor/assets/bower_components/angular-material/modules/closure/switch/switch.js +169 -0
  150. data/vendor/assets/bower_components/angular-material/modules/closure/tabs/tabs-arrow.svg +7 -0
  151. data/vendor/assets/bower_components/angular-material/modules/closure/tabs/tabs-default-theme.css +82 -0
  152. data/vendor/assets/bower_components/angular-material/modules/closure/tabs/tabs.css +274 -0
  153. data/vendor/assets/bower_components/angular-material/modules/closure/tabs/tabs.js +1060 -0
  154. data/vendor/assets/bower_components/angular-material/modules/closure/textField/textField-default-theme.css +30 -0
  155. data/vendor/assets/bower_components/angular-material/modules/closure/textField/textField.css +111 -0
  156. data/vendor/assets/bower_components/angular-material/modules/closure/textField/textField.js +145 -0
  157. data/vendor/assets/bower_components/angular-material/modules/closure/toast/toast-default-theme.css +18 -0
  158. data/vendor/assets/bower_components/angular-material/modules/closure/toast/toast.css +119 -0
  159. data/vendor/assets/bower_components/angular-material/modules/closure/toast/toast.js +265 -0
  160. data/vendor/assets/bower_components/angular-material/modules/closure/toolbar/toolbar-default-theme.css +20 -0
  161. data/vendor/assets/bower_components/angular-material/modules/closure/toolbar/toolbar.css +83 -0
  162. data/vendor/assets/bower_components/angular-material/modules/closure/toolbar/toolbar.js +169 -0
  163. data/vendor/assets/bower_components/angular-material/modules/closure/tooltip/tooltip-default-theme.css +11 -0
  164. data/vendor/assets/bower_components/angular-material/modules/closure/tooltip/tooltip.css +72 -0
  165. data/vendor/assets/bower_components/angular-material/modules/closure/tooltip/tooltip.js +267 -0
  166. data/vendor/assets/bower_components/angular-material/modules/closure/whiteframe/whiteframe.css +25 -0
  167. data/vendor/assets/bower_components/angular-material/modules/closure/whiteframe/whiteframe.js +15 -0
  168. data/vendor/assets/bower_components/angular-material/modules/css/angular-material-layout.css +2375 -0
  169. data/vendor/assets/bower_components/angular-material/modules/js/autocomplete/autocomplete-default-theme.css +24 -0
  170. data/vendor/assets/bower_components/angular-material/modules/js/autocomplete/autocomplete-default-theme.min.css +6 -0
  171. data/vendor/assets/bower_components/angular-material/modules/js/autocomplete/autocomplete.css +220 -0
  172. data/vendor/assets/bower_components/angular-material/modules/js/autocomplete/autocomplete.js +951 -0
  173. data/vendor/assets/bower_components/angular-material/modules/js/autocomplete/autocomplete.min.css +6 -0
  174. data/vendor/assets/bower_components/angular-material/modules/js/autocomplete/autocomplete.min.js +7 -0
  175. data/vendor/assets/bower_components/angular-material/modules/js/autocomplete/bower.json +8 -0
  176. data/vendor/assets/bower_components/angular-material/modules/js/backdrop/backdrop-default-theme.css +9 -0
  177. data/vendor/assets/bower_components/angular-material/modules/js/backdrop/backdrop-default-theme.min.css +6 -0
  178. data/vendor/assets/bower_components/angular-material/modules/js/backdrop/backdrop.css +59 -0
  179. data/vendor/assets/bower_components/angular-material/modules/js/backdrop/backdrop.js +39 -0
  180. data/vendor/assets/bower_components/angular-material/modules/js/backdrop/backdrop.min.css +6 -0
  181. data/vendor/assets/bower_components/angular-material/modules/js/backdrop/backdrop.min.js +7 -0
  182. data/vendor/assets/bower_components/angular-material/modules/js/backdrop/bower.json +7 -0
  183. data/vendor/assets/bower_components/angular-material/modules/js/bottomSheet/bottomSheet-default-theme.css +16 -0
  184. data/vendor/assets/bower_components/angular-material/modules/js/bottomSheet/bottomSheet-default-theme.min.css +6 -0
  185. data/vendor/assets/bower_components/angular-material/modules/js/bottomSheet/bottomSheet.css +170 -0
  186. data/vendor/assets/bower_components/angular-material/modules/js/bottomSheet/bottomSheet.js +267 -0
  187. data/vendor/assets/bower_components/angular-material/modules/js/bottomSheet/bottomSheet.min.css +6 -0
  188. data/vendor/assets/bower_components/angular-material/modules/js/bottomSheet/bottomSheet.min.js +7 -0
  189. data/vendor/assets/bower_components/angular-material/modules/js/bottomSheet/bower.json +8 -0
  190. data/vendor/assets/bower_components/angular-material/modules/js/button/bower.json +7 -0
  191. data/vendor/assets/bower_components/angular-material/modules/js/button/button-default-theme.css +94 -0
  192. data/vendor/assets/bower_components/angular-material/modules/js/button/button-default-theme.min.css +6 -0
  193. data/vendor/assets/bower_components/angular-material/modules/js/button/button.css +158 -0
  194. data/vendor/assets/bower_components/angular-material/modules/js/button/button.js +136 -0
  195. data/vendor/assets/bower_components/angular-material/modules/js/button/button.min.css +6 -0
  196. data/vendor/assets/bower_components/angular-material/modules/js/button/button.min.js +7 -0
  197. data/vendor/assets/bower_components/angular-material/modules/js/card/bower.json +7 -0
  198. data/vendor/assets/bower_components/angular-material/modules/js/card/card-default-theme.css +12 -0
  199. data/vendor/assets/bower_components/angular-material/modules/js/card/card-default-theme.min.css +6 -0
  200. data/vendor/assets/bower_components/angular-material/modules/js/card/card.css +34 -0
  201. data/vendor/assets/bower_components/angular-material/modules/js/card/card.js +85 -0
  202. data/vendor/assets/bower_components/angular-material/modules/js/card/card.min.css +6 -0
  203. data/vendor/assets/bower_components/angular-material/modules/js/card/card.min.js +7 -0
  204. data/vendor/assets/bower_components/angular-material/modules/js/checkbox/bower.json +7 -0
  205. data/vendor/assets/bower_components/angular-material/modules/js/checkbox/checkbox-default-theme.css +47 -0
  206. data/vendor/assets/bower_components/angular-material/modules/js/checkbox/checkbox-default-theme.min.css +6 -0
  207. data/vendor/assets/bower_components/angular-material/modules/js/checkbox/checkbox.css +124 -0
  208. data/vendor/assets/bower_components/angular-material/modules/js/checkbox/checkbox.js +167 -0
  209. data/vendor/assets/bower_components/angular-material/modules/js/checkbox/checkbox.min.css +6 -0
  210. data/vendor/assets/bower_components/angular-material/modules/js/checkbox/checkbox.min.js +7 -0
  211. data/vendor/assets/bower_components/angular-material/modules/js/chips/bower.json +8 -0
  212. data/vendor/assets/bower_components/angular-material/modules/js/chips/chips-default-theme.css +24 -0
  213. data/vendor/assets/bower_components/angular-material/modules/js/chips/chips-default-theme.min.css +6 -0
  214. data/vendor/assets/bower_components/angular-material/modules/js/chips/chips.css +131 -0
  215. data/vendor/assets/bower_components/angular-material/modules/js/chips/chips.js +949 -0
  216. data/vendor/assets/bower_components/angular-material/modules/js/chips/chips.min.css +6 -0
  217. data/vendor/assets/bower_components/angular-material/modules/js/chips/chips.min.js +7 -0
  218. data/vendor/assets/bower_components/angular-material/modules/js/content/bower.json +7 -0
  219. data/vendor/assets/bower_components/angular-material/modules/js/content/content-default-theme.css +9 -0
  220. data/vendor/assets/bower_components/angular-material/modules/js/content/content-default-theme.min.css +6 -0
  221. data/vendor/assets/bower_components/angular-material/modules/js/content/content.css +20 -0
  222. data/vendor/assets/bower_components/angular-material/modules/js/content/content.js +85 -0
  223. data/vendor/assets/bower_components/angular-material/modules/js/content/content.min.css +6 -0
  224. data/vendor/assets/bower_components/angular-material/modules/js/content/content.min.js +7 -0
  225. data/vendor/assets/bower_components/angular-material/modules/js/core/bower.json +8 -0
  226. data/vendor/assets/bower_components/angular-material/modules/js/core/core.css +2594 -0
  227. data/vendor/assets/bower_components/angular-material/modules/js/core/core.js +3772 -0
  228. data/vendor/assets/bower_components/angular-material/modules/js/core/core.min.css +6 -0
  229. data/vendor/assets/bower_components/angular-material/modules/js/core/core.min.js +10 -0
  230. data/vendor/assets/bower_components/angular-material/modules/js/core/default-theme.js +4 -0
  231. data/vendor/assets/bower_components/angular-material/modules/js/dialog/bower.json +8 -0
  232. data/vendor/assets/bower_components/angular-material/modules/js/dialog/dialog-default-theme.css +12 -0
  233. data/vendor/assets/bower_components/angular-material/modules/js/dialog/dialog-default-theme.min.css +6 -0
  234. data/vendor/assets/bower_components/angular-material/modules/js/dialog/dialog.css +111 -0
  235. data/vendor/assets/bower_components/angular-material/modules/js/dialog/dialog.js +713 -0
  236. data/vendor/assets/bower_components/angular-material/modules/js/dialog/dialog.min.css +6 -0
  237. data/vendor/assets/bower_components/angular-material/modules/js/dialog/dialog.min.js +7 -0
  238. data/vendor/assets/bower_components/angular-material/modules/js/divider/bower.json +7 -0
  239. data/vendor/assets/bower_components/angular-material/modules/js/divider/divider-default-theme.css +9 -0
  240. data/vendor/assets/bower_components/angular-material/modules/js/divider/divider-default-theme.min.css +6 -0
  241. data/vendor/assets/bower_components/angular-material/modules/js/divider/divider.css +14 -0
  242. data/vendor/assets/bower_components/angular-material/modules/js/divider/divider.js +46 -0
  243. data/vendor/assets/bower_components/angular-material/modules/js/divider/divider.min.css +6 -0
  244. data/vendor/assets/bower_components/angular-material/modules/js/divider/divider.min.js +7 -0
  245. data/vendor/assets/bower_components/angular-material/modules/js/fabActions/bower.json +7 -0
  246. data/vendor/assets/bower_components/angular-material/modules/js/fabActions/fabActions.js +58 -0
  247. data/vendor/assets/bower_components/angular-material/modules/js/fabActions/fabActions.min.js +7 -0
  248. data/vendor/assets/bower_components/angular-material/modules/js/fabSpeedDial/bower.json +9 -0
  249. data/vendor/assets/bower_components/angular-material/modules/js/fabSpeedDial/fabSpeedDial.css +100 -0
  250. data/vendor/assets/bower_components/angular-material/modules/js/fabSpeedDial/fabSpeedDial.js +235 -0
  251. data/vendor/assets/bower_components/angular-material/modules/js/fabSpeedDial/fabSpeedDial.min.css +6 -0
  252. data/vendor/assets/bower_components/angular-material/modules/js/fabSpeedDial/fabSpeedDial.min.js +7 -0
  253. data/vendor/assets/bower_components/angular-material/modules/js/fabToolbar/bower.json +9 -0
  254. data/vendor/assets/bower_components/angular-material/modules/js/fabToolbar/fabToolbar.css +74 -0
  255. data/vendor/assets/bower_components/angular-material/modules/js/fabToolbar/fabToolbar.js +217 -0
  256. data/vendor/assets/bower_components/angular-material/modules/js/fabToolbar/fabToolbar.min.css +6 -0
  257. data/vendor/assets/bower_components/angular-material/modules/js/fabToolbar/fabToolbar.min.js +7 -0
  258. data/vendor/assets/bower_components/angular-material/modules/js/fabTrigger/bower.json +7 -0
  259. data/vendor/assets/bower_components/angular-material/modules/js/fabTrigger/fabTrigger.js +55 -0
  260. data/vendor/assets/bower_components/angular-material/modules/js/fabTrigger/fabTrigger.min.js +7 -0
  261. data/vendor/assets/bower_components/angular-material/modules/js/gridList/bower.json +7 -0
  262. data/vendor/assets/bower_components/angular-material/modules/js/gridList/gridList.css +68 -0
  263. data/vendor/assets/bower_components/angular-material/modules/js/gridList/gridList.js +763 -0
  264. data/vendor/assets/bower_components/angular-material/modules/js/gridList/gridList.min.css +6 -0
  265. data/vendor/assets/bower_components/angular-material/modules/js/gridList/gridList.min.js +7 -0
  266. data/vendor/assets/bower_components/angular-material/modules/js/icon/bower.json +7 -0
  267. data/vendor/assets/bower_components/angular-material/modules/js/icon/icon-default-theme.css +15 -0
  268. data/vendor/assets/bower_components/angular-material/modules/js/icon/icon-default-theme.min.css +6 -0
  269. data/vendor/assets/bower_components/angular-material/modules/js/icon/icon.css +20 -0
  270. data/vendor/assets/bower_components/angular-material/modules/js/icon/icon.js +784 -0
  271. data/vendor/assets/bower_components/angular-material/modules/js/icon/icon.min.css +6 -0
  272. data/vendor/assets/bower_components/angular-material/modules/js/icon/icon.min.js +7 -0
  273. data/vendor/assets/bower_components/angular-material/modules/js/input/bower.json +7 -0
  274. data/vendor/assets/bower_components/angular-material/modules/js/input/input-default-theme.css +46 -0
  275. data/vendor/assets/bower_components/angular-material/modules/js/input/input-default-theme.min.css +6 -0
  276. data/vendor/assets/bower_components/angular-material/modules/js/input/input.css +162 -0
  277. data/vendor/assets/bower_components/angular-material/modules/js/input/input.js +372 -0
  278. data/vendor/assets/bower_components/angular-material/modules/js/input/input.min.css +6 -0
  279. data/vendor/assets/bower_components/angular-material/modules/js/input/input.min.js +7 -0
  280. data/vendor/assets/bower_components/angular-material/modules/js/list/bower.json +7 -0
  281. data/vendor/assets/bower_components/angular-material/modules/js/list/list-default-theme.css +23 -0
  282. data/vendor/assets/bower_components/angular-material/modules/js/list/list-default-theme.min.css +6 -0
  283. data/vendor/assets/bower_components/angular-material/modules/js/list/list.css +147 -0
  284. data/vendor/assets/bower_components/angular-material/modules/js/list/list.js +274 -0
  285. data/vendor/assets/bower_components/angular-material/modules/js/list/list.min.css +6 -0
  286. data/vendor/assets/bower_components/angular-material/modules/js/list/list.min.js +7 -0
  287. data/vendor/assets/bower_components/angular-material/modules/js/menu/bower.json +8 -0
  288. data/vendor/assets/bower_components/angular-material/modules/js/menu/menu-default-theme.css +11 -0
  289. data/vendor/assets/bower_components/angular-material/modules/js/menu/menu-default-theme.min.css +6 -0
  290. data/vendor/assets/bower_components/angular-material/modules/js/menu/menu.css +121 -0
  291. data/vendor/assets/bower_components/angular-material/modules/js/menu/menu.js +620 -0
  292. data/vendor/assets/bower_components/angular-material/modules/js/menu/menu.min.css +6 -0
  293. data/vendor/assets/bower_components/angular-material/modules/js/menu/menu.min.js +7 -0
  294. data/vendor/assets/bower_components/angular-material/modules/js/progressCircular/bower.json +7 -0
  295. data/vendor/assets/bower_components/angular-material/modules/js/progressCircular/progressCircular-default-theme.css +36 -0
  296. data/vendor/assets/bower_components/angular-material/modules/js/progressCircular/progressCircular-default-theme.min.css +6 -0
  297. data/vendor/assets/bower_components/angular-material/modules/js/progressCircular/progressCircular.css +1409 -0
  298. data/vendor/assets/bower_components/angular-material/modules/js/progressCircular/progressCircular.js +110 -0
  299. data/vendor/assets/bower_components/angular-material/modules/js/progressCircular/progressCircular.min.css +6 -0
  300. data/vendor/assets/bower_components/angular-material/modules/js/progressCircular/progressCircular.min.js +7 -0
  301. data/vendor/assets/bower_components/angular-material/modules/js/progressLinear/bower.json +7 -0
  302. data/vendor/assets/bower_components/angular-material/modules/js/progressLinear/progressLinear-default-theme.css +27 -0
  303. data/vendor/assets/bower_components/angular-material/modules/js/progressLinear/progressLinear-default-theme.min.css +6 -0
  304. data/vendor/assets/bower_components/angular-material/modules/js/progressLinear/progressLinear.css +287 -0
  305. data/vendor/assets/bower_components/angular-material/modules/js/progressLinear/progressLinear.js +127 -0
  306. data/vendor/assets/bower_components/angular-material/modules/js/progressLinear/progressLinear.min.css +6 -0
  307. data/vendor/assets/bower_components/angular-material/modules/js/progressLinear/progressLinear.min.js +7 -0
  308. data/vendor/assets/bower_components/angular-material/modules/js/radioButton/bower.json +7 -0
  309. data/vendor/assets/bower_components/angular-material/modules/js/radioButton/radioButton-default-theme.css +47 -0
  310. data/vendor/assets/bower_components/angular-material/modules/js/radioButton/radioButton-default-theme.min.css +6 -0
  311. data/vendor/assets/bower_components/angular-material/modules/js/radioButton/radioButton.css +91 -0
  312. data/vendor/assets/bower_components/angular-material/modules/js/radioButton/radioButton.js +313 -0
  313. data/vendor/assets/bower_components/angular-material/modules/js/radioButton/radioButton.min.css +6 -0
  314. data/vendor/assets/bower_components/angular-material/modules/js/radioButton/radioButton.min.js +7 -0
  315. data/vendor/assets/bower_components/angular-material/modules/js/select/bower.json +8 -0
  316. data/vendor/assets/bower_components/angular-material/modules/js/select/select-default-theme.css +42 -0
  317. data/vendor/assets/bower_components/angular-material/modules/js/select/select-default-theme.min.css +6 -0
  318. data/vendor/assets/bower_components/angular-material/modules/js/select/select.css +170 -0
  319. data/vendor/assets/bower_components/angular-material/modules/js/select/select.js +1055 -0
  320. data/vendor/assets/bower_components/angular-material/modules/js/select/select.min.css +6 -0
  321. data/vendor/assets/bower_components/angular-material/modules/js/select/select.min.js +7 -0
  322. data/vendor/assets/bower_components/angular-material/modules/js/sidenav/bower.json +8 -0
  323. data/vendor/assets/bower_components/angular-material/modules/js/sidenav/sidenav-default-theme.css +9 -0
  324. data/vendor/assets/bower_components/angular-material/modules/js/sidenav/sidenav-default-theme.min.css +6 -0
  325. data/vendor/assets/bower_components/angular-material/modules/js/sidenav/sidenav.css +99 -0
  326. data/vendor/assets/bower_components/angular-material/modules/js/sidenav/sidenav.js +424 -0
  327. data/vendor/assets/bower_components/angular-material/modules/js/sidenav/sidenav.min.css +6 -0
  328. data/vendor/assets/bower_components/angular-material/modules/js/sidenav/sidenav.min.js +7 -0
  329. data/vendor/assets/bower_components/angular-material/modules/js/slider/bower.json +7 -0
  330. data/vendor/assets/bower_components/angular-material/modules/js/slider/slider-default-theme.css +56 -0
  331. data/vendor/assets/bower_components/angular-material/modules/js/slider/slider-default-theme.min.css +6 -0
  332. data/vendor/assets/bower_components/angular-material/modules/js/slider/slider.css +220 -0
  333. data/vendor/assets/bower_components/angular-material/modules/js/slider/slider.js +404 -0
  334. data/vendor/assets/bower_components/angular-material/modules/js/slider/slider.min.css +6 -0
  335. data/vendor/assets/bower_components/angular-material/modules/js/slider/slider.min.js +7 -0
  336. data/vendor/assets/bower_components/angular-material/modules/js/sticky/bower.json +8 -0
  337. data/vendor/assets/bower_components/angular-material/modules/js/sticky/sticky.css +21 -0
  338. data/vendor/assets/bower_components/angular-material/modules/js/sticky/sticky.js +315 -0
  339. data/vendor/assets/bower_components/angular-material/modules/js/sticky/sticky.min.css +6 -0
  340. data/vendor/assets/bower_components/angular-material/modules/js/sticky/sticky.min.js +7 -0
  341. data/vendor/assets/bower_components/angular-material/modules/js/subheader/bower.json +8 -0
  342. data/vendor/assets/bower_components/angular-material/modules/js/subheader/subheader-default-theme.css +16 -0
  343. data/vendor/assets/bower_components/angular-material/modules/js/subheader/subheader-default-theme.min.css +6 -0
  344. data/vendor/assets/bower_components/angular-material/modules/js/subheader/subheader.css +63 -0
  345. data/vendor/assets/bower_components/angular-material/modules/js/subheader/subheader.js +93 -0
  346. data/vendor/assets/bower_components/angular-material/modules/js/subheader/subheader.min.css +6 -0
  347. data/vendor/assets/bower_components/angular-material/modules/js/subheader/subheader.min.js +7 -0
  348. data/vendor/assets/bower_components/angular-material/modules/js/swipe/bower.json +7 -0
  349. data/vendor/assets/bower_components/angular-material/modules/js/swipe/swipe.js +73 -0
  350. data/vendor/assets/bower_components/angular-material/modules/js/swipe/swipe.min.js +7 -0
  351. data/vendor/assets/bower_components/angular-material/modules/js/switch/bower.json +8 -0
  352. data/vendor/assets/bower_components/angular-material/modules/js/switch/switch-default-theme.css +33 -0
  353. data/vendor/assets/bower_components/angular-material/modules/js/switch/switch-default-theme.min.css +6 -0
  354. data/vendor/assets/bower_components/angular-material/modules/js/switch/switch.css +110 -0
  355. data/vendor/assets/bower_components/angular-material/modules/js/switch/switch.js +169 -0
  356. data/vendor/assets/bower_components/angular-material/modules/js/switch/switch.min.css +6 -0
  357. data/vendor/assets/bower_components/angular-material/modules/js/switch/switch.min.js +7 -0
  358. data/vendor/assets/bower_components/angular-material/modules/js/tabs/bower.json +8 -0
  359. data/vendor/assets/bower_components/angular-material/modules/js/tabs/tabs-default-theme.css +82 -0
  360. data/vendor/assets/bower_components/angular-material/modules/js/tabs/tabs-default-theme.min.css +6 -0
  361. data/vendor/assets/bower_components/angular-material/modules/js/tabs/tabs.css +274 -0
  362. data/vendor/assets/bower_components/angular-material/modules/js/tabs/tabs.js +1060 -0
  363. data/vendor/assets/bower_components/angular-material/modules/js/tabs/tabs.min.css +6 -0
  364. data/vendor/assets/bower_components/angular-material/modules/js/tabs/tabs.min.js +7 -0
  365. data/vendor/assets/bower_components/angular-material/modules/js/textField/bower.json +7 -0
  366. data/vendor/assets/bower_components/angular-material/modules/js/textField/textField-default-theme.css +30 -0
  367. data/vendor/assets/bower_components/angular-material/modules/js/textField/textField-default-theme.min.css +6 -0
  368. data/vendor/assets/bower_components/angular-material/modules/js/textField/textField.css +111 -0
  369. data/vendor/assets/bower_components/angular-material/modules/js/textField/textField.js +143 -0
  370. data/vendor/assets/bower_components/angular-material/modules/js/textField/textField.min.css +6 -0
  371. data/vendor/assets/bower_components/angular-material/modules/js/textField/textField.min.js +7 -0
  372. data/vendor/assets/bower_components/angular-material/modules/js/toast/bower.json +8 -0
  373. data/vendor/assets/bower_components/angular-material/modules/js/toast/toast-default-theme.css +18 -0
  374. data/vendor/assets/bower_components/angular-material/modules/js/toast/toast-default-theme.min.css +6 -0
  375. data/vendor/assets/bower_components/angular-material/modules/js/toast/toast.css +119 -0
  376. data/vendor/assets/bower_components/angular-material/modules/js/toast/toast.js +265 -0
  377. data/vendor/assets/bower_components/angular-material/modules/js/toast/toast.min.css +6 -0
  378. data/vendor/assets/bower_components/angular-material/modules/js/toast/toast.min.js +7 -0
  379. data/vendor/assets/bower_components/angular-material/modules/js/toolbar/bower.json +8 -0
  380. data/vendor/assets/bower_components/angular-material/modules/js/toolbar/toolbar-default-theme.css +20 -0
  381. data/vendor/assets/bower_components/angular-material/modules/js/toolbar/toolbar-default-theme.min.css +6 -0
  382. data/vendor/assets/bower_components/angular-material/modules/js/toolbar/toolbar.css +83 -0
  383. data/vendor/assets/bower_components/angular-material/modules/js/toolbar/toolbar.js +169 -0
  384. data/vendor/assets/bower_components/angular-material/modules/js/toolbar/toolbar.min.css +6 -0
  385. data/vendor/assets/bower_components/angular-material/modules/js/toolbar/toolbar.min.js +7 -0
  386. data/vendor/assets/bower_components/angular-material/modules/js/tooltip/bower.json +7 -0
  387. data/vendor/assets/bower_components/angular-material/modules/js/tooltip/tooltip-default-theme.css +11 -0
  388. data/vendor/assets/bower_components/angular-material/modules/js/tooltip/tooltip-default-theme.min.css +6 -0
  389. data/vendor/assets/bower_components/angular-material/modules/js/tooltip/tooltip.css +72 -0
  390. data/vendor/assets/bower_components/angular-material/modules/js/tooltip/tooltip.js +268 -0
  391. data/vendor/assets/bower_components/angular-material/modules/js/tooltip/tooltip.min.css +6 -0
  392. data/vendor/assets/bower_components/angular-material/modules/js/tooltip/tooltip.min.js +7 -0
  393. data/vendor/assets/bower_components/angular-material/modules/js/whiteframe/bower.json +5 -0
  394. data/vendor/assets/bower_components/angular-material/modules/js/whiteframe/whiteframe.css +25 -0
  395. data/vendor/assets/bower_components/angular-material/modules/js/whiteframe/whiteframe.js +16 -0
  396. data/vendor/assets/bower_components/angular-material/modules/js/whiteframe/whiteframe.min.css +6 -0
  397. data/vendor/assets/bower_components/angular-material/modules/js/whiteframe/whiteframe.min.js +7 -0
  398. data/vendor/assets/bower_components/angular-material/package.json +48 -0
  399. data/vendor/assets/bower_components/angular/README.md +64 -0
  400. data/vendor/assets/bower_components/angular/angular-csp.css +21 -0
  401. data/vendor/assets/bower_components/angular/angular.js +28364 -0
  402. data/vendor/assets/bower_components/angular/angular.min.js +290 -0
  403. data/vendor/assets/bower_components/angular/angular.min.js.gzip +0 -0
  404. data/vendor/assets/bower_components/angular/angular.min.js.map +8 -0
  405. data/vendor/assets/bower_components/angular/bower.json +8 -0
  406. data/vendor/assets/bower_components/angular/index.js +2 -0
  407. data/vendor/assets/bower_components/angular/package.json +25 -0
  408. data/vendor/assets/bower_components/lodash/LICENSE +22 -0
  409. data/vendor/assets/bower_components/lodash/bower.json +19 -0
  410. data/vendor/assets/bower_components/lodash/lodash.js +12351 -0
  411. data/vendor/assets/bower_components/lodash/lodash.min.js +99 -0
  412. data/vendor/assets/bower_components/restangular/CHANGELOG.md +18 -0
  413. data/vendor/assets/bower_components/restangular/CONTRIBUTE.md +31 -0
  414. data/vendor/assets/bower_components/restangular/Gruntfile.js +149 -0
  415. data/vendor/assets/bower_components/restangular/README.md +1336 -0
  416. data/vendor/assets/bower_components/restangular/bower.json +19 -0
  417. data/vendor/assets/bower_components/restangular/dist/restangular.js +1355 -0
  418. data/vendor/assets/bower_components/restangular/dist/restangular.min.js +6 -0
  419. data/vendor/assets/bower_components/restangular/dist/restangular.zip +0 -0
  420. data/vendor/assets/bower_components/restangular/karma.conf.js +74 -0
  421. data/vendor/assets/bower_components/restangular/karma.underscore.conf.js +74 -0
  422. data/vendor/assets/bower_components/restangular/license.md +21 -0
  423. data/vendor/assets/bower_components/restangular/package.json +55 -0
  424. data/vendor/assets/bower_components/restangular/src/restangular.js +1350 -0
  425. data/vendor/assets/bower_components/restangular/test/restangularSpec.js +1136 -0
  426. metadata +424 -1
@@ -0,0 +1,1136 @@
1
+ describe("Restangular", function() {
2
+ // API
3
+ var Restangular, $httpBackend;
4
+ var accountsModel, restangularAccounts, restangularAccount0, restangularAccount1;
5
+ var accountsHalModel;
6
+ var messages, newAccount;
7
+
8
+ // Load required modules
9
+ beforeEach(angular.mock.module("restangular"));
10
+
11
+ // Init HTTP mock backend and Restangular resources
12
+ beforeEach(inject(function($injector) {
13
+ // Model
14
+ accountsModel = [
15
+ {id: 0, user: "Martin ", amount: 42, transactions: []},
16
+ {id: 1, user: "Paul", amount: 3.1416, transactions: [{from: "Martin", amount: 3, id: 0}, {from: "Anonymous", amount: 0.1416, id:1}]}
17
+ ];
18
+
19
+ // HAL model (http://stateless.co/hal_specification.html)
20
+ accountsHalModel = [
21
+ {id: 0, user: "Martin", amount: 42, transaction: [], _links: {self: "/accountsHAL/martin"}},
22
+ {id: 1, user: "Paul", amount: 3.1416, transaction: [
23
+ {from: "Martin", amount: 3, id: 0, _links: {self: "/accountsHAL/paul/transactions/0"}},
24
+ {from: "Anonymous", amount: 0.1416, id: 1, _links: {self: "/accountsHAL/paul/transactions/1"}}
25
+ ], _links: {self: "/accountsHAL/paul"}}
26
+ ];
27
+
28
+ infoModel = {
29
+ id: 0, text: "Some additional account information"
30
+ }
31
+
32
+ newAccount = {id: 44, user: "First User", amount: 45, transactions: []};
33
+
34
+ messages = [{id: 23, name: "Gonto"}, {id: 45, name: "John"}]
35
+
36
+ accountsDoSomethingModel = { result: 1 };
37
+
38
+ $httpBackend = $injector.get("$httpBackend");
39
+
40
+ $httpBackend.when("HEAD", "/accounts").respond();
41
+ $httpBackend.when("TRACE", "/accounts").respond();
42
+ $httpBackend.when("OPTIONS", "/accounts").respond();
43
+
44
+ $httpBackend.whenGET("/accounts").respond(accountsModel);
45
+ $httpBackend.whenGET("/accounts/do-something").respond(accountsDoSomethingModel);
46
+ $httpBackend.whenJSONP("/accounts").respond(accountsModel);
47
+ $httpBackend.whenGET("/accounts/0,1").respond(accountsModel);
48
+ $httpBackend.whenGET("/accounts/messages").respond(messages);
49
+ $httpBackend.whenGET("/accounts/1/message").respond(messages[0]);
50
+ $httpBackend.whenGET("/accounts/1/messages").respond(messages);
51
+ $httpBackend.whenGET("/accounts/0").respond(accountsModel[0]);
52
+ $httpBackend.whenGET("/accounts/1").respond(accountsModel[1]);
53
+ $httpBackend.whenJSONP("/accounts/1").respond(accountsModel[1]);
54
+ $httpBackend.whenGET("/accounts/1/transactions").respond(accountsModel[1].transactions);
55
+ $httpBackend.whenGET("/accounts/1/transactions/1").respond(accountsModel[1].transactions[1]);
56
+
57
+ $httpBackend.whenGET("/info").respond(infoModel);
58
+ $httpBackend.whenGET("/accounts/1/info").respond(infoModel);
59
+ $httpBackend.whenPUT("/info").respond(function(method, url, data) {
60
+ return [200, data, ""];
61
+ });
62
+
63
+ $httpBackend.whenGET("/accountsHAL").respond(accountsHalModel);
64
+ $httpBackend.whenPUT("/accountsHAL/martin").respond(function(method, url, data) {
65
+ accountsHalModel[0] = angular.fromJson(data);
66
+ return [200, data, ""];
67
+ });
68
+
69
+ // Full URL
70
+ $httpBackend.whenGET('http://accounts.com/all').respond(accountsModel);
71
+
72
+ $httpBackend.whenPOST("/accounts").respond(function(method, url, data, headers) {
73
+ var newData = angular.fromJson(data);
74
+ newData.fromServer = true;
75
+ return [201, JSON.stringify(newData), ""];
76
+ });
77
+
78
+ $httpBackend.whenPOST("/accounts/1/transactions").respond(function(method, url, data, headers) {
79
+ return [201, "", ""];
80
+ });
81
+
82
+ $httpBackend.whenDELETE("/accounts/1/transactions/1").respond(function(method, url, data, headers) {
83
+ return [200, "", ""];
84
+ });
85
+
86
+ $httpBackend.whenDELETE("/accounts/1").respond(function(method, url, data, headers) {
87
+ return [200, "", ""];
88
+ });
89
+
90
+ $httpBackend.whenPOST("/accounts/1").respond(function(method, url, data, headers) {
91
+ return [200, "", ""];
92
+ });
93
+
94
+ $httpBackend.whenPUT("/accounts/1").respond(function(method, url, data, headers) {
95
+ accountsModel[1] = angular.fromJson(data);
96
+ return [201, data, ""];
97
+ });
98
+
99
+ $httpBackend.whenGET("/error").respond(function() {
100
+ return [500, {}, ""];
101
+ });
102
+
103
+ $httpBackend.whenPOST("/customs").respond(function(method, url, data, headers) {
104
+ if (JSON.parse(data).one) {
105
+ return [201, "", ""];
106
+ } else {
107
+ return [400, "", ""];
108
+ }
109
+ });
110
+
111
+ // return the status code given
112
+ // e.g.: /error/404 returns 404 Not Found
113
+ var urlRegex = /\/error\/(\d{3})/;
114
+ $httpBackend.whenGET(urlRegex).respond(function(method, url, data, headers) {
115
+ return [url.match(urlRegex)[1], {}, ""];
116
+ });
117
+
118
+ Restangular = $injector.get("Restangular");
119
+ restangularAccounts = Restangular.all("accounts");
120
+ restangularAccount0 = Restangular.one("accounts", 0);
121
+ restangularAccount1 = Restangular.one("accounts", 1);
122
+
123
+
124
+ // Another API for testing
125
+ customers = [
126
+ {
127
+ id: 0,
128
+ name: "Alice",
129
+ status: 'active',
130
+ credit: 4000.0
131
+ },
132
+ {
133
+ id: 1,
134
+ name: "Bob",
135
+ status: 'active',
136
+ credit: 4000.0
137
+ },
138
+ {
139
+ id: 2,
140
+ name: "Carl",
141
+ status: 'active',
142
+ credit: 4000.0
143
+ }
144
+ ];
145
+ publications = [
146
+ {
147
+ id: 1,
148
+ title: "Sample",
149
+ content: "Rich data",
150
+ tags: [
151
+ 'science',
152
+ 'chemistry'
153
+ ]
154
+ }
155
+ ];
156
+ newCustomer = {
157
+ id: 3,
158
+ name: "New",
159
+ status: 'active',
160
+ credit: 4000.0
161
+ };
162
+
163
+ $httpBackend.whenGET("/customers/").respond(customers);
164
+ $httpBackend.whenGET("http://localhost:8080/customers/").respond(customers);
165
+ $httpBackend.whenGET("api.new.domain/customers/").respond(customers);
166
+ $httpBackend.whenGET("/customers/?active=true").respond(customers);
167
+ $httpBackend.whenGET("/customers/publications/?tags=chemistry").respond(publications);
168
+ $httpBackend.whenPUT("/customers/0").respond(function (method, url, data) {
169
+ customers[0] = angular.fromJson(data);
170
+ return [200, data, ""];
171
+ });
172
+ $httpBackend.whenPOST("/customers/").respond(function (method, url, data, headers) {
173
+ var newData = angular.fromJson(data);
174
+ newData.fromServer = true;
175
+ return [201, JSON.stringify(newData), ""];
176
+ });
177
+
178
+ }));
179
+
180
+ afterEach(function() {
181
+ $httpBackend.verifyNoOutstandingExpectation();
182
+ $httpBackend.verifyNoOutstandingRequest();
183
+ });
184
+
185
+ describe("Interceptors", function() {
186
+ it("Should add multiple request and response interceptors", function() {
187
+ Restangular.addRequestInterceptor(function(elem) {
188
+ var elemCopy = angular.copy(elem);
189
+ elemCopy.firstRequestInterceptor = true;
190
+ return elemCopy;
191
+ });
192
+ Restangular.addRequestInterceptor(function(elem) {
193
+ expect(elem.firstRequestInterceptor).toBeDefined();
194
+ var elemCopy = angular.copy(elem);
195
+ elemCopy.secondRequestInterceptor = true;
196
+ return elemCopy;
197
+ });
198
+ Restangular.addFullRequestInterceptor(function(elem) {
199
+ expect(elem.firstRequestInterceptor).toBeDefined();
200
+ expect(elem.secondRequestInterceptor).toBeDefined();
201
+ var elemCopy = angular.copy(elem);
202
+ elemCopy.thirdRequestInterceptor = true;
203
+ return {
204
+ element: elemCopy
205
+ };
206
+ });
207
+
208
+ Restangular.addResponseInterceptor(function(elem) {
209
+ var elemCopy = angular.copy(elem);
210
+ elemCopy.firstResponseInterceptor = true;
211
+ return elemCopy;
212
+ });
213
+
214
+ Restangular.addResponseInterceptor(function(elem) {
215
+ expect(elem.firstResponseInterceptor).toBeDefined();
216
+ var elemCopy = angular.copy(elem);
217
+ elemCopy.secondResponseInterceptor = true;
218
+ return elemCopy;
219
+ });
220
+
221
+ $httpBackend.whenPOST("/list").respond(function(method, url, data, headers) {
222
+ var elem = angular.fromJson(data);
223
+ expect(elem.firstRequestInterceptor).toBeDefined();
224
+ expect(elem.secondRequestInterceptor).toBeDefined();
225
+ expect(elem.thirdRequestInterceptor).toBeDefined();
226
+ return [200, elem, ""];
227
+ });
228
+
229
+ $httpBackend.expectPOST('/list');
230
+
231
+ Restangular.all('list').post({name: "Gonto"}).then(function(elem) {
232
+ expect(elem.firstResponseInterceptor).toBeDefined();
233
+ expect(elem.secondResponseInterceptor).toBeDefined();
234
+ });
235
+
236
+ $httpBackend.flush();
237
+ });
238
+
239
+ it("Should add multiple error interceptors", function() {
240
+ $httpBackend.expectGET("/error");
241
+
242
+ var CallbackManager = function() {};
243
+ CallbackManager.successCallback = function() {
244
+ expect(CallbackManager.successCallback).not.toHaveBeenCalled();
245
+ };
246
+ CallbackManager.errorCallback = function() {
247
+ expect(CallbackManager.firstErrorInterceptor).toHaveBeenCalled();
248
+ expect(CallbackManager.secondErrorInterceptor).toHaveBeenCalled();
249
+ };
250
+
251
+ CallbackManager.firstErrorInterceptor = function() {};
252
+ CallbackManager.secondErrorInterceptor = function() {};
253
+
254
+ spyOn(CallbackManager, "successCallback").andCallThrough();
255
+ spyOn(CallbackManager, "firstErrorInterceptor").andCallThrough();
256
+ spyOn(CallbackManager, "secondErrorInterceptor").andCallThrough();
257
+
258
+ Restangular.addErrorInterceptor(CallbackManager.firstErrorInterceptor);
259
+ Restangular.addErrorInterceptor(CallbackManager.secondErrorInterceptor);
260
+
261
+ Restangular.all("error").getList()
262
+ .then(CallbackManager.successCallback)
263
+ .catch(CallbackManager.errorCallback);
264
+
265
+ $httpBackend.flush();
266
+ });
267
+
268
+ it("Should add multiple error interceptors but don't reject the promise if one of them returns false", function() {
269
+ $httpBackend.expectGET("/error");
270
+
271
+ var CallbackManager = function() {};
272
+ CallbackManager.successCallback = function() {
273
+ expect(CallbackManager.successCallback).not.toHaveBeenCalled();
274
+ };
275
+ CallbackManager.errorCallback = function() {
276
+ expect(CallbackManager.errorCallback).not.toHaveBeenCalled();
277
+ };
278
+
279
+ CallbackManager.firstErrorInterceptor = function() {
280
+ return true;
281
+ };
282
+ CallbackManager.secondErrorInterceptor = function() {
283
+ return false; // prevent promise to be rejected
284
+ };
285
+
286
+ spyOn(CallbackManager, "successCallback").andCallThrough();
287
+ spyOn(CallbackManager, "errorCallback").andCallThrough();
288
+
289
+ Restangular.addErrorInterceptor(CallbackManager.firstErrorInterceptor);
290
+ Restangular.addErrorInterceptor(CallbackManager.secondErrorInterceptor);
291
+
292
+ Restangular.all("error").getList()
293
+ .then(CallbackManager.successCallback)
294
+ .catch(CallbackManager.errorCallback);
295
+
296
+ $httpBackend.flush();
297
+ });
298
+
299
+ it("Should add multiple error interceptors for a single get too", function() {
300
+ $httpBackend.expectGET("/error/404");
301
+
302
+ var CallbackManager = function() {};
303
+ CallbackManager.successCallback = function() {
304
+ expect(CallbackManager.successCallback).not.toHaveBeenCalled();
305
+ };
306
+ CallbackManager.errorCallback = function() {
307
+ expect(CallbackManager.firstErrorInterceptor).toHaveBeenCalled();
308
+ expect(CallbackManager.secondErrorInterceptor).toHaveBeenCalled();
309
+ };
310
+
311
+ CallbackManager.firstErrorInterceptor = function(response) {
312
+ expect(response.status).toEqual(404);
313
+ };
314
+ CallbackManager.secondErrorInterceptor = function() {};
315
+
316
+ spyOn(CallbackManager, "successCallback").andCallThrough();
317
+ spyOn(CallbackManager, "firstErrorInterceptor").andCallThrough();
318
+ spyOn(CallbackManager, "secondErrorInterceptor").andCallThrough();
319
+
320
+ Restangular.addErrorInterceptor(CallbackManager.firstErrorInterceptor);
321
+ Restangular.addErrorInterceptor(CallbackManager.secondErrorInterceptor);
322
+
323
+ Restangular.one("error", 404).get()
324
+ .then(CallbackManager.successCallback)
325
+ .catch(CallbackManager.errorCallback);
326
+
327
+ $httpBackend.flush();
328
+ });
329
+ });
330
+
331
+ describe("Transformers", function() {
332
+ it("Should decorate element both on server and local by default", function() {
333
+
334
+ Restangular.extendModel('accounts', function(account) {
335
+ account.extended = function() {return true;}
336
+ return account;
337
+ });
338
+
339
+ Restangular.one('accounts', 1).get().then(function(account) {
340
+ expect(account.extended).toBeDefined();
341
+ });
342
+
343
+ var local = {};
344
+ Restangular.restangularizeElement(null, local, 'accounts');
345
+ expect(local.extended).toBeDefined();
346
+
347
+ $httpBackend.flush();
348
+ });
349
+
350
+ });
351
+
352
+ describe("With Suffix", function() {
353
+ it("shouldn't add suffix to getRestangularUrl", function() {
354
+ var suffixRestangular = Restangular.withConfig(function(RestangularConfigurer) {
355
+ RestangularConfigurer.setRequestSuffix('.json');
356
+ });
357
+ var collection = suffixRestangular.all('accounts');
358
+ expect(collection.getRestangularUrl()).toBe('/accounts');
359
+ expect(collection.one('1').getRestangularUrl()).toBe('/accounts/1');
360
+ });
361
+
362
+ it("should add suffix to getRequestedUrl", function() {
363
+ var suffixRestangular = Restangular.withConfig(function(RestangularConfigurer) {
364
+ RestangularConfigurer.setRequestSuffix('.json');
365
+ });
366
+ var collection = suffixRestangular.all('accounts');
367
+ expect(collection.getRequestedUrl()).toBe('/accounts.json');
368
+ expect(collection.one('1').getRequestedUrl()).toBe('/accounts/1.json');
369
+ });
370
+
371
+ it("should add suffix to request", function() {
372
+ var suffixRestangular = Restangular.withConfig(function(RestangularConfigurer) {
373
+ RestangularConfigurer.setRequestSuffix('.json');
374
+ });
375
+ var collection = suffixRestangular.all('accounts');
376
+ $httpBackend.expectGET('/accounts.json').respond(200);
377
+ $httpBackend.expectGET('/accounts/1.json').respond(200);
378
+ collection.getList();
379
+ collection.get('1');
380
+ $httpBackend.flush();
381
+ });
382
+
383
+ it("shouldn't add suffix to allUrl", function() {
384
+ var suffixRestangular = Restangular.withConfig(function(RestangularConfigurer) {
385
+ RestangularConfigurer.setRequestSuffix('.json');
386
+ });
387
+ $httpBackend.expectGET('http://accounts.com/all');
388
+ suffixRestangular.allUrl('accounts', 'http://accounts.com/all').getList();
389
+ $httpBackend.flush();
390
+ });
391
+ });
392
+
393
+ describe("JSONp", function() {
394
+ it("should work for get", function() {
395
+ Restangular.setJsonp(true);
396
+ Restangular.one('accounts', 1).get();
397
+
398
+ $httpBackend.expectJSONP('/accounts/1');
399
+ $httpBackend.flush();
400
+ });
401
+
402
+ it("should work for getList", function() {
403
+ Restangular.setJsonp(true);
404
+ Restangular.all('accounts').getList();
405
+
406
+ $httpBackend.expectJSONP('/accounts');
407
+ $httpBackend.flush();
408
+ });
409
+
410
+ it("shouldn't override post", function() {
411
+ Restangular.setJsonp(true);
412
+ restangularAccounts.post({id: 2, user: "Someone"});
413
+
414
+ $httpBackend.expectPOST('/accounts').respond(201, '');
415
+ $httpBackend.flush();
416
+ });
417
+
418
+
419
+ });
420
+
421
+ describe("Local data", function() {
422
+ it("Should restangularize a collection OK", function() {
423
+ var collection = angular.copy(accountsModel);
424
+
425
+ Restangular.restangularizeCollection(null, collection, 'accounts');
426
+
427
+ expect(_.has(collection, 'get')).toBe(true);
428
+ expect(_.has(collection[0], 'get')).toBe(true);
429
+
430
+ expect(collection.getRestangularUrl()).toBe('/accounts');
431
+ expect(collection[0].getRestangularUrl()).toBe('/accounts/0');
432
+
433
+ });
434
+ });
435
+
436
+ describe("restangularizePromiseIntercept", function() {
437
+ it("should be invoked by restangularizePromise", function() {
438
+ var calledWithPromise;
439
+
440
+ Restangular.setRestangularizePromiseInterceptor(function(promise) {
441
+ calledWithPromise = promise;
442
+
443
+ promise.$object.$custom = true;
444
+ });
445
+
446
+ var promise = Restangular.one('accounts', 1).get();
447
+
448
+ expect(calledWithPromise).toBeDefined();
449
+ expect(promise.$object.$custom).toBeDefined();
450
+
451
+ $httpBackend.flush();
452
+ });
453
+ });
454
+
455
+ describe("$object", function() {
456
+ it("Should work for single get", function() {
457
+ var promise = Restangular.one('accounts', 1).get();
458
+ var obj = promise.$object;
459
+ expect(obj).toBeDefined();
460
+ expect(obj.amount).toBeUndefined();
461
+
462
+ $httpBackend.flush();
463
+
464
+ expect(obj.amount).toEqual(3.1416);
465
+ });
466
+
467
+ it("Shouldn't be restangularized by default", function() {
468
+ Restangular.extendModel('accounts', function(account) {
469
+ account.extended = function() {return true;}
470
+ return account;
471
+ });
472
+
473
+ var promise = Restangular.one('accounts', 1).get();
474
+ var obj = promise.$object;
475
+ expect(obj).toBeDefined();
476
+ expect(obj.extended).toBeUndefined();
477
+
478
+ $httpBackend.flush();
479
+ });
480
+
481
+ it("Should work for single get", function() {
482
+ var promise = Restangular.all('accounts').getList();
483
+ var list = promise.$object;
484
+ expect(list).toBeDefined();
485
+ expect(list.length).toEqual(0);
486
+
487
+ $httpBackend.flush();
488
+
489
+ expect(list.length).toEqual(2);
490
+ expect(list[1].amount).toEqual(3.1416);
491
+ });
492
+ });
493
+
494
+ describe("ALL", function() {
495
+ it("getList() should return an array of items", function() {
496
+ restangularAccounts.getList().then(function(accounts) {
497
+ expect(Restangular.stripRestangular(accounts)).toEqual(Restangular.stripRestangular(accountsModel));
498
+ });
499
+
500
+ $httpBackend.flush();
501
+ });
502
+
503
+ it("several getList() should return an array of items", function() {
504
+ $httpBackend.expectGET('/accounts/0,1');
505
+ Restangular.several("accounts", 0, 1).getList().then(function(accounts) {
506
+ expect(Restangular.stripRestangular(accounts)).toEqual(Restangular.stripRestangular(accountsModel));
507
+ });
508
+
509
+ $httpBackend.flush();
510
+ });
511
+
512
+ it("several remove() should work", function() {
513
+ $httpBackend.expectDELETE('/accounts/0,1').respond([200, "", ""]);
514
+ Restangular.several("accounts", 0, 1).remove();
515
+
516
+ $httpBackend.flush();
517
+ });
518
+
519
+ it("get(id) should return the item with given id", function() {
520
+ restangularAccounts.get(0).then(function(account) {
521
+ expect(Restangular.stripRestangular(account)).toEqual(Restangular.stripRestangular(accountsModel[0]));
522
+ });
523
+
524
+ $httpBackend.flush();
525
+ });
526
+
527
+ it('uses all to get the list without parameters', function() {
528
+ Restangular.one('accounts', 1).all('messages').getList();
529
+ $httpBackend.expectGET('/accounts/1/messages');
530
+ $httpBackend.flush();
531
+ });
532
+
533
+ it("Custom GET methods should work", function() {
534
+ restangularAccounts.customGETLIST("messages").then(function(msgs) {
535
+ expect(Restangular.stripRestangular(msgs)).toEqual(Restangular.stripRestangular(messages));
536
+ });
537
+
538
+ $httpBackend.flush();
539
+ });
540
+
541
+ it("post() should add a new item", function() {
542
+ restangularAccounts.post({id: 2, user: "Someone"}).then(function() {
543
+ expect(accountsModel.length).toEqual(2);
544
+ });
545
+
546
+ $httpBackend.expectPOST('/accounts').respond(201, '');
547
+ $httpBackend.flush();
548
+ });
549
+
550
+ it("customPOST() should add a new item", function() {
551
+ restangularAccounts.customPOST({id: 2, user: "Someone"}).then(function() {
552
+ expect(accountsModel.length).toEqual(2);
553
+ });
554
+
555
+ $httpBackend.expectPOST('/accounts').respond(201, '');
556
+ $httpBackend.flush();
557
+ });
558
+
559
+ it("post() should work with arrays", function() {
560
+ Restangular.all('places').post([{name: "Gonto"}, {name: 'John'}]).then(function(value) {
561
+ expect(value.length).toEqual(2);
562
+ });
563
+
564
+ $httpBackend.expectPOST('/places').respond(function(method, url, data, headers) {
565
+ return [201, angular.fromJson(data), ""];
566
+ });
567
+
568
+ $httpBackend.flush();
569
+ });
570
+
571
+ it("post() should add a new item with data and return the data from the server", function() {
572
+ restangularAccounts.post(newAccount).then(function(added) {
573
+ expect(added.fromServer).toEqual(true);
574
+ expect(added.id).toEqual(newAccount.id);
575
+ });
576
+
577
+ $httpBackend.expectPOST('/accounts');
578
+ $httpBackend.flush();
579
+ });
580
+
581
+ it("Doing a post and then other operation (delete) should call right URLs", function() {
582
+ restangularAccounts.post(newAccount).then(function(added) {
583
+ added.remove();
584
+ $httpBackend.expectDELETE('/accounts/44').respond(201, '');
585
+ });
586
+
587
+ $httpBackend.flush();
588
+ });
589
+
590
+ it("Doing a post to a server that returns no element will return undefined", function() {
591
+ restangularAccounts.getList().then(function(accounts) {
592
+ var newTransaction = {id: 1, name: "Gonto"};
593
+ accounts[1].post('transactions', newTransaction).then(function(transaction) {
594
+ expect(transaction).toBeUndefined();
595
+ });
596
+ });
597
+
598
+ $httpBackend.flush();
599
+ });
600
+
601
+ it("head() should safely return", function() {
602
+ restangularAccounts.head().then(function() {
603
+ expect(true).toBe(true);
604
+ });
605
+ $httpBackend.flush();
606
+ });
607
+
608
+ it("trace() should safely return", function() {
609
+ restangularAccounts.trace().then(function() {
610
+ expect(true).toBe(true);
611
+ });
612
+
613
+ $httpBackend.flush();
614
+ });
615
+
616
+ it("customPUT should work", function() {
617
+ $httpBackend.expectPUT('/accounts/hey').respond(accountsModel);
618
+ restangularAccounts.customPUT({key: 'value'}, 'hey');
619
+
620
+ $httpBackend.flush();
621
+ });
622
+
623
+ it("options() should safely return", function() {
624
+ restangularAccounts.options().then(function() {
625
+ expect(true).toBe(true);
626
+ });
627
+
628
+ $httpBackend.flush();
629
+ });
630
+
631
+ it("getList() should correctly handle params after customDELETE", function() {
632
+ $httpBackend.expectGET('/accounts?foo=1').respond(accountsModel);
633
+ restangularAccounts.getList({foo: 1}).then(function(){
634
+ $httpBackend.expectDELETE('/accounts?id=1').respond(201, '');
635
+ return restangularAccounts.customDELETE('', {id: 1});
636
+ }).then(function() {
637
+ $httpBackend.expectGET('/accounts?foo=1').respond(accountsModel);
638
+ return restangularAccounts.getList({foo: 1});
639
+ }).then(function(accounts) {
640
+ expect(Restangular.stripRestangular(accounts)).toEqual(Restangular.stripRestangular(accountsModel));
641
+ });
642
+
643
+ $httpBackend.flush();
644
+ });
645
+ });
646
+
647
+ describe("Scoped Service", function() {
648
+
649
+ it("should correctly work", function() {
650
+ var Accounts = Restangular.service('accounts');
651
+ Accounts.post(newAccount);
652
+ Accounts.one(0).get();
653
+ Accounts.getList();
654
+
655
+ $httpBackend.expectPOST('/accounts');
656
+ $httpBackend.expectGET('/accounts/0');
657
+ $httpBackend.expectGET('/accounts');
658
+ $httpBackend.flush();
659
+ });
660
+
661
+ it("should correctly work with children", function() {
662
+ var Transactions = Restangular.service('transactions', restangularAccount1);
663
+ Transactions.post(newAccount);
664
+ Transactions.one(1).get();
665
+ Transactions.getList();
666
+
667
+ $httpBackend.expectPOST('/accounts/1/transactions');
668
+ $httpBackend.expectGET('/accounts/1/transactions/1');
669
+ $httpBackend.expectGET('/accounts/1/transactions');
670
+ $httpBackend.flush();
671
+ });
672
+
673
+ it("should add custom collection method added with withConfig", function() {
674
+ var Accounts = Restangular.withConfig(function(RestangularConfigurer) {
675
+ RestangularConfigurer.addElementTransformer('accounts', true, function(worker) {
676
+ worker.addRestangularMethod('doSomething', 'get', 'do-something');
677
+ return worker;
678
+ });
679
+ }).service('accounts');
680
+
681
+ expect(Accounts.doSomething).toBeDefined();
682
+ expect(_.isFunction(Accounts.doSomething)).toBeTruthy();
683
+
684
+ Accounts.post(newAccount);
685
+ Accounts.one(0).get();
686
+ Accounts.getList();
687
+ Accounts.doSomething();
688
+
689
+ $httpBackend.expectPOST('/accounts');
690
+ $httpBackend.expectGET('/accounts/0');
691
+ $httpBackend.expectGET('/accounts');
692
+ $httpBackend.expectGET('/accounts/do-something');
693
+ $httpBackend.flush();
694
+ });
695
+ });
696
+
697
+ describe("ONE", function() {
698
+ it("get() should return a JSON item", function() {
699
+ restangularAccount1.get().then(function(account) {
700
+ expect(Restangular.stripRestangular(account))
701
+ .toEqual(Restangular.stripRestangular(accountsModel[1]));
702
+ });
703
+
704
+ $httpBackend.flush();
705
+ });
706
+
707
+ it("Should save as put correctly", function() {
708
+ restangularAccount1.get().then(function(account) {
709
+ $httpBackend.expectPUT('/accounts/1');
710
+ account.put();
711
+ });
712
+
713
+ $httpBackend.flush();
714
+ });
715
+
716
+ it("Should save as post correctly", function() {
717
+ var account1 = angular.copy(restangularAccount1);
718
+ $httpBackend.expectPOST('/accounts/1');
719
+ account1.name = "Hey";
720
+ account1.save();
721
+
722
+ $httpBackend.flush();
723
+ });
724
+
725
+ it("Should keep route property when element is created", function() {
726
+ var account1 = Restangular.restangularizeElement(null, {}, 'accounts');
727
+ $httpBackend.expectPOST('/accounts');
728
+ $httpBackend.expectPUT('/accounts/1');
729
+ account1.name = "Hey";
730
+ account1.save().then(function(accountFromServer) {
731
+ accountFromServer.id = 1;
732
+ return accountFromServer.save();
733
+ }).then(function(accountFromServer2) {
734
+ expect(accountFromServer2.route).toBe(account1.route);
735
+ });
736
+ $httpBackend.flush()
737
+ });
738
+
739
+ it("Should make RequestLess connections with one", function() {
740
+ restangularAccount1.one("transactions", 1).get().then(function(transaction) {
741
+ expect(Restangular.stripRestangular(transaction))
742
+ .toEqual(Restangular.stripRestangular(accountsModel[1].transactions[1]));
743
+ });
744
+
745
+ $httpBackend.flush();
746
+ });
747
+
748
+ it("Should make RequestLess connections with all", function() {
749
+ restangularAccount1.all("transactions").getList().then(function(transactions) {
750
+ expect(Restangular.stripRestangular(transactions))
751
+ .toEqual(Restangular.stripRestangular(accountsModel[1].transactions));
752
+ });
753
+
754
+ $httpBackend.flush();
755
+ });
756
+
757
+
758
+ it("Custom GET methods should work", function() {
759
+ restangularAccount1.customGET("message").then(function(msg) {
760
+ expect(Restangular.stripRestangular(msg)).toEqual(Restangular.stripRestangular(messages[0]));
761
+ });
762
+
763
+ $httpBackend.flush();
764
+ });
765
+
766
+ it("put() should update the value", function() {
767
+ restangularAccount1.get().then(function(account) {
768
+ account.amount = 1.618;
769
+ account.put().then(function(newAc) {
770
+ expect(accountsModel[1].amount).toEqual(1.618);
771
+ newAc.remove();
772
+ $httpBackend.expectDELETE("/accounts/1");
773
+ });
774
+ $httpBackend.expectPUT("/accounts/1");
775
+
776
+
777
+ });
778
+
779
+ $httpBackend.flush();
780
+ });
781
+
782
+ it("should return an array when accessing a subvalue", function() {
783
+ restangularAccount1.get().then(function(account) {
784
+ account.getList("transactions").then(function(transactions) {
785
+ expect(Restangular.stripRestangular(transactions))
786
+ .toEqual(Restangular.stripRestangular(accountsModel[1].transactions));
787
+ });
788
+ });
789
+
790
+ $httpBackend.flush();
791
+ });
792
+ });
793
+
794
+ describe("COPY", function() {
795
+ it("should copy an object and 'this' should reference the copied object", function() {
796
+ var copiedAccount = Restangular.copy(accountsModel[0]);
797
+ var that;
798
+
799
+ copiedAccount.user = "Copied string";
800
+ expect(copiedAccount).not.toBe(accountsModel[0]);
801
+
802
+ // create a spy for one of the methods to capture the value of 'this'
803
+ spyOn(copiedAccount, 'getRestangularUrl').andCallFake(function() {
804
+ that = this;
805
+ });
806
+
807
+ copiedAccount.getRestangularUrl(); // invoke the method we are spying on
808
+ expect(that).toBe(copiedAccount);
809
+ });
810
+ });
811
+
812
+ describe("getRestangularUrl", function() {
813
+ it("should return the generated URL when you chain Restangular methods together", function() {
814
+ var restangularSpaces = Restangular.one("accounts",123).one("buildings", 456).all("spaces");
815
+ expect(restangularSpaces.getRestangularUrl()).toEqual("/accounts/123/buildings/456/spaces");
816
+ });
817
+ });
818
+
819
+ describe("getRestangularUrl with useCannonicalId set to true", function() {
820
+ it("should return the generated URL when you chain Restangular methods together", function() {
821
+ var R = Restangular.withConfig(function(config) {
822
+ config.setUseCannonicalId(true);
823
+ });
824
+ var restangularSpaces = R.one("accounts",123).one("buildings", 456).all("spaces");
825
+ expect(restangularSpaces.getRestangularUrl()).toEqual("/accounts/123/buildings/456/spaces");
826
+ });
827
+ });
828
+
829
+
830
+ describe("addElementTransformer", function() {
831
+ it("should allow for a custom method to be placed at the collection level", function() {
832
+ var accountsPromise;
833
+
834
+ Restangular.addElementTransformer('accounts', true, function(collection) {
835
+ collection.totalAmount = function() {};
836
+ return collection;
837
+ });
838
+
839
+ accountsPromise = Restangular.all('accounts').getList();
840
+
841
+ accountsPromise.then(function(accounts) {
842
+ expect(typeof accounts.totalAmount).toEqual("function");
843
+ });
844
+
845
+ $httpBackend.flush();
846
+ });
847
+
848
+ it("should allow for a custom method to be placed at the model level when one model is requested", function() {
849
+ var accountPromise;
850
+
851
+ Restangular.addElementTransformer('accounts', false, function(model) {
852
+ model.prettifyAmount = function() {};
853
+ return model;
854
+ });
855
+
856
+ accountPromise = Restangular.one('accounts', 1).get();
857
+
858
+ accountPromise.then(function(account) {
859
+ expect(typeof account.prettifyAmount).toEqual("function");
860
+ });
861
+
862
+ $httpBackend.flush();
863
+ });
864
+
865
+ it("should allow for a custom method to be placed at the model level when several models are requested", function() {
866
+ var accountPromise;
867
+
868
+ Restangular.addElementTransformer('accounts', false, function(model) {
869
+ model.prettifyAmount = function() {};
870
+ return model;
871
+ });
872
+
873
+ accountsPromise = Restangular.all('accounts', 1).getList();
874
+
875
+ accountsPromise.then(function(accounts) {
876
+ accounts.forEach(function(account, index) {
877
+ expect(typeof account.prettifyAmount).toEqual("function");
878
+ });
879
+ });
880
+
881
+ $httpBackend.flush();
882
+ });
883
+ });
884
+
885
+ describe("extendCollection", function() {
886
+ it("should be an alias for a specific invocation of addElementTransformer", function() {
887
+ var spy = spyOn(Restangular, 'addElementTransformer');
888
+
889
+ var fn = function(collection) {
890
+ collection.totalAmount = function() {};
891
+ return collection;
892
+ };
893
+
894
+ Restangular.extendCollection('accounts', fn);
895
+
896
+ expect(spy).toHaveBeenCalledWith('accounts', true, fn);
897
+ });
898
+ });
899
+
900
+ describe("extendModel", function() {
901
+ it("should be an alias for a specific invocation of addElementTransformer", function() {
902
+ var spy = spyOn(Restangular, 'addElementTransformer');
903
+
904
+ var fn = function(model) {
905
+ model.prettifyAmount = function() {};
906
+ return model;
907
+ };
908
+
909
+ Restangular.extendModel('accounts', fn);
910
+
911
+ expect(spy).toHaveBeenCalledWith('accounts', false, fn);
912
+ });
913
+ });
914
+
915
+ describe("headers", function() {
916
+ it("should return defaultHeaders", function() {
917
+ var defaultHeaders = {testheader:'header value'};
918
+ Restangular.setDefaultHeaders(defaultHeaders);
919
+ expect(Restangular.defaultHeaders).toEqual(defaultHeaders);
920
+ });
921
+
922
+ it("should pass uppercase methods in X-HTTP-Method-Override", function() {
923
+ Restangular.setMethodOverriders(["put"]);
924
+ $httpBackend.expectPOST('/overriders/1').respond(function(method, url, data, headers) {
925
+ expect(headers['X-HTTP-Method-Override']).toBe('PUT');
926
+ return {};
927
+ });
928
+ Restangular.one('overriders', 1).put();
929
+ $httpBackend.flush();
930
+ });
931
+ });
932
+
933
+ describe("defaultRequestParams", function() {
934
+ it("should return defaultRequestParams", function() {
935
+ var defaultRequestParams = {param:'value'};
936
+
937
+ Restangular.setDefaultRequestParams(defaultRequestParams);
938
+
939
+ expect(Restangular.requestParams.common).toEqual(defaultRequestParams);
940
+ });
941
+
942
+ it("should be able to set default params for get, post, put.. methods separately", function() {
943
+ var postParams = {post:'value'},
944
+ putParams = {put:'value'};
945
+
946
+ Restangular.setDefaultRequestParams('post', postParams);
947
+ expect(Restangular.requestParams.post).toEqual(postParams);
948
+
949
+ Restangular.setDefaultRequestParams('put', putParams);
950
+ expect(Restangular.requestParams.put).toEqual(putParams);
951
+
952
+ expect(Restangular.requestParams.common).not.toEqual(putParams);
953
+ });
954
+
955
+ it("should be able to set default params for multiple methods with array", function() {
956
+ var defaultParams = {param:'value'};
957
+
958
+ Restangular.setDefaultRequestParams(['post', 'put'], defaultParams);
959
+
960
+ expect(Restangular.requestParams.post).toEqual(defaultParams);
961
+ expect(Restangular.requestParams.put).toEqual(defaultParams);
962
+
963
+ expect(Restangular.requestParams.common).not.toEqual(defaultParams);
964
+ });
965
+ });
966
+
967
+ describe("withConfig", function() {
968
+ it("should create new service with scoped configuration", function() {
969
+ var childRestangular = Restangular.withConfig(function(RestangularConfigurer){
970
+ RestangularConfigurer.setBaseUrl('/api/v1');
971
+ });
972
+
973
+ expect(Restangular.configuration.baseUrl).toEqual('');
974
+ expect(childRestangular.configuration.baseUrl).toEqual('/api/v1');
975
+
976
+ });
977
+
978
+ it("should allow nested configurations", function() {
979
+ var childRestangular = Restangular.withConfig(function(RestangularConfigurer){
980
+ RestangularConfigurer.setBaseUrl('/api/v1');
981
+ });
982
+
983
+ var grandchildRestangular = childRestangular.withConfig(function(RestangularConfigurer){
984
+ RestangularConfigurer.setRequestSuffix('.json');
985
+ });
986
+
987
+ expect(Restangular.configuration.baseUrl).toEqual('');
988
+ expect(Restangular.configuration.suffix).toEqual(null);
989
+
990
+ expect(childRestangular.configuration.baseUrl).toEqual('/api/v1');
991
+ expect(childRestangular.configuration.suffix).toEqual(null);
992
+
993
+ expect(grandchildRestangular.configuration.baseUrl).toEqual('/api/v1');
994
+ expect(grandchildRestangular.configuration.suffix).toEqual('.json');
995
+ });
996
+ });
997
+
998
+ describe("Self linking", function() {
999
+ it("Should request the link in HAL format", function() {
1000
+ var linkRestangular = Restangular.withConfig(function(RestangularConfigurer) {
1001
+ RestangularConfigurer.setRestangularFields({
1002
+ selfLink: "_links.self"
1003
+ });
1004
+ });
1005
+
1006
+ var arr = linkRestangular.all('accountsHAL').getList().$object;
1007
+ $httpBackend.flush();
1008
+
1009
+ var account = arr[0];
1010
+ $httpBackend.expectPUT("/accountsHAL/martin");
1011
+ account.name = "Updated";
1012
+ account.put();
1013
+
1014
+ $httpBackend.flush();
1015
+ });
1016
+ });
1017
+
1018
+ describe("Singe one (endpoint not expecting an id)", function() {
1019
+ it('does not use the id for single resource GET', function() {
1020
+ Restangular.one('info', 0, true).get();
1021
+ $httpBackend.expectGET('/info');
1022
+ $httpBackend.flush();
1023
+ });
1024
+
1025
+ it('getRestangularUrl() returns still the url without id after GET', function() {
1026
+ record = Restangular.one('info', 0, true);
1027
+ record.get().then(function(data){
1028
+ expect(data.getRestangularUrl()).toEqual("/info")
1029
+ });
1030
+ $httpBackend.expectGET('/info');
1031
+ $httpBackend.flush();
1032
+ });
1033
+
1034
+ it('does not use the id for single nested resource GET', function() {
1035
+ Restangular.one('accounts', 1).one('info', 0, true).get()
1036
+ $httpBackend.expectGET('/accounts/1/info');
1037
+ $httpBackend.flush();
1038
+ });
1039
+
1040
+ it('does not use the id for single resource PUT', function() {
1041
+ Restangular.one('info', 0, true).put();
1042
+ $httpBackend.expectPUT('/info');
1043
+ $httpBackend.flush();
1044
+ });
1045
+ });
1046
+
1047
+ describe("setSelfLinkAbsoluteUrl", function() {
1048
+ it("works", function() {
1049
+ var childRestangular = Restangular.withConfig(function(RestangularConfigurer){
1050
+ RestangularConfigurer.setSelfLinkAbsoluteUrl(false);
1051
+ });
1052
+
1053
+ expect(Restangular.configuration.absoluteUrl).toEqual(true);
1054
+ expect(childRestangular.configuration.absoluteUrl).toEqual(false);
1055
+ })
1056
+ });
1057
+
1058
+ describe("Misc", function () {
1059
+ it("should not strip [one] or [all] key from plain object", function () {
1060
+ Restangular.all("customs").customPOST({one: 'I am here', two: 'I am also here'}).then(function () {
1061
+ expect(1).toBe(1);
1062
+ }, function () {
1063
+ expect("Promise").toBe("correctly fulfilled");
1064
+ });
1065
+ $httpBackend.flush();
1066
+ });
1067
+
1068
+ it("should not stip non-restangularized elements", function () {
1069
+ expect(Restangular.stripRestangular(["test","test2"])).toEqual(["test","test2"]);
1070
+ });
1071
+ });
1072
+
1073
+ describe("testing normilize url", function () {
1074
+
1075
+ it("should get a list of objects", function () {
1076
+ Restangular.all('customers/').getList().then(function(res){
1077
+ res.getList({active: true});
1078
+ $httpBackend.expectGET('/customers/?active=true');
1079
+ //res.getList('publications/', {tags: 'chemistry'});
1080
+ //$httpBackend.expectGET('/customers/publications/?tags=chemistry');
1081
+ });
1082
+ $httpBackend.expectGET('/customers/');
1083
+ $httpBackend.flush();
1084
+ });
1085
+
1086
+ it("should get a list of objects even if the path has extra slashes", function () {
1087
+ Restangular.all('customers///').getList().then(function(res){
1088
+ res.getList({active: true});
1089
+ $httpBackend.expectGET('/customers/?active=true');
1090
+ });
1091
+ $httpBackend.expectGET('/customers/');
1092
+ $httpBackend.flush();
1093
+ });
1094
+
1095
+ it("should post with slash at the end", function () {
1096
+ Restangular.all('customers/').getList().then(function(res){
1097
+ res.post(newCustomer);
1098
+ $httpBackend.expectPOST('/customers/');
1099
+ });
1100
+ $httpBackend.expectGET('/customers/');
1101
+ $httpBackend.flush();
1102
+ });
1103
+
1104
+ it("should put with slash at the end", function () {
1105
+ Restangular.all('customers/').getList().then(function(customers){
1106
+ customers[0].put();
1107
+ $httpBackend.expectPUT('/customers/0');
1108
+ });
1109
+ $httpBackend.flush();
1110
+ });
1111
+
1112
+ it("should return a normilized URL even it has extra slashes", function() {
1113
+ var restangularSpaces = Restangular.one("accounts//", 123).one("buildings//", 456).all("spaces///");
1114
+ expect(restangularSpaces.getRestangularUrl()).toEqual("/accounts/123/buildings/456/spaces/");
1115
+ });
1116
+
1117
+ it("should create a new service and still working normilized URL", function() {
1118
+ var newRes = Restangular.withConfig(function(RestangularConfigurer){
1119
+ RestangularConfigurer.setBaseUrl('http://localhost:8080');
1120
+ });
1121
+ expect(newRes.configuration.baseUrl).toEqual('http://localhost:8080');
1122
+ newRes.all("customers////").getList();
1123
+ $httpBackend.expectGET('http://localhost:8080/customers/');
1124
+
1125
+ var newApi = Restangular.withConfig(function(RestangularConfigurer){
1126
+ RestangularConfigurer.setBaseUrl('api.new.domain');
1127
+ });
1128
+
1129
+ expect(newApi.configuration.baseUrl).toEqual('api.new.domain');
1130
+ newApi.all("customers////").getList();
1131
+ $httpBackend.expectGET('api.new.domain/customers/');
1132
+
1133
+ $httpBackend.flush();
1134
+ });
1135
+ });
1136
+ });