discourse-ember-source 3.5.1.1 → 3.5.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (741) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ember/version.rb +1 -1
  3. metadata +2 -740
  4. data/.gitignore +0 -9
  5. data/.travis.yml +0 -5
  6. data/Gemfile +0 -6
  7. data/LICENSE.txt +0 -21
  8. data/README +0 -18
  9. data/README.md +0 -39
  10. data/Rakefile +0 -27
  11. data/bin/console +0 -14
  12. data/bin/setup +0 -8
  13. data/discourse-ember-source-3.5.1.0.gem +0 -0
  14. data/dist/ember-all.debug.map +0 -1
  15. data/dist/ember-template-compiler.map +0 -1
  16. data/dist/ember-testing.map +0 -1
  17. data/dist/ember-tests.map +0 -1
  18. data/dist/ember-tests.prod.map +0 -1
  19. data/dist/ember.debug.map +0 -1
  20. data/dist/ember.min.map +0 -1
  21. data/dist/ember.prod.map +0 -1
  22. data/dist/es/@ember/application/globals-resolver.js +0 -425
  23. data/dist/es/@ember/application/index.js +0 -3
  24. data/dist/es/@ember/application/instance.js +0 -513
  25. data/dist/es/@ember/application/lib/application.js +0 -1139
  26. data/dist/es/@ember/application/lib/lazy_load.js +0 -69
  27. data/dist/es/@ember/application/lib/validate-type.js +0 -24
  28. data/dist/es/@ember/application/tests/application_instance_test.js +0 -230
  29. data/dist/es/@ember/application/tests/application_test.js +0 -470
  30. data/dist/es/@ember/application/tests/bootstrap-test.js +0 -28
  31. data/dist/es/@ember/application/tests/dependency_injection/custom_resolver_test.js +0 -32
  32. data/dist/es/@ember/application/tests/dependency_injection/default_resolver_test.js +0 -363
  33. data/dist/es/@ember/application/tests/dependency_injection/normalization_test.js +0 -70
  34. data/dist/es/@ember/application/tests/dependency_injection/to_string_test.js +0 -71
  35. data/dist/es/@ember/application/tests/dependency_injection_test.js +0 -93
  36. data/dist/es/@ember/application/tests/initializers_test.js +0 -391
  37. data/dist/es/@ember/application/tests/instance_initializers_test.js +0 -395
  38. data/dist/es/@ember/application/tests/lazy_load_test.js +0 -79
  39. data/dist/es/@ember/application/tests/logging_test.js +0 -179
  40. data/dist/es/@ember/application/tests/readiness_test.js +0 -138
  41. data/dist/es/@ember/application/tests/reset_test.js +0 -185
  42. data/dist/es/@ember/application/tests/visit_test.js +0 -783
  43. data/dist/es/@ember/canary-features/index.js +0 -76
  44. data/dist/es/@ember/controller/index.js +0 -50
  45. data/dist/es/@ember/controller/lib/controller_mixin.js +0 -42
  46. data/dist/es/@ember/controller/tests/controller_test.js +0 -209
  47. data/dist/es/@ember/debug/index.js +0 -264
  48. data/dist/es/@ember/debug/lib/deprecate.js +0 -198
  49. data/dist/es/@ember/debug/lib/handlers.js +0 -22
  50. data/dist/es/@ember/debug/lib/testing.js +0 -7
  51. data/dist/es/@ember/debug/lib/warn.js +0 -107
  52. data/dist/es/@ember/debug/tests/handlers-test.js +0 -144
  53. data/dist/es/@ember/debug/tests/main_test.js +0 -444
  54. data/dist/es/@ember/deprecated-features/index.js +0 -21
  55. data/dist/es/@ember/engine/index.js +0 -532
  56. data/dist/es/@ember/engine/instance.js +0 -228
  57. data/dist/es/@ember/engine/lib/engine-parent.js +0 -32
  58. data/dist/es/@ember/engine/tests/engine_initializers_test.js +0 -366
  59. data/dist/es/@ember/engine/tests/engine_instance_initializers_test.js +0 -409
  60. data/dist/es/@ember/engine/tests/engine_instance_test.js +0 -115
  61. data/dist/es/@ember/engine/tests/engine_parent_test.js +0 -20
  62. data/dist/es/@ember/engine/tests/engine_test.js +0 -121
  63. data/dist/es/@ember/error/index.js +0 -36
  64. data/dist/es/@ember/error/tests/index_test.js +0 -19
  65. data/dist/es/@ember/instrumentation/index.js +0 -240
  66. data/dist/es/@ember/instrumentation/tests/index-test.js +0 -214
  67. data/dist/es/@ember/map/index.js +0 -218
  68. data/dist/es/@ember/map/lib/ordered-set.js +0 -186
  69. data/dist/es/@ember/map/lib/utils.js +0 -29
  70. data/dist/es/@ember/map/tests/map_test.js +0 -578
  71. data/dist/es/@ember/map/with-default.js +0 -87
  72. data/dist/es/@ember/object/computed.js +0 -35
  73. data/dist/es/@ember/object/lib/computed/computed_macros.js +0 -742
  74. data/dist/es/@ember/object/lib/computed/reduce_computed_macros.js +0 -894
  75. data/dist/es/@ember/object/tests/computed/computed_macros_test.js +0 -533
  76. data/dist/es/@ember/object/tests/computed/reduce_computed_macros_test.js +0 -2243
  77. data/dist/es/@ember/polyfills/index.js +0 -3
  78. data/dist/es/@ember/polyfills/lib/assign.js +0 -43
  79. data/dist/es/@ember/polyfills/lib/merge.js +0 -35
  80. data/dist/es/@ember/polyfills/tests/assign_test.js +0 -64
  81. data/dist/es/@ember/runloop/index.js +0 -749
  82. data/dist/es/@ember/runloop/tests/debounce_test.js +0 -87
  83. data/dist/es/@ember/runloop/tests/later_test.js +0 -264
  84. data/dist/es/@ember/runloop/tests/next_test.js +0 -56
  85. data/dist/es/@ember/runloop/tests/once_test.js +0 -62
  86. data/dist/es/@ember/runloop/tests/onerror_test.js +0 -59
  87. data/dist/es/@ember/runloop/tests/run_bind_test.js +0 -59
  88. data/dist/es/@ember/runloop/tests/run_test.js +0 -28
  89. data/dist/es/@ember/runloop/tests/schedule_test.js +0 -86
  90. data/dist/es/@ember/runloop/tests/sync_test.js +0 -32
  91. data/dist/es/@ember/runloop/tests/unwind_test.js +0 -54
  92. data/dist/es/@ember/service/index.js +0 -57
  93. data/dist/es/@ember/string/index.js +0 -362
  94. data/dist/es/@ember/string/lib/string_registry.js +0 -13
  95. data/dist/es/@ember/string/tests/camelize_test.js +0 -53
  96. data/dist/es/@ember/string/tests/capitalize_test.js +0 -58
  97. data/dist/es/@ember/string/tests/classify_test.js +0 -79
  98. data/dist/es/@ember/string/tests/dasherize_test.js +0 -57
  99. data/dist/es/@ember/string/tests/decamelize_test.js +0 -51
  100. data/dist/es/@ember/string/tests/loc_test.js +0 -76
  101. data/dist/es/@ember/string/tests/underscore_test.js +0 -51
  102. data/dist/es/@ember/string/tests/w_test.js +0 -39
  103. data/dist/es/@glimmer/compiler.js +0 -1226
  104. data/dist/es/@glimmer/encoder.js +0 -39
  105. data/dist/es/@glimmer/low-level.js +0 -82
  106. data/dist/es/@glimmer/node.js +0 -112
  107. data/dist/es/@glimmer/opcode-compiler.js +0 -1999
  108. data/dist/es/@glimmer/program.js +0 -405
  109. data/dist/es/@glimmer/reference.js +0 -478
  110. data/dist/es/@glimmer/runtime.js +0 -4086
  111. data/dist/es/@glimmer/syntax.js +0 -1424
  112. data/dist/es/@glimmer/util.js +0 -189
  113. data/dist/es/@glimmer/vm.js +0 -27
  114. data/dist/es/@glimmer/wire-format.js +0 -56
  115. data/dist/es/backburner.js +0 -936
  116. data/dist/es/container/index.js +0 -8
  117. data/dist/es/container/lib/container.js +0 -437
  118. data/dist/es/container/lib/registry.js +0 -646
  119. data/dist/es/container/tests/container_test.js +0 -872
  120. data/dist/es/container/tests/owner_test.js +0 -20
  121. data/dist/es/container/tests/registry_test.js +0 -943
  122. data/dist/es/dag-map.js +0 -209
  123. data/dist/es/ember-browser-environment/index.js +0 -8
  124. data/dist/es/ember-browser-environment/lib/has-dom.js +0 -19
  125. data/dist/es/ember-console/index.js +0 -177
  126. data/dist/es/ember-environment/index.js +0 -3
  127. data/dist/es/ember-environment/lib/context.js +0 -20
  128. data/dist/es/ember-environment/lib/env.js +0 -185
  129. data/dist/es/ember-environment/lib/global.js +0 -14
  130. data/dist/es/ember-error-handling/index.js +0 -22
  131. data/dist/es/ember-extension-support/index.js +0 -2
  132. data/dist/es/ember-extension-support/lib/container_debug_adapter.js +0 -99
  133. data/dist/es/ember-extension-support/lib/data_adapter.js +0 -493
  134. data/dist/es/ember-extension-support/tests/container_debug_adapter_test.js +0 -73
  135. data/dist/es/ember-extension-support/tests/data_adapter_test.js +0 -301
  136. data/dist/es/ember-glimmer/index.js +0 -286
  137. data/dist/es/ember-glimmer/lib/compile-time-lookup.js +0 -37
  138. data/dist/es/ember-glimmer/lib/component-managers/abstract.js +0 -49
  139. data/dist/es/ember-glimmer/lib/component-managers/curly.js +0 -395
  140. data/dist/es/ember-glimmer/lib/component-managers/custom.js +0 -145
  141. data/dist/es/ember-glimmer/lib/component-managers/definition-state.js +0 -1
  142. data/dist/es/ember-glimmer/lib/component-managers/mount.js +0 -103
  143. data/dist/es/ember-glimmer/lib/component-managers/outlet.js +0 -114
  144. data/dist/es/ember-glimmer/lib/component-managers/render.js +0 -112
  145. data/dist/es/ember-glimmer/lib/component-managers/root.js +0 -74
  146. data/dist/es/ember-glimmer/lib/component-managers/template-only.js +0 -46
  147. data/dist/es/ember-glimmer/lib/component.js +0 -633
  148. data/dist/es/ember-glimmer/lib/components/checkbox.js +0 -57
  149. data/dist/es/ember-glimmer/lib/components/link-to.js +0 -777
  150. data/dist/es/ember-glimmer/lib/components/text_area.js +0 -236
  151. data/dist/es/ember-glimmer/lib/components/text_field.js +0 -145
  152. data/dist/es/ember-glimmer/lib/dom.js +0 -3
  153. data/dist/es/ember-glimmer/lib/environment.js +0 -102
  154. data/dist/es/ember-glimmer/lib/helper.js +0 -128
  155. data/dist/es/ember-glimmer/lib/helpers/-class.js +0 -23
  156. data/dist/es/ember-glimmer/lib/helpers/-html-safe.js +0 -9
  157. data/dist/es/ember-glimmer/lib/helpers/-input-type.js +0 -11
  158. data/dist/es/ember-glimmer/lib/helpers/-normalize-class.js +0 -22
  159. data/dist/es/ember-glimmer/lib/helpers/action.js +0 -360
  160. data/dist/es/ember-glimmer/lib/helpers/component.js +0 -135
  161. data/dist/es/ember-glimmer/lib/helpers/concat.js +0 -38
  162. data/dist/es/ember-glimmer/lib/helpers/each-in.js +0 -126
  163. data/dist/es/ember-glimmer/lib/helpers/get.js +0 -100
  164. data/dist/es/ember-glimmer/lib/helpers/hash.js +0 -44
  165. data/dist/es/ember-glimmer/lib/helpers/if-unless.js +0 -142
  166. data/dist/es/ember-glimmer/lib/helpers/loc.js +0 -40
  167. data/dist/es/ember-glimmer/lib/helpers/log.js +0 -25
  168. data/dist/es/ember-glimmer/lib/helpers/mut.js +0 -107
  169. data/dist/es/ember-glimmer/lib/helpers/query-param.js +0 -31
  170. data/dist/es/ember-glimmer/lib/helpers/readonly.js +0 -104
  171. data/dist/es/ember-glimmer/lib/helpers/unbound.js +0 -36
  172. data/dist/es/ember-glimmer/lib/modifiers/action.js +0 -185
  173. data/dist/es/ember-glimmer/lib/protocol-for-url.js +0 -48
  174. data/dist/es/ember-glimmer/lib/renderer.js +0 -371
  175. data/dist/es/ember-glimmer/lib/resolver.js +0 -290
  176. data/dist/es/ember-glimmer/lib/setup-registry.js +0 -77
  177. data/dist/es/ember-glimmer/lib/syntax.js +0 -73
  178. data/dist/es/ember-glimmer/lib/syntax/-text-area.js +0 -8
  179. data/dist/es/ember-glimmer/lib/syntax/input.js +0 -173
  180. data/dist/es/ember-glimmer/lib/syntax/let.js +0 -50
  181. data/dist/es/ember-glimmer/lib/syntax/mount.js +0 -101
  182. data/dist/es/ember-glimmer/lib/syntax/outlet.js +0 -120
  183. data/dist/es/ember-glimmer/lib/syntax/render.js +0 -140
  184. data/dist/es/ember-glimmer/lib/syntax/utils.js +0 -6
  185. data/dist/es/ember-glimmer/lib/template-compiler.js +0 -7
  186. data/dist/es/ember-glimmer/lib/template.js +0 -16
  187. data/dist/es/ember-glimmer/lib/template_registry.js +0 -18
  188. data/dist/es/ember-glimmer/lib/templates/component.js +0 -2
  189. data/dist/es/ember-glimmer/lib/templates/empty.js +0 -2
  190. data/dist/es/ember-glimmer/lib/templates/link-to.js +0 -2
  191. data/dist/es/ember-glimmer/lib/templates/outlet.js +0 -2
  192. data/dist/es/ember-glimmer/lib/templates/root.js +0 -2
  193. data/dist/es/ember-glimmer/lib/utils/bindings.js +0 -180
  194. data/dist/es/ember-glimmer/lib/utils/curly-component-state-bucket.js +0 -36
  195. data/dist/es/ember-glimmer/lib/utils/custom-component-manager.js +0 -20
  196. data/dist/es/ember-glimmer/lib/utils/debug-stack.js +0 -57
  197. data/dist/es/ember-glimmer/lib/utils/iterable.js +0 -358
  198. data/dist/es/ember-glimmer/lib/utils/outlet.js +0 -89
  199. data/dist/es/ember-glimmer/lib/utils/process-args.js +0 -40
  200. data/dist/es/ember-glimmer/lib/utils/references.js +0 -325
  201. data/dist/es/ember-glimmer/lib/utils/serialization-first-node-helpers.js +0 -1
  202. data/dist/es/ember-glimmer/lib/utils/string.js +0 -98
  203. data/dist/es/ember-glimmer/lib/utils/to-bool.js +0 -9
  204. data/dist/es/ember-glimmer/lib/views/outlet.js +0 -71
  205. data/dist/es/ember-glimmer/tests/integration/application/actions-test.js +0 -107
  206. data/dist/es/ember-glimmer/tests/integration/application/engine-test.js +0 -912
  207. data/dist/es/ember-glimmer/tests/integration/application/rendering-test.js +0 -530
  208. data/dist/es/ember-glimmer/tests/integration/components/angle-bracket-invocation-test.js +0 -852
  209. data/dist/es/ember-glimmer/tests/integration/components/append-test.js +0 -742
  210. data/dist/es/ember-glimmer/tests/integration/components/attribute-bindings-test.js +0 -999
  211. data/dist/es/ember-glimmer/tests/integration/components/attrs-lookup-test.js +0 -268
  212. data/dist/es/ember-glimmer/tests/integration/components/class-bindings-test.js +0 -849
  213. data/dist/es/ember-glimmer/tests/integration/components/contextual-components-test.js +0 -1493
  214. data/dist/es/ember-glimmer/tests/integration/components/curly-components-test.js +0 -3705
  215. data/dist/es/ember-glimmer/tests/integration/components/destroy-test.js +0 -33
  216. data/dist/es/ember-glimmer/tests/integration/components/dynamic-components-test.js +0 -896
  217. data/dist/es/ember-glimmer/tests/integration/components/error-handling-test.js +0 -164
  218. data/dist/es/ember-glimmer/tests/integration/components/fragment-components-test.js +0 -285
  219. data/dist/es/ember-glimmer/tests/integration/components/instrumentation-compile-test.js +0 -108
  220. data/dist/es/ember-glimmer/tests/integration/components/instrumentation-test.js +0 -157
  221. data/dist/es/ember-glimmer/tests/integration/components/life-cycle-test.js +0 -1653
  222. data/dist/es/ember-glimmer/tests/integration/components/link-to-test.js +0 -218
  223. data/dist/es/ember-glimmer/tests/integration/components/local-lookup-test.js +0 -414
  224. data/dist/es/ember-glimmer/tests/integration/components/namespaced-lookup-test.js +0 -185
  225. data/dist/es/ember-glimmer/tests/integration/components/render-to-element-test.js +0 -0
  226. data/dist/es/ember-glimmer/tests/integration/components/target-action-test.js +0 -779
  227. data/dist/es/ember-glimmer/tests/integration/components/template-only-components-test.js +0 -225
  228. data/dist/es/ember-glimmer/tests/integration/components/to-string-test.js +0 -27
  229. data/dist/es/ember-glimmer/tests/integration/components/utils-test.js +0 -401
  230. data/dist/es/ember-glimmer/tests/integration/components/web-component-fallback-test.js +0 -35
  231. data/dist/es/ember-glimmer/tests/integration/components/will-destroy-element-hook-test.js +0 -40
  232. data/dist/es/ember-glimmer/tests/integration/content-test.js +0 -1759
  233. data/dist/es/ember-glimmer/tests/integration/custom-component-manager-test.js +0 -508
  234. data/dist/es/ember-glimmer/tests/integration/event-dispatcher-test.js +0 -607
  235. data/dist/es/ember-glimmer/tests/integration/helpers/-class-test.js +0 -76
  236. data/dist/es/ember-glimmer/tests/integration/helpers/closure-action-test.js +0 -1240
  237. data/dist/es/ember-glimmer/tests/integration/helpers/concat-test.js +0 -106
  238. data/dist/es/ember-glimmer/tests/integration/helpers/custom-helper-test.js +0 -672
  239. data/dist/es/ember-glimmer/tests/integration/helpers/element-action-test.js +0 -1595
  240. data/dist/es/ember-glimmer/tests/integration/helpers/get-test.js +0 -618
  241. data/dist/es/ember-glimmer/tests/integration/helpers/hash-test.js +0 -188
  242. data/dist/es/ember-glimmer/tests/integration/helpers/if-unless-test.js +0 -149
  243. data/dist/es/ember-glimmer/tests/integration/helpers/input-test.js +0 -827
  244. data/dist/es/ember-glimmer/tests/integration/helpers/loc-test.js +0 -103
  245. data/dist/es/ember-glimmer/tests/integration/helpers/log-test.js +0 -61
  246. data/dist/es/ember-glimmer/tests/integration/helpers/mut-test.js +0 -580
  247. data/dist/es/ember-glimmer/tests/integration/helpers/partial-test.js +0 -386
  248. data/dist/es/ember-glimmer/tests/integration/helpers/readonly-test.js +0 -293
  249. data/dist/es/ember-glimmer/tests/integration/helpers/render-test.js +0 -522
  250. data/dist/es/ember-glimmer/tests/integration/helpers/text-area-test.js +0 -166
  251. data/dist/es/ember-glimmer/tests/integration/helpers/unbound-test.js +0 -650
  252. data/dist/es/ember-glimmer/tests/integration/helpers/yield-test.js +0 -275
  253. data/dist/es/ember-glimmer/tests/integration/input-test.js +0 -242
  254. data/dist/es/ember-glimmer/tests/integration/mount-test.js +0 -424
  255. data/dist/es/ember-glimmer/tests/integration/outlet-test.js +0 -318
  256. data/dist/es/ember-glimmer/tests/integration/refinements-test.js +0 -74
  257. data/dist/es/ember-glimmer/tests/integration/render-settled-test.js +0 -72
  258. data/dist/es/ember-glimmer/tests/integration/svg-test.js +0 -158
  259. data/dist/es/ember-glimmer/tests/integration/syntax/each-in-test.js +0 -697
  260. data/dist/es/ember-glimmer/tests/integration/syntax/each-test.js +0 -1251
  261. data/dist/es/ember-glimmer/tests/integration/syntax/experimental-syntax-test.js +0 -42
  262. data/dist/es/ember-glimmer/tests/integration/syntax/if-unless-test.js +0 -108
  263. data/dist/es/ember-glimmer/tests/integration/syntax/in-element-test.js +0 -119
  264. data/dist/es/ember-glimmer/tests/integration/syntax/let-test.js +0 -390
  265. data/dist/es/ember-glimmer/tests/integration/syntax/with-dynamic-var-test.js +0 -36
  266. data/dist/es/ember-glimmer/tests/integration/syntax/with-test.js +0 -422
  267. data/dist/es/ember-glimmer/tests/unit/outlet-test.js +0 -48
  268. data/dist/es/ember-glimmer/tests/unit/runtime-resolver-cache-test.js +0 -263
  269. data/dist/es/ember-glimmer/tests/unit/template-factory-test.js +0 -67
  270. data/dist/es/ember-glimmer/tests/unit/utils/debug-stack-test.js +0 -38
  271. data/dist/es/ember-glimmer/tests/utils/abstract-test-case.js +0 -1
  272. data/dist/es/ember-glimmer/tests/utils/helpers.js +0 -15
  273. data/dist/es/ember-glimmer/tests/utils/shared-conditional-tests.js +0 -965
  274. data/dist/es/ember-glimmer/tests/utils/string-test.js +0 -47
  275. data/dist/es/ember-glimmer/tests/utils/test-case.js +0 -6
  276. data/dist/es/ember-glimmer/tests/utils/test-helpers.js +0 -1
  277. data/dist/es/ember-meta/index.js +0 -1
  278. data/dist/es/ember-meta/lib/meta.js +0 -623
  279. data/dist/es/ember-meta/tests/meta_test.js +0 -169
  280. data/dist/es/ember-metal/index.js +0 -33
  281. data/dist/es/ember-metal/lib/alias.js +0 -80
  282. data/dist/es/ember-metal/lib/array.js +0 -55
  283. data/dist/es/ember-metal/lib/array_events.js +0 -65
  284. data/dist/es/ember-metal/lib/chains.js +0 -315
  285. data/dist/es/ember-metal/lib/change_event.js +0 -4
  286. data/dist/es/ember-metal/lib/computed.js +0 -526
  287. data/dist/es/ember-metal/lib/computed_cache.js +0 -58
  288. data/dist/es/ember-metal/lib/dependent_keys.js +0 -34
  289. data/dist/es/ember-metal/lib/deprecate_property.js +0 -34
  290. data/dist/es/ember-metal/lib/descriptor.js +0 -28
  291. data/dist/es/ember-metal/lib/each_proxy.js +0 -106
  292. data/dist/es/ember-metal/lib/each_proxy_events.js +0 -13
  293. data/dist/es/ember-metal/lib/events.js +0 -174
  294. data/dist/es/ember-metal/lib/expand_properties.js +0 -64
  295. data/dist/es/ember-metal/lib/get_properties.js +0 -45
  296. data/dist/es/ember-metal/lib/injected_property.js +0 -53
  297. data/dist/es/ember-metal/lib/is_blank.js +0 -34
  298. data/dist/es/ember-metal/lib/is_empty.js +0 -63
  299. data/dist/es/ember-metal/lib/is_none.js +0 -27
  300. data/dist/es/ember-metal/lib/is_present.js +0 -38
  301. data/dist/es/ember-metal/lib/libraries.js +0 -80
  302. data/dist/es/ember-metal/lib/mixin.js +0 -646
  303. data/dist/es/ember-metal/lib/namespace_search.js +0 -166
  304. data/dist/es/ember-metal/lib/observer.js +0 -34
  305. data/dist/es/ember-metal/lib/observer_set.js +0 -48
  306. data/dist/es/ember-metal/lib/path_cache.js +0 -5
  307. data/dist/es/ember-metal/lib/properties.js +0 -192
  308. data/dist/es/ember-metal/lib/property_events.js +0 -198
  309. data/dist/es/ember-metal/lib/property_get.js +0 -160
  310. data/dist/es/ember-metal/lib/property_set.js +0 -157
  311. data/dist/es/ember-metal/lib/set_properties.js +0 -43
  312. data/dist/es/ember-metal/lib/tags.js +0 -81
  313. data/dist/es/ember-metal/lib/tracked.js +0 -201
  314. data/dist/es/ember-metal/lib/transaction.js +0 -137
  315. data/dist/es/ember-metal/lib/watch_key.js +0 -113
  316. data/dist/es/ember-metal/lib/watch_path.js +0 -24
  317. data/dist/es/ember-metal/lib/watching.js +0 -54
  318. data/dist/es/ember-metal/tests/accessors/get_path_test.js +0 -82
  319. data/dist/es/ember-metal/tests/accessors/get_properties_test.js +0 -36
  320. data/dist/es/ember-metal/tests/accessors/get_test.js +0 -335
  321. data/dist/es/ember-metal/tests/accessors/mandatory_setters_test.js +0 -470
  322. data/dist/es/ember-metal/tests/accessors/set_path_test.js +0 -97
  323. data/dist/es/ember-metal/tests/accessors/set_test.js +0 -128
  324. data/dist/es/ember-metal/tests/alias_test.js +0 -167
  325. data/dist/es/ember-metal/tests/chains_test.js +0 -210
  326. data/dist/es/ember-metal/tests/computed_test.js +0 -1040
  327. data/dist/es/ember-metal/tests/descriptor_test.js +0 -368
  328. data/dist/es/ember-metal/tests/events_test.js +0 -210
  329. data/dist/es/ember-metal/tests/expand_properties_test.js +0 -119
  330. data/dist/es/ember-metal/tests/injected_property_test.js +0 -76
  331. data/dist/es/ember-metal/tests/is_blank_test.js +0 -29
  332. data/dist/es/ember-metal/tests/is_empty_test.js +0 -55
  333. data/dist/es/ember-metal/tests/is_none_test.js +0 -23
  334. data/dist/es/ember-metal/tests/is_present_test.js +0 -30
  335. data/dist/es/ember-metal/tests/libraries_test.js +0 -99
  336. data/dist/es/ember-metal/tests/main_test.js +0 -31
  337. data/dist/es/ember-metal/tests/mixin/alias_method_test.js +0 -91
  338. data/dist/es/ember-metal/tests/mixin/apply_test.js +0 -40
  339. data/dist/es/ember-metal/tests/mixin/computed_test.js +0 -166
  340. data/dist/es/ember-metal/tests/mixin/concatenated_properties_test.js +0 -117
  341. data/dist/es/ember-metal/tests/mixin/detect_test.js +0 -40
  342. data/dist/es/ember-metal/tests/mixin/introspection_test.js +0 -75
  343. data/dist/es/ember-metal/tests/mixin/merged_properties_test.js +0 -200
  344. data/dist/es/ember-metal/tests/mixin/method_test.js +0 -252
  345. data/dist/es/ember-metal/tests/mixin/observer_test.js +0 -202
  346. data/dist/es/ember-metal/tests/mixin/reopen_test.js +0 -53
  347. data/dist/es/ember-metal/tests/mixin/without_test.js +0 -22
  348. data/dist/es/ember-metal/tests/namespace_search_test.js +0 -16
  349. data/dist/es/ember-metal/tests/observer_test.js +0 -961
  350. data/dist/es/ember-metal/tests/performance_test.js +0 -81
  351. data/dist/es/ember-metal/tests/properties_test.js +0 -120
  352. data/dist/es/ember-metal/tests/property_did_change_hook.js +0 -73
  353. data/dist/es/ember-metal/tests/set_properties_test.js +0 -49
  354. data/dist/es/ember-metal/tests/tracked/computed_test.js +0 -67
  355. data/dist/es/ember-metal/tests/tracked/get_test.js +0 -86
  356. data/dist/es/ember-metal/tests/tracked/set_test.js +0 -44
  357. data/dist/es/ember-metal/tests/tracked/support.js +0 -37
  358. data/dist/es/ember-metal/tests/tracked/validation_test.js +0 -233
  359. data/dist/es/ember-metal/tests/watching/is_watching_test.js +0 -97
  360. data/dist/es/ember-metal/tests/watching/unwatch_test.js +0 -109
  361. data/dist/es/ember-metal/tests/watching/watch_test.js +0 -255
  362. data/dist/es/ember-owner/index.js +0 -66
  363. data/dist/es/ember-routing/index.js +0 -21
  364. data/dist/es/ember-routing/lib/ext/controller.js +0 -222
  365. data/dist/es/ember-routing/lib/location/api.js +0 -118
  366. data/dist/es/ember-routing/lib/location/auto_location.js +0 -323
  367. data/dist/es/ember-routing/lib/location/hash_location.js +0 -171
  368. data/dist/es/ember-routing/lib/location/history_location.js +0 -298
  369. data/dist/es/ember-routing/lib/location/none_location.js +0 -122
  370. data/dist/es/ember-routing/lib/location/util.js +0 -114
  371. data/dist/es/ember-routing/lib/services/router.js +0 -243
  372. data/dist/es/ember-routing/lib/services/routing.js +0 -101
  373. data/dist/es/ember-routing/lib/system/cache.js +0 -40
  374. data/dist/es/ember-routing/lib/system/controller_for.js +0 -14
  375. data/dist/es/ember-routing/lib/system/dsl.js +0 -208
  376. data/dist/es/ember-routing/lib/system/generate_controller.js +0 -54
  377. data/dist/es/ember-routing/lib/system/query_params.js +0 -6
  378. data/dist/es/ember-routing/lib/system/route.js +0 -2476
  379. data/dist/es/ember-routing/lib/system/router.js +0 -1607
  380. data/dist/es/ember-routing/lib/system/router_state.js +0 -26
  381. data/dist/es/ember-routing/lib/system/transition.js +0 -153
  382. data/dist/es/ember-routing/lib/utils.js +0 -230
  383. data/dist/es/ember-routing/tests/ext/controller_test.js +0 -85
  384. data/dist/es/ember-routing/tests/location/auto_location_test.js +0 -379
  385. data/dist/es/ember-routing/tests/location/hash_location_test.js +0 -207
  386. data/dist/es/ember-routing/tests/location/history_location_test.js +0 -322
  387. data/dist/es/ember-routing/tests/location/none_location_test.js +0 -88
  388. data/dist/es/ember-routing/tests/location/util_test.js +0 -159
  389. data/dist/es/ember-routing/tests/system/cache_test.js +0 -54
  390. data/dist/es/ember-routing/tests/system/controller_for_test.js +0 -75
  391. data/dist/es/ember-routing/tests/system/dsl_test.js +0 -413
  392. data/dist/es/ember-routing/tests/system/route_test.js +0 -587
  393. data/dist/es/ember-routing/tests/system/router_test.js +0 -287
  394. data/dist/es/ember-routing/tests/utils_test.js +0 -37
  395. data/dist/es/ember-runtime/.gitignore +0 -1
  396. data/dist/es/ember-runtime/README +0 -12
  397. data/dist/es/ember-runtime/index.js +0 -35
  398. data/dist/es/ember-runtime/lib/compare.js +0 -149
  399. data/dist/es/ember-runtime/lib/copy.js +0 -106
  400. data/dist/es/ember-runtime/lib/ext/function.js +0 -154
  401. data/dist/es/ember-runtime/lib/ext/rsvp.js +0 -59
  402. data/dist/es/ember-runtime/lib/is-equal.js +0 -60
  403. data/dist/es/ember-runtime/lib/mixins/-proxy.js +0 -109
  404. data/dist/es/ember-runtime/lib/mixins/action_handler.js +0 -222
  405. data/dist/es/ember-runtime/lib/mixins/array.js +0 -1661
  406. data/dist/es/ember-runtime/lib/mixins/comparable.js +0 -38
  407. data/dist/es/ember-runtime/lib/mixins/container_proxy.js +0 -154
  408. data/dist/es/ember-runtime/lib/mixins/copyable.js +0 -34
  409. data/dist/es/ember-runtime/lib/mixins/enumerable.js +0 -16
  410. data/dist/es/ember-runtime/lib/mixins/evented.js +0 -149
  411. data/dist/es/ember-runtime/lib/mixins/mutable_enumerable.js +0 -18
  412. data/dist/es/ember-runtime/lib/mixins/observable.js +0 -482
  413. data/dist/es/ember-runtime/lib/mixins/promise_proxy.js +0 -224
  414. data/dist/es/ember-runtime/lib/mixins/registry_proxy.js +0 -265
  415. data/dist/es/ember-runtime/lib/mixins/target_action_support.js +0 -172
  416. data/dist/es/ember-runtime/lib/system/array_proxy.js +0 -298
  417. data/dist/es/ember-runtime/lib/system/core_object.js +0 -1037
  418. data/dist/es/ember-runtime/lib/system/namespace.js +0 -69
  419. data/dist/es/ember-runtime/lib/system/object.js +0 -73
  420. data/dist/es/ember-runtime/lib/system/object_proxy.js +0 -81
  421. data/dist/es/ember-runtime/lib/type-of.js +0 -107
  422. data/dist/es/ember-runtime/tests/array/any-test.js +0 -55
  423. data/dist/es/ember-runtime/tests/array/compact-test.js +0 -12
  424. data/dist/es/ember-runtime/tests/array/every-test.js +0 -82
  425. data/dist/es/ember-runtime/tests/array/filter-test.js +0 -123
  426. data/dist/es/ember-runtime/tests/array/find-test.js +0 -86
  427. data/dist/es/ember-runtime/tests/array/firstObject-test.js +0 -27
  428. data/dist/es/ember-runtime/tests/array/forEach-test.js +0 -68
  429. data/dist/es/ember-runtime/tests/array/includes-test.js +0 -46
  430. data/dist/es/ember-runtime/tests/array/indexOf-test.js +0 -27
  431. data/dist/es/ember-runtime/tests/array/invoke-test.js +0 -60
  432. data/dist/es/ember-runtime/tests/array/isAny-test.js +0 -53
  433. data/dist/es/ember-runtime/tests/array/lastIndexOf-test.js +0 -78
  434. data/dist/es/ember-runtime/tests/array/lastObject-test.js +0 -31
  435. data/dist/es/ember-runtime/tests/array/map-test.js +0 -68
  436. data/dist/es/ember-runtime/tests/array/mapBy-test.js +0 -16
  437. data/dist/es/ember-runtime/tests/array/objectAt-test.js +0 -34
  438. data/dist/es/ember-runtime/tests/array/reduce-test.js +0 -24
  439. data/dist/es/ember-runtime/tests/array/reject-test.js +0 -134
  440. data/dist/es/ember-runtime/tests/array/sortBy-test.js +0 -23
  441. data/dist/es/ember-runtime/tests/array/toArray-test.js +0 -11
  442. data/dist/es/ember-runtime/tests/array/uniq-test.js +0 -27
  443. data/dist/es/ember-runtime/tests/array/uniqBy-test.js +0 -33
  444. data/dist/es/ember-runtime/tests/array/without-test.js +0 -39
  445. data/dist/es/ember-runtime/tests/copyable-array/copy-test.js +0 -12
  446. data/dist/es/ember-runtime/tests/core/compare_test.js +0 -89
  447. data/dist/es/ember-runtime/tests/core/copy_test.js +0 -47
  448. data/dist/es/ember-runtime/tests/core/isEqual_test.js +0 -65
  449. data/dist/es/ember-runtime/tests/core/is_array_test.js +0 -59
  450. data/dist/es/ember-runtime/tests/core/is_empty_test.js +0 -15
  451. data/dist/es/ember-runtime/tests/core/type_of_test.js +0 -54
  452. data/dist/es/ember-runtime/tests/ext/function_test.js +0 -121
  453. data/dist/es/ember-runtime/tests/ext/rsvp_test.js +0 -269
  454. data/dist/es/ember-runtime/tests/helpers/array.js +0 -336
  455. data/dist/es/ember-runtime/tests/inject_test.js +0 -51
  456. data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/chained_test.js +0 -63
  457. data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js +0 -892
  458. data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/propertyChanges_test.js +0 -142
  459. data/dist/es/ember-runtime/tests/legacy_1x/system/object/base_test.js +0 -98
  460. data/dist/es/ember-runtime/tests/legacy_1x/system/object/concatenated_test.js +0 -131
  461. data/dist/es/ember-runtime/tests/mixins/array_test.js +0 -400
  462. data/dist/es/ember-runtime/tests/mixins/comparable_test.js +0 -37
  463. data/dist/es/ember-runtime/tests/mixins/container_proxy_test.js +0 -48
  464. data/dist/es/ember-runtime/tests/mixins/enumerable_test.js +0 -17
  465. data/dist/es/ember-runtime/tests/mixins/evented_test.js +0 -23
  466. data/dist/es/ember-runtime/tests/mixins/mutable_enumerable_test.js +0 -17
  467. data/dist/es/ember-runtime/tests/mixins/observable_test.js +0 -137
  468. data/dist/es/ember-runtime/tests/mixins/promise_proxy_test.js +0 -593
  469. data/dist/es/ember-runtime/tests/mixins/target_action_support_test.js +0 -237
  470. data/dist/es/ember-runtime/tests/mutable-array/addObject-test.js +0 -76
  471. data/dist/es/ember-runtime/tests/mutable-array/clear-test.js +0 -64
  472. data/dist/es/ember-runtime/tests/mutable-array/insertAt-test.js +0 -216
  473. data/dist/es/ember-runtime/tests/mutable-array/popObject-test.js +0 -91
  474. data/dist/es/ember-runtime/tests/mutable-array/pushObject-test.js +0 -98
  475. data/dist/es/ember-runtime/tests/mutable-array/pushObjects-test.js +0 -12
  476. data/dist/es/ember-runtime/tests/mutable-array/removeAt-test.js +0 -187
  477. data/dist/es/ember-runtime/tests/mutable-array/removeObject-test.js +0 -77
  478. data/dist/es/ember-runtime/tests/mutable-array/removeObjects-test.js +0 -202
  479. data/dist/es/ember-runtime/tests/mutable-array/replace-test.js +0 -221
  480. data/dist/es/ember-runtime/tests/mutable-array/reverseObjects-test.js +0 -35
  481. data/dist/es/ember-runtime/tests/mutable-array/setObjects-test.js +0 -63
  482. data/dist/es/ember-runtime/tests/mutable-array/shiftObject-test.js +0 -105
  483. data/dist/es/ember-runtime/tests/mutable-array/unshiftObject-test.js +0 -99
  484. data/dist/es/ember-runtime/tests/mutable-array/unshiftObjects-test.js +0 -102
  485. data/dist/es/ember-runtime/tests/system/array_proxy/arranged_content_test.js +0 -275
  486. data/dist/es/ember-runtime/tests/system/array_proxy/array_observer_test.js +0 -51
  487. data/dist/es/ember-runtime/tests/system/array_proxy/content_change_test.js +0 -85
  488. data/dist/es/ember-runtime/tests/system/array_proxy/length_test.js +0 -201
  489. data/dist/es/ember-runtime/tests/system/array_proxy/watching_and_listening_test.js +0 -157
  490. data/dist/es/ember-runtime/tests/system/core_object_test.js +0 -114
  491. data/dist/es/ember-runtime/tests/system/namespace/base_test.js +0 -175
  492. data/dist/es/ember-runtime/tests/system/native_array/a_test.js +0 -16
  493. data/dist/es/ember-runtime/tests/system/native_array/copyable_suite_test.js +0 -19
  494. data/dist/es/ember-runtime/tests/system/native_array/replace_test.js +0 -17
  495. data/dist/es/ember-runtime/tests/system/object/computed_test.js +0 -352
  496. data/dist/es/ember-runtime/tests/system/object/create_test.js +0 -135
  497. data/dist/es/ember-runtime/tests/system/object/destroy_test.js +0 -146
  498. data/dist/es/ember-runtime/tests/system/object/detectInstance_test.js +0 -38
  499. data/dist/es/ember-runtime/tests/system/object/detect_test.js +0 -33
  500. data/dist/es/ember-runtime/tests/system/object/es-compatibility-test.js +0 -469
  501. data/dist/es/ember-runtime/tests/system/object/events_test.js +0 -156
  502. data/dist/es/ember-runtime/tests/system/object/extend_test.js +0 -153
  503. data/dist/es/ember-runtime/tests/system/object/observer_test.js +0 -216
  504. data/dist/es/ember-runtime/tests/system/object/reopenClass_test.js +0 -36
  505. data/dist/es/ember-runtime/tests/system/object/reopen_test.js +0 -48
  506. data/dist/es/ember-runtime/tests/system/object/strict-mode-test.js +0 -31
  507. data/dist/es/ember-runtime/tests/system/object/toString_test.js +0 -125
  508. data/dist/es/ember-runtime/tests/system/object_proxy_test.js +0 -314
  509. data/dist/es/ember-template-compiler/index.js +0 -26
  510. data/dist/es/ember-template-compiler/lib/compat.js +0 -16
  511. data/dist/es/ember-template-compiler/lib/plugins/assert-if-helper-without-arguments.js +0 -38
  512. data/dist/es/ember-template-compiler/lib/plugins/assert-input-helper-without-block.js +0 -20
  513. data/dist/es/ember-template-compiler/lib/plugins/assert-reserved-named-arguments.js +0 -26
  514. data/dist/es/ember-template-compiler/lib/plugins/assert-splattribute-expression.js +0 -27
  515. data/dist/es/ember-template-compiler/lib/plugins/deprecate-render-model.js +0 -38
  516. data/dist/es/ember-template-compiler/lib/plugins/deprecate-render.js +0 -41
  517. data/dist/es/ember-template-compiler/lib/plugins/deprecate-send-action.js +0 -42
  518. data/dist/es/ember-template-compiler/lib/plugins/index.js +0 -50
  519. data/dist/es/ember-template-compiler/lib/plugins/transform-action-syntax.js +0 -52
  520. data/dist/es/ember-template-compiler/lib/plugins/transform-angle-bracket-components.js +0 -10
  521. data/dist/es/ember-template-compiler/lib/plugins/transform-attrs-into-args.js +0 -62
  522. data/dist/es/ember-template-compiler/lib/plugins/transform-dot-component-invocation.js +0 -88
  523. data/dist/es/ember-template-compiler/lib/plugins/transform-each-in-into-each.js +0 -48
  524. data/dist/es/ember-template-compiler/lib/plugins/transform-has-block-syntax.js +0 -46
  525. data/dist/es/ember-template-compiler/lib/plugins/transform-in-element.js +0 -83
  526. data/dist/es/ember-template-compiler/lib/plugins/transform-inline-link-to.js +0 -31
  527. data/dist/es/ember-template-compiler/lib/plugins/transform-input-type-syntax.js +0 -52
  528. data/dist/es/ember-template-compiler/lib/plugins/transform-old-binding-syntax.js +0 -48
  529. data/dist/es/ember-template-compiler/lib/plugins/transform-old-class-binding-syntax.js +0 -102
  530. data/dist/es/ember-template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings.js +0 -34
  531. data/dist/es/ember-template-compiler/lib/plugins/transform-top-level-components.js +0 -41
  532. data/dist/es/ember-template-compiler/lib/system/bootstrap.js +0 -44
  533. data/dist/es/ember-template-compiler/lib/system/calculate-location-display.js +0 -20
  534. data/dist/es/ember-template-compiler/lib/system/compile-options.js +0 -71
  535. data/dist/es/ember-template-compiler/lib/system/compile.js +0 -28
  536. data/dist/es/ember-template-compiler/lib/system/dasherize-component-name.js +0 -13
  537. data/dist/es/ember-template-compiler/lib/system/initializer.js +0 -22
  538. data/dist/es/ember-template-compiler/lib/system/precompile.js +0 -18
  539. data/dist/es/ember-template-compiler/tests/plugins/assert-if-helper-without-arguments-test.js +0 -51
  540. data/dist/es/ember-template-compiler/tests/plugins/assert-input-helper-without-block-test.js +0 -17
  541. data/dist/es/ember-template-compiler/tests/plugins/assert-reserved-named-arguments-test.js +0 -416
  542. data/dist/es/ember-template-compiler/tests/plugins/assert-splattribute-expression-test.js +0 -57
  543. data/dist/es/ember-template-compiler/tests/plugins/deprecate-render-model-test.js +0 -19
  544. data/dist/es/ember-template-compiler/tests/plugins/deprecate-render-test.js +0 -19
  545. data/dist/es/ember-template-compiler/tests/plugins/deprecate-send-action-test.js +0 -29
  546. data/dist/es/ember-template-compiler/tests/plugins/transform-dot-component-invocation-test.js +0 -27
  547. data/dist/es/ember-template-compiler/tests/plugins/transform-inline-link-to-test.js +0 -15
  548. data/dist/es/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js +0 -25
  549. data/dist/es/ember-template-compiler/tests/system/bootstrap-test.js +0 -155
  550. data/dist/es/ember-template-compiler/tests/system/compile_options_test.js +0 -115
  551. data/dist/es/ember-template-compiler/tests/system/dasherize-component-name-test.js +0 -19
  552. data/dist/es/ember-testing/index.js +0 -10
  553. data/dist/es/ember-testing/lib/adapters/adapter.js +0 -58
  554. data/dist/es/ember-testing/lib/adapters/qunit.js +0 -47
  555. data/dist/es/ember-testing/lib/events.js +0 -136
  556. data/dist/es/ember-testing/lib/ext/application.js +0 -191
  557. data/dist/es/ember-testing/lib/ext/rsvp.js +0 -19
  558. data/dist/es/ember-testing/lib/helpers.js +0 -30
  559. data/dist/es/ember-testing/lib/helpers/-is-form-control.js +0 -16
  560. data/dist/es/ember-testing/lib/helpers/and_then.js +0 -3
  561. data/dist/es/ember-testing/lib/helpers/click.js +0 -36
  562. data/dist/es/ember-testing/lib/helpers/current_path.js +0 -27
  563. data/dist/es/ember-testing/lib/helpers/current_route_name.js +0 -25
  564. data/dist/es/ember-testing/lib/helpers/current_url.js +0 -27
  565. data/dist/es/ember-testing/lib/helpers/fill_in.js +0 -46
  566. data/dist/es/ember-testing/lib/helpers/find.js +0 -41
  567. data/dist/es/ember-testing/lib/helpers/find_with_assert.js +0 -34
  568. data/dist/es/ember-testing/lib/helpers/key_event.js +0 -36
  569. data/dist/es/ember-testing/lib/helpers/pause_test.js +0 -65
  570. data/dist/es/ember-testing/lib/helpers/trigger_event.js +0 -62
  571. data/dist/es/ember-testing/lib/helpers/visit.js +0 -42
  572. data/dist/es/ember-testing/lib/helpers/wait.js +0 -72
  573. data/dist/es/ember-testing/lib/initializers.js +0 -17
  574. data/dist/es/ember-testing/lib/setup_for_testing.js +0 -44
  575. data/dist/es/ember-testing/lib/support.js +0 -62
  576. data/dist/es/ember-testing/lib/test.js +0 -70
  577. data/dist/es/ember-testing/lib/test/adapter.js +0 -33
  578. data/dist/es/ember-testing/lib/test/helpers.js +0 -125
  579. data/dist/es/ember-testing/lib/test/on_inject_helpers.js +0 -38
  580. data/dist/es/ember-testing/lib/test/pending_requests.js +0 -24
  581. data/dist/es/ember-testing/lib/test/promise.js +0 -79
  582. data/dist/es/ember-testing/lib/test/run.js +0 -9
  583. data/dist/es/ember-testing/lib/test/waiters.js +0 -117
  584. data/dist/es/ember-testing/tests/acceptance_test.js +0 -478
  585. data/dist/es/ember-testing/tests/adapters/adapter_test.js +0 -31
  586. data/dist/es/ember-testing/tests/adapters/qunit_test.js +0 -50
  587. data/dist/es/ember-testing/tests/adapters_test.js +0 -405
  588. data/dist/es/ember-testing/tests/ext/rsvp_test.js +0 -124
  589. data/dist/es/ember-testing/tests/helper_registration_test.js +0 -98
  590. data/dist/es/ember-testing/tests/helpers_test.js +0 -1228
  591. data/dist/es/ember-testing/tests/integration_test.js +0 -106
  592. data/dist/es/ember-testing/tests/reexports_test.js +0 -26
  593. data/dist/es/ember-testing/tests/test/waiters-test.js +0 -145
  594. data/dist/es/ember-utils/index.js +0 -28
  595. data/dist/es/ember-utils/lib/cache.js +0 -36
  596. data/dist/es/ember-utils/lib/dictionary.js +0 -11
  597. data/dist/es/ember-utils/lib/guid.js +0 -120
  598. data/dist/es/ember-utils/lib/inspect.js +0 -112
  599. data/dist/es/ember-utils/lib/intern.js +0 -49
  600. data/dist/es/ember-utils/lib/invoke.js +0 -53
  601. data/dist/es/ember-utils/lib/is_proxy.js +0 -14
  602. data/dist/es/ember-utils/lib/lookup-descriptor.js +0 -11
  603. data/dist/es/ember-utils/lib/make-array.js +0 -7
  604. data/dist/es/ember-utils/lib/name.js +0 -9
  605. data/dist/es/ember-utils/lib/proxy-utils.js +0 -1
  606. data/dist/es/ember-utils/lib/spec.js +0 -14
  607. data/dist/es/ember-utils/lib/super.js +0 -83
  608. data/dist/es/ember-utils/lib/symbol-utils.js +0 -8
  609. data/dist/es/ember-utils/lib/symbol.js +0 -15
  610. data/dist/es/ember-utils/lib/to-string.js +0 -35
  611. data/dist/es/ember-utils/lib/weak_set.js +0 -18
  612. data/dist/es/ember-utils/tests/cache_test.js +0 -77
  613. data/dist/es/ember-utils/tests/can_invoke_test.js +0 -46
  614. data/dist/es/ember-utils/tests/checkHasSuper_test.js +0 -17
  615. data/dist/es/ember-utils/tests/generate_guid_test.js +0 -13
  616. data/dist/es/ember-utils/tests/guid_for_test.js +0 -101
  617. data/dist/es/ember-utils/tests/inspect_test.js +0 -146
  618. data/dist/es/ember-utils/tests/is_proxy_test.js +0 -18
  619. data/dist/es/ember-utils/tests/make_array_test.js +0 -41
  620. data/dist/es/ember-utils/tests/to-string-test.js +0 -32
  621. data/dist/es/ember-utils/tests/try_invoke_test.js +0 -48
  622. data/dist/es/ember-views/index.js +0 -28
  623. data/dist/es/ember-views/lib/compat/attrs.js +0 -3
  624. data/dist/es/ember-views/lib/compat/fallback-view-registry.js +0 -3
  625. data/dist/es/ember-views/lib/component_lookup.js +0 -27
  626. data/dist/es/ember-views/lib/mixins/action_support.js +0 -189
  627. data/dist/es/ember-views/lib/mixins/child_views_support.js +0 -27
  628. data/dist/es/ember-views/lib/mixins/class_names_support.js +0 -102
  629. data/dist/es/ember-views/lib/mixins/text_support.js +0 -333
  630. data/dist/es/ember-views/lib/mixins/view_state_support.js +0 -19
  631. data/dist/es/ember-views/lib/mixins/view_support.js +0 -452
  632. data/dist/es/ember-views/lib/system/action_manager.js +0 -14
  633. data/dist/es/ember-views/lib/system/event_dispatcher.js +0 -454
  634. data/dist/es/ember-views/lib/system/jquery.js +0 -29
  635. data/dist/es/ember-views/lib/system/jquery_event_deprecation.js +0 -61
  636. data/dist/es/ember-views/lib/system/lookup_partial.js +0 -55
  637. data/dist/es/ember-views/lib/system/utils.js +0 -201
  638. data/dist/es/ember-views/lib/utils/lookup-component.js +0 -58
  639. data/dist/es/ember-views/lib/views/core_view.js +0 -83
  640. data/dist/es/ember-views/lib/views/states.js +0 -48
  641. data/dist/es/ember-views/lib/views/states/default.js +0 -17
  642. data/dist/es/ember-views/lib/views/states/destroying.js +0 -16
  643. data/dist/es/ember-views/lib/views/states/has_element.js +0 -31
  644. data/dist/es/ember-views/lib/views/states/in_dom.js +0 -28
  645. data/dist/es/ember-views/lib/views/states/pre_render.js +0 -3
  646. data/dist/es/ember/index.js +0 -645
  647. data/dist/es/ember/tests/application_lifecycle_test.js +0 -188
  648. data/dist/es/ember/tests/component_context_test.js +0 -255
  649. data/dist/es/ember/tests/component_registration_test.js +0 -252
  650. data/dist/es/ember/tests/controller_test.js +0 -44
  651. data/dist/es/ember/tests/error_handler_test.js +0 -581
  652. data/dist/es/ember/tests/helpers/helper_registration_test.js +0 -103
  653. data/dist/es/ember/tests/helpers/link_to_test.js +0 -2103
  654. data/dist/es/ember/tests/helpers/link_to_test/link_to_transitioning_classes_test.js +0 -342
  655. data/dist/es/ember/tests/helpers/link_to_test/link_to_with_query_params_test.js +0 -694
  656. data/dist/es/ember/tests/homepage_example_test.js +0 -47
  657. data/dist/es/ember/tests/integration/multiple-app-test.js +0 -101
  658. data/dist/es/ember/tests/production_build_test.js +0 -34
  659. data/dist/es/ember/tests/reexports_test.js +0 -307
  660. data/dist/es/ember/tests/routing/decoupled_basic_test.js +0 -4506
  661. data/dist/es/ember/tests/routing/query_params_test.js +0 -1579
  662. data/dist/es/ember/tests/routing/query_params_test/model_dependent_state_with_query_params_test.js +0 -1117
  663. data/dist/es/ember/tests/routing/query_params_test/overlapping_query_params_test.js +0 -185
  664. data/dist/es/ember/tests/routing/query_params_test/query_param_async_get_handler_test.js +0 -327
  665. data/dist/es/ember/tests/routing/query_params_test/query_params_paramless_link_to_test.js +0 -37
  666. data/dist/es/ember/tests/routing/query_params_test/shared_state_test.js +0 -84
  667. data/dist/es/ember/tests/routing/router_map_test.js +0 -46
  668. data/dist/es/ember/tests/routing/router_service_test/basic_test.js +0 -95
  669. data/dist/es/ember/tests/routing/router_service_test/currenturl_lifecycle_test.js +0 -149
  670. data/dist/es/ember/tests/routing/router_service_test/isActive_test.js +0 -113
  671. data/dist/es/ember/tests/routing/router_service_test/replaceWith_test.js +0 -144
  672. data/dist/es/ember/tests/routing/router_service_test/transitionTo_test.js +0 -370
  673. data/dist/es/ember/tests/routing/router_service_test/urlFor_test.js +0 -307
  674. data/dist/es/ember/tests/routing/substates_test.js +0 -1110
  675. data/dist/es/ember/tests/routing/toplevel_dom_test.js +0 -37
  676. data/dist/es/ember/tests/service_injection_test.js +0 -278
  677. data/dist/es/ember/tests/view_instrumentation_test.js +0 -47
  678. data/dist/es/ember/version.js +0 -1
  679. data/dist/es/handlebars.js +0 -1268
  680. data/dist/es/internal-test-helpers/index.js +0 -31
  681. data/dist/es/internal-test-helpers/lib/.gitkeep +0 -0
  682. data/dist/es/internal-test-helpers/lib/apply-mixins.js +0 -37
  683. data/dist/es/internal-test-helpers/lib/browser-detect.js +0 -4
  684. data/dist/es/internal-test-helpers/lib/build-owner.js +0 -49
  685. data/dist/es/internal-test-helpers/lib/confirm-export.js +0 -45
  686. data/dist/es/internal-test-helpers/lib/ember-dev/assertion.js +0 -87
  687. data/dist/es/internal-test-helpers/lib/ember-dev/containers.js +0 -34
  688. data/dist/es/internal-test-helpers/lib/ember-dev/debug.js +0 -47
  689. data/dist/es/internal-test-helpers/lib/ember-dev/deprecation.js +0 -71
  690. data/dist/es/internal-test-helpers/lib/ember-dev/index.js +0 -19
  691. data/dist/es/internal-test-helpers/lib/ember-dev/method-call-tracker.js +0 -127
  692. data/dist/es/internal-test-helpers/lib/ember-dev/namespaces.js +0 -34
  693. data/dist/es/internal-test-helpers/lib/ember-dev/run-loop.js +0 -28
  694. data/dist/es/internal-test-helpers/lib/ember-dev/setup-qunit.js +0 -26
  695. data/dist/es/internal-test-helpers/lib/ember-dev/utils.js +0 -33
  696. data/dist/es/internal-test-helpers/lib/ember-dev/warning.js +0 -71
  697. data/dist/es/internal-test-helpers/lib/equal-inner-html.js +0 -37
  698. data/dist/es/internal-test-helpers/lib/equal-tokens.js +0 -53
  699. data/dist/es/internal-test-helpers/lib/factory.js +0 -65
  700. data/dist/es/internal-test-helpers/lib/get-all-property-names.js +0 -12
  701. data/dist/es/internal-test-helpers/lib/get-text-of.js +0 -3
  702. data/dist/es/internal-test-helpers/lib/matchers.js +0 -167
  703. data/dist/es/internal-test-helpers/lib/module-for.js +0 -89
  704. data/dist/es/internal-test-helpers/lib/registry-check.js +0 -28
  705. data/dist/es/internal-test-helpers/lib/run.js +0 -11
  706. data/dist/es/internal-test-helpers/lib/strip.js +0 -12
  707. data/dist/es/internal-test-helpers/lib/system/synthetic-events.js +0 -183
  708. data/dist/es/internal-test-helpers/lib/test-cases/abstract-application.js +0 -70
  709. data/dist/es/internal-test-helpers/lib/test-cases/abstract-rendering.js +0 -203
  710. data/dist/es/internal-test-helpers/lib/test-cases/abstract.js +0 -222
  711. data/dist/es/internal-test-helpers/lib/test-cases/application.js +0 -39
  712. data/dist/es/internal-test-helpers/lib/test-cases/autoboot-application.js +0 -34
  713. data/dist/es/internal-test-helpers/lib/test-cases/default-resolver-application.js +0 -43
  714. data/dist/es/internal-test-helpers/lib/test-cases/node-query.js +0 -120
  715. data/dist/es/internal-test-helpers/lib/test-cases/query-param.js +0 -124
  716. data/dist/es/internal-test-helpers/lib/test-cases/rendering.js +0 -14
  717. data/dist/es/internal-test-helpers/lib/test-cases/router.js +0 -26
  718. data/dist/es/internal-test-helpers/lib/test-cases/test-resolver-application.js +0 -40
  719. data/dist/es/internal-test-helpers/lib/test-resolver.js +0 -86
  720. data/dist/es/internal-test-helpers/tests/index-test.js +0 -10
  721. data/dist/es/route-recognizer.js +0 -685
  722. data/dist/es/router.js +0 -2454
  723. data/dist/es/rsvp.js +0 -2394
  724. data/dist/es/simple-html-tokenizer.js +0 -638
  725. data/dist/jquery/jquery.js +0 -10364
  726. data/dist/node/app-boot-test.js +0 -146
  727. data/dist/node/build-info-test.js +0 -177
  728. data/dist/node/component-rendering-test.js +0 -34
  729. data/dist/node/helpers/app-module.js +0 -198
  730. data/dist/node/helpers/assert-html-matches.js +0 -25
  731. data/dist/node/helpers/build-owner.js +0 -28
  732. data/dist/node/helpers/component-module.js +0 -137
  733. data/dist/node/sourcemap-test.js +0 -27
  734. data/dist/node/template-compiler-test.js +0 -45
  735. data/dist/node/visit-test.js +0 -349
  736. data/dist/qunit/qunit.css +0 -436
  737. data/dist/qunit/qunit.js +0 -5188
  738. data/dist/tests/index.html +0 -254
  739. data/ember-source.gemspec +0 -28
  740. data/node_modules/.yarn-integrity +0 -10
  741. data/yarn.lock +0 -4
@@ -1,4506 +0,0 @@
1
- /* eslint-disable no-console */
2
- import { getOwner } from 'ember-owner';
3
- import RSVP from 'rsvp';
4
- import { compile } from 'ember-template-compiler';
5
- import { ENV } from 'ember-environment';
6
- import { Route, NoneLocation, HistoryLocation } from 'ember-routing';
7
- import Controller from '@ember/controller';
8
- import { Object as EmberObject, A as emberA } from 'ember-runtime';
9
- import { moduleFor, ApplicationTestCase, runDestroy } from 'internal-test-helpers';
10
- import { run } from '@ember/runloop';
11
- import { Mixin, computed, set, addObserver, observer } from 'ember-metal';
12
- import { getTextOf } from 'internal-test-helpers';
13
- import { Component } from 'ember-glimmer';
14
- import Engine from '@ember/engine';
15
- import { Transition } from 'router';
16
-
17
- let originalRenderSupport;
18
- let originalConsoleError;
19
-
20
- moduleFor(
21
- 'Basic Routing - Decoupled from global resolver',
22
- class extends ApplicationTestCase {
23
- constructor() {
24
- super(...arguments);
25
- this.addTemplate('home', '<h3 class="hours">Hours</h3>');
26
- this.addTemplate('camelot', '<section id="camelot"><h3>Is a silly place</h3></section>');
27
- this.addTemplate('homepage', '<h3 id="troll">Megatroll</h3><p>{{model.home}}</p>');
28
-
29
- this.router.map(function() {
30
- this.route('home', { path: '/' });
31
- });
32
- originalRenderSupport = ENV._ENABLE_RENDER_SUPPORT;
33
- ENV._ENABLE_RENDER_SUPPORT = true;
34
- originalConsoleError = console.error;
35
- }
36
-
37
- teardown() {
38
- super.teardown();
39
- ENV._ENABLE_RENDER_SUPPORT = originalRenderSupport;
40
- console.error = originalConsoleError;
41
- }
42
-
43
- getController(name) {
44
- return this.applicationInstance.lookup(`controller:${name}`);
45
- }
46
-
47
- handleURLAborts(assert, path) {
48
- run(() => {
49
- let router = this.applicationInstance.lookup('router:main');
50
- router.handleURL(path).then(
51
- function() {
52
- assert.ok(false, 'url: `' + path + '` was NOT to be handled');
53
- },
54
- function(reason) {
55
- assert.ok(
56
- reason && reason.message === 'TransitionAborted',
57
- 'url: `' + path + '` was to be aborted'
58
- );
59
- }
60
- );
61
- });
62
- }
63
-
64
- get currentPath() {
65
- return this.getController('application').get('currentPath');
66
- }
67
-
68
- get currentURL() {
69
- return this.appRouter.get('currentURL');
70
- }
71
-
72
- handleURLRejectsWith(context, assert, path, expectedReason) {
73
- return context
74
- .visit(path)
75
- .then(() => {
76
- assert.ok(false, 'expected handleURLing: `' + path + '` to fail');
77
- })
78
- .catch(reason => {
79
- assert.equal(reason, expectedReason);
80
- });
81
- }
82
-
83
- ['@test warn on URLs not included in the route set']() {
84
- return this.visit('/').then(() => {
85
- expectAssertion(() => {
86
- this.visit('/what-is-this-i-dont-even');
87
- }, /'\/what-is-this-i-dont-even' did not match any routes/);
88
- });
89
- }
90
-
91
- ['@test The Homepage'](assert) {
92
- return this.visit('/').then(() => {
93
- assert.equal(this.currentPath, 'home', 'currently on the home route');
94
-
95
- let text = this.$('.hours').text();
96
- assert.equal(text, 'Hours', 'the home template was rendered');
97
- });
98
- }
99
-
100
- [`@test The Homepage and the Camelot page with multiple Router.map calls`](assert) {
101
- this.router.map(function() {
102
- this.route('camelot', { path: '/camelot' });
103
- });
104
-
105
- return this.visit('/camelot')
106
- .then(() => {
107
- assert.equal(this.currentPath, 'camelot');
108
-
109
- let text = this.$('#camelot').text();
110
- assert.equal(text, 'Is a silly place', 'the camelot template was rendered');
111
-
112
- return this.visit('/');
113
- })
114
- .then(() => {
115
- assert.equal(this.currentPath, 'home');
116
-
117
- let text = this.$('.hours').text();
118
- assert.equal(text, 'Hours', 'the home template was rendered');
119
- });
120
- }
121
-
122
- [`@test The Homepage with explicit template name in renderTemplate`](assert) {
123
- this.add(
124
- 'route:home',
125
- Route.extend({
126
- renderTemplate() {
127
- this.render('homepage');
128
- },
129
- })
130
- );
131
-
132
- return this.visit('/').then(() => {
133
- let text = this.$('#troll').text();
134
- assert.equal(text, 'Megatroll', 'the homepage template was rendered');
135
- });
136
- }
137
-
138
- [`@test an alternate template will pull in an alternate controller`](assert) {
139
- this.add(
140
- 'route:home',
141
- Route.extend({
142
- renderTemplate() {
143
- this.render('homepage');
144
- },
145
- })
146
- );
147
- this.add(
148
- 'controller:homepage',
149
- Controller.extend({
150
- model: {
151
- home: 'Comes from homepage',
152
- },
153
- })
154
- );
155
-
156
- return this.visit('/').then(() => {
157
- let text = this.$('p').text();
158
-
159
- assert.equal(text, 'Comes from homepage', 'the homepage template was rendered');
160
- });
161
- }
162
-
163
- [`@test An alternate template will pull in an alternate controller instead of controllerName`](
164
- assert
165
- ) {
166
- this.add(
167
- 'route:home',
168
- Route.extend({
169
- controllerName: 'foo',
170
- renderTemplate() {
171
- this.render('homepage');
172
- },
173
- })
174
- );
175
- this.add(
176
- 'controller:foo',
177
- Controller.extend({
178
- model: {
179
- home: 'Comes from foo',
180
- },
181
- })
182
- );
183
- this.add(
184
- 'controller:homepage',
185
- Controller.extend({
186
- model: {
187
- home: 'Comes from homepage',
188
- },
189
- })
190
- );
191
-
192
- return this.visit('/').then(() => {
193
- let text = this.$('p').text();
194
-
195
- assert.equal(text, 'Comes from homepage', 'the homepage template was rendered');
196
- });
197
- }
198
-
199
- [`@test The template will pull in an alternate controller via key/value`](assert) {
200
- this.router.map(function() {
201
- this.route('homepage', { path: '/' });
202
- });
203
-
204
- this.add(
205
- 'route:homepage',
206
- Route.extend({
207
- renderTemplate() {
208
- this.render({ controller: 'home' });
209
- },
210
- })
211
- );
212
- this.add(
213
- 'controller:home',
214
- Controller.extend({
215
- model: {
216
- home: 'Comes from home.',
217
- },
218
- })
219
- );
220
-
221
- return this.visit('/').then(() => {
222
- let text = this.$('p').text();
223
-
224
- assert.equal(
225
- text,
226
- 'Comes from home.',
227
- 'the homepage template was rendered from data from the HomeController'
228
- );
229
- });
230
- }
231
-
232
- [`@test The Homepage with explicit template name in renderTemplate and controller`](assert) {
233
- this.add(
234
- 'controller:home',
235
- Controller.extend({
236
- model: {
237
- home: 'YES I AM HOME',
238
- },
239
- })
240
- );
241
- this.add(
242
- 'route:home',
243
- Route.extend({
244
- renderTemplate() {
245
- this.render('homepage');
246
- },
247
- })
248
- );
249
-
250
- return this.visit('/').then(() => {
251
- let text = this.$('p').text();
252
-
253
- assert.equal(text, 'YES I AM HOME', 'The homepage template was rendered');
254
- });
255
- }
256
-
257
- [`@test Model passed via renderTemplate model is set as controller's model`](assert) {
258
- this.addTemplate('bio', '<p>{{model.name}}</p>');
259
- this.add(
260
- 'route:home',
261
- Route.extend({
262
- renderTemplate() {
263
- this.render('bio', {
264
- model: { name: 'emberjs' },
265
- });
266
- },
267
- })
268
- );
269
-
270
- return this.visit('/').then(() => {
271
- let text = this.$('p').text();
272
-
273
- assert.equal(text, 'emberjs', `Passed model was set as controller's model`);
274
- });
275
- }
276
-
277
- ['@test render uses templateName from route'](assert) {
278
- this.addTemplate('the_real_home_template', '<p>THIS IS THE REAL HOME</p>');
279
- this.add(
280
- 'route:home',
281
- Route.extend({
282
- templateName: 'the_real_home_template',
283
- })
284
- );
285
-
286
- return this.visit('/').then(() => {
287
- let text = this.$('p').text();
288
-
289
- assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');
290
- });
291
- }
292
-
293
- ['@test defining templateName allows other templates to be rendered'](assert) {
294
- this.addTemplate('alert', `<div class='alert-box'>Invader!</div>`);
295
- this.addTemplate('the_real_home_template', `<p>THIS IS THE REAL HOME</p>{{outlet 'alert'}}`);
296
- this.add(
297
- 'route:home',
298
- Route.extend({
299
- templateName: 'the_real_home_template',
300
- actions: {
301
- showAlert() {
302
- this.render('alert', {
303
- into: 'home',
304
- outlet: 'alert',
305
- });
306
- },
307
- },
308
- })
309
- );
310
-
311
- return this.visit('/')
312
- .then(() => {
313
- let text = this.$('p').text();
314
- assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');
315
-
316
- return this.runTask(() => this.appRouter.send('showAlert'));
317
- })
318
- .then(() => {
319
- let text = this.$('.alert-box').text();
320
-
321
- assert.equal(text, 'Invader!', 'Template for alert was rendered into the outlet');
322
- });
323
- }
324
-
325
- ['@test templateName is still used when calling render with no name and options'](assert) {
326
- this.addTemplate('alert', `<div class='alert-box'>Invader!</div>`);
327
- this.addTemplate('home', `<p>THIS IS THE REAL HOME</p>{{outlet 'alert'}}`);
328
-
329
- this.add(
330
- 'route:home',
331
- Route.extend({
332
- templateName: 'alert',
333
- renderTemplate() {
334
- this.render({});
335
- },
336
- })
337
- );
338
-
339
- return this.visit('/').then(() => {
340
- let text = this.$('.alert-box').text();
341
-
342
- assert.equal(text, 'Invader!', 'default templateName was rendered into outlet');
343
- });
344
- }
345
-
346
- ['@test The Homepage with a `setupController` hook'](assert) {
347
- this.addTemplate(
348
- 'home',
349
- `<ul>{{#each hours as |entry|}}
350
- <li>{{entry}}</li>
351
- {{/each}}
352
- </ul>
353
- `
354
- );
355
-
356
- this.add(
357
- 'route:home',
358
- Route.extend({
359
- setupController(controller) {
360
- controller.set('hours', [
361
- 'Monday through Friday: 9am to 5pm',
362
- 'Saturday: Noon to Midnight',
363
- 'Sunday: Noon to 6pm',
364
- ]);
365
- },
366
- })
367
- );
368
- return this.visit('/').then(() => {
369
- let text = this.$('ul li:nth-child(3)').text();
370
-
371
- assert.equal(
372
- text,
373
- 'Sunday: Noon to 6pm',
374
- 'The template was rendered with the hours context'
375
- );
376
- });
377
- }
378
-
379
- [`@test The route controller is still set when overriding the setupController hook`](assert) {
380
- this.add(
381
- 'route:home',
382
- Route.extend({
383
- setupController() {
384
- // no-op
385
- // importantly, we are not calling this._super
386
- },
387
- })
388
- );
389
-
390
- this.add('controller:home', Controller.extend());
391
-
392
- return this.visit('/').then(() => {
393
- let homeRoute = this.applicationInstance.lookup('route:home');
394
- let homeController = this.applicationInstance.lookup('controller:home');
395
-
396
- assert.equal(
397
- homeRoute.controller,
398
- homeController,
399
- 'route controller is the home controller'
400
- );
401
- });
402
- }
403
-
404
- ['@test the route controller can be specified via controllerName'](assert) {
405
- this.addTemplate('home', '<p>{{myValue}}</p>');
406
- this.add(
407
- 'route:home',
408
- Route.extend({
409
- controllerName: 'myController',
410
- })
411
- );
412
- this.add(
413
- 'controller:myController',
414
- Controller.extend({
415
- myValue: 'foo',
416
- })
417
- );
418
-
419
- return this.visit('/').then(() => {
420
- let homeRoute = this.applicationInstance.lookup('route:home');
421
- let myController = this.applicationInstance.lookup('controller:myController');
422
- let text = this.$('p').text();
423
-
424
- assert.equal(
425
- homeRoute.controller,
426
- myController,
427
- 'route controller is set by controllerName'
428
- );
429
- assert.equal(
430
- text,
431
- 'foo',
432
- 'The homepage template was rendered with data from the custom controller'
433
- );
434
- });
435
- }
436
-
437
- [`@test The route controller specified via controllerName is used in render`](assert) {
438
- this.router.map(function() {
439
- this.route('home', { path: '/' });
440
- });
441
-
442
- this.add(
443
- 'route:home',
444
- Route.extend({
445
- controllerName: 'myController',
446
- renderTemplate() {
447
- this.render('alternative_home');
448
- },
449
- })
450
- );
451
-
452
- this.add(
453
- 'controller:myController',
454
- Controller.extend({
455
- myValue: 'foo',
456
- })
457
- );
458
-
459
- this.addTemplate('alternative_home', '<p>alternative home: {{myValue}}</p>');
460
-
461
- return this.visit('/').then(() => {
462
- let homeRoute = this.applicationInstance.lookup('route:home');
463
- let myController = this.applicationInstance.lookup('controller:myController');
464
- let text = this.$('p').text();
465
-
466
- assert.equal(
467
- homeRoute.controller,
468
- myController,
469
- 'route controller is set by controllerName'
470
- );
471
-
472
- assert.equal(
473
- text,
474
- 'alternative home: foo',
475
- 'The homepage template was rendered with data from the custom controller'
476
- );
477
- });
478
- }
479
-
480
- [`@test The route controller specified via controllerName is used in render even when a controller with the routeName is available`](
481
- assert
482
- ) {
483
- this.router.map(function() {
484
- this.route('home', { path: '/' });
485
- });
486
-
487
- this.addTemplate('home', '<p>home: {{myValue}}</p>');
488
-
489
- this.add(
490
- 'route:home',
491
- Route.extend({
492
- controllerName: 'myController',
493
- })
494
- );
495
-
496
- this.add(
497
- 'controller:home',
498
- Controller.extend({
499
- myValue: 'home',
500
- })
501
- );
502
-
503
- this.add(
504
- 'controller:myController',
505
- Controller.extend({
506
- myValue: 'myController',
507
- })
508
- );
509
-
510
- return this.visit('/').then(() => {
511
- let homeRoute = this.applicationInstance.lookup('route:home');
512
- let myController = this.applicationInstance.lookup('controller:myController');
513
- let text = this.$('p').text();
514
-
515
- assert.equal(
516
- homeRoute.controller,
517
- myController,
518
- 'route controller is set by controllerName'
519
- );
520
-
521
- assert.equal(
522
- text,
523
- 'home: myController',
524
- 'The homepage template was rendered with data from the custom controller'
525
- );
526
- });
527
- }
528
-
529
- [`@test The Homepage with a 'setupController' hook modifying other controllers`](assert) {
530
- this.router.map(function() {
531
- this.route('home', { path: '/' });
532
- });
533
-
534
- this.add(
535
- 'route:home',
536
- Route.extend({
537
- setupController(/* controller */) {
538
- this.controllerFor('home').set('hours', [
539
- 'Monday through Friday: 9am to 5pm',
540
- 'Saturday: Noon to Midnight',
541
- 'Sunday: Noon to 6pm',
542
- ]);
543
- },
544
- })
545
- );
546
-
547
- this.addTemplate('home', '<ul>{{#each hours as |entry|}}<li>{{entry}}</li>{{/each}}</ul>');
548
-
549
- return this.visit('/').then(() => {
550
- let text = this.$('ul li:nth-child(3)').text();
551
-
552
- assert.equal(
553
- text,
554
- 'Sunday: Noon to 6pm',
555
- 'The template was rendered with the hours context'
556
- );
557
- });
558
- }
559
-
560
- [`@test The Homepage with a computed model that does not get overridden`](assert) {
561
- this.router.map(function() {
562
- this.route('home', { path: '/' });
563
- });
564
-
565
- this.add(
566
- 'controller:home',
567
- Controller.extend({
568
- model: computed(function() {
569
- return [
570
- 'Monday through Friday: 9am to 5pm',
571
- 'Saturday: Noon to Midnight',
572
- 'Sunday: Noon to 6pm',
573
- ];
574
- }),
575
- })
576
- );
577
-
578
- this.addTemplate(
579
- 'home',
580
- '<ul>{{#each model as |passage|}}<li>{{passage}}</li>{{/each}}</ul>'
581
- );
582
-
583
- return this.visit('/').then(() => {
584
- let text = this.$('ul li:nth-child(3)').text();
585
-
586
- assert.equal(
587
- text,
588
- 'Sunday: Noon to 6pm',
589
- 'The template was rendered with the context intact'
590
- );
591
- });
592
- }
593
-
594
- [`@test The Homepage getting its controller context via model`](assert) {
595
- this.router.map(function() {
596
- this.route('home', { path: '/' });
597
- });
598
-
599
- this.add(
600
- 'route:home',
601
- Route.extend({
602
- model() {
603
- return [
604
- 'Monday through Friday: 9am to 5pm',
605
- 'Saturday: Noon to Midnight',
606
- 'Sunday: Noon to 6pm',
607
- ];
608
- },
609
-
610
- setupController(controller, model) {
611
- assert.equal(this.controllerFor('home'), controller);
612
-
613
- this.controllerFor('home').set('hours', model);
614
- },
615
- })
616
- );
617
-
618
- this.addTemplate('home', '<ul>{{#each hours as |entry|}}<li>{{entry}}</li>{{/each}}</ul>');
619
-
620
- return this.visit('/').then(() => {
621
- let text = this.$('ul li:nth-child(3)').text();
622
-
623
- assert.equal(
624
- text,
625
- 'Sunday: Noon to 6pm',
626
- 'The template was rendered with the hours context'
627
- );
628
- });
629
- }
630
-
631
- [`@test The Specials Page getting its controller context by deserializing the params hash`](
632
- assert
633
- ) {
634
- this.router.map(function() {
635
- this.route('home', { path: '/' });
636
- this.route('special', { path: '/specials/:menu_item_id' });
637
- });
638
-
639
- this.add(
640
- 'route:special',
641
- Route.extend({
642
- model(params) {
643
- return EmberObject.create({
644
- menuItemId: params.menu_item_id,
645
- });
646
- },
647
- })
648
- );
649
-
650
- this.addTemplate('special', '<p>{{model.menuItemId}}</p>');
651
-
652
- return this.visit('/specials/1').then(() => {
653
- let text = this.$('p').text();
654
-
655
- assert.equal(text, '1', 'The model was used to render the template');
656
- });
657
- }
658
-
659
- ['@test The Specials Page defaults to looking models up via `find`']() {
660
- let MenuItem = EmberObject.extend();
661
- MenuItem.reopenClass({
662
- find(id) {
663
- return MenuItem.create({ id });
664
- },
665
- });
666
- this.add('model:menu_item', MenuItem);
667
-
668
- this.router.map(function() {
669
- this.route('home', { path: '/' });
670
- this.route('special', { path: '/specials/:menu_item_id' });
671
- });
672
-
673
- this.addTemplate('special', '{{model.id}}');
674
-
675
- return this.visit('/specials/1').then(() => {
676
- this.assertText('1', 'The model was used to render the template');
677
- });
678
- }
679
-
680
- ['@test The Special Page returning a promise puts the app into a loading state until the promise is resolved']() {
681
- this.router.map(function() {
682
- this.route('home', { path: '/' });
683
- this.route('special', { path: '/specials/:menu_item_id' });
684
- });
685
-
686
- let menuItem, resolve;
687
-
688
- let MenuItem = EmberObject.extend();
689
- MenuItem.reopenClass({
690
- find(id) {
691
- menuItem = MenuItem.create({ id: id });
692
-
693
- return new RSVP.Promise(function(res) {
694
- resolve = res;
695
- });
696
- },
697
- });
698
-
699
- this.add('model:menu_item', MenuItem);
700
-
701
- this.addTemplate('special', '<p>{{model.id}}</p>');
702
- this.addTemplate('loading', '<p>LOADING!</p>');
703
-
704
- let visited = this.visit('/specials/1');
705
- this.assertText('LOADING!', 'The app is in the loading state');
706
-
707
- resolve(menuItem);
708
-
709
- return visited.then(() => {
710
- this.assertText('1', 'The app is now in the specials state');
711
- });
712
- }
713
-
714
- [`@test The loading state doesn't get entered for promises that resolve on the same run loop`](
715
- assert
716
- ) {
717
- this.router.map(function() {
718
- this.route('home', { path: '/' });
719
- this.route('special', { path: '/specials/:menu_item_id' });
720
- });
721
-
722
- let MenuItem = EmberObject.extend();
723
- MenuItem.reopenClass({
724
- find(id) {
725
- return { id: id };
726
- },
727
- });
728
-
729
- this.add('model:menu_item', MenuItem);
730
-
731
- this.add(
732
- 'route:loading',
733
- Route.extend({
734
- enter() {
735
- assert.ok(false, "LoadingRoute shouldn't have been entered.");
736
- },
737
- })
738
- );
739
-
740
- this.addTemplate('special', '<p>{{model.id}}</p>');
741
- this.addTemplate('loading', '<p>LOADING!</p>');
742
-
743
- return this.visit('/specials/1').then(() => {
744
- let text = this.$('p').text();
745
-
746
- assert.equal(text, '1', 'The app is now in the specials state');
747
- });
748
- }
749
-
750
- ["@test The Special page returning an error invokes SpecialRoute's error handler"](assert) {
751
- this.router.map(function() {
752
- this.route('home', { path: '/' });
753
- this.route('special', { path: '/specials/:menu_item_id' });
754
- });
755
-
756
- let menuItem, promise, resolve;
757
-
758
- let MenuItem = EmberObject.extend();
759
- MenuItem.reopenClass({
760
- find(id) {
761
- menuItem = MenuItem.create({ id: id });
762
- promise = new RSVP.Promise(res => (resolve = res));
763
-
764
- return promise;
765
- },
766
- });
767
-
768
- this.add('model:menu_item', MenuItem);
769
-
770
- this.add(
771
- 'route:special',
772
- Route.extend({
773
- setup() {
774
- throw 'Setup error';
775
- },
776
- actions: {
777
- error(reason) {
778
- assert.equal(
779
- reason,
780
- 'Setup error',
781
- 'SpecialRoute#error received the error thrown from setup'
782
- );
783
- return true;
784
- },
785
- },
786
- })
787
- );
788
-
789
- this.handleURLRejectsWith(this, assert, 'specials/1', 'Setup error');
790
-
791
- run(() => resolve(menuItem));
792
- }
793
-
794
- ["@test ApplicationRoute's default error handler can be overridden"](assert) {
795
- assert.expect(2);
796
-
797
- this.router.map(function() {
798
- this.route('home', { path: '/' });
799
- this.route('special', { path: '/specials/:menu_item_id' });
800
- });
801
-
802
- let menuItem, resolve;
803
-
804
- let MenuItem = EmberObject.extend();
805
-
806
- MenuItem.reopenClass({
807
- find(id) {
808
- menuItem = MenuItem.create({ id: id });
809
- return new RSVP.Promise(res => (resolve = res));
810
- },
811
- });
812
- this.add('model:menu_item', MenuItem);
813
-
814
- this.add(
815
- 'route:application',
816
- Route.extend({
817
- actions: {
818
- error(reason) {
819
- assert.equal(
820
- reason,
821
- 'Setup error',
822
- 'error was correctly passed to custom ApplicationRoute handler'
823
- );
824
- return true;
825
- },
826
- },
827
- })
828
- );
829
-
830
- this.add(
831
- 'route:special',
832
- Route.extend({
833
- setup() {
834
- throw 'Setup error';
835
- },
836
- })
837
- );
838
-
839
- this.handleURLRejectsWith(this, assert, '/specials/1', 'Setup error');
840
-
841
- run(() => resolve(menuItem));
842
- }
843
-
844
- ['@test Moving from one page to another triggers the correct callbacks'](assert) {
845
- assert.expect(3);
846
-
847
- this.router.map(function() {
848
- this.route('home', { path: '/' });
849
- this.route('special', { path: '/specials/:menu_item_id' });
850
- });
851
-
852
- let MenuItem = EmberObject.extend();
853
- MenuItem.reopenClass({
854
- find(id) {
855
- return MenuItem.create({ id: id });
856
- },
857
- });
858
- this.add('model:menu_item', MenuItem);
859
-
860
- this.addTemplate('home', '<h3>Home</h3>');
861
- this.addTemplate('special', '<p>{{model.id}}</p>');
862
-
863
- return this.visit('/')
864
- .then(() => {
865
- this.assertText('Home', 'The app is now in the initial state');
866
-
867
- let promiseContext = MenuItem.create({ id: 1 });
868
-
869
- return this.visit('/specials/1', promiseContext);
870
- })
871
- .then(() => {
872
- assert.equal(this.currentURL, '/specials/1');
873
- this.assertText('1', 'The app is now transitioned');
874
- });
875
- }
876
-
877
- ['@test Nested callbacks are not exited when moving to siblings'](assert) {
878
- let rootSetup = 0;
879
- let rootRender = 0;
880
- let rootModel = 0;
881
- let rootSerialize = 0;
882
- let menuItem;
883
- let rootElement;
884
-
885
- let MenuItem = EmberObject.extend();
886
- MenuItem.reopenClass({
887
- find(id) {
888
- menuItem = MenuItem.create({ id: id });
889
- return menuItem;
890
- },
891
- });
892
-
893
- this.router.map(function() {
894
- this.route('root', { path: '/' }, function() {
895
- this.route('special', {
896
- path: '/specials/:menu_item_id',
897
- resetNamespace: true,
898
- });
899
- });
900
- });
901
-
902
- this.add(
903
- 'route:root',
904
- Route.extend({
905
- model() {
906
- rootModel++;
907
- return this._super(...arguments);
908
- },
909
-
910
- setupController() {
911
- rootSetup++;
912
- },
913
-
914
- renderTemplate() {
915
- rootRender++;
916
- },
917
-
918
- serialize() {
919
- rootSerialize++;
920
- return this._super(...arguments);
921
- },
922
- })
923
- );
924
-
925
- this.add('route:loading', Route.extend({}));
926
- this.add('route:home', Route.extend({}));
927
- this.add(
928
- 'route:special',
929
- Route.extend({
930
- model({ menu_item_id }) {
931
- return MenuItem.find(menu_item_id);
932
- },
933
- setupController(controller, model) {
934
- set(controller, 'model', model);
935
- },
936
- })
937
- );
938
-
939
- this.addTemplate('root.index', '<h3>Home</h3>');
940
- this.addTemplate('special', '<p>{{model.id}}</p>');
941
- this.addTemplate('loading', '<p>LOADING!</p>');
942
-
943
- return this.visit('/').then(() => {
944
- rootElement = document.getElementById('qunit-fixture');
945
-
946
- assert.equal(
947
- getTextOf(rootElement.querySelector('h3')),
948
- 'Home',
949
- 'The app is now in the initial state'
950
- );
951
- assert.equal(rootSetup, 1, 'The root setup was triggered');
952
- assert.equal(rootRender, 1, 'The root render was triggered');
953
- assert.equal(rootSerialize, 0, 'The root serialize was not called');
954
- assert.equal(rootModel, 1, 'The root model was called');
955
-
956
- let router = this.applicationInstance.lookup('router:main');
957
- let menuItem = MenuItem.create({ id: 1 });
958
-
959
- return router.transitionTo('special', menuItem).then(function() {
960
- assert.equal(rootSetup, 1, 'The root setup was not triggered again');
961
- assert.equal(rootRender, 1, 'The root render was not triggered again');
962
- assert.equal(rootSerialize, 0, 'The root serialize was not called');
963
-
964
- // TODO: Should this be changed?
965
- assert.equal(rootModel, 1, 'The root model was called again');
966
-
967
- assert.deepEqual(router.location.path, '/specials/1');
968
- assert.equal(router.currentPath, 'root.special');
969
- });
970
- });
971
- }
972
-
973
- ['@test Events are triggered on the controller if a matching action name is implemented'](
974
- assert
975
- ) {
976
- let done = assert.async();
977
-
978
- this.router.map(function() {
979
- this.route('home', { path: '/' });
980
- });
981
-
982
- let model = { name: 'Tom Dale' };
983
- let stateIsNotCalled = true;
984
-
985
- this.add(
986
- 'route:home',
987
- Route.extend({
988
- model() {
989
- return model;
990
- },
991
-
992
- actions: {
993
- showStuff() {
994
- stateIsNotCalled = false;
995
- },
996
- },
997
- })
998
- );
999
-
1000
- this.addTemplate('home', '<a {{action "showStuff" model}}>{{name}}</a>');
1001
- this.add(
1002
- 'controller:home',
1003
- Controller.extend({
1004
- actions: {
1005
- showStuff(context) {
1006
- assert.ok(stateIsNotCalled, 'an event on the state is not triggered');
1007
- assert.deepEqual(context, { name: 'Tom Dale' }, 'an event with context is passed');
1008
- done();
1009
- },
1010
- },
1011
- })
1012
- );
1013
-
1014
- this.visit('/').then(() => {
1015
- document
1016
- .getElementById('qunit-fixture')
1017
- .querySelector('a')
1018
- .click();
1019
- });
1020
- }
1021
-
1022
- ['@test Events are triggered on the current state when defined in `actions` object'](assert) {
1023
- let done = assert.async();
1024
-
1025
- this.router.map(function() {
1026
- this.route('home', { path: '/' });
1027
- });
1028
-
1029
- let model = { name: 'Tom Dale' };
1030
- let HomeRoute = Route.extend({
1031
- model() {
1032
- return model;
1033
- },
1034
-
1035
- actions: {
1036
- showStuff(obj) {
1037
- assert.ok(this instanceof HomeRoute, 'the handler is an App.HomeRoute');
1038
- assert.deepEqual(
1039
- Object.assign({}, obj),
1040
- { name: 'Tom Dale' },
1041
- 'the context is correct'
1042
- );
1043
- done();
1044
- },
1045
- },
1046
- });
1047
-
1048
- this.add('route:home', HomeRoute);
1049
- this.addTemplate('home', '<a {{action "showStuff" model}}>{{model.name}}</a>');
1050
-
1051
- this.visit('/').then(() => {
1052
- document
1053
- .getElementById('qunit-fixture')
1054
- .querySelector('a')
1055
- .click();
1056
- });
1057
- }
1058
-
1059
- ['@test Events defined in `actions` object are triggered on the current state when routes are nested'](
1060
- assert
1061
- ) {
1062
- let done = assert.async();
1063
-
1064
- this.router.map(function() {
1065
- this.route('root', { path: '/' }, function() {
1066
- this.route('index', { path: '/' });
1067
- });
1068
- });
1069
-
1070
- let model = { name: 'Tom Dale' };
1071
-
1072
- let RootRoute = Route.extend({
1073
- actions: {
1074
- showStuff(obj) {
1075
- assert.ok(this instanceof RootRoute, 'the handler is an App.HomeRoute');
1076
- assert.deepEqual(
1077
- Object.assign({}, obj),
1078
- { name: 'Tom Dale' },
1079
- 'the context is correct'
1080
- );
1081
- done();
1082
- },
1083
- },
1084
- });
1085
- this.add('route:root', RootRoute);
1086
- this.add(
1087
- 'route:root.index',
1088
- Route.extend({
1089
- model() {
1090
- return model;
1091
- },
1092
- })
1093
- );
1094
-
1095
- this.addTemplate('root.index', '<a {{action "showStuff" model}}>{{model.name}}</a>');
1096
-
1097
- this.visit('/').then(() => {
1098
- document
1099
- .getElementById('qunit-fixture')
1100
- .querySelector('a')
1101
- .click();
1102
- });
1103
- }
1104
-
1105
- ['@test Events can be handled by inherited event handlers'](assert) {
1106
- assert.expect(4);
1107
-
1108
- let SuperRoute = Route.extend({
1109
- actions: {
1110
- foo() {
1111
- assert.ok(true, 'foo');
1112
- },
1113
- bar(msg) {
1114
- assert.equal(msg, 'HELLO', 'bar hander in super route');
1115
- },
1116
- },
1117
- });
1118
-
1119
- let RouteMixin = Mixin.create({
1120
- actions: {
1121
- bar(msg) {
1122
- assert.equal(msg, 'HELLO', 'bar handler in mixin');
1123
- this._super(msg);
1124
- },
1125
- },
1126
- });
1127
-
1128
- this.add(
1129
- 'route:home',
1130
- SuperRoute.extend(RouteMixin, {
1131
- actions: {
1132
- baz() {
1133
- assert.ok(true, 'baz', 'baz hander in route');
1134
- },
1135
- },
1136
- })
1137
- );
1138
- this.addTemplate(
1139
- 'home',
1140
- `
1141
- <a class="do-foo" {{action "foo"}}>Do foo</a>
1142
- <a class="do-bar-with-arg" {{action "bar" "HELLO"}}>Do bar with arg</a>
1143
- <a class="do-baz" {{action "baz"}}>Do bar</a>
1144
- `
1145
- );
1146
-
1147
- return this.visit('/').then(() => {
1148
- let rootElement = document.getElementById('qunit-fixture');
1149
- rootElement.querySelector('.do-foo').click();
1150
- rootElement.querySelector('.do-bar-with-arg').click();
1151
- rootElement.querySelector('.do-baz').click();
1152
- });
1153
- }
1154
-
1155
- ['@test Actions are not triggered on the controller if a matching action name is implemented as a method'](
1156
- assert
1157
- ) {
1158
- let done = assert.async();
1159
-
1160
- this.router.map(function() {
1161
- this.route('home', { path: '/' });
1162
- });
1163
-
1164
- let model = { name: 'Tom Dale' };
1165
- let stateIsNotCalled = true;
1166
-
1167
- this.add(
1168
- 'route:home',
1169
- Route.extend({
1170
- model() {
1171
- return model;
1172
- },
1173
-
1174
- actions: {
1175
- showStuff(context) {
1176
- assert.ok(stateIsNotCalled, 'an event on the state is not triggered');
1177
- assert.deepEqual(context, { name: 'Tom Dale' }, 'an event with context is passed');
1178
- done();
1179
- },
1180
- },
1181
- })
1182
- );
1183
-
1184
- this.addTemplate('home', '<a {{action "showStuff" model}}>{{name}}</a>');
1185
-
1186
- this.add(
1187
- 'controller:home',
1188
- Controller.extend({
1189
- showStuff() {
1190
- stateIsNotCalled = false;
1191
- assert.ok(stateIsNotCalled, 'an event on the state is not triggered');
1192
- },
1193
- })
1194
- );
1195
-
1196
- this.visit('/').then(() => {
1197
- document
1198
- .getElementById('qunit-fixture')
1199
- .querySelector('a')
1200
- .click();
1201
- });
1202
- }
1203
-
1204
- ['@test actions can be triggered with multiple arguments'](assert) {
1205
- let done = assert.async();
1206
- this.router.map(function() {
1207
- this.route('root', { path: '/' }, function() {
1208
- this.route('index', { path: '/' });
1209
- });
1210
- });
1211
-
1212
- let model1 = { name: 'Tilde' };
1213
- let model2 = { name: 'Tom Dale' };
1214
-
1215
- let RootRoute = Route.extend({
1216
- actions: {
1217
- showStuff(obj1, obj2) {
1218
- assert.ok(this instanceof RootRoute, 'the handler is an App.HomeRoute');
1219
- assert.deepEqual(
1220
- Object.assign({}, obj1),
1221
- { name: 'Tilde' },
1222
- 'the first context is correct'
1223
- );
1224
- assert.deepEqual(
1225
- Object.assign({}, obj2),
1226
- { name: 'Tom Dale' },
1227
- 'the second context is correct'
1228
- );
1229
- done();
1230
- },
1231
- },
1232
- });
1233
-
1234
- this.add('route:root', RootRoute);
1235
-
1236
- this.add(
1237
- 'controller:root.index',
1238
- Controller.extend({
1239
- model1: model1,
1240
- model2: model2,
1241
- })
1242
- );
1243
-
1244
- this.addTemplate('root.index', '<a {{action "showStuff" model1 model2}}>{{model1.name}}</a>');
1245
-
1246
- this.visit('/').then(() => {
1247
- document
1248
- .getElementById('qunit-fixture')
1249
- .querySelector('a')
1250
- .click();
1251
- });
1252
- }
1253
-
1254
- ['@test transitioning multiple times in a single run loop only sets the URL once'](assert) {
1255
- this.router.map(function() {
1256
- this.route('root', { path: '/' });
1257
- this.route('foo');
1258
- this.route('bar');
1259
- });
1260
-
1261
- return this.visit('/').then(() => {
1262
- let urlSetCount = 0;
1263
- let router = this.applicationInstance.lookup('router:main');
1264
-
1265
- router.get('location').setURL = function(path) {
1266
- urlSetCount++;
1267
- set(this, 'path', path);
1268
- };
1269
-
1270
- assert.equal(urlSetCount, 0);
1271
-
1272
- run(function() {
1273
- router.transitionTo('foo');
1274
- router.transitionTo('bar');
1275
- });
1276
-
1277
- assert.equal(urlSetCount, 1);
1278
- assert.equal(router.get('location').getURL(), '/bar');
1279
- });
1280
- }
1281
-
1282
- ['@test navigating away triggers a url property change'](assert) {
1283
- assert.expect(3);
1284
-
1285
- this.router.map(function() {
1286
- this.route('root', { path: '/' });
1287
- this.route('foo', { path: '/foo' });
1288
- this.route('bar', { path: '/bar' });
1289
- });
1290
-
1291
- return this.visit('/').then(() => {
1292
- let router = this.applicationInstance.lookup('router:main');
1293
-
1294
- addObserver(router, 'url', function() {
1295
- assert.ok(true, 'url change event was fired');
1296
- });
1297
- ['foo', 'bar', '/foo'].forEach(destination => run(router, 'transitionTo', destination));
1298
- });
1299
- }
1300
-
1301
- ['@test using replaceWith calls location.replaceURL if available'](assert) {
1302
- let setCount = 0;
1303
- let replaceCount = 0;
1304
- this.router.reopen({
1305
- location: NoneLocation.create({
1306
- setURL(path) {
1307
- setCount++;
1308
- set(this, 'path', path);
1309
- },
1310
-
1311
- replaceURL(path) {
1312
- replaceCount++;
1313
- set(this, 'path', path);
1314
- },
1315
- }),
1316
- });
1317
-
1318
- this.router.map(function() {
1319
- this.route('root', { path: '/' });
1320
- this.route('foo');
1321
- });
1322
-
1323
- return this.visit('/').then(() => {
1324
- let router = this.applicationInstance.lookup('router:main');
1325
- assert.equal(setCount, 1);
1326
- assert.equal(replaceCount, 0);
1327
-
1328
- run(() => router.replaceWith('foo'));
1329
-
1330
- assert.equal(setCount, 1, 'should not call setURL');
1331
- assert.equal(replaceCount, 1, 'should call replaceURL once');
1332
- assert.equal(router.get('location').getURL(), '/foo');
1333
- });
1334
- }
1335
-
1336
- ['@test using replaceWith calls setURL if location.replaceURL is not defined'](assert) {
1337
- let setCount = 0;
1338
-
1339
- this.router.reopen({
1340
- location: NoneLocation.create({
1341
- setURL(path) {
1342
- setCount++;
1343
- set(this, 'path', path);
1344
- },
1345
- }),
1346
- });
1347
-
1348
- this.router.map(function() {
1349
- this.route('root', { path: '/' });
1350
- this.route('foo');
1351
- });
1352
-
1353
- return this.visit('/').then(() => {
1354
- let router = this.applicationInstance.lookup('router:main');
1355
-
1356
- assert.equal(setCount, 1);
1357
- run(() => router.replaceWith('foo'));
1358
- assert.equal(setCount, 2, 'should call setURL once');
1359
- assert.equal(router.get('location').getURL(), '/foo');
1360
- });
1361
- }
1362
-
1363
- ['@test Route inherits model from parent route'](assert) {
1364
- assert.expect(9);
1365
-
1366
- this.router.map(function() {
1367
- this.route('the-post', { path: '/posts/:post_id' }, function() {
1368
- this.route('comments');
1369
-
1370
- this.route('shares', { path: '/shares/:share_id', resetNamespace: true }, function() {
1371
- this.route('share');
1372
- });
1373
- });
1374
- });
1375
-
1376
- let post1 = {};
1377
- let post2 = {};
1378
- let post3 = {};
1379
- let share1 = {};
1380
- let share2 = {};
1381
- let share3 = {};
1382
-
1383
- let posts = {
1384
- 1: post1,
1385
- 2: post2,
1386
- 3: post3,
1387
- };
1388
- let shares = {
1389
- 1: share1,
1390
- 2: share2,
1391
- 3: share3,
1392
- };
1393
-
1394
- this.add(
1395
- 'route:the-post',
1396
- Route.extend({
1397
- model(params) {
1398
- return posts[params.post_id];
1399
- },
1400
- })
1401
- );
1402
-
1403
- this.add(
1404
- 'route:the-post.comments',
1405
- Route.extend({
1406
- afterModel(post /*, transition */) {
1407
- let parent_model = this.modelFor('the-post');
1408
-
1409
- assert.equal(post, parent_model);
1410
- },
1411
- })
1412
- );
1413
-
1414
- this.add(
1415
- 'route:shares',
1416
- Route.extend({
1417
- model(params) {
1418
- return shares[params.share_id];
1419
- },
1420
- })
1421
- );
1422
-
1423
- this.add(
1424
- 'route:shares.share',
1425
- Route.extend({
1426
- afterModel(share /*, transition */) {
1427
- let parent_model = this.modelFor('shares');
1428
-
1429
- assert.equal(share, parent_model);
1430
- },
1431
- })
1432
- );
1433
-
1434
- return this.visit('/posts/1/comments')
1435
- .then(() => {
1436
- assert.ok(true, 'url: /posts/1/comments was handled');
1437
- return this.visit('/posts/1/shares/1');
1438
- })
1439
- .then(() => {
1440
- assert.ok(true, 'url: /posts/1/shares/1 was handled');
1441
- return this.visit('/posts/2/comments');
1442
- })
1443
- .then(() => {
1444
- assert.ok(true, 'url: /posts/2/comments was handled');
1445
- return this.visit('/posts/2/shares/2');
1446
- })
1447
- .then(() => {
1448
- assert.ok(true, 'url: /posts/2/shares/2 was handled');
1449
- return this.visit('/posts/3/comments');
1450
- })
1451
- .then(() => {
1452
- assert.ok(true, 'url: /posts/3/shares was handled');
1453
- return this.visit('/posts/3/shares/3');
1454
- })
1455
- .then(() => {
1456
- assert.ok(true, 'url: /posts/3/shares/3 was handled');
1457
- });
1458
- }
1459
-
1460
- ['@test Routes with { resetNamespace: true } inherits model from parent route'](assert) {
1461
- assert.expect(6);
1462
-
1463
- this.router.map(function() {
1464
- this.route('the-post', { path: '/posts/:post_id' }, function() {
1465
- this.route('comments', { resetNamespace: true }, function() {});
1466
- });
1467
- });
1468
-
1469
- let post1 = {};
1470
- let post2 = {};
1471
- let post3 = {};
1472
-
1473
- let posts = {
1474
- 1: post1,
1475
- 2: post2,
1476
- 3: post3,
1477
- };
1478
-
1479
- this.add(
1480
- 'route:the-post',
1481
- Route.extend({
1482
- model(params) {
1483
- return posts[params.post_id];
1484
- },
1485
- })
1486
- );
1487
-
1488
- this.add(
1489
- 'route:comments',
1490
- Route.extend({
1491
- afterModel(post /*, transition */) {
1492
- let parent_model = this.modelFor('the-post');
1493
-
1494
- assert.equal(post, parent_model);
1495
- },
1496
- })
1497
- );
1498
-
1499
- return this.visit('/posts/1/comments')
1500
- .then(() => {
1501
- assert.ok(true, '/posts/1/comments');
1502
- return this.visit('/posts/2/comments');
1503
- })
1504
- .then(() => {
1505
- assert.ok(true, '/posts/2/comments');
1506
- return this.visit('/posts/3/comments');
1507
- })
1508
- .then(() => {
1509
- assert.ok(true, '/posts/3/comments');
1510
- });
1511
- }
1512
-
1513
- ['@test It is possible to get the model from a parent route'](assert) {
1514
- assert.expect(6);
1515
-
1516
- this.router.map(function() {
1517
- this.route('the-post', { path: '/posts/:post_id' }, function() {
1518
- this.route('comments', { resetNamespace: true });
1519
- });
1520
- });
1521
-
1522
- let post1 = {};
1523
- let post2 = {};
1524
- let post3 = {};
1525
- let currentPost;
1526
-
1527
- let posts = {
1528
- 1: post1,
1529
- 2: post2,
1530
- 3: post3,
1531
- };
1532
-
1533
- this.add(
1534
- 'route:the-post',
1535
- Route.extend({
1536
- model(params) {
1537
- return posts[params.post_id];
1538
- },
1539
- })
1540
- );
1541
-
1542
- this.add(
1543
- 'route:comments',
1544
- Route.extend({
1545
- model() {
1546
- assert.equal(this.modelFor('the-post'), currentPost);
1547
- },
1548
- })
1549
- );
1550
-
1551
- currentPost = post1;
1552
- return this.visit('/posts/1/comments')
1553
- .then(() => {
1554
- assert.ok(true, '/posts/1/comments has been handled');
1555
- currentPost = post2;
1556
- return this.visit('/posts/2/comments');
1557
- })
1558
- .then(() => {
1559
- assert.ok(true, '/posts/2/comments has been handled');
1560
- currentPost = post3;
1561
- return this.visit('/posts/3/comments');
1562
- })
1563
- .then(() => {
1564
- assert.ok(true, '/posts/3/comments has been handled');
1565
- });
1566
- }
1567
-
1568
- ['@test A redirection hook is provided'](assert) {
1569
- this.router.map(function() {
1570
- this.route('choose', { path: '/' });
1571
- this.route('home');
1572
- });
1573
-
1574
- let chooseFollowed = 0;
1575
- let destination = 'home';
1576
-
1577
- this.add(
1578
- 'route:choose',
1579
- Route.extend({
1580
- redirect() {
1581
- if (destination) {
1582
- this.transitionTo(destination);
1583
- }
1584
- },
1585
-
1586
- setupController() {
1587
- chooseFollowed++;
1588
- },
1589
- })
1590
- );
1591
-
1592
- return this.visit('/').then(() => {
1593
- let rootElement = document.getElementById('qunit-fixture');
1594
- assert.equal(
1595
- chooseFollowed,
1596
- 0,
1597
- "The choose route wasn't entered since a transition occurred"
1598
- );
1599
- assert.equal(
1600
- rootElement.querySelectorAll('h3.hours').length,
1601
- 1,
1602
- 'The home template was rendered'
1603
- );
1604
- assert.equal(
1605
- this.applicationInstance.lookup('controller:application').get('currentPath'),
1606
- 'home'
1607
- );
1608
- });
1609
- }
1610
-
1611
- ['@test Redirecting from the middle of a route aborts the remainder of the routes'](assert) {
1612
- assert.expect(3);
1613
-
1614
- this.router.map(function() {
1615
- this.route('home');
1616
- this.route('foo', function() {
1617
- this.route('bar', { resetNamespace: true }, function() {
1618
- this.route('baz');
1619
- });
1620
- });
1621
- });
1622
-
1623
- this.add(
1624
- 'route:bar',
1625
- Route.extend({
1626
- redirect() {
1627
- this.transitionTo('home');
1628
- },
1629
- setupController() {
1630
- assert.ok(false, 'Should transition before setupController');
1631
- },
1632
- })
1633
- );
1634
-
1635
- this.add(
1636
- 'route:bar-baz',
1637
- Route.extend({
1638
- enter() {
1639
- assert.ok(false, 'Should abort transition getting to next route');
1640
- },
1641
- })
1642
- );
1643
-
1644
- return this.visit('/').then(() => {
1645
- let router = this.applicationInstance.lookup('router:main');
1646
- this.handleURLAborts(assert, '/foo/bar/baz');
1647
- assert.equal(
1648
- this.applicationInstance.lookup('controller:application').get('currentPath'),
1649
- 'home'
1650
- );
1651
- assert.equal(router.get('location').getURL(), '/home');
1652
- });
1653
- }
1654
-
1655
- ['@test Redirecting to the current target in the middle of a route does not abort initial routing'](
1656
- assert
1657
- ) {
1658
- assert.expect(5);
1659
-
1660
- this.router.map(function() {
1661
- this.route('home');
1662
- this.route('foo', function() {
1663
- this.route('bar', { resetNamespace: true }, function() {
1664
- this.route('baz');
1665
- });
1666
- });
1667
- });
1668
-
1669
- let successCount = 0;
1670
-
1671
- this.add(
1672
- 'route:bar',
1673
- Route.extend({
1674
- redirect() {
1675
- return this.transitionTo('bar.baz').then(function() {
1676
- successCount++;
1677
- });
1678
- },
1679
-
1680
- setupController() {
1681
- assert.ok(true, "Should still invoke bar's setupController");
1682
- },
1683
- })
1684
- );
1685
-
1686
- this.add(
1687
- 'route:bar.baz',
1688
- Route.extend({
1689
- setupController() {
1690
- assert.ok(true, "Should still invoke bar.baz's setupController");
1691
- },
1692
- })
1693
- );
1694
-
1695
- return this.visit('/foo/bar/baz').then(() => {
1696
- assert.ok(true, '/foo/bar/baz has been handled');
1697
- assert.equal(
1698
- this.applicationInstance.lookup('controller:application').get('currentPath'),
1699
- 'foo.bar.baz'
1700
- );
1701
- assert.equal(successCount, 1, 'transitionTo success handler was called once');
1702
- });
1703
- }
1704
-
1705
- ['@test Redirecting to the current target with a different context aborts the remainder of the routes'](
1706
- assert
1707
- ) {
1708
- assert.expect(4);
1709
-
1710
- this.router.map(function() {
1711
- this.route('home');
1712
- this.route('foo', function() {
1713
- this.route('bar', { path: 'bar/:id', resetNamespace: true }, function() {
1714
- this.route('baz');
1715
- });
1716
- });
1717
- });
1718
-
1719
- let model = { id: 2 };
1720
-
1721
- let count = 0;
1722
-
1723
- this.add(
1724
- 'route:bar',
1725
- Route.extend({
1726
- afterModel() {
1727
- if (count++ > 10) {
1728
- assert.ok(false, 'infinite loop');
1729
- } else {
1730
- this.transitionTo('bar.baz', model);
1731
- }
1732
- },
1733
- })
1734
- );
1735
-
1736
- this.add(
1737
- 'route:bar.baz',
1738
- Route.extend({
1739
- setupController() {
1740
- assert.ok(true, 'Should still invoke setupController');
1741
- },
1742
- })
1743
- );
1744
-
1745
- return this.visit('/').then(() => {
1746
- this.handleURLAborts(assert, '/foo/bar/1/baz');
1747
- assert.equal(
1748
- this.applicationInstance.lookup('controller:application').get('currentPath'),
1749
- 'foo.bar.baz'
1750
- );
1751
- assert.equal(
1752
- this.applicationInstance
1753
- .lookup('router:main')
1754
- .get('location')
1755
- .getURL(),
1756
- '/foo/bar/2/baz'
1757
- );
1758
- });
1759
- }
1760
-
1761
- ['@test Transitioning from a parent event does not prevent currentPath from being set'](
1762
- assert
1763
- ) {
1764
- this.router.map(function() {
1765
- this.route('foo', function() {
1766
- this.route('bar', { resetNamespace: true }, function() {
1767
- this.route('baz');
1768
- });
1769
- this.route('qux');
1770
- });
1771
- });
1772
-
1773
- this.add(
1774
- 'route:foo',
1775
- Route.extend({
1776
- actions: {
1777
- goToQux() {
1778
- this.transitionTo('foo.qux');
1779
- },
1780
- },
1781
- })
1782
- );
1783
-
1784
- return this.visit('/foo/bar/baz').then(() => {
1785
- assert.ok(true, '/foo/bar/baz has been handled');
1786
- let applicationController = this.applicationInstance.lookup('controller:application');
1787
- let router = this.applicationInstance.lookup('router:main');
1788
- assert.equal(applicationController.get('currentPath'), 'foo.bar.baz');
1789
- run(() => router.send('goToQux'));
1790
- assert.equal(applicationController.get('currentPath'), 'foo.qux');
1791
- assert.equal(router.get('location').getURL(), '/foo/qux');
1792
- });
1793
- }
1794
-
1795
- ['@test Generated names can be customized when providing routes with dot notation'](assert) {
1796
- assert.expect(4);
1797
-
1798
- this.addTemplate('index', '<div>Index</div>');
1799
- this.addTemplate('application', "<h1>Home</h1><div class='main'>{{outlet}}</div>");
1800
- this.addTemplate('foo', "<div class='middle'>{{outlet}}</div>");
1801
- this.addTemplate('bar', "<div class='bottom'>{{outlet}}</div>");
1802
- this.addTemplate('bar.baz', '<p>{{name}}Bottom!</p>');
1803
-
1804
- this.router.map(function() {
1805
- this.route('foo', { path: '/top' }, function() {
1806
- this.route('bar', { path: '/middle', resetNamespace: true }, function() {
1807
- this.route('baz', { path: '/bottom' });
1808
- });
1809
- });
1810
- });
1811
-
1812
- this.add(
1813
- 'route:foo',
1814
- Route.extend({
1815
- renderTemplate() {
1816
- assert.ok(true, 'FooBarRoute was called');
1817
- return this._super(...arguments);
1818
- },
1819
- })
1820
- );
1821
-
1822
- this.add(
1823
- 'route:bar.baz',
1824
- Route.extend({
1825
- renderTemplate() {
1826
- assert.ok(true, 'BarBazRoute was called');
1827
- return this._super(...arguments);
1828
- },
1829
- })
1830
- );
1831
-
1832
- this.add(
1833
- 'controller:bar',
1834
- Controller.extend({
1835
- name: 'Bar',
1836
- })
1837
- );
1838
-
1839
- this.add(
1840
- 'controller:bar.baz',
1841
- Controller.extend({
1842
- name: 'BarBaz',
1843
- })
1844
- );
1845
-
1846
- return this.visit('/top/middle/bottom').then(() => {
1847
- assert.ok(true, '/top/middle/bottom has been handled');
1848
- let rootElement = document.getElementById('qunit-fixture');
1849
- assert.equal(
1850
- getTextOf(rootElement.querySelector('.main .middle .bottom p')),
1851
- 'BarBazBottom!',
1852
- 'The templates were rendered into their appropriate parents'
1853
- );
1854
- });
1855
- }
1856
-
1857
- ["@test Child routes render into their parent route's template by default"](assert) {
1858
- this.addTemplate('index', '<div>Index</div>');
1859
- this.addTemplate('application', "<h1>Home</h1><div class='main'>{{outlet}}</div>");
1860
- this.addTemplate('top', "<div class='middle'>{{outlet}}</div>");
1861
- this.addTemplate('middle', "<div class='bottom'>{{outlet}}</div>");
1862
- this.addTemplate('middle.bottom', '<p>Bottom!</p>');
1863
-
1864
- this.router.map(function() {
1865
- this.route('top', function() {
1866
- this.route('middle', { resetNamespace: true }, function() {
1867
- this.route('bottom');
1868
- });
1869
- });
1870
- });
1871
-
1872
- return this.visit('/top/middle/bottom').then(() => {
1873
- assert.ok(true, '/top/middle/bottom has been handled');
1874
- let rootElement = document.getElementById('qunit-fixture');
1875
- assert.equal(
1876
- getTextOf(rootElement.querySelector('.main .middle .bottom p')),
1877
- 'Bottom!',
1878
- 'The templates were rendered into their appropriate parents'
1879
- );
1880
- });
1881
- }
1882
-
1883
- ['@test Child routes render into specified template'](assert) {
1884
- this.addTemplate('index', '<div>Index</div>');
1885
- this.addTemplate('application', "<h1>Home</h1><div class='main'>{{outlet}}</div>");
1886
- this.addTemplate('top', "<div class='middle'>{{outlet}}</div>");
1887
- this.addTemplate('middle', "<div class='bottom'>{{outlet}}</div>");
1888
- this.addTemplate('middle.bottom', '<p>Bottom!</p>');
1889
-
1890
- this.router.map(function() {
1891
- this.route('top', function() {
1892
- this.route('middle', { resetNamespace: true }, function() {
1893
- this.route('bottom');
1894
- });
1895
- });
1896
- });
1897
-
1898
- this.add(
1899
- 'route:middle.bottom',
1900
- Route.extend({
1901
- renderTemplate() {
1902
- this.render('middle/bottom', { into: 'top' });
1903
- },
1904
- })
1905
- );
1906
-
1907
- return this.visit('/top/middle/bottom').then(() => {
1908
- assert.ok(true, '/top/middle/bottom has been handled');
1909
- let rootElement = document.getElementById('qunit-fixture');
1910
- assert.equal(
1911
- rootElement.querySelectorAll('.main .middle .bottom p').length,
1912
- 0,
1913
- 'should not render into the middle template'
1914
- );
1915
- assert.equal(
1916
- getTextOf(rootElement.querySelector('.main .middle > p')),
1917
- 'Bottom!',
1918
- 'The template was rendered into the top template'
1919
- );
1920
- });
1921
- }
1922
-
1923
- ['@test Rendering into specified template with slash notation'](assert) {
1924
- this.addTemplate('person.profile', 'profile {{outlet}}');
1925
- this.addTemplate('person.details', 'details!');
1926
-
1927
- this.router.map(function() {
1928
- this.route('home', { path: '/' });
1929
- });
1930
-
1931
- this.add(
1932
- 'route:home',
1933
- Route.extend({
1934
- renderTemplate() {
1935
- this.render('person/profile');
1936
- this.render('person/details', { into: 'person/profile' });
1937
- },
1938
- })
1939
- );
1940
-
1941
- return this.visit('/').then(() => {
1942
- let rootElement = document.getElementById('qunit-fixture');
1943
- assert.equal(
1944
- rootElement.textContent.trim(),
1945
- 'profile details!',
1946
- 'The templates were rendered'
1947
- );
1948
- });
1949
- }
1950
-
1951
- ['@test Parent route context change'](assert) {
1952
- let editCount = 0;
1953
- let editedPostIds = emberA();
1954
-
1955
- this.addTemplate('application', '{{outlet}}');
1956
- this.addTemplate('posts', '{{outlet}}');
1957
- this.addTemplate('post', '{{outlet}}');
1958
- this.addTemplate('post/index', 'showing');
1959
- this.addTemplate('post/edit', 'editing');
1960
-
1961
- this.router.map(function() {
1962
- this.route('posts', function() {
1963
- this.route('post', { path: '/:postId', resetNamespace: true }, function() {
1964
- this.route('edit');
1965
- });
1966
- });
1967
- });
1968
-
1969
- this.add(
1970
- 'route:posts',
1971
- Route.extend({
1972
- actions: {
1973
- showPost(context) {
1974
- this.transitionTo('post', context);
1975
- },
1976
- },
1977
- })
1978
- );
1979
-
1980
- this.add(
1981
- 'route:post',
1982
- Route.extend({
1983
- model(params) {
1984
- return { id: params.postId };
1985
- },
1986
-
1987
- serialize(model) {
1988
- return { postId: model.id };
1989
- },
1990
-
1991
- actions: {
1992
- editPost() {
1993
- this.transitionTo('post.edit');
1994
- },
1995
- },
1996
- })
1997
- );
1998
-
1999
- this.add(
2000
- 'route:post.edit',
2001
- Route.extend({
2002
- model() {
2003
- let postId = this.modelFor('post').id;
2004
- editedPostIds.push(postId);
2005
- return null;
2006
- },
2007
- setup() {
2008
- this._super(...arguments);
2009
- editCount++;
2010
- },
2011
- })
2012
- );
2013
-
2014
- return this.visit('/posts/1').then(() => {
2015
- assert.ok(true, '/posts/1 has been handled');
2016
- let router = this.applicationInstance.lookup('router:main');
2017
- run(() => router.send('editPost'));
2018
- run(() => router.send('showPost', { id: '2' }));
2019
- run(() => router.send('editPost'));
2020
- assert.equal(editCount, 2, 'set up the edit route twice without failure');
2021
- assert.deepEqual(
2022
- editedPostIds,
2023
- ['1', '2'],
2024
- 'modelFor posts.post returns the right context'
2025
- );
2026
- });
2027
- }
2028
-
2029
- ['@test Router accounts for rootURL on page load when using history location'](assert) {
2030
- let rootURL = window.location.pathname + '/app';
2031
- let postsTemplateRendered = false;
2032
- let setHistory;
2033
-
2034
- setHistory = function(obj, path) {
2035
- obj.set('history', { state: { path: path } });
2036
- };
2037
-
2038
- let location = HistoryLocation.create({
2039
- initState() {
2040
- let path = rootURL + '/posts';
2041
-
2042
- setHistory(this, path);
2043
- this.set('location', {
2044
- pathname: path,
2045
- href: 'http://localhost/' + path,
2046
- });
2047
- },
2048
-
2049
- replaceState(path) {
2050
- setHistory(this, path);
2051
- },
2052
-
2053
- pushState(path) {
2054
- setHistory(this, path);
2055
- },
2056
- });
2057
-
2058
- this.router.reopen({
2059
- // location: 'historyTest',
2060
- location,
2061
- rootURL: rootURL,
2062
- });
2063
-
2064
- this.router.map(function() {
2065
- this.route('posts', { path: '/posts' });
2066
- });
2067
-
2068
- this.add(
2069
- 'route:posts',
2070
- Route.extend({
2071
- model() {},
2072
- renderTemplate() {
2073
- postsTemplateRendered = true;
2074
- },
2075
- })
2076
- );
2077
-
2078
- return this.visit('/').then(() => {
2079
- assert.ok(postsTemplateRendered, 'Posts route successfully stripped from rootURL');
2080
-
2081
- runDestroy(location);
2082
- location = null;
2083
- });
2084
- }
2085
-
2086
- ['@test The rootURL is passed properly to the location implementation'](assert) {
2087
- assert.expect(1);
2088
- let rootURL = '/blahzorz';
2089
- this.add(
2090
- 'location:history-test',
2091
- HistoryLocation.extend({
2092
- rootURL: 'this is not the URL you are looking for',
2093
- history: {
2094
- pushState() {},
2095
- },
2096
- initState() {
2097
- assert.equal(this.get('rootURL'), rootURL);
2098
- },
2099
- })
2100
- );
2101
-
2102
- this.router.reopen({
2103
- location: 'history-test',
2104
- rootURL: rootURL,
2105
- // if we transition in this test we will receive failures
2106
- // if the tests are run from a static file
2107
- _doURLTransition() {
2108
- return RSVP.resolve('');
2109
- },
2110
- });
2111
-
2112
- return this.visit('/');
2113
- }
2114
-
2115
- ['@test Only use route rendered into main outlet for default into property on child'](assert) {
2116
- this.addTemplate('application', "{{outlet 'menu'}}{{outlet}}");
2117
- this.addTemplate('posts', '{{outlet}}');
2118
- this.addTemplate('posts.index', '<p class="posts-index">postsIndex</p>');
2119
- this.addTemplate('posts.menu', '<div class="posts-menu">postsMenu</div>');
2120
-
2121
- this.router.map(function() {
2122
- this.route('posts', function() {});
2123
- });
2124
-
2125
- this.add(
2126
- 'route:posts',
2127
- Route.extend({
2128
- renderTemplate() {
2129
- this.render();
2130
- this.render('posts/menu', {
2131
- into: 'application',
2132
- outlet: 'menu',
2133
- });
2134
- },
2135
- })
2136
- );
2137
-
2138
- return this.visit('/posts').then(() => {
2139
- assert.ok(true, '/posts has been handled');
2140
- let rootElement = document.getElementById('qunit-fixture');
2141
- assert.equal(
2142
- getTextOf(rootElement.querySelector('div.posts-menu')),
2143
- 'postsMenu',
2144
- 'The posts/menu template was rendered'
2145
- );
2146
- assert.equal(
2147
- getTextOf(rootElement.querySelector('p.posts-index')),
2148
- 'postsIndex',
2149
- 'The posts/index template was rendered'
2150
- );
2151
- });
2152
- }
2153
-
2154
- ['@test Generating a URL should not affect currentModel'](assert) {
2155
- this.router.map(function() {
2156
- this.route('post', { path: '/posts/:post_id' });
2157
- });
2158
-
2159
- let posts = {
2160
- 1: { id: 1 },
2161
- 2: { id: 2 },
2162
- };
2163
-
2164
- this.add(
2165
- 'route:post',
2166
- Route.extend({
2167
- model(params) {
2168
- return posts[params.post_id];
2169
- },
2170
- })
2171
- );
2172
-
2173
- return this.visit('/posts/1').then(() => {
2174
- assert.ok(true, '/posts/1 has been handled');
2175
-
2176
- let route = this.applicationInstance.lookup('route:post');
2177
- assert.equal(route.modelFor('post'), posts[1]);
2178
-
2179
- let url = this.applicationInstance.lookup('router:main').generate('post', posts[2]);
2180
- assert.equal(url, '/posts/2');
2181
- assert.equal(route.modelFor('post'), posts[1]);
2182
- });
2183
- }
2184
-
2185
- ["@test Nested index route is not overridden by parent's implicit index route"](assert) {
2186
- this.router.map(function() {
2187
- this.route('posts', function() {
2188
- this.route('index', { path: ':category' });
2189
- });
2190
- });
2191
-
2192
- return this.visit('/')
2193
- .then(() => {
2194
- let router = this.applicationInstance.lookup('router:main');
2195
- return router.transitionTo('posts', { category: 'emberjs' });
2196
- })
2197
- .then(() => {
2198
- let router = this.applicationInstance.lookup('router:main');
2199
- assert.deepEqual(router.location.path, '/posts/emberjs');
2200
- });
2201
- }
2202
-
2203
- ['@test Application template does not duplicate when re-rendered'](assert) {
2204
- this.addTemplate('application', '<h3 class="render-once">I render once</h3>{{outlet}}');
2205
-
2206
- this.router.map(function() {
2207
- this.route('posts');
2208
- });
2209
-
2210
- this.add(
2211
- 'route:application',
2212
- Route.extend({
2213
- model() {
2214
- return emberA();
2215
- },
2216
- })
2217
- );
2218
-
2219
- return this.visit('/posts').then(() => {
2220
- assert.ok(true, '/posts has been handled');
2221
- let rootElement = document.getElementById('qunit-fixture');
2222
- assert.equal(getTextOf(rootElement.querySelector('h3.render-once')), 'I render once');
2223
- });
2224
- }
2225
-
2226
- ['@test Child routes should render inside the application template if the application template causes a redirect'](
2227
- assert
2228
- ) {
2229
- this.addTemplate('application', '<h3>App</h3> {{outlet}}');
2230
- this.addTemplate('posts', 'posts');
2231
-
2232
- this.router.map(function() {
2233
- this.route('posts');
2234
- this.route('photos');
2235
- });
2236
-
2237
- this.add(
2238
- 'route:application',
2239
- Route.extend({
2240
- afterModel() {
2241
- this.transitionTo('posts');
2242
- },
2243
- })
2244
- );
2245
-
2246
- return this.visit('/posts').then(() => {
2247
- let rootElement = document.getElementById('qunit-fixture');
2248
- assert.equal(rootElement.textContent.trim(), 'App posts');
2249
- });
2250
- }
2251
-
2252
- ["@test The template is not re-rendered when the route's context changes"](assert) {
2253
- this.router.map(function() {
2254
- this.route('page', { path: '/page/:name' });
2255
- });
2256
-
2257
- this.add(
2258
- 'route:page',
2259
- Route.extend({
2260
- model(params) {
2261
- return EmberObject.create({ name: params.name });
2262
- },
2263
- })
2264
- );
2265
-
2266
- let insertionCount = 0;
2267
- this.add(
2268
- 'component:foo-bar',
2269
- Component.extend({
2270
- didInsertElement() {
2271
- insertionCount += 1;
2272
- },
2273
- })
2274
- );
2275
-
2276
- this.addTemplate('page', '<p>{{model.name}}{{foo-bar}}</p>');
2277
-
2278
- let rootElement = document.getElementById('qunit-fixture');
2279
- return this.visit('/page/first')
2280
- .then(() => {
2281
- assert.ok(true, '/page/first has been handled');
2282
- assert.equal(getTextOf(rootElement.querySelector('p')), 'first');
2283
- assert.equal(insertionCount, 1);
2284
- return this.visit('/page/second');
2285
- })
2286
- .then(() => {
2287
- assert.ok(true, '/page/second has been handled');
2288
- assert.equal(getTextOf(rootElement.querySelector('p')), 'second');
2289
- assert.equal(insertionCount, 1, 'view should have inserted only once');
2290
- let router = this.applicationInstance.lookup('router:main');
2291
- return run(() => router.transitionTo('page', EmberObject.create({ name: 'third' })));
2292
- })
2293
- .then(() => {
2294
- assert.equal(getTextOf(rootElement.querySelector('p')), 'third');
2295
- assert.equal(insertionCount, 1, 'view should still have inserted only once');
2296
- });
2297
- }
2298
-
2299
- ['@test The template is not re-rendered when two routes present the exact same template & controller'](
2300
- assert
2301
- ) {
2302
- this.router.map(function() {
2303
- this.route('first');
2304
- this.route('second');
2305
- this.route('third');
2306
- this.route('fourth');
2307
- });
2308
-
2309
- // Note add a component to test insertion
2310
-
2311
- let insertionCount = 0;
2312
- this.add(
2313
- 'component:x-input',
2314
- Component.extend({
2315
- didInsertElement() {
2316
- insertionCount += 1;
2317
- },
2318
- })
2319
- );
2320
-
2321
- let SharedRoute = Route.extend({
2322
- setupController() {
2323
- this.controllerFor('shared').set('message', 'This is the ' + this.routeName + ' message');
2324
- },
2325
-
2326
- renderTemplate() {
2327
- this.render('shared', { controller: 'shared' });
2328
- },
2329
- });
2330
-
2331
- this.add('route:shared', SharedRoute);
2332
- this.add('route:first', SharedRoute.extend());
2333
- this.add('route:second', SharedRoute.extend());
2334
- this.add('route:third', SharedRoute.extend());
2335
- this.add('route:fourth', SharedRoute.extend());
2336
-
2337
- this.add('controller:shared', Controller.extend());
2338
-
2339
- this.addTemplate('shared', '<p>{{message}}{{x-input}}</p>');
2340
-
2341
- let rootElement = document.getElementById('qunit-fixture');
2342
- return this.visit('/first')
2343
- .then(() => {
2344
- assert.ok(true, '/first has been handled');
2345
- assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the first message');
2346
- assert.equal(insertionCount, 1, 'expected one assertion');
2347
- return this.visit('/second');
2348
- })
2349
- .then(() => {
2350
- assert.ok(true, '/second has been handled');
2351
- assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the second message');
2352
- assert.equal(insertionCount, 1, 'expected one assertion');
2353
- return run(() => {
2354
- this.applicationInstance
2355
- .lookup('router:main')
2356
- .transitionTo('third')
2357
- .then(
2358
- function() {
2359
- assert.ok(true, 'expected transition');
2360
- },
2361
- function(reason) {
2362
- assert.ok(false, 'unexpected transition failure: ', QUnit.jsDump.parse(reason));
2363
- }
2364
- );
2365
- });
2366
- })
2367
- .then(() => {
2368
- assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the third message');
2369
- assert.equal(insertionCount, 1, 'expected one assertion');
2370
- return this.visit('fourth');
2371
- })
2372
- .then(() => {
2373
- assert.ok(true, '/fourth has been handled');
2374
- assert.equal(insertionCount, 1, 'expected one assertion');
2375
- assert.equal(getTextOf(rootElement.querySelector('p')), 'This is the fourth message');
2376
- });
2377
- }
2378
-
2379
- ['@test ApplicationRoute with model does not proxy the currentPath'](assert) {
2380
- let model = {};
2381
- let currentPath;
2382
-
2383
- this.router.map(function() {
2384
- this.route('index', { path: '/' });
2385
- });
2386
-
2387
- this.add(
2388
- 'route:application',
2389
- Route.extend({
2390
- model() {
2391
- return model;
2392
- },
2393
- })
2394
- );
2395
-
2396
- this.add(
2397
- 'controller:application',
2398
- Controller.extend({
2399
- currentPathDidChange: observer('currentPath', function() {
2400
- currentPath = this.currentPath;
2401
- }),
2402
- })
2403
- );
2404
-
2405
- return this.visit('/').then(() => {
2406
- assert.equal(currentPath, 'index', 'currentPath is index');
2407
- assert.equal(
2408
- 'currentPath' in model,
2409
- false,
2410
- 'should have defined currentPath on controller'
2411
- );
2412
- });
2413
- }
2414
-
2415
- ['@test Promises encountered on app load put app into loading state until resolved'](assert) {
2416
- assert.expect(2);
2417
-
2418
- let deferred = RSVP.defer();
2419
- this.router.map(function() {
2420
- this.route('index', { path: '/' });
2421
- });
2422
-
2423
- this.add(
2424
- 'route:index',
2425
- Route.extend({
2426
- model() {
2427
- return deferred.promise;
2428
- },
2429
- })
2430
- );
2431
-
2432
- this.addTemplate('index', '<p>INDEX</p>');
2433
- this.addTemplate('loading', '<p>LOADING</p>');
2434
-
2435
- run(() => this.visit('/'));
2436
- let rootElement = document.getElementById('qunit-fixture');
2437
- assert.equal(
2438
- getTextOf(rootElement.querySelector('p')),
2439
- 'LOADING',
2440
- 'The loading state is displaying.'
2441
- );
2442
- run(deferred.resolve);
2443
- assert.equal(
2444
- getTextOf(rootElement.querySelector('p')),
2445
- 'INDEX',
2446
- 'The index route is display.'
2447
- );
2448
- }
2449
-
2450
- ['@test Route should tear down multiple outlets'](assert) {
2451
- this.addTemplate('application', "{{outlet 'menu'}}{{outlet}}{{outlet 'footer'}}");
2452
- this.addTemplate('posts', '{{outlet}}');
2453
- this.addTemplate('users', 'users');
2454
- this.addTemplate('posts.index', '<p class="posts-index">postsIndex</p>');
2455
- this.addTemplate('posts.menu', '<div class="posts-menu">postsMenu</div>');
2456
- this.addTemplate('posts.footer', '<div class="posts-footer">postsFooter</div>');
2457
-
2458
- this.router.map(function() {
2459
- this.route('posts', function() {});
2460
- this.route('users', function() {});
2461
- });
2462
-
2463
- this.add(
2464
- 'route:posts',
2465
- Route.extend({
2466
- renderTemplate() {
2467
- this.render('posts/menu', {
2468
- into: 'application',
2469
- outlet: 'menu',
2470
- });
2471
-
2472
- this.render();
2473
-
2474
- this.render('posts/footer', {
2475
- into: 'application',
2476
- outlet: 'footer',
2477
- });
2478
- },
2479
- })
2480
- );
2481
-
2482
- let rootElement = document.getElementById('qunit-fixture');
2483
- return this.visit('/posts')
2484
- .then(() => {
2485
- assert.ok(true, '/posts has been handled');
2486
- assert.equal(
2487
- getTextOf(rootElement.querySelector('div.posts-menu')),
2488
- 'postsMenu',
2489
- 'The posts/menu template was rendered'
2490
- );
2491
- assert.equal(
2492
- getTextOf(rootElement.querySelector('p.posts-index')),
2493
- 'postsIndex',
2494
- 'The posts/index template was rendered'
2495
- );
2496
- assert.equal(
2497
- getTextOf(rootElement.querySelector('div.posts-footer')),
2498
- 'postsFooter',
2499
- 'The posts/footer template was rendered'
2500
- );
2501
-
2502
- return this.visit('/users');
2503
- })
2504
- .then(() => {
2505
- assert.ok(true, '/users has been handled');
2506
- assert.equal(
2507
- rootElement.querySelector('div.posts-menu'),
2508
- null,
2509
- 'The posts/menu template was removed'
2510
- );
2511
- assert.equal(
2512
- rootElement.querySelector('p.posts-index'),
2513
- null,
2514
- 'The posts/index template was removed'
2515
- );
2516
- assert.equal(
2517
- rootElement.querySelector('div.posts-footer'),
2518
- null,
2519
- 'The posts/footer template was removed'
2520
- );
2521
- });
2522
- }
2523
-
2524
- ['@test Route will assert if you try to explicitly render {into: ...} a missing template']() {
2525
- expectDeprecation(
2526
- /Rendering into a {{render}} helper that resolves to an {{outlet}} is deprecated./
2527
- );
2528
-
2529
- this.router.map(function() {
2530
- this.route('home', { path: '/' });
2531
- });
2532
-
2533
- this.add(
2534
- 'route:home',
2535
- Route.extend({
2536
- renderTemplate() {
2537
- this.render({ into: 'nonexistent' });
2538
- },
2539
- })
2540
- );
2541
-
2542
- expectAssertion(
2543
- () => this.visit('/'),
2544
- "You attempted to render into 'nonexistent' but it was not found"
2545
- );
2546
- }
2547
-
2548
- ['@test Route supports clearing outlet explicitly'](assert) {
2549
- this.addTemplate('application', "{{outlet}}{{outlet 'modal'}}");
2550
- this.addTemplate('posts', '{{outlet}}');
2551
- this.addTemplate('users', 'users');
2552
- this.addTemplate('posts.index', '<div class="posts-index">postsIndex {{outlet}}</div>');
2553
- this.addTemplate('posts.modal', '<div class="posts-modal">postsModal</div>');
2554
- this.addTemplate('posts.extra', '<div class="posts-extra">postsExtra</div>');
2555
-
2556
- this.router.map(function() {
2557
- this.route('posts', function() {});
2558
- this.route('users', function() {});
2559
- });
2560
-
2561
- this.add(
2562
- 'route:posts',
2563
- Route.extend({
2564
- actions: {
2565
- showModal() {
2566
- this.render('posts/modal', {
2567
- into: 'application',
2568
- outlet: 'modal',
2569
- });
2570
- },
2571
- hideModal() {
2572
- this.disconnectOutlet({
2573
- outlet: 'modal',
2574
- parentView: 'application',
2575
- });
2576
- },
2577
- },
2578
- })
2579
- );
2580
-
2581
- this.add(
2582
- 'route:posts.index',
2583
- Route.extend({
2584
- actions: {
2585
- showExtra() {
2586
- this.render('posts/extra', {
2587
- into: 'posts/index',
2588
- });
2589
- },
2590
- hideExtra() {
2591
- this.disconnectOutlet({ parentView: 'posts/index' });
2592
- },
2593
- },
2594
- })
2595
- );
2596
-
2597
- let rootElement = document.getElementById('qunit-fixture');
2598
-
2599
- return this.visit('/posts')
2600
- .then(() => {
2601
- let router = this.applicationInstance.lookup('router:main');
2602
-
2603
- assert.equal(
2604
- getTextOf(rootElement.querySelector('div.posts-index')),
2605
- 'postsIndex',
2606
- 'The posts/index template was rendered'
2607
- );
2608
- run(() => router.send('showModal'));
2609
- assert.equal(
2610
- getTextOf(rootElement.querySelector('div.posts-modal')),
2611
- 'postsModal',
2612
- 'The posts/modal template was rendered'
2613
- );
2614
- run(() => router.send('showExtra'));
2615
-
2616
- assert.equal(
2617
- getTextOf(rootElement.querySelector('div.posts-extra')),
2618
- 'postsExtra',
2619
- 'The posts/extra template was rendered'
2620
- );
2621
- run(() => router.send('hideModal'));
2622
-
2623
- assert.equal(
2624
- rootElement.querySelector('div.posts-modal'),
2625
- null,
2626
- 'The posts/modal template was removed'
2627
- );
2628
- run(() => router.send('hideExtra'));
2629
-
2630
- assert.equal(
2631
- rootElement.querySelector('div.posts-extra'),
2632
- null,
2633
- 'The posts/extra template was removed'
2634
- );
2635
- run(function() {
2636
- router.send('showModal');
2637
- });
2638
- assert.equal(
2639
- getTextOf(rootElement.querySelector('div.posts-modal')),
2640
- 'postsModal',
2641
- 'The posts/modal template was rendered'
2642
- );
2643
- run(function() {
2644
- router.send('showExtra');
2645
- });
2646
- assert.equal(
2647
- getTextOf(rootElement.querySelector('div.posts-extra')),
2648
- 'postsExtra',
2649
- 'The posts/extra template was rendered'
2650
- );
2651
- return this.visit('/users');
2652
- })
2653
- .then(() => {
2654
- assert.equal(
2655
- rootElement.querySelector('div.posts-index'),
2656
- null,
2657
- 'The posts/index template was removed'
2658
- );
2659
- assert.equal(
2660
- rootElement.querySelector('div.posts-modal'),
2661
- null,
2662
- 'The posts/modal template was removed'
2663
- );
2664
- assert.equal(
2665
- rootElement.querySelector('div.posts-extra'),
2666
- null,
2667
- 'The posts/extra template was removed'
2668
- );
2669
- });
2670
- }
2671
-
2672
- ['@test Route supports clearing outlet using string parameter'](assert) {
2673
- this.addTemplate('application', "{{outlet}}{{outlet 'modal'}}");
2674
- this.addTemplate('posts', '{{outlet}}');
2675
- this.addTemplate('users', 'users');
2676
- this.addTemplate('posts.index', '<div class="posts-index">postsIndex {{outlet}}</div>');
2677
- this.addTemplate('posts.modal', '<div class="posts-modal">postsModal</div>');
2678
-
2679
- this.router.map(function() {
2680
- this.route('posts', function() {});
2681
- this.route('users', function() {});
2682
- });
2683
-
2684
- this.add(
2685
- 'route:posts',
2686
- Route.extend({
2687
- actions: {
2688
- showModal() {
2689
- this.render('posts/modal', {
2690
- into: 'application',
2691
- outlet: 'modal',
2692
- });
2693
- },
2694
- hideModal() {
2695
- this.disconnectOutlet('modal');
2696
- },
2697
- },
2698
- })
2699
- );
2700
-
2701
- let rootElement = document.getElementById('qunit-fixture');
2702
- return this.visit('/posts')
2703
- .then(() => {
2704
- let router = this.applicationInstance.lookup('router:main');
2705
- assert.equal(
2706
- getTextOf(rootElement.querySelector('div.posts-index')),
2707
- 'postsIndex',
2708
- 'The posts/index template was rendered'
2709
- );
2710
- run(() => router.send('showModal'));
2711
- assert.equal(
2712
- getTextOf(rootElement.querySelector('div.posts-modal')),
2713
- 'postsModal',
2714
- 'The posts/modal template was rendered'
2715
- );
2716
- run(() => router.send('hideModal'));
2717
- assert.equal(
2718
- rootElement.querySelector('div.posts-modal'),
2719
- null,
2720
- 'The posts/modal template was removed'
2721
- );
2722
- return this.visit('/users');
2723
- })
2724
- .then(() => {
2725
- assert.equal(
2726
- rootElement.querySelector('div.posts-index'),
2727
- null,
2728
- 'The posts/index template was removed'
2729
- );
2730
- assert.equal(
2731
- rootElement.querySelector('div.posts-modal'),
2732
- null,
2733
- 'The posts/modal template was removed'
2734
- );
2735
- });
2736
- }
2737
-
2738
- ['@test Route silently fails when cleaning an outlet from an inactive view'](assert) {
2739
- assert.expect(1); // handleURL
2740
-
2741
- this.addTemplate('application', '{{outlet}}');
2742
- this.addTemplate('posts', "{{outlet 'modal'}}");
2743
- this.addTemplate('modal', 'A Yo.');
2744
-
2745
- this.router.map(function() {
2746
- this.route('posts');
2747
- });
2748
-
2749
- this.add(
2750
- 'route:posts',
2751
- Route.extend({
2752
- actions: {
2753
- hideSelf() {
2754
- this.disconnectOutlet({
2755
- outlet: 'main',
2756
- parentView: 'application',
2757
- });
2758
- },
2759
- showModal() {
2760
- this.render('modal', { into: 'posts', outlet: 'modal' });
2761
- },
2762
- hideModal() {
2763
- this.disconnectOutlet({ outlet: 'modal', parentView: 'posts' });
2764
- },
2765
- },
2766
- })
2767
- );
2768
-
2769
- return this.visit('/posts').then(() => {
2770
- assert.ok(true, '/posts has been handled');
2771
- let router = this.applicationInstance.lookup('router:main');
2772
- run(() => router.send('showModal'));
2773
- run(() => router.send('hideSelf'));
2774
- run(() => router.send('hideModal'));
2775
- });
2776
- }
2777
-
2778
- ['@test Router `willTransition` hook passes in cancellable transition'](assert) {
2779
- // Should hit willTransition 3 times, once for the initial route, and then 2 more times
2780
- // for the two handleURL calls below
2781
- assert.expect(5);
2782
-
2783
- this.router.map(function() {
2784
- this.route('nork');
2785
- this.route('about');
2786
- });
2787
-
2788
- this.router.reopen({
2789
- willTransition(_, _2, transition) {
2790
- assert.ok(true, 'willTransition was called');
2791
- if (transition.intent.url !== '/') {
2792
- transition.abort();
2793
- }
2794
- },
2795
- });
2796
-
2797
- this.add(
2798
- 'route:loading',
2799
- Route.extend({
2800
- activate() {
2801
- assert.ok(false, 'LoadingRoute was not entered');
2802
- },
2803
- })
2804
- );
2805
-
2806
- this.add(
2807
- 'route:nork',
2808
- Route.extend({
2809
- activate() {
2810
- assert.ok(false, 'NorkRoute was not entered');
2811
- },
2812
- })
2813
- );
2814
-
2815
- this.add(
2816
- 'route:about',
2817
- Route.extend({
2818
- activate() {
2819
- assert.ok(false, 'AboutRoute was not entered');
2820
- },
2821
- })
2822
- );
2823
-
2824
- return this.visit('/').then(() => {
2825
- this.handleURLAborts(assert, '/nork');
2826
- this.handleURLAborts(assert, '/about');
2827
- });
2828
- }
2829
-
2830
- ['@test Aborting/redirecting the transition in `willTransition` prevents LoadingRoute from being entered'](
2831
- assert
2832
- ) {
2833
- assert.expect(5);
2834
-
2835
- this.router.map(function() {
2836
- this.route('index');
2837
- this.route('nork');
2838
- this.route('about');
2839
- });
2840
-
2841
- let redirect = false;
2842
-
2843
- this.add(
2844
- 'route:index',
2845
- Route.extend({
2846
- actions: {
2847
- willTransition(transition) {
2848
- assert.ok(true, 'willTransition was called');
2849
- if (redirect) {
2850
- // router.js won't refire `willTransition` for this redirect
2851
- this.transitionTo('about');
2852
- } else {
2853
- transition.abort();
2854
- }
2855
- },
2856
- },
2857
- })
2858
- );
2859
-
2860
- let deferred = null;
2861
-
2862
- this.add(
2863
- 'route:loading',
2864
- Route.extend({
2865
- activate() {
2866
- assert.ok(deferred, 'LoadingRoute should be entered at this time');
2867
- },
2868
- deactivate() {
2869
- assert.ok(true, 'LoadingRoute was exited');
2870
- },
2871
- })
2872
- );
2873
-
2874
- this.add(
2875
- 'route:nork',
2876
- Route.extend({
2877
- activate() {
2878
- assert.ok(true, 'NorkRoute was entered');
2879
- },
2880
- })
2881
- );
2882
-
2883
- this.add(
2884
- 'route:about',
2885
- Route.extend({
2886
- activate() {
2887
- assert.ok(true, 'AboutRoute was entered');
2888
- },
2889
- model() {
2890
- if (deferred) {
2891
- return deferred.promise;
2892
- }
2893
- },
2894
- })
2895
- );
2896
-
2897
- return this.visit('/').then(() => {
2898
- let router = this.applicationInstance.lookup('router:main');
2899
- // Attempted transitions out of index should abort.
2900
- run(router, 'transitionTo', 'nork');
2901
- run(router, 'handleURL', '/nork');
2902
-
2903
- // Attempted transitions out of index should redirect to about
2904
- redirect = true;
2905
- run(router, 'transitionTo', 'nork');
2906
- run(router, 'transitionTo', 'index');
2907
-
2908
- // Redirected transitions out of index to a route with a
2909
- // promise model should pause the transition and
2910
- // activate LoadingRoute
2911
- deferred = RSVP.defer();
2912
- run(router, 'transitionTo', 'nork');
2913
- run(deferred.resolve);
2914
- });
2915
- }
2916
-
2917
- ['@test `didTransition` event fires on the router'](assert) {
2918
- assert.expect(3);
2919
-
2920
- this.router.map(function() {
2921
- this.route('nork');
2922
- });
2923
-
2924
- return this.visit('/')
2925
- .then(() => {
2926
- let router = this.applicationInstance.lookup('router:main');
2927
- router.one('didTransition', function() {
2928
- assert.ok(true, 'didTransition fired on initial routing');
2929
- });
2930
- this.visit('/');
2931
- })
2932
- .then(() => {
2933
- let router = this.applicationInstance.lookup('router:main');
2934
- router.one('didTransition', function() {
2935
- assert.ok(true, 'didTransition fired on the router');
2936
- assert.equal(
2937
- router.get('url'),
2938
- '/nork',
2939
- 'The url property is updated by the time didTransition fires'
2940
- );
2941
- });
2942
-
2943
- return this.visit('/nork');
2944
- });
2945
- }
2946
-
2947
- ['@test `didTransition` can be reopened'](assert) {
2948
- assert.expect(1);
2949
-
2950
- this.router.map(function() {
2951
- this.route('nork');
2952
- });
2953
-
2954
- this.router.reopen({
2955
- didTransition() {
2956
- this._super(...arguments);
2957
- assert.ok(true, 'reopened didTransition was called');
2958
- },
2959
- });
2960
-
2961
- return this.visit('/');
2962
- }
2963
-
2964
- ['@test `activate` event fires on the route'](assert) {
2965
- assert.expect(2);
2966
-
2967
- let eventFired = 0;
2968
-
2969
- this.router.map(function() {
2970
- this.route('nork');
2971
- });
2972
-
2973
- this.add(
2974
- 'route:nork',
2975
- Route.extend({
2976
- init() {
2977
- this._super(...arguments);
2978
-
2979
- this.on('activate', function() {
2980
- assert.equal(++eventFired, 1, 'activate event is fired once');
2981
- });
2982
- },
2983
-
2984
- activate() {
2985
- assert.ok(true, 'activate hook is called');
2986
- },
2987
- })
2988
- );
2989
-
2990
- return this.visit('/nork');
2991
- }
2992
-
2993
- ['@test `deactivate` event fires on the route'](assert) {
2994
- assert.expect(2);
2995
-
2996
- let eventFired = 0;
2997
-
2998
- this.router.map(function() {
2999
- this.route('nork');
3000
- this.route('dork');
3001
- });
3002
-
3003
- this.add(
3004
- 'route:nork',
3005
- Route.extend({
3006
- init() {
3007
- this._super(...arguments);
3008
-
3009
- this.on('deactivate', function() {
3010
- assert.equal(++eventFired, 1, 'deactivate event is fired once');
3011
- });
3012
- },
3013
-
3014
- deactivate() {
3015
- assert.ok(true, 'deactivate hook is called');
3016
- },
3017
- })
3018
- );
3019
-
3020
- return this.visit('/nork').then(() => this.visit('/dork'));
3021
- }
3022
-
3023
- ['@test Actions can be handled by inherited action handlers'](assert) {
3024
- assert.expect(4);
3025
-
3026
- let SuperRoute = Route.extend({
3027
- actions: {
3028
- foo() {
3029
- assert.ok(true, 'foo');
3030
- },
3031
- bar(msg) {
3032
- assert.equal(msg, 'HELLO');
3033
- },
3034
- },
3035
- });
3036
-
3037
- let RouteMixin = Mixin.create({
3038
- actions: {
3039
- bar(msg) {
3040
- assert.equal(msg, 'HELLO');
3041
- this._super(msg);
3042
- },
3043
- },
3044
- });
3045
-
3046
- this.add(
3047
- 'route:home',
3048
- SuperRoute.extend(RouteMixin, {
3049
- actions: {
3050
- baz() {
3051
- assert.ok(true, 'baz');
3052
- },
3053
- },
3054
- })
3055
- );
3056
-
3057
- this.addTemplate(
3058
- 'home',
3059
- `
3060
- <a class="do-foo" {{action "foo"}}>Do foo</a>
3061
- <a class="do-bar-with-arg" {{action "bar" "HELLO"}}>Do bar with arg</a>
3062
- <a class="do-baz" {{action "baz"}}>Do bar</a>
3063
- `
3064
- );
3065
-
3066
- return this.visit('/').then(() => {
3067
- let rootElement = document.getElementById('qunit-fixture');
3068
- rootElement.querySelector('.do-foo').click();
3069
- rootElement.querySelector('.do-bar-with-arg').click();
3070
- rootElement.querySelector('.do-baz').click();
3071
- });
3072
- }
3073
-
3074
- ['@test transitionTo returns Transition when passed a route name'](assert) {
3075
- assert.expect(1);
3076
-
3077
- this.router.map(function() {
3078
- this.route('root', { path: '/' });
3079
- this.route('bar');
3080
- });
3081
-
3082
- return this.visit('/').then(() => {
3083
- let router = this.applicationInstance.lookup('router:main');
3084
- let transition = run(() => router.transitionTo('bar'));
3085
- assert.equal(transition instanceof Transition, true);
3086
- });
3087
- }
3088
-
3089
- ['@test transitionTo returns Transition when passed a url'](assert) {
3090
- assert.expect(1);
3091
-
3092
- this.router.map(function() {
3093
- this.route('root', { path: '/' });
3094
- this.route('bar', function() {
3095
- this.route('baz');
3096
- });
3097
- });
3098
-
3099
- return this.visit('/').then(() => {
3100
- let router = this.applicationInstance.lookup('router:main');
3101
- let transition = run(() => router.transitionTo('/bar/baz'));
3102
- assert.equal(transition instanceof Transition, true);
3103
- });
3104
- }
3105
-
3106
- ['@test currentRouteName is a property installed on ApplicationController that can be used in transitionTo'](
3107
- assert
3108
- ) {
3109
- assert.expect(24);
3110
-
3111
- this.router.map(function() {
3112
- this.route('index', { path: '/' });
3113
- this.route('be', function() {
3114
- this.route('excellent', { resetNamespace: true }, function() {
3115
- this.route('to', { resetNamespace: true }, function() {
3116
- this.route('each', { resetNamespace: true }, function() {
3117
- this.route('other');
3118
- });
3119
- });
3120
- });
3121
- });
3122
- });
3123
-
3124
- return this.visit('/').then(() => {
3125
- let appController = this.applicationInstance.lookup('controller:application');
3126
- let router = this.applicationInstance.lookup('router:main');
3127
-
3128
- function transitionAndCheck(path, expectedPath, expectedRouteName) {
3129
- if (path) {
3130
- run(router, 'transitionTo', path);
3131
- }
3132
- assert.equal(appController.get('currentPath'), expectedPath);
3133
- assert.equal(appController.get('currentRouteName'), expectedRouteName);
3134
- }
3135
-
3136
- transitionAndCheck(null, 'index', 'index');
3137
- transitionAndCheck('/be', 'be.index', 'be.index');
3138
- transitionAndCheck('/be/excellent', 'be.excellent.index', 'excellent.index');
3139
- transitionAndCheck('/be/excellent/to', 'be.excellent.to.index', 'to.index');
3140
- transitionAndCheck('/be/excellent/to/each', 'be.excellent.to.each.index', 'each.index');
3141
- transitionAndCheck(
3142
- '/be/excellent/to/each/other',
3143
- 'be.excellent.to.each.other',
3144
- 'each.other'
3145
- );
3146
-
3147
- transitionAndCheck('index', 'index', 'index');
3148
- transitionAndCheck('be', 'be.index', 'be.index');
3149
- transitionAndCheck('excellent', 'be.excellent.index', 'excellent.index');
3150
- transitionAndCheck('to.index', 'be.excellent.to.index', 'to.index');
3151
- transitionAndCheck('each', 'be.excellent.to.each.index', 'each.index');
3152
- transitionAndCheck('each.other', 'be.excellent.to.each.other', 'each.other');
3153
- });
3154
- }
3155
-
3156
- ['@test Route model hook finds the same model as a manual find'](assert) {
3157
- let post;
3158
- let Post = EmberObject.extend();
3159
- this.add('model:post', Post);
3160
- Post.reopenClass({
3161
- find() {
3162
- post = this;
3163
- return {};
3164
- },
3165
- });
3166
-
3167
- this.router.map(function() {
3168
- this.route('post', { path: '/post/:post_id' });
3169
- });
3170
-
3171
- return this.visit('/post/1').then(() => {
3172
- assert.equal(Post, post);
3173
- });
3174
- }
3175
-
3176
- ['@test Routes can refresh themselves causing their model hooks to be re-run'](assert) {
3177
- this.router.map(function() {
3178
- this.route('parent', { path: '/parent/:parent_id' }, function() {
3179
- this.route('child');
3180
- });
3181
- });
3182
-
3183
- let appcount = 0;
3184
- this.add(
3185
- 'route:application',
3186
- Route.extend({
3187
- model() {
3188
- ++appcount;
3189
- },
3190
- })
3191
- );
3192
-
3193
- let parentcount = 0;
3194
- this.add(
3195
- 'route:parent',
3196
- Route.extend({
3197
- model(params) {
3198
- assert.equal(params.parent_id, '123');
3199
- ++parentcount;
3200
- },
3201
- actions: {
3202
- refreshParent() {
3203
- this.refresh();
3204
- },
3205
- },
3206
- })
3207
- );
3208
-
3209
- let childcount = 0;
3210
- this.add(
3211
- 'route:parent.child',
3212
- Route.extend({
3213
- model() {
3214
- ++childcount;
3215
- },
3216
- })
3217
- );
3218
-
3219
- let router;
3220
- return this.visit('/')
3221
- .then(() => {
3222
- router = this.applicationInstance.lookup('router:main');
3223
- assert.equal(appcount, 1);
3224
- assert.equal(parentcount, 0);
3225
- assert.equal(childcount, 0);
3226
- return run(router, 'transitionTo', 'parent.child', '123');
3227
- })
3228
- .then(() => {
3229
- assert.equal(appcount, 1);
3230
- assert.equal(parentcount, 1);
3231
- assert.equal(childcount, 1);
3232
- return run(router, 'send', 'refreshParent');
3233
- })
3234
- .then(() => {
3235
- assert.equal(appcount, 1);
3236
- assert.equal(parentcount, 2);
3237
- assert.equal(childcount, 2);
3238
- });
3239
- }
3240
-
3241
- ['@test Specifying non-existent controller name in route#render throws'](assert) {
3242
- assert.expect(1);
3243
-
3244
- this.router.map(function() {
3245
- this.route('home', { path: '/' });
3246
- });
3247
-
3248
- this.add(
3249
- 'route:home',
3250
- Route.extend({
3251
- renderTemplate() {
3252
- expectAssertion(() => {
3253
- this.render('homepage', {
3254
- controller: 'stefanpenneristhemanforme',
3255
- });
3256
- }, "You passed `controller: 'stefanpenneristhemanforme'` into the `render` method, but no such controller could be found.");
3257
- },
3258
- })
3259
- );
3260
-
3261
- return this.visit('/');
3262
- }
3263
-
3264
- ["@test Redirecting with null model doesn't error out"](assert) {
3265
- this.router.map(function() {
3266
- this.route('home', { path: '/' });
3267
- this.route('about', { path: '/about/:hurhurhur' });
3268
- });
3269
-
3270
- this.add(
3271
- 'route:about',
3272
- Route.extend({
3273
- serialize: function(model) {
3274
- if (model === null) {
3275
- return { hurhurhur: 'TreeklesMcGeekles' };
3276
- }
3277
- },
3278
- })
3279
- );
3280
-
3281
- this.add(
3282
- 'route:home',
3283
- Route.extend({
3284
- beforeModel() {
3285
- this.transitionTo('about', null);
3286
- },
3287
- })
3288
- );
3289
-
3290
- return this.visit('/').then(() => {
3291
- let router = this.applicationInstance.lookup('router:main');
3292
- assert.equal(router.get('location.path'), '/about/TreeklesMcGeekles');
3293
- });
3294
- }
3295
-
3296
- ['@test rejecting the model hooks promise with a non-error prints the `message` property'](
3297
- assert
3298
- ) {
3299
- assert.expect(5);
3300
-
3301
- let rejectedMessage = 'OMG!! SOOOOOO BAD!!!!';
3302
- let rejectedStack = 'Yeah, buddy: stack gets printed too.';
3303
-
3304
- this.router.map(function() {
3305
- this.route('yippie', { path: '/' });
3306
- });
3307
-
3308
- console.error = function(initialMessage, errorMessage, errorStack) {
3309
- assert.equal(
3310
- initialMessage,
3311
- 'Error while processing route: yippie',
3312
- 'a message with the current route name is printed'
3313
- );
3314
- assert.equal(
3315
- errorMessage,
3316
- rejectedMessage,
3317
- "the rejected reason's message property is logged"
3318
- );
3319
- assert.equal(errorStack, rejectedStack, "the rejected reason's stack property is logged");
3320
- };
3321
-
3322
- this.add(
3323
- 'route:yippie',
3324
- Route.extend({
3325
- model() {
3326
- return RSVP.reject({
3327
- message: rejectedMessage,
3328
- stack: rejectedStack,
3329
- });
3330
- },
3331
- })
3332
- );
3333
-
3334
- return assert.throws(
3335
- () => {
3336
- return this.visit('/');
3337
- },
3338
- function(err) {
3339
- assert.equal(err.message, rejectedMessage);
3340
- return true;
3341
- },
3342
- 'expected an exception'
3343
- );
3344
- }
3345
-
3346
- ['@test rejecting the model hooks promise with an error with `errorThrown` property prints `errorThrown.message` property'](
3347
- assert
3348
- ) {
3349
- assert.expect(5);
3350
- let rejectedMessage = 'OMG!! SOOOOOO BAD!!!!';
3351
- let rejectedStack = 'Yeah, buddy: stack gets printed too.';
3352
-
3353
- this.router.map(function() {
3354
- this.route('yippie', { path: '/' });
3355
- });
3356
-
3357
- console.error = function(initialMessage, errorMessage, errorStack) {
3358
- assert.equal(
3359
- initialMessage,
3360
- 'Error while processing route: yippie',
3361
- 'a message with the current route name is printed'
3362
- );
3363
- assert.equal(
3364
- errorMessage,
3365
- rejectedMessage,
3366
- "the rejected reason's message property is logged"
3367
- );
3368
- assert.equal(errorStack, rejectedStack, "the rejected reason's stack property is logged");
3369
- };
3370
-
3371
- this.add(
3372
- 'route:yippie',
3373
- Route.extend({
3374
- model() {
3375
- return RSVP.reject({
3376
- errorThrown: { message: rejectedMessage, stack: rejectedStack },
3377
- });
3378
- },
3379
- })
3380
- );
3381
-
3382
- assert.throws(
3383
- () => this.visit('/'),
3384
- function(err) {
3385
- assert.equal(err.message, rejectedMessage);
3386
- return true;
3387
- },
3388
- 'expected an exception'
3389
- );
3390
- }
3391
-
3392
- ['@test rejecting the model hooks promise with no reason still logs error'](assert) {
3393
- assert.expect(2);
3394
- this.router.map(function() {
3395
- this.route('wowzers', { path: '/' });
3396
- });
3397
-
3398
- console.error = function(initialMessage) {
3399
- assert.equal(
3400
- initialMessage,
3401
- 'Error while processing route: wowzers',
3402
- 'a message with the current route name is printed'
3403
- );
3404
- };
3405
-
3406
- this.add(
3407
- 'route:wowzers',
3408
- Route.extend({
3409
- model() {
3410
- return RSVP.reject();
3411
- },
3412
- })
3413
- );
3414
-
3415
- return assert.throws(() => this.visit('/'));
3416
- }
3417
-
3418
- ['@test rejecting the model hooks promise with a string shows a good error'](assert) {
3419
- assert.expect(3);
3420
- let rejectedMessage = 'Supercalifragilisticexpialidocious';
3421
-
3422
- this.router.map(function() {
3423
- this.route('yondo', { path: '/' });
3424
- });
3425
-
3426
- console.error = function(initialMessage, errorMessage) {
3427
- assert.equal(
3428
- initialMessage,
3429
- 'Error while processing route: yondo',
3430
- 'a message with the current route name is printed'
3431
- );
3432
- assert.equal(
3433
- errorMessage,
3434
- rejectedMessage,
3435
- "the rejected reason's message property is logged"
3436
- );
3437
- };
3438
-
3439
- this.add(
3440
- 'route:yondo',
3441
- Route.extend({
3442
- model() {
3443
- return RSVP.reject(rejectedMessage);
3444
- },
3445
- })
3446
- );
3447
-
3448
- assert.throws(() => this.visit('/'), new RegExp(rejectedMessage), 'expected an exception');
3449
- }
3450
-
3451
- ["@test willLeave, willChangeContext, willChangeModel actions don't fire unless feature flag enabled"](
3452
- assert
3453
- ) {
3454
- assert.expect(1);
3455
-
3456
- this.router.map(function() {
3457
- this.route('about');
3458
- });
3459
-
3460
- function shouldNotFire() {
3461
- assert.ok(false, "this action shouldn't have been received");
3462
- }
3463
-
3464
- this.add(
3465
- 'route:index',
3466
- Route.extend({
3467
- actions: {
3468
- willChangeModel: shouldNotFire,
3469
- willChangeContext: shouldNotFire,
3470
- willLeave: shouldNotFire,
3471
- },
3472
- })
3473
- );
3474
-
3475
- this.add(
3476
- 'route:about',
3477
- Route.extend({
3478
- setupController() {
3479
- assert.ok(true, 'about route was entered');
3480
- },
3481
- })
3482
- );
3483
-
3484
- return this.visit('/about');
3485
- }
3486
-
3487
- ['@test Errors in transitionTo within redirect hook are logged'](assert) {
3488
- assert.expect(4);
3489
- let actual = [];
3490
-
3491
- this.router.map(function() {
3492
- this.route('yondo', { path: '/' });
3493
- this.route('stink-bomb');
3494
- });
3495
-
3496
- this.add(
3497
- 'route:yondo',
3498
- Route.extend({
3499
- redirect() {
3500
- this.transitionTo('stink-bomb', { something: 'goes boom' });
3501
- },
3502
- })
3503
- );
3504
-
3505
- console.error = function() {
3506
- // push the arguments onto an array so we can detect if the error gets logged twice
3507
- actual.push(arguments);
3508
- };
3509
-
3510
- assert.throws(() => this.visit('/'), /More context objects were passed/);
3511
-
3512
- assert.equal(actual.length, 1, 'the error is only logged once');
3513
- assert.equal(actual[0][0], 'Error while processing route: yondo', 'source route is printed');
3514
- assert.ok(
3515
- actual[0][1].match(
3516
- /More context objects were passed than there are dynamic segments for the route: stink-bomb/
3517
- ),
3518
- 'the error is printed'
3519
- );
3520
- }
3521
-
3522
- ['@test Errors in transition show error template if available'](assert) {
3523
- this.addTemplate('error', "<div id='error'>Error!</div>");
3524
-
3525
- this.router.map(function() {
3526
- this.route('yondo', { path: '/' });
3527
- this.route('stink-bomb');
3528
- });
3529
-
3530
- this.add(
3531
- 'route:yondo',
3532
- Route.extend({
3533
- redirect() {
3534
- this.transitionTo('stink-bomb', { something: 'goes boom' });
3535
- },
3536
- })
3537
- );
3538
- console.error = () => {};
3539
-
3540
- return this.visit('/').then(() => {
3541
- let rootElement = document.querySelector('#qunit-fixture');
3542
- assert.equal(
3543
- rootElement.querySelectorAll('#error').length,
3544
- 1,
3545
- 'Error template was rendered.'
3546
- );
3547
- });
3548
- }
3549
-
3550
- ['@test Route#resetController gets fired when changing models and exiting routes'](assert) {
3551
- assert.expect(4);
3552
-
3553
- this.router.map(function() {
3554
- this.route('a', function() {
3555
- this.route('b', { path: '/b/:id', resetNamespace: true }, function() {});
3556
- this.route('c', { path: '/c/:id', resetNamespace: true }, function() {});
3557
- });
3558
- this.route('out');
3559
- });
3560
-
3561
- let calls = [];
3562
-
3563
- let SpyRoute = Route.extend({
3564
- setupController(/* controller, model, transition */) {
3565
- calls.push(['setup', this.routeName]);
3566
- },
3567
-
3568
- resetController(/* controller */) {
3569
- calls.push(['reset', this.routeName]);
3570
- },
3571
- });
3572
-
3573
- this.add('route:a', SpyRoute.extend());
3574
- this.add('route:b', SpyRoute.extend());
3575
- this.add('route:c', SpyRoute.extend());
3576
- this.add('route:out', SpyRoute.extend());
3577
-
3578
- let router;
3579
- return this.visit('/')
3580
- .then(() => {
3581
- router = this.applicationInstance.lookup('router:main');
3582
- assert.deepEqual(calls, []);
3583
- return run(router, 'transitionTo', 'b', 'b-1');
3584
- })
3585
- .then(() => {
3586
- assert.deepEqual(calls, [['setup', 'a'], ['setup', 'b']]);
3587
- calls.length = 0;
3588
- return run(router, 'transitionTo', 'c', 'c-1');
3589
- })
3590
- .then(() => {
3591
- assert.deepEqual(calls, [['reset', 'b'], ['setup', 'c']]);
3592
- calls.length = 0;
3593
- return run(router, 'transitionTo', 'out');
3594
- })
3595
- .then(() => {
3596
- assert.deepEqual(calls, [['reset', 'c'], ['reset', 'a'], ['setup', 'out']]);
3597
- });
3598
- }
3599
-
3600
- ['@test Exception during initialization of non-initial route is not swallowed'](assert) {
3601
- this.router.map(function() {
3602
- this.route('boom');
3603
- });
3604
- this.add(
3605
- 'route:boom',
3606
- Route.extend({
3607
- init() {
3608
- throw new Error('boom!');
3609
- },
3610
- })
3611
- );
3612
-
3613
- return assert.throws(() => this.visit('/boom'), /\bboom\b/);
3614
- }
3615
-
3616
- ['@test Exception during initialization of initial route is not swallowed'](assert) {
3617
- this.router.map(function() {
3618
- this.route('boom', { path: '/' });
3619
- });
3620
- this.add(
3621
- 'route:boom',
3622
- Route.extend({
3623
- init() {
3624
- throw new Error('boom!');
3625
- },
3626
- })
3627
- );
3628
- return assert.throws(() => this.visit('/'), /\bboom\b/);
3629
- }
3630
-
3631
- ['@test {{outlet}} works when created after initial render'](assert) {
3632
- this.addTemplate('sample', 'Hi{{#if showTheThing}}{{outlet}}{{/if}}Bye');
3633
- this.addTemplate('sample.inner', 'Yay');
3634
- this.addTemplate('sample.inner2', 'Boo');
3635
- this.router.map(function() {
3636
- this.route('sample', { path: '/' }, function() {
3637
- this.route('inner', { path: '/' });
3638
- this.route('inner2', { path: '/2' });
3639
- });
3640
- });
3641
-
3642
- let rootElement;
3643
- return this.visit('/')
3644
- .then(() => {
3645
- rootElement = document.getElementById('qunit-fixture');
3646
- assert.equal(rootElement.textContent.trim(), 'HiBye', 'initial render');
3647
-
3648
- run(() => this.applicationInstance.lookup('controller:sample').set('showTheThing', true));
3649
-
3650
- assert.equal(rootElement.textContent.trim(), 'HiYayBye', 'second render');
3651
- return this.visit('/2');
3652
- })
3653
- .then(() => {
3654
- assert.equal(rootElement.textContent.trim(), 'HiBooBye', 'third render');
3655
- });
3656
- }
3657
-
3658
- ['@test Can render into a named outlet at the top level'](assert) {
3659
- this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
3660
- this.addTemplate('modal', 'Hello world');
3661
- this.addTemplate('index', 'The index');
3662
- this.router.map(function() {
3663
- this.route('index', { path: '/' });
3664
- });
3665
- this.add(
3666
- 'route:application',
3667
- Route.extend({
3668
- renderTemplate() {
3669
- this.render();
3670
- this.render('modal', {
3671
- into: 'application',
3672
- outlet: 'other',
3673
- });
3674
- },
3675
- })
3676
- );
3677
-
3678
- return this.visit('/').then(() => {
3679
- let rootElement = document.getElementById('qunit-fixture');
3680
- assert.equal(
3681
- rootElement.textContent.trim(),
3682
- 'A-The index-B-Hello world-C',
3683
- 'initial render'
3684
- );
3685
- });
3686
- }
3687
-
3688
- ['@test Can disconnect a named outlet at the top level'](assert) {
3689
- this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
3690
- this.addTemplate('modal', 'Hello world');
3691
- this.addTemplate('index', 'The index');
3692
- this.router.map(function() {
3693
- this.route('index', { path: '/' });
3694
- });
3695
- this.add(
3696
- 'route:application',
3697
- Route.extend({
3698
- renderTemplate() {
3699
- this.render();
3700
- this.render('modal', {
3701
- into: 'application',
3702
- outlet: 'other',
3703
- });
3704
- },
3705
- actions: {
3706
- banish() {
3707
- this.disconnectOutlet({
3708
- parentView: 'application',
3709
- outlet: 'other',
3710
- });
3711
- },
3712
- },
3713
- })
3714
- );
3715
-
3716
- return this.visit('/').then(() => {
3717
- let rootElement = document.getElementById('qunit-fixture');
3718
- assert.equal(
3719
- rootElement.textContent.trim(),
3720
- 'A-The index-B-Hello world-C',
3721
- 'initial render'
3722
- );
3723
-
3724
- run(this.applicationInstance.lookup('router:main'), 'send', 'banish');
3725
-
3726
- assert.equal(rootElement.textContent.trim(), 'A-The index-B--C', 'second render');
3727
- });
3728
- }
3729
-
3730
- ['@test Can render into a named outlet at the top level, with empty main outlet'](assert) {
3731
- this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
3732
- this.addTemplate('modal', 'Hello world');
3733
-
3734
- this.router.map(function() {
3735
- this.route('hasNoTemplate', { path: '/' });
3736
- });
3737
-
3738
- this.add(
3739
- 'route:application',
3740
- Route.extend({
3741
- renderTemplate() {
3742
- this.render();
3743
- this.render('modal', {
3744
- into: 'application',
3745
- outlet: 'other',
3746
- });
3747
- },
3748
- })
3749
- );
3750
-
3751
- return this.visit('/').then(() => {
3752
- let rootElement = document.getElementById('qunit-fixture');
3753
- assert.equal(rootElement.textContent.trim(), 'A--B-Hello world-C', 'initial render');
3754
- });
3755
- }
3756
-
3757
- ['@test Can render into a named outlet at the top level, later'](assert) {
3758
- this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
3759
- this.addTemplate('modal', 'Hello world');
3760
- this.addTemplate('index', 'The index');
3761
- this.router.map(function() {
3762
- this.route('index', { path: '/' });
3763
- });
3764
- this.add(
3765
- 'route:application',
3766
- Route.extend({
3767
- actions: {
3768
- launch() {
3769
- this.render('modal', {
3770
- into: 'application',
3771
- outlet: 'other',
3772
- });
3773
- },
3774
- },
3775
- })
3776
- );
3777
-
3778
- return this.visit('/').then(() => {
3779
- let rootElement = document.getElementById('qunit-fixture');
3780
- assert.equal(rootElement.textContent.trim(), 'A-The index-B--C', 'initial render');
3781
- run(this.applicationInstance.lookup('router:main'), 'send', 'launch');
3782
- assert.equal(
3783
- rootElement.textContent.trim(),
3784
- 'A-The index-B-Hello world-C',
3785
- 'second render'
3786
- );
3787
- });
3788
- }
3789
-
3790
- ["@test Can render routes with no 'main' outlet and their children"](assert) {
3791
- this.addTemplate('application', '<div id="application">{{outlet "app"}}</div>');
3792
- this.addTemplate(
3793
- 'app',
3794
- '<div id="app-common">{{outlet "common"}}</div><div id="app-sub">{{outlet "sub"}}</div>'
3795
- );
3796
- this.addTemplate('common', '<div id="common"></div>');
3797
- this.addTemplate('sub', '<div id="sub"></div>');
3798
-
3799
- this.router.map(function() {
3800
- this.route('app', { path: '/app' }, function() {
3801
- this.route('sub', { path: '/sub', resetNamespace: true });
3802
- });
3803
- });
3804
-
3805
- this.add(
3806
- 'route:app',
3807
- Route.extend({
3808
- renderTemplate() {
3809
- this.render('app', {
3810
- outlet: 'app',
3811
- into: 'application',
3812
- });
3813
- this.render('common', {
3814
- outlet: 'common',
3815
- into: 'app',
3816
- });
3817
- },
3818
- })
3819
- );
3820
-
3821
- this.add(
3822
- 'route:sub',
3823
- Route.extend({
3824
- renderTemplate() {
3825
- this.render('sub', {
3826
- outlet: 'sub',
3827
- into: 'app',
3828
- });
3829
- },
3830
- })
3831
- );
3832
-
3833
- let rootElement;
3834
- return this.visit('/app')
3835
- .then(() => {
3836
- rootElement = document.getElementById('qunit-fixture');
3837
- assert.equal(
3838
- rootElement.querySelectorAll('#app-common #common').length,
3839
- 1,
3840
- 'Finds common while viewing /app'
3841
- );
3842
- return this.visit('/app/sub');
3843
- })
3844
- .then(() => {
3845
- assert.equal(
3846
- rootElement.querySelectorAll('#app-common #common').length,
3847
- 1,
3848
- 'Finds common while viewing /app/sub'
3849
- );
3850
- assert.equal(
3851
- rootElement.querySelectorAll('#app-sub #sub').length,
3852
- 1,
3853
- 'Finds sub while viewing /app/sub'
3854
- );
3855
- });
3856
- }
3857
-
3858
- ['@test Tolerates stacked renders'](assert) {
3859
- this.addTemplate('application', '{{outlet}}{{outlet "modal"}}');
3860
- this.addTemplate('index', 'hi');
3861
- this.addTemplate('layer', 'layer');
3862
- this.router.map(function() {
3863
- this.route('index', { path: '/' });
3864
- });
3865
- this.add(
3866
- 'route:application',
3867
- Route.extend({
3868
- actions: {
3869
- openLayer() {
3870
- this.render('layer', {
3871
- into: 'application',
3872
- outlet: 'modal',
3873
- });
3874
- },
3875
- close() {
3876
- this.disconnectOutlet({
3877
- outlet: 'modal',
3878
- parentView: 'application',
3879
- });
3880
- },
3881
- },
3882
- })
3883
- );
3884
-
3885
- return this.visit('/').then(() => {
3886
- let rootElement = document.getElementById('qunit-fixture');
3887
- let router = this.applicationInstance.lookup('router:main');
3888
- assert.equal(rootElement.textContent.trim(), 'hi');
3889
- run(router, 'send', 'openLayer');
3890
- assert.equal(rootElement.textContent.trim(), 'hilayer');
3891
- run(router, 'send', 'openLayer');
3892
- assert.equal(rootElement.textContent.trim(), 'hilayer');
3893
- run(router, 'send', 'close');
3894
- assert.equal(rootElement.textContent.trim(), 'hi');
3895
- });
3896
- }
3897
-
3898
- ['@test Renders child into parent with non-default template name'](assert) {
3899
- this.addTemplate('application', '<div class="a">{{outlet}}</div>');
3900
- this.addTemplate('exports.root', '<div class="b">{{outlet}}</div>');
3901
- this.addTemplate('exports.index', '<div class="c"></div>');
3902
-
3903
- this.router.map(function() {
3904
- this.route('root', function() {});
3905
- });
3906
-
3907
- this.add(
3908
- 'route:root',
3909
- Route.extend({
3910
- renderTemplate() {
3911
- this.render('exports/root');
3912
- },
3913
- })
3914
- );
3915
-
3916
- this.add(
3917
- 'route:root.index',
3918
- Route.extend({
3919
- renderTemplate() {
3920
- this.render('exports/index');
3921
- },
3922
- })
3923
- );
3924
-
3925
- return this.visit('/root').then(() => {
3926
- let rootElement = document.getElementById('qunit-fixture');
3927
- assert.equal(rootElement.querySelectorAll('.a .b .c').length, 1);
3928
- });
3929
- }
3930
-
3931
- ["@test Allows any route to disconnectOutlet another route's templates"](assert) {
3932
- this.addTemplate('application', '{{outlet}}{{outlet "modal"}}');
3933
- this.addTemplate('index', 'hi');
3934
- this.addTemplate('layer', 'layer');
3935
- this.router.map(function() {
3936
- this.route('index', { path: '/' });
3937
- });
3938
- this.add(
3939
- 'route:application',
3940
- Route.extend({
3941
- actions: {
3942
- openLayer() {
3943
- this.render('layer', {
3944
- into: 'application',
3945
- outlet: 'modal',
3946
- });
3947
- },
3948
- },
3949
- })
3950
- );
3951
- this.add(
3952
- 'route:index',
3953
- Route.extend({
3954
- actions: {
3955
- close() {
3956
- this.disconnectOutlet({
3957
- parentView: 'application',
3958
- outlet: 'modal',
3959
- });
3960
- },
3961
- },
3962
- })
3963
- );
3964
-
3965
- return this.visit('/').then(() => {
3966
- let rootElement = document.getElementById('qunit-fixture');
3967
- let router = this.applicationInstance.lookup('router:main');
3968
- assert.equal(rootElement.textContent.trim(), 'hi');
3969
- run(router, 'send', 'openLayer');
3970
- assert.equal(rootElement.textContent.trim(), 'hilayer');
3971
- run(router, 'send', 'close');
3972
- assert.equal(rootElement.textContent.trim(), 'hi');
3973
- });
3974
- }
3975
-
3976
- ['@test Can this.render({into:...}) the render helper'](assert) {
3977
- expectDeprecation(
3978
- /Rendering into a {{render}} helper that resolves to an {{outlet}} is deprecated./
3979
- );
3980
-
3981
- expectDeprecation(() => {
3982
- this.addTemplate('application', '{{render "sidebar"}}');
3983
- }, /Please refactor [\w\{\}"` ]+ to a component/);
3984
- this.router.map(function() {
3985
- this.route('index', { path: '/' });
3986
- });
3987
- this.addTemplate('sidebar', '<div class="sidebar">{{outlet}}</div>');
3988
- this.addTemplate('index', 'other');
3989
- this.addTemplate('bar', 'bar');
3990
-
3991
- this.add(
3992
- 'route:index',
3993
- Route.extend({
3994
- renderTemplate() {
3995
- this.render({ into: 'sidebar' });
3996
- },
3997
- actions: {
3998
- changeToBar() {
3999
- this.disconnectOutlet({
4000
- parentView: 'sidebar',
4001
- outlet: 'main',
4002
- });
4003
- this.render('bar', { into: 'sidebar' });
4004
- },
4005
- },
4006
- })
4007
- );
4008
-
4009
- return this.visit('/').then(() => {
4010
- let rootElement = document.getElementById('qunit-fixture');
4011
- let router = this.applicationInstance.lookup('router:main');
4012
- assert.equal(getTextOf(rootElement.querySelector('.sidebar')), 'other');
4013
- run(router, 'send', 'changeToBar');
4014
- assert.equal(getTextOf(rootElement.querySelector('.sidebar')), 'bar');
4015
- });
4016
- }
4017
-
4018
- ['@test Can disconnect from the render helper'](assert) {
4019
- expectDeprecation(
4020
- /Rendering into a {{render}} helper that resolves to an {{outlet}} is deprecated./
4021
- );
4022
-
4023
- expectDeprecation(() => {
4024
- this.addTemplate('application', '{{render "sidebar"}}');
4025
- }, /Please refactor [\w\{\}"` ]+ to a component/);
4026
- this.router.map(function() {
4027
- this.route('index', { path: '/' });
4028
- });
4029
- this.addTemplate('sidebar', '<div class="sidebar">{{outlet}}</div>');
4030
- this.addTemplate('index', 'other');
4031
-
4032
- this.add(
4033
- 'route:index',
4034
- Route.extend({
4035
- renderTemplate() {
4036
- this.render({ into: 'sidebar' });
4037
- },
4038
- actions: {
4039
- disconnect: function() {
4040
- this.disconnectOutlet({
4041
- parentView: 'sidebar',
4042
- outlet: 'main',
4043
- });
4044
- },
4045
- },
4046
- })
4047
- );
4048
-
4049
- return this.visit('/').then(() => {
4050
- let rootElement = document.getElementById('qunit-fixture');
4051
- let router = this.applicationInstance.lookup('router:main');
4052
- assert.equal(getTextOf(rootElement.querySelector('.sidebar')), 'other');
4053
- run(router, 'send', 'disconnect');
4054
- assert.equal(getTextOf(rootElement.querySelector('.sidebar')), '');
4055
- });
4056
- }
4057
-
4058
- ["@test Can this.render({into:...}) the render helper's children"](assert) {
4059
- expectDeprecation(
4060
- /Rendering into a {{render}} helper that resolves to an {{outlet}} is deprecated./
4061
- );
4062
-
4063
- expectDeprecation(() => {
4064
- this.addTemplate('application', '{{render "sidebar"}}');
4065
- }, /Please refactor [\w\{\}"` ]+ to a component/);
4066
-
4067
- this.addTemplate('sidebar', '<div class="sidebar">{{outlet}}</div>');
4068
- this.addTemplate('index', '<div class="index">{{outlet}}</div>');
4069
- this.addTemplate('other', 'other');
4070
- this.addTemplate('bar', 'bar');
4071
- this.router.map(function() {
4072
- this.route('index', { path: '/' });
4073
- });
4074
- this.add(
4075
- 'route:index',
4076
- Route.extend({
4077
- renderTemplate() {
4078
- this.render({ into: 'sidebar' });
4079
- this.render('other', { into: 'index' });
4080
- },
4081
- actions: {
4082
- changeToBar() {
4083
- this.disconnectOutlet({
4084
- parentView: 'index',
4085
- outlet: 'main',
4086
- });
4087
- this.render('bar', { into: 'index' });
4088
- },
4089
- },
4090
- })
4091
- );
4092
-
4093
- return this.visit('/').then(() => {
4094
- let rootElement = document.getElementById('qunit-fixture');
4095
- let router = this.applicationInstance.lookup('router:main');
4096
- assert.equal(getTextOf(rootElement.querySelector('.sidebar .index')), 'other');
4097
- run(router, 'send', 'changeToBar');
4098
- assert.equal(getTextOf(rootElement.querySelector('.sidebar .index')), 'bar');
4099
- });
4100
- }
4101
-
4102
- ["@test Can disconnect from the render helper's children"](assert) {
4103
- expectDeprecation(
4104
- /Rendering into a {{render}} helper that resolves to an {{outlet}} is deprecated./
4105
- );
4106
-
4107
- expectDeprecation(() => {
4108
- this.addTemplate('application', '{{render "sidebar"}}');
4109
- }, /Please refactor [\w\{\}"` ]+ to a component/);
4110
- this.router.map(function() {
4111
- this.route('index', { path: '/' });
4112
- });
4113
- this.addTemplate('sidebar', '<div class="sidebar">{{outlet}}</div>');
4114
- this.addTemplate('index', '<div class="index">{{outlet}}</div>');
4115
- this.addTemplate('other', 'other');
4116
-
4117
- this.add(
4118
- 'route:index',
4119
- Route.extend({
4120
- renderTemplate() {
4121
- this.render({ into: 'sidebar' });
4122
- this.render('other', { into: 'index' });
4123
- },
4124
- actions: {
4125
- disconnect() {
4126
- this.disconnectOutlet({
4127
- parentView: 'index',
4128
- outlet: 'main',
4129
- });
4130
- },
4131
- },
4132
- })
4133
- );
4134
-
4135
- return this.visit('/').then(() => {
4136
- let rootElement = document.getElementById('qunit-fixture');
4137
- let router = this.applicationInstance.lookup('router:main');
4138
- assert.equal(getTextOf(rootElement.querySelector('.sidebar .index')), 'other');
4139
- run(router, 'send', 'disconnect');
4140
- assert.equal(getTextOf(rootElement.querySelector('.sidebar .index')), '');
4141
- });
4142
- }
4143
-
4144
- ['@test Can this.render({into:...}) nested render helpers'](assert) {
4145
- expectDeprecation(
4146
- /Rendering into a {{render}} helper that resolves to an {{outlet}} is deprecated./
4147
- );
4148
-
4149
- expectDeprecation(() => {
4150
- this.addTemplate('application', '{{render "sidebar"}}');
4151
- }, /Please refactor [\w\{\}"` ]+ to a component/);
4152
-
4153
- expectDeprecation(() => {
4154
- this.addTemplate('sidebar', '<div class="sidebar">{{render "cart"}}</div>');
4155
- }, /Please refactor [\w\{\}"` ]+ to a component/);
4156
- this.router.map(function() {
4157
- this.route('index', { path: '/' });
4158
- });
4159
- this.addTemplate('cart', '<div class="cart">{{outlet}}</div>');
4160
- this.addTemplate('index', 'other');
4161
- this.addTemplate('baz', 'baz');
4162
-
4163
- this.add(
4164
- 'route:index',
4165
- Route.extend({
4166
- renderTemplate() {
4167
- this.render({ into: 'cart' });
4168
- },
4169
- actions: {
4170
- changeToBaz() {
4171
- this.disconnectOutlet({
4172
- parentView: 'cart',
4173
- outlet: 'main',
4174
- });
4175
- this.render('baz', { into: 'cart' });
4176
- },
4177
- },
4178
- })
4179
- );
4180
-
4181
- return this.visit('/').then(() => {
4182
- let rootElement = document.getElementById('qunit-fixture');
4183
- let router = this.applicationInstance.lookup('router:main');
4184
- assert.equal(getTextOf(rootElement.querySelector('.cart')), 'other');
4185
- run(router, 'send', 'changeToBaz');
4186
- assert.equal(getTextOf(rootElement.querySelector('.cart')), 'baz');
4187
- });
4188
- }
4189
-
4190
- ['@test Can disconnect from nested render helpers'](assert) {
4191
- expectDeprecation(
4192
- /Rendering into a {{render}} helper that resolves to an {{outlet}} is deprecated./
4193
- );
4194
-
4195
- expectDeprecation(() => {
4196
- this.addTemplate('application', '{{render "sidebar"}}');
4197
- }, /Please refactor [\w\{\}"` ]+ to a component/);
4198
-
4199
- expectDeprecation(() => {
4200
- this.addTemplate('sidebar', '<div class="sidebar">{{render "cart"}}</div>');
4201
- }, /Please refactor [\w\{\}"` ]+ to a component/);
4202
- this.router.map(function() {
4203
- this.route('index', { path: '/' });
4204
- });
4205
- this.addTemplate('cart', '<div class="cart">{{outlet}}</div>');
4206
- this.addTemplate('index', 'other');
4207
-
4208
- this.add(
4209
- 'route:index',
4210
- Route.extend({
4211
- renderTemplate() {
4212
- this.render({ into: 'cart' });
4213
- },
4214
- actions: {
4215
- disconnect() {
4216
- this.disconnectOutlet({
4217
- parentView: 'cart',
4218
- outlet: 'main',
4219
- });
4220
- },
4221
- },
4222
- })
4223
- );
4224
-
4225
- return this.visit('/').then(() => {
4226
- let rootElement = document.getElementById('qunit-fixture');
4227
- let router = this.applicationInstance.lookup('router:main');
4228
- assert.equal(getTextOf(rootElement.querySelector('.cart')), 'other');
4229
- run(router, 'send', 'disconnect');
4230
- assert.equal(getTextOf(rootElement.querySelector('.cart')), '');
4231
- });
4232
- }
4233
-
4234
- ['@test Components inside an outlet have their didInsertElement hook invoked when the route is displayed'](
4235
- assert
4236
- ) {
4237
- this.addTemplate(
4238
- 'index',
4239
- '{{#if showFirst}}{{my-component}}{{else}}{{other-component}}{{/if}}'
4240
- );
4241
-
4242
- let myComponentCounter = 0;
4243
- let otherComponentCounter = 0;
4244
- let indexController;
4245
-
4246
- this.router.map(function() {
4247
- this.route('index', { path: '/' });
4248
- });
4249
-
4250
- this.add(
4251
- 'controller:index',
4252
- Controller.extend({
4253
- showFirst: true,
4254
- })
4255
- );
4256
-
4257
- this.add(
4258
- 'route:index',
4259
- Route.extend({
4260
- setupController(controller) {
4261
- indexController = controller;
4262
- },
4263
- })
4264
- );
4265
-
4266
- this.add(
4267
- 'component:my-component',
4268
- Component.extend({
4269
- didInsertElement() {
4270
- myComponentCounter++;
4271
- },
4272
- })
4273
- );
4274
-
4275
- this.add(
4276
- 'component:other-component',
4277
- Component.extend({
4278
- didInsertElement() {
4279
- otherComponentCounter++;
4280
- },
4281
- })
4282
- );
4283
-
4284
- return this.visit('/').then(() => {
4285
- assert.strictEqual(
4286
- myComponentCounter,
4287
- 1,
4288
- 'didInsertElement invoked on displayed component'
4289
- );
4290
- assert.strictEqual(
4291
- otherComponentCounter,
4292
- 0,
4293
- 'didInsertElement not invoked on displayed component'
4294
- );
4295
-
4296
- run(() => indexController.set('showFirst', false));
4297
-
4298
- assert.strictEqual(
4299
- myComponentCounter,
4300
- 1,
4301
- 'didInsertElement not invoked on displayed component'
4302
- );
4303
- assert.strictEqual(
4304
- otherComponentCounter,
4305
- 1,
4306
- 'didInsertElement invoked on displayed component'
4307
- );
4308
- });
4309
- }
4310
-
4311
- ['@test Doesnt swallow exception thrown from willTransition'](assert) {
4312
- assert.expect(1);
4313
- this.addTemplate('application', '{{outlet}}');
4314
- this.addTemplate('index', 'index');
4315
- this.addTemplate('other', 'other');
4316
-
4317
- this.router.map(function() {
4318
- this.route('index', { path: '/' });
4319
- this.route('other', function() {});
4320
- });
4321
-
4322
- this.add(
4323
- 'route:index',
4324
- Route.extend({
4325
- actions: {
4326
- willTransition() {
4327
- throw new Error('boom');
4328
- },
4329
- },
4330
- })
4331
- );
4332
-
4333
- return this.visit('/').then(() => {
4334
- return assert.throws(
4335
- () => {
4336
- return this.visit('/other');
4337
- },
4338
- /boom/,
4339
- 'expected an exception but none was thrown'
4340
- );
4341
- });
4342
- }
4343
-
4344
- ['@test Exception if outlet name is undefined in render and disconnectOutlet']() {
4345
- this.add(
4346
- 'route:application',
4347
- Route.extend({
4348
- actions: {
4349
- showModal() {
4350
- this.render({
4351
- outlet: undefined,
4352
- parentView: 'application',
4353
- });
4354
- },
4355
- hideModal() {
4356
- this.disconnectOutlet({
4357
- outlet: undefined,
4358
- parentView: 'application',
4359
- });
4360
- },
4361
- },
4362
- })
4363
- );
4364
-
4365
- return this.visit('/').then(() => {
4366
- let router = this.applicationInstance.lookup('router:main');
4367
- expectAssertion(() => {
4368
- run(() => router.send('showModal'));
4369
- }, /You passed undefined as the outlet name/);
4370
-
4371
- expectAssertion(() => {
4372
- run(() => router.send('hideModal'));
4373
- }, /You passed undefined as the outlet name/);
4374
- });
4375
- }
4376
-
4377
- ['@test Route serializers work for Engines'](assert) {
4378
- assert.expect(2);
4379
-
4380
- // Register engine
4381
- let BlogEngine = Engine.extend();
4382
- this.add('engine:blog', BlogEngine);
4383
-
4384
- // Register engine route map
4385
- let postSerialize = function(params) {
4386
- assert.ok(true, 'serialize hook runs');
4387
- return {
4388
- post_id: params.id,
4389
- };
4390
- };
4391
- let BlogMap = function() {
4392
- this.route('post', {
4393
- path: '/post/:post_id',
4394
- serialize: postSerialize,
4395
- });
4396
- };
4397
- this.add('route-map:blog', BlogMap);
4398
-
4399
- this.router.map(function() {
4400
- this.mount('blog');
4401
- });
4402
-
4403
- return this.visit('/').then(() => {
4404
- let router = this.applicationInstance.lookup('router:main');
4405
- assert.equal(
4406
- router._routerMicrolib.generate('blog.post', { id: '13' }),
4407
- '/blog/post/13',
4408
- 'url is generated properly'
4409
- );
4410
- });
4411
- }
4412
-
4413
- ['@test Defining a Route#serialize method in an Engine throws an error'](assert) {
4414
- assert.expect(1);
4415
-
4416
- // Register engine
4417
- let BlogEngine = Engine.extend();
4418
- this.add('engine:blog', BlogEngine);
4419
-
4420
- // Register engine route map
4421
- let BlogMap = function() {
4422
- this.route('post');
4423
- };
4424
- this.add('route-map:blog', BlogMap);
4425
-
4426
- this.router.map(function() {
4427
- this.mount('blog');
4428
- });
4429
-
4430
- return this.visit('/').then(() => {
4431
- let router = this.applicationInstance.lookup('router:main');
4432
- let PostRoute = Route.extend({ serialize() {} });
4433
- this.applicationInstance.lookup('engine:blog').register('route:post', PostRoute);
4434
-
4435
- assert.throws(
4436
- () => router.transitionTo('blog.post'),
4437
- /Defining a custom serialize method on an Engine route is not supported/
4438
- );
4439
- });
4440
- }
4441
-
4442
- ['@test App.destroy does not leave undestroyed views after clearing engines'](assert) {
4443
- assert.expect(4);
4444
-
4445
- let engineInstance;
4446
- // Register engine
4447
- let BlogEngine = Engine.extend();
4448
- this.add('engine:blog', BlogEngine);
4449
- let EngineIndexRoute = Route.extend({
4450
- init() {
4451
- this._super(...arguments);
4452
- engineInstance = getOwner(this);
4453
- },
4454
- });
4455
-
4456
- // Register engine route map
4457
- let BlogMap = function() {
4458
- this.route('post');
4459
- };
4460
- this.add('route-map:blog', BlogMap);
4461
-
4462
- this.router.map(function() {
4463
- this.mount('blog');
4464
- });
4465
-
4466
- return this.visit('/')
4467
- .then(() => {
4468
- let engine = this.applicationInstance.lookup('engine:blog');
4469
- engine.register('route:index', EngineIndexRoute);
4470
- engine.register('template:index', compile('Engine Post!'));
4471
- return this.visit('/blog');
4472
- })
4473
- .then(() => {
4474
- assert.ok(true, '/blog has been handled');
4475
- let route = engineInstance.lookup('route:index');
4476
- let router = this.applicationInstance.lookup('router:main');
4477
-
4478
- run(router, 'destroy');
4479
- assert.equal(router._toplevelView, null, 'the toplevelView was cleared');
4480
-
4481
- run(route, 'destroy');
4482
- assert.equal(router._toplevelView, null, 'the toplevelView was not reinitialized');
4483
-
4484
- run(this.applicationInstance, 'destroy');
4485
- assert.equal(router._toplevelView, null, 'the toplevelView was not reinitialized');
4486
- });
4487
- }
4488
-
4489
- ["@test Generated route should be an instance of App's default route if provided"](assert) {
4490
- let generatedRoute;
4491
-
4492
- this.router.map(function() {
4493
- this.route('posts');
4494
- });
4495
-
4496
- let AppRoute = Route.extend();
4497
- this.add('route:basic', AppRoute);
4498
-
4499
- return this.visit('/posts').then(() => {
4500
- generatedRoute = this.applicationInstance.lookup('route:posts');
4501
-
4502
- assert.ok(generatedRoute instanceof AppRoute, 'should extend the correct route');
4503
- });
4504
- }
4505
- }
4506
- );