{"version":3,"sources":["license.js","loader.js","@ember/application/tests/application_instance_test.js","@ember/application/tests/application_test.js","@ember/application/tests/bootstrap-test.js","@ember/application/tests/dependency_injection/custom_resolver_test.js","@ember/application/tests/dependency_injection/default_resolver_test.js","@ember/application/tests/dependency_injection/normalization_test.js","@ember/application/tests/dependency_injection/to_string_test.js","@ember/application/tests/dependency_injection_test.js","@ember/application/tests/initializers_test.js","@ember/application/tests/instance_initializers_test.js","@ember/application/tests/lazy_load_test.js","@ember/application/tests/logging_test.js","@ember/application/tests/readiness_test.js","@ember/application/tests/reset_test.js","@ember/application/tests/visit_test.js","@ember/controller/tests/controller_test.js","@ember/debug/tests/handlers-test.js","@ember/debug/tests/main_test.js","@ember/engine/tests/engine_initializers_test.js","@ember/engine/tests/engine_instance_initializers_test.js","@ember/engine/tests/engine_instance_test.js","@ember/engine/tests/engine_parent_test.js","@ember/engine/tests/engine_test.js","@ember/error/tests/index_test.js","@ember/instrumentation/tests/index-test.js","@ember/map/tests/map_test.js","@ember/object/tests/computed/computed_macros_test.js","@ember/object/tests/computed/reduce_computed_macros_test.js","@ember/polyfills/tests/assign_test.js","@ember/polyfills/tests/merge_test.js","@ember/runloop/tests/debounce_test.js","@ember/runloop/tests/later_test.js","@ember/runloop/tests/next_test.js","@ember/runloop/tests/once_test.js","@ember/runloop/tests/onerror_test.js","@ember/runloop/tests/run_bind_test.js","@ember/runloop/tests/run_test.js","@ember/runloop/tests/schedule_test.js","@ember/runloop/tests/sync_test.js","@ember/runloop/tests/unwind_test.js","@ember/string/tests/camelize_test.js","@ember/string/tests/capitalize_test.js","@ember/string/tests/classify_test.js","@ember/string/tests/dasherize_test.js","@ember/string/tests/decamelize_test.js","@ember/string/tests/loc_test.js","@ember/string/tests/underscore_test.js","@ember/string/tests/w_test.js","ember-template-compiler/tests/plugins/assert-if-helper-without-arguments-test.js","ember-template-compiler/tests/plugins/assert-input-helper-without-block-test.js","ember-template-compiler/tests/plugins/assert-local-variable-shadowing-helper-invocation-test.js","ember-template-compiler/tests/plugins/assert-reserved-named-arguments-test.js","ember-template-compiler/tests/plugins/assert-splattribute-expression-test.js","ember-template-compiler/tests/plugins/deprecate-send-action-test.js","ember-template-compiler/tests/plugins/transform-component-invocation-test.js","ember-template-compiler/tests/plugins/transform-inline-link-to-test.js","ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js","ember-template-compiler/tests/system/bootstrap-test.js","ember-template-compiler/tests/system/compile_options_test.js","ember-template-compiler/tests/system/dasherize-component-name-test.js","ember-testing/tests/acceptance_test.js","ember-testing/tests/adapters/adapter_test.js","ember-testing/tests/adapters/qunit_test.js","ember-testing/tests/adapters_test.js","ember-testing/tests/ext/rsvp_test.js","ember-testing/tests/helper_registration_test.js","ember-testing/tests/helpers_test.js","ember-testing/tests/integration_test.js","ember-testing/tests/reexports_test.js","ember-testing/tests/test/waiters-test.js","ember/tests/application_lifecycle_test.js","ember/tests/component_context_test.js","ember/tests/component_registration_test.js","ember/tests/controller_test.js","ember/tests/error_handler_test.js","ember/tests/helpers/helper_registration_test.js","ember/tests/helpers/link_to_test.js","ember/tests/helpers/link_to_test/link_to_transitioning_classes_test.js","ember/tests/helpers/link_to_test/link_to_with_query_params_test.js","ember/tests/homepage_example_test.js","ember/tests/integration/multiple-app-test.js","ember/tests/production_build_test.js","ember/tests/reexports_test.js","ember/tests/routing/decoupled_basic_test.js","ember/tests/routing/deprecated_handler_infos_test.js","ember/tests/routing/deprecated_transition_state_test.js","ember/tests/routing/query_params_test.js","ember/tests/routing/query_params_test/model_dependent_state_with_query_params_test.js","ember/tests/routing/query_params_test/overlapping_query_params_test.js","ember/tests/routing/query_params_test/query_param_async_get_handler_test.js","ember/tests/routing/query_params_test/query_params_paramless_link_to_test.js","ember/tests/routing/query_params_test/shared_state_test.js","ember/tests/routing/router_map_test.js","ember/tests/routing/router_service_test/basic_test.js","ember/tests/routing/router_service_test/currenturl_lifecycle_test.js","ember/tests/routing/router_service_test/events_test.js","ember/tests/routing/router_service_test/isActive_test.js","ember/tests/routing/router_service_test/recognize_test.js","ember/tests/routing/router_service_test/replaceWith_test.js","ember/tests/routing/router_service_test/transitionTo_test.js","ember/tests/routing/router_service_test/urlFor_test.js","ember/tests/routing/substates_test.js","ember/tests/routing/toplevel_dom_test.js","ember/tests/service_injection_test.js","ember/tests/view_instrumentation_test.js","internal-test-helpers/index.js","internal-test-helpers/lib/apply-mixins.js","internal-test-helpers/lib/browser-detect.js","internal-test-helpers/lib/build-owner.js","internal-test-helpers/lib/confirm-export.js","internal-test-helpers/lib/ember-dev/assertion.js","internal-test-helpers/lib/ember-dev/containers.js","internal-test-helpers/lib/ember-dev/debug.js","internal-test-helpers/lib/ember-dev/deprecation.js","internal-test-helpers/lib/ember-dev/index.js","internal-test-helpers/lib/ember-dev/method-call-tracker.js","internal-test-helpers/lib/ember-dev/namespaces.js","internal-test-helpers/lib/ember-dev/run-loop.js","internal-test-helpers/lib/ember-dev/setup-qunit.js","internal-test-helpers/lib/ember-dev/utils.js","internal-test-helpers/lib/ember-dev/warning.js","internal-test-helpers/lib/equal-inner-html.js","internal-test-helpers/lib/equal-tokens.js","internal-test-helpers/lib/factory.js","internal-test-helpers/lib/get-all-property-names.js","internal-test-helpers/lib/get-text-of.js","internal-test-helpers/lib/matchers.js","internal-test-helpers/lib/module-for.js","internal-test-helpers/lib/registry-check.js","internal-test-helpers/lib/run.js","internal-test-helpers/lib/strip.js","internal-test-helpers/lib/system/synthetic-events.js","internal-test-helpers/lib/test-cases/abstract-application.js","internal-test-helpers/lib/test-cases/abstract-rendering.js","internal-test-helpers/lib/test-cases/abstract.js","internal-test-helpers/lib/test-cases/application.js","internal-test-helpers/lib/test-cases/autoboot-application.js","internal-test-helpers/lib/test-cases/default-resolver-application.js","internal-test-helpers/lib/test-cases/node-query.js","internal-test-helpers/lib/test-cases/query-param.js","internal-test-helpers/lib/test-cases/rendering.js","internal-test-helpers/lib/test-cases/router.js","internal-test-helpers/lib/test-cases/test-resolver-application.js","internal-test-helpers/lib/test-resolver.js","internal-test-helpers/tests/index-test.js","node-module.js"],"sourcesContent":["/*!\n * @overview Ember - JavaScript Application Framework\n * @copyright Copyright 2011-2018 Tilde Inc. and contributors\n * Portions Copyright 2006-2011 Strobe Inc.\n * Portions Copyright 2008-2011 Apple Inc. All rights reserved.\n * @license Licensed under MIT license\n * See https://raw.github.com/emberjs/ember.js/master/LICENSE\n * @version 3.6.0\n */\n","/*globals process */\nvar enifed, requireModule, Ember;\n\n// Used in @ember/-internals/environment/lib/global.js\nmainContext = this; // eslint-disable-line no-undef\n\n(function() {\n function missingModule(name, referrerName) {\n if (referrerName) {\n throw new Error('Could not find module ' + name + ' required by: ' + referrerName);\n } else {\n throw new Error('Could not find module ' + name);\n }\n }\n\n function internalRequire(_name, referrerName) {\n var name = _name;\n var mod = registry[name];\n\n if (!mod) {\n name = name + '/index';\n mod = registry[name];\n }\n\n var exports = seen[name];\n\n if (exports !== undefined) {\n return exports;\n }\n\n exports = seen[name] = {};\n\n if (!mod) {\n missingModule(_name, referrerName);\n }\n\n var deps = mod.deps;\n var callback = mod.callback;\n var reified = new Array(deps.length);\n\n for (var i = 0; i < deps.length; i++) {\n if (deps[i] === 'exports') {\n reified[i] = exports;\n } else if (deps[i] === 'require') {\n reified[i] = requireModule;\n } else {\n reified[i] = internalRequire(deps[i], name);\n }\n }\n\n callback.apply(this, reified);\n\n return exports;\n }\n\n var isNode =\n typeof window === 'undefined' &&\n typeof process !== 'undefined' &&\n {}.toString.call(process) === '[object process]';\n\n if (!isNode) {\n Ember = this.Ember = this.Ember || {};\n }\n\n if (typeof Ember === 'undefined') {\n Ember = {};\n }\n\n if (typeof Ember.__loader === 'undefined') {\n var registry = Object.create(null);\n var seen = Object.create(null);\n\n enifed = function(name, deps, callback) {\n var value = {};\n\n if (!callback) {\n value.deps = [];\n value.callback = deps;\n } else {\n value.deps = deps;\n value.callback = callback;\n }\n\n registry[name] = value;\n };\n\n requireModule = function(name) {\n return internalRequire(name, null);\n };\n\n // setup `require` module\n requireModule['default'] = requireModule;\n\n requireModule.has = function registryHas(moduleName) {\n return !!registry[moduleName] || !!registry[moduleName + '/index'];\n };\n\n requireModule._eak_seen = registry;\n\n Ember.__loader = {\n define: enifed,\n require: requireModule,\n registry: registry,\n };\n } else {\n enifed = Ember.__loader.define;\n requireModule = Ember.__loader.require;\n }\n})();\n","enifed('@ember/application/tests/application_instance_test', ['ember-babel', '@ember/engine', '@ember/application', '@ember/application/instance', '@ember/runloop', '@ember/-internals/container', 'internal-test-helpers', '@ember/-internals/runtime', '@ember/debug'], function (_emberBabel, _engine, _application, _instance, _runloop, _container, _internalTestHelpers, _runtime, _debug) {\n 'use strict';\n\n var _templateObject = (0, _emberBabel.taggedTemplateLiteralLoose)(['-bucket-cache:main'], ['-bucket-cache:main']);\n\n var originalDebug = (0, _debug.getDebugFunction)('debug');\n var noop = function () {};\n\n var application = void 0,\n appInstance = void 0;\n\n (0, _internalTestHelpers.moduleFor)('ApplicationInstance', function (_TestCase) {\n (0, _emberBabel.inherits)(_class, _TestCase);\n\n function _class() {\n\n (0, _debug.setDebugFunction)('debug', noop);\n\n var _this = (0, _emberBabel.possibleConstructorReturn)(this, _TestCase.call(this));\n\n document.getElementById('qunit-fixture').innerHTML = '\\n
Dis cache money
\\n '));\n this.register('component:cache-money', _glimmer.Component.extend({}));\n }\n });\n this.add('engine:blog', BlogEngine);\n\n // Register engine route map\n var BlogMap = function () {};\n this.add('route-map:blog', BlogMap);\n\n this.assertEmptyFixture();\n\n return this.visit('/blog', { isInteractive: false }).then(function (instance) {\n assert.ok(instance instanceof _instance.default, 'promise is resolved with an ApplicationInstance');\n assert.strictEqual(_this8.element.querySelector('p').textContent, 'Dis cache money', 'Engine component is resolved');\n });\n };\n\n _class.prototype['@test visit() on engine resolves engine component'] = function (assert) {\n var _this9 = this;\n\n assert.expect(2);\n\n this.router.map(function () {\n this.mount('blog');\n });\n\n // Register engine\n var BlogEngine = _engine.default.extend({\n init: function () {\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n this._super.apply(this, args);\n this.register('template:application', (0, _emberTemplateCompiler.compile)('{{cache-money}}'));\n this.register('template:components/cache-money', (0, _emberTemplateCompiler.compile)('\\nDis cache money
\\n '));\n this.register('component:cache-money', _glimmer.Component.extend({}));\n }\n });\n this.add('engine:blog', BlogEngine);\n\n // Register engine route map\n var BlogMap = function () {};\n this.add('route-map:blog', BlogMap);\n\n this.assertEmptyFixture();\n\n return this.visit('/blog', { shouldRender: true }).then(function () {\n assert.strictEqual(_this9.element.querySelector('p').textContent, 'Dis cache money', 'Engine component is resolved');\n });\n };\n\n _class.prototype['@test visit() on engine resolves engine helper'] = function (assert) {\n var _this10 = this;\n\n assert.expect(2);\n\n this.router.map(function () {\n this.mount('blog');\n });\n\n // Register engine\n var BlogEngine = _engine.default.extend({\n init: function () {\n for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n this._super.apply(this, args);\n this.register('template:application', (0, _emberTemplateCompiler.compile)('{{swag}}'));\n this.register('helper:swag', (0, _glimmer.helper)(function () {\n return 'turnt up';\n }));\n }\n });\n this.add('engine:blog', BlogEngine);\n\n // Register engine route map\n var BlogMap = function () {};\n this.add('route-map:blog', BlogMap);\n\n this.assertEmptyFixture();\n\n return this.visit('/blog', { shouldRender: true }).then(function () {\n assert.strictEqual(_this10.element.textContent, 'turnt up', 'Engine component is resolved');\n });\n };\n\n _class.prototype['@test Ember Islands-style setup'] = function (assert) {\n var _this11 = this;\n\n var xFooInitCalled = false;\n var xFooDidInsertElementCalled = false;\n\n var xBarInitCalled = false;\n var xBarDidInsertElementCalled = false;\n\n this.router.map(function () {\n this.route('show', { path: '/:component_name' });\n });\n\n this.add('route:show', _routing.Route.extend({\n queryParams: {\n data: { refreshModel: true }\n },\n\n model: function (params) {\n return {\n componentName: params.component_name,\n componentData: params.data ? JSON.parse(params.data) : undefined\n };\n }\n }));\n\n var Counter = _runtime.Object.extend({\n value: 0,\n\n increment: function () {\n this.incrementProperty('value');\n }\n });\n\n this.add('service:isolatedCounter', Counter);\n this.add('service:sharedCounter', Counter.create());\n this.application.registerOptions('service:sharedCounter', {\n instantiate: false\n });\n\n this.addTemplate('show', '{{component model.componentName model=model.componentData}}');\n\n this.addTemplate('components/x-foo', '\\nHello {{model.name}}, I have been clicked {{isolatedCounter.value}} times ({{sharedCounter.value}} times combined)!
\\n ');\n\n this.add('component:x-foo', _glimmer.Component.extend({\n tagName: 'x-foo',\n\n isolatedCounter: (0, _service.inject)(),\n sharedCounter: (0, _service.inject)(),\n\n init: function () {\n this._super();\n xFooInitCalled = true;\n },\n didInsertElement: function () {\n xFooDidInsertElementCalled = true;\n },\n click: function () {\n this.get('isolatedCounter').increment();\n this.get('sharedCounter').increment();\n }\n }));\n\n this.addTemplate('components/x-bar', '\\nhello {{yield}}
');\n this.addTemplate('application', 'Hello world {{#expand-it}}world{{/expand-it}}');\n\n return this.visit('/').then(function () {\n _this2.assertText('Hello world hello world');\n _this2.assertComponentElement(_this2.element.firstElementChild, {\n tagName: 'div',\n content: 'hello world
'\n });\n });\n };\n\n _class.prototype['@test The helper becomes the body of the component (ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = true;)'] = function testTheHelperBecomesTheBodyOfTheComponentENV_TEMPLATE_ONLY_GLIMMER_COMPONENTSTrue() {\n var _this3 = this;\n\n _environment.ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = true;\n this.addTemplate('components/expand-it', 'hello {{yield}}
');\n this.addTemplate('application', 'Hello world {{#expand-it}}world{{/expand-it}}');\n\n return this.visit('/').then(function () {\n _this3.assertInnerHTML('Hello worldhello world
');\n _environment.ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = false;\n });\n };\n\n _class.prototype['@test If a component is registered, it is used'] = function testIfAComponentIsRegisteredItIsUsed(assert) {\n var _this4 = this;\n\n this.addTemplate('components/expand-it', 'hello {{yield}}
');\n this.addTemplate('application', 'Hello world {{#expand-it}}world{{/expand-it}}');\n\n this.application.instanceInitializer({\n name: 'expand-it-component',\n initialize: function (applicationInstance) {\n applicationInstance.register('component:expand-it', _glimmer.Component.extend({\n classNames: 'testing123'\n }));\n }\n });\n\n return this.visit('/').then(function () {\n var text = _this4.$('div.testing123').text().trim();\n assert.equal(text, 'hello world', 'The component is composed correctly');\n });\n };\n\n _class.prototype['@test Late-registered components can be rendered with custom `layout` property'] = function testLateRegisteredComponentsCanBeRenderedWithCustomLayoutProperty(assert) {\n var _this5 = this;\n\n this.addTemplate('application', '{{model.name}}
\\n {{#link-to \\'index\\' id=\\'home-link\\'}}Home{{/link-to}}\\n ');\n\n this.addTemplate('index', '\\n{{filter}}
\\n {{#link-to \"filter\" \"unpopular\" id=\"link\"}}Unpopular{{/link-to}}\\n {{#link-to \"filter\" filter id=\"path-link\"}}Unpopular{{/link-to}}\\n {{#link-to \"post\" post_id id=\"post-path-link\"}}Post{{/link-to}}\\n {{#link-to \"post\" 123 id=\"post-number-link\"}}Post{{/link-to}}\\n {{#link-to \"repo\" repo id=\"repo-object-link\"}}Repo{{/link-to}}\\n ');\n\n return this.visit('/filters/popular').then(function () {\n assert.equal(normalizeUrl(_this40.$('#link').attr('href')), '/filters/unpopular');\n assert.equal(normalizeUrl(_this40.$('#path-link').attr('href')), '/filters/unpopular');\n assert.equal(normalizeUrl(_this40.$('#post-path-link').attr('href')), '/post/123');\n assert.equal(normalizeUrl(_this40.$('#post-number-link').attr('href')), '/post/123');\n assert.equal(normalizeUrl(_this40.$('#repo-object-link').attr('href')), '/repo/ember/ember.js');\n });\n };\n\n _class4.prototype['@test Issue 4201 - Shorthand for route.index shouldn\\'t throw errors about context arguments'] = function (assert) {\n var _this41 = this;\n\n assert.expect(2);\n this.router.map(function () {\n this.route('lobby', function () {\n this.route('index', { path: ':lobby_id' });\n this.route('list');\n });\n });\n\n this.add('route:lobby.index', _routing.Route.extend({\n model: function (params) {\n assert.equal(params.lobby_id, 'foobar');\n return params.lobby_id;\n }\n }));\n\n this.addTemplate('lobby.index', '\\n {{#link-to \\'lobby\\' \\'foobar\\' id=\\'lobby-link\\'}}Lobby{{/link-to}}\\n ');\n this.addTemplate('lobby.list', '\\n {{#link-to \\'lobby\\' \\'foobar\\' id=\\'lobby-link\\'}}Lobby{{/link-to}}\\n ');\n\n return this.visit('/lobby/list').then(function () {\n return _this41.click('#lobby-link');\n }).then(function () {\n return shouldBeActive(assert, _this41.$('#lobby-link'));\n });\n };\n\n _class4.prototype['@test Quoteless route param performs property lookup'] = function (assert) {\n var _this42 = this;\n\n this.router.map(function () {\n this.route('about');\n });\n\n this.addTemplate('index', '\\n {{#link-to \\'index\\' id=\\'string-link\\'}}string{{/link-to}}\\n {{#link-to foo id=\\'path-link\\'}}path{{/link-to}}\\n ');\n\n this.add('controller:index', _controller.default.extend({\n foo: 'index'\n }));\n\n var assertEquality = function (href) {\n assert.equal(normalizeUrl(_this42.$('#string-link').attr('href')), '/');\n assert.equal(normalizeUrl(_this42.$('#path-link').attr('href')), href);\n };\n\n return this.visit('/').then(function () {\n assertEquality('/');\n\n var controller = _this42.applicationInstance.lookup('controller:index');\n _this42.runTask(function () {\n return controller.set('foo', 'about');\n });\n\n assertEquality('/about');\n });\n };\n\n _class4.prototype['@test The {{link-to}} helper refreshes href element when one of params changes'] = function (assert) {\n var _this43 = this;\n\n this.router.map(function () {\n this.route('post', { path: '/posts/:post_id' });\n });\n\n var post = { id: '1' };\n var secondPost = { id: '2' };\n\n this.addTemplate('index', '\\n {{#link-to \"post\" post id=\"post\"}}post{{/link-to}}\\n ');\n\n this.add('controller:index', _controller.default.extend());\n\n return this.visit('/').then(function () {\n var indexController = _this43.applicationInstance.lookup('controller:index');\n _this43.runTask(function () {\n return indexController.set('post', post);\n });\n\n assert.equal(normalizeUrl(_this43.$('#post').attr('href')), '/posts/1', 'precond - Link has rendered href attr properly');\n\n _this43.runTask(function () {\n return indexController.set('post', secondPost);\n });\n\n assert.equal(_this43.$('#post').attr('href'), '/posts/2', 'href attr was updated after one of the params had been changed');\n\n _this43.runTask(function () {\n return indexController.set('post', null);\n });\n\n assert.equal(_this43.$('#post').attr('href'), '#', 'href attr becomes # when one of the arguments in nullified');\n });\n };\n\n _class4.prototype['@test The {{link-to}} helper is active when a route is active'] = function (assert) {\n var _this44 = this;\n\n this.router.map(function () {\n this.route('about', function () {\n this.route('item');\n });\n });\n\n this.addTemplate('about', '\\n{{model.name}}
\\n {{#link-to \\'index\\' id=\\'home-link\\'}}Home{{/link-to}}\\n ');\n\n return this.visit('/').then(function () {\n return _this48.click('#yehuda');\n }).then(function () {\n assert.equal(_this48.$('h3.item').length, 1, 'The item template was rendered');\n assert.equal(_this48.$('p').text(), 'Yehuda Katz', 'The name is correct');\n\n return _this48.click('#home-link');\n }).then(function () {\n assert.equal(normalizeUrl(_this48.$('li a#yehuda').attr('href')), '/item/yehuda');\n assert.equal(normalizeUrl(_this48.$('li a#tom').attr('href')), '/item/tom');\n assert.equal(normalizeUrl(_this48.$('li a#erik').attr('href')), '/item/erik');\n });\n };\n\n _class4.prototype['@test The non-block form {{link-to}} performs property lookup'] = function (assert) {\n var _this49 = this;\n\n this.router.map(function () {\n this.route('about');\n });\n\n this.addTemplate('index', '\\n {{link-to \\'string\\' \\'index\\' id=\\'string-link\\'}}\\n {{link-to path foo id=\\'path-link\\'}}\\n ');\n\n this.add('controller:index', _controller.default.extend({\n foo: 'index'\n }));\n\n return this.visit('/').then(function () {\n var assertEquality = function (href) {\n assert.equal(normalizeUrl(_this49.$('#string-link').attr('href')), '/');\n assert.equal(normalizeUrl(_this49.$('#path-link').attr('href')), href);\n };\n\n assertEquality('/');\n\n var controller = _this49.applicationInstance.lookup('controller:index');\n _this49.runTask(function () {\n return controller.set('foo', 'about');\n });\n\n assertEquality('/about');\n });\n };\n\n _class4.prototype['@test The non-block form {{link-to}} protects against XSS'] = function (assert) {\n var _this50 = this;\n\n this.addTemplate('application', '{{link-to display \\'index\\' id=\\'link\\'}}');\n\n this.add('controller:application', _controller.default.extend({\n display: 'blahzorz'\n }));\n\n return this.visit('/').then(function () {\n assert.equal(_this50.$('#link').text(), 'blahzorz');\n\n var controller = _this50.applicationInstance.lookup('controller:application');\n _this50.runTask(function () {\n return controller.set('display', 'BLAMMO');\n });\n\n assert.equal(_this50.$('#link').text(), 'BLAMMO');\n assert.equal(_this50.$('b').length, 0);\n });\n };\n\n _class4.prototype['@test the {{link-to}} helper throws a useful error if you invoke it wrong'] = function (assert) {\n var _this51 = this;\n\n assert.expect(1);\n\n this.router.map(function () {\n this.route('post', { path: 'post/:post_id' });\n });\n\n this.addTemplate('application', '{{#link-to \\'post\\'}}Post{{/link-to}}');\n\n assert.throws(function () {\n _this51.visit('/');\n }, /(You attempted to define a `\\{\\{link-to \"post\"\\}\\}` but did not pass the parameters required for generating its dynamic segments.|You must provide param `post_id` to `generate`)/);\n\n return this.runLoopSettled();\n };\n\n _class4.prototype['@test the {{link-to}} helper does not throw an error if its route has exited'] = function (assert) {\n var _this52 = this;\n\n assert.expect(0);\n\n this.router.map(function () {\n this.route('post', { path: 'post/:post_id' });\n });\n\n this.addTemplate('application', '\\n {{#link-to \\'index\\' id=\\'home-link\\'}}Home{{/link-to}}\\n {{#link-to \\'post\\' defaultPost id=\\'default-post-link\\'}}Default Post{{/link-to}}\\n {{#if currentPost}}\\n {{#link-to \\'post\\' currentPost id=\\'current-post-link\\'}}Current Post{{/link-to}}\\n {{/if}}\\n ');\n\n this.add('controller:application', _controller.default.extend({\n defaultPost: { id: 1 },\n postController: (0, _controller.inject)('post'),\n currentPost: (0, _metal.alias)('postController.model')\n }));\n\n this.add('controller:post', _controller.default.extend());\n\n this.add('route:post', _routing.Route.extend({\n model: function () {\n return { id: 2 };\n },\n serialize: function (model) {\n return { post_id: model.id };\n }\n }));\n\n return this.visit('/').then(function () {\n return _this52.click('#default-post-link');\n }).then(function () {\n return _this52.click('#home-link');\n }).then(function () {\n return _this52.click('#current-post-link');\n }).then(function () {\n return _this52.click('#home-link');\n });\n };\n\n _class4.prototype['@test {{link-to}} active property respects changing parent route context'] = function (assert) {\n var _this53 = this;\n\n this.router.map(function () {\n this.route('things', { path: '/things/:name' }, function () {\n this.route('other');\n });\n });\n\n this.addTemplate('application', '\\n {{link-to \\'OMG\\' \\'things\\' \\'omg\\' id=\\'omg-link\\'}}\\n {{link-to \\'LOL\\' \\'things\\' \\'lol\\' id=\\'lol-link\\'}}\\n ');\n\n return this.visit('/things/omg').then(function () {\n shouldBeActive(assert, _this53.$('#omg-link'));\n shouldNotBeActive(assert, _this53.$('#lol-link'));\n\n return _this53.visit('/things/omg/other');\n }).then(function () {\n shouldBeActive(assert, _this53.$('#omg-link'));\n shouldNotBeActive(assert, _this53.$('#lol-link'));\n });\n };\n\n _class4.prototype['@test {{link-to}} populates href with default query param values even without query-params object'] = function (assert) {\n var _this54 = this;\n\n this.add('controller:index', _controller.default.extend({\n queryParams: ['foo'],\n foo: '123'\n }));\n\n this.addTemplate('index', '{{#link-to \\'index\\' id=\\'the-link\\'}}Index{{/link-to}}');\n\n return this.visit('/').then(function () {\n assert.equal(_this54.$('#the-link').attr('href'), '/', 'link has right href');\n });\n };\n\n _class4.prototype['@test {{link-to}} populates href with default query param values with empty query-params object'] = function (assert) {\n var _this55 = this;\n\n this.add('controller:index', _controller.default.extend({\n queryParams: ['foo'],\n foo: '123'\n }));\n\n this.addTemplate('index', '\\n {{#link-to \\'index\\' (query-params) id=\\'the-link\\'}}Index{{/link-to}}\\n ');\n\n return this.visit('/').then(function () {\n assert.equal(_this55.$('#the-link').attr('href'), '/', 'link has right href');\n });\n };\n\n _class4.prototype['@test {{link-to}} with only query-params and a block updates when route changes'] = function (assert) {\n var _this56 = this;\n\n this.router.map(function () {\n this.route('about');\n });\n\n this.add('controller:application', _controller.default.extend({\n queryParams: ['foo', 'bar'],\n foo: '123',\n bar: 'yes'\n }));\n\n this.addTemplate('application', '\\n {{#link-to (query-params foo=\\'456\\' bar=\\'NAW\\') id=\\'the-link\\'}}Index{{/link-to}}\\n ');\n\n return this.visit('/').then(function () {\n assert.equal(_this56.$('#the-link').attr('href'), '/?bar=NAW&foo=456', 'link has right href');\n\n return _this56.visit('/about');\n }).then(function () {\n assert.equal(_this56.$('#the-link').attr('href'), '/about?bar=NAW&foo=456', 'link has right href');\n });\n };\n\n _class4.prototype['@test Block-less {{link-to}} with only query-params updates when route changes'] = function (assert) {\n var _this57 = this;\n\n this.router.map(function () {\n this.route('about');\n });\n\n this.add('controller:application', _controller.default.extend({\n queryParams: ['foo', 'bar'],\n foo: '123',\n bar: 'yes'\n }));\n\n this.addTemplate('application', '\\n {{link-to \"Index\" (query-params foo=\\'456\\' bar=\\'NAW\\') id=\\'the-link\\'}}\\n ');\n\n return this.visit('/').then(function () {\n assert.equal(_this57.$('#the-link').attr('href'), '/?bar=NAW&foo=456', 'link has right href');\n\n return _this57.visit('/about');\n }).then(function () {\n assert.equal(_this57.$('#the-link').attr('href'), '/about?bar=NAW&foo=456', 'link has right href');\n });\n };\n\n _class4.prototype['@test The {{link-to}} helper can use dynamic params'] = function (assert) {\n var _this58 = this;\n\n this.router.map(function () {\n this.route('foo', { path: 'foo/:some/:thing' });\n this.route('bar', { path: 'bar/:some/:thing/:else' });\n });\n\n this.add('controller:index', _controller.default.extend({\n init: function () {\n this._super.apply(this, arguments);\n this.dynamicLinkParams = ['foo', 'one', 'two'];\n }\n }));\n\n this.addTemplate('index', '\\n{{model.home}}
');\n\n _this.router.map(function () {\n this.route('home', { path: '/' });\n });\n\n originalConsoleError = console.error;\n return _this;\n }\n\n _class.prototype.teardown = function teardown() {\n _ApplicationTestCase.prototype.teardown.call(this);\n console.error = originalConsoleError;\n };\n\n _class.prototype.getController = function getController(name) {\n return this.applicationInstance.lookup('controller:' + name);\n };\n\n _class.prototype.handleURLAborts = function handleURLAborts(assert, path) {\n var _this2 = this;\n\n (0, _runloop.run)(function () {\n var router = _this2.applicationInstance.lookup('router:main');\n router.handleURL(path).then(function () {\n assert.ok(false, 'url: `' + path + '` was NOT to be handled');\n }, function (reason) {\n assert.ok(reason && reason.message === 'TransitionAborted', 'url: `' + path + '` was to be aborted');\n });\n });\n };\n\n _class.prototype.handleURLRejectsWith = function handleURLRejectsWith(context, assert, path, expectedReason) {\n return context.visit(path).then(function () {\n assert.ok(false, 'expected handleURLing: `' + path + '` to fail');\n }).catch(function (reason) {\n assert.equal(reason.message, expectedReason);\n });\n };\n\n _class.prototype['@test warn on URLs not included in the route set'] = function testWarnOnURLsNotIncludedInTheRouteSet() {\n var _this3 = this;\n\n return this.visit('/').then(function () {\n expectAssertion(function () {\n _this3.visit('/what-is-this-i-dont-even');\n }, /'\\/what-is-this-i-dont-even' did not match any routes/);\n });\n };\n\n _class.prototype['@test The Homepage'] = function testTheHomepage(assert) {\n var _this4 = this;\n\n return this.visit('/').then(function () {\n assert.equal(_this4.currentPath, 'home', 'currently on the home route');\n\n var text = _this4.$('.hours').text();\n assert.equal(text, 'Hours', 'the home template was rendered');\n });\n };\n\n _class.prototype['@test The Homepage and the Camelot page with multiple Router.map calls'] = function (assert) {\n var _this5 = this;\n\n this.router.map(function () {\n this.route('camelot', { path: '/camelot' });\n });\n\n return this.visit('/camelot').then(function () {\n assert.equal(_this5.currentPath, 'camelot');\n\n var text = _this5.$('#camelot').text();\n assert.equal(text, 'Is a silly place', 'the camelot template was rendered');\n\n return _this5.visit('/');\n }).then(function () {\n assert.equal(_this5.currentPath, 'home');\n\n var text = _this5.$('.hours').text();\n assert.equal(text, 'Hours', 'the home template was rendered');\n });\n };\n\n _class.prototype['@test The Homepage with explicit template name in renderTemplate'] = function (assert) {\n var _this6 = this;\n\n this.add('route:home', _routing.Route.extend({\n renderTemplate: function () {\n this.render('homepage');\n }\n }));\n\n return this.visit('/').then(function () {\n var text = _this6.$('#troll').text();\n assert.equal(text, 'Megatroll', 'the homepage template was rendered');\n });\n };\n\n _class.prototype['@test an alternate template will pull in an alternate controller'] = function (assert) {\n var _this7 = this;\n\n this.add('route:home', _routing.Route.extend({\n renderTemplate: function () {\n this.render('homepage');\n }\n }));\n this.add('controller:homepage', _controller.default.extend({\n model: {\n home: 'Comes from homepage'\n }\n }));\n\n return this.visit('/').then(function () {\n var text = _this7.$('p').text();\n\n assert.equal(text, 'Comes from homepage', 'the homepage template was rendered');\n });\n };\n\n _class.prototype['@test An alternate template will pull in an alternate controller instead of controllerName'] = function (assert) {\n var _this8 = this;\n\n this.add('route:home', _routing.Route.extend({\n controllerName: 'foo',\n renderTemplate: function () {\n this.render('homepage');\n }\n }));\n this.add('controller:foo', _controller.default.extend({\n model: {\n home: 'Comes from foo'\n }\n }));\n this.add('controller:homepage', _controller.default.extend({\n model: {\n home: 'Comes from homepage'\n }\n }));\n\n return this.visit('/').then(function () {\n var text = _this8.$('p').text();\n\n assert.equal(text, 'Comes from homepage', 'the homepage template was rendered');\n });\n };\n\n _class.prototype['@test The template will pull in an alternate controller via key/value'] = function (assert) {\n var _this9 = this;\n\n this.router.map(function () {\n this.route('homepage', { path: '/' });\n });\n\n this.add('route:homepage', _routing.Route.extend({\n renderTemplate: function () {\n this.render({ controller: 'home' });\n }\n }));\n this.add('controller:home', _controller.default.extend({\n model: {\n home: 'Comes from home.'\n }\n }));\n\n return this.visit('/').then(function () {\n var text = _this9.$('p').text();\n\n assert.equal(text, 'Comes from home.', 'the homepage template was rendered from data from the HomeController');\n });\n };\n\n _class.prototype['@test The Homepage with explicit template name in renderTemplate and controller'] = function (assert) {\n var _this10 = this;\n\n this.add('controller:home', _controller.default.extend({\n model: {\n home: 'YES I AM HOME'\n }\n }));\n this.add('route:home', _routing.Route.extend({\n renderTemplate: function () {\n this.render('homepage');\n }\n }));\n\n return this.visit('/').then(function () {\n var text = _this10.$('p').text();\n\n assert.equal(text, 'YES I AM HOME', 'The homepage template was rendered');\n });\n };\n\n _class.prototype['@test Model passed via renderTemplate model is set as controller\\'s model'] = function (assert) {\n var _this11 = this;\n\n this.addTemplate('bio', '{{model.name}}
');\n this.add('route:home', _routing.Route.extend({\n renderTemplate: function () {\n this.render('bio', {\n model: { name: 'emberjs' }\n });\n }\n }));\n\n return this.visit('/').then(function () {\n var text = _this11.$('p').text();\n\n assert.equal(text, 'emberjs', 'Passed model was set as controller\\'s model');\n });\n };\n\n _class.prototype['@test render uses templateName from route'] = function testRenderUsesTemplateNameFromRoute(assert) {\n var _this12 = this;\n\n this.addTemplate('the_real_home_template', 'THIS IS THE REAL HOME
');\n this.add('route:home', _routing.Route.extend({\n templateName: 'the_real_home_template'\n }));\n\n return this.visit('/').then(function () {\n var text = _this12.$('p').text();\n\n assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');\n });\n };\n\n _class.prototype['@test defining templateName allows other templates to be rendered'] = function testDefiningTemplateNameAllowsOtherTemplatesToBeRendered(assert) {\n var _this13 = this;\n\n this.addTemplate('alert', 'THIS IS THE REAL HOME
{{outlet \\'alert\\'}}');\n this.add('route:home', _routing.Route.extend({\n templateName: 'the_real_home_template',\n actions: {\n showAlert: function () {\n this.render('alert', {\n into: 'home',\n outlet: 'alert'\n });\n }\n }\n }));\n\n return this.visit('/').then(function () {\n var text = _this13.$('p').text();\n assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');\n\n return _this13.runTask(function () {\n return _this13.appRouter.send('showAlert');\n });\n }).then(function () {\n var text = _this13.$('.alert-box').text();\n\n assert.equal(text, 'Invader!', 'Template for alert was rendered into the outlet');\n });\n };\n\n _class.prototype['@test templateName is still used when calling render with no name and options'] = function testTemplateNameIsStillUsedWhenCallingRenderWithNoNameAndOptions(assert) {\n var _this14 = this;\n\n this.addTemplate('alert', 'THIS IS THE REAL HOME
{{outlet \\'alert\\'}}');\n\n this.add('route:home', _routing.Route.extend({\n templateName: 'alert',\n renderTemplate: function () {\n this.render({});\n }\n }));\n\n return this.visit('/').then(function () {\n var text = _this14.$('.alert-box').text();\n\n assert.equal(text, 'Invader!', 'default templateName was rendered into outlet');\n });\n };\n\n _class.prototype['@test The Homepage with a `setupController` hook'] = function testTheHomepageWithASetupControllerHook(assert) {\n var _this15 = this;\n\n this.addTemplate('home', '{{myValue}}
');\n this.add('route:home', _routing.Route.extend({\n controllerName: 'myController'\n }));\n this.add('controller:myController', _controller.default.extend({\n myValue: 'foo'\n }));\n\n return this.visit('/').then(function () {\n var homeRoute = _this17.applicationInstance.lookup('route:home');\n var myController = _this17.applicationInstance.lookup('controller:myController');\n var text = _this17.$('p').text();\n\n assert.equal(homeRoute.controller, myController, 'route controller is set by controllerName');\n assert.equal(text, 'foo', 'The homepage template was rendered with data from the custom controller');\n });\n };\n\n _class.prototype['@test The route controller specified via controllerName is used in render'] = function (assert) {\n var _this18 = this;\n\n this.router.map(function () {\n this.route('home', { path: '/' });\n });\n\n this.add('route:home', _routing.Route.extend({\n controllerName: 'myController',\n renderTemplate: function () {\n this.render('alternative_home');\n }\n }));\n\n this.add('controller:myController', _controller.default.extend({\n myValue: 'foo'\n }));\n\n this.addTemplate('alternative_home', 'alternative home: {{myValue}}
');\n\n return this.visit('/').then(function () {\n var homeRoute = _this18.applicationInstance.lookup('route:home');\n var myController = _this18.applicationInstance.lookup('controller:myController');\n var text = _this18.$('p').text();\n\n assert.equal(homeRoute.controller, myController, 'route controller is set by controllerName');\n\n assert.equal(text, 'alternative home: foo', 'The homepage template was rendered with data from the custom controller');\n });\n };\n\n _class.prototype['@test The route controller specified via controllerName is used in render even when a controller with the routeName is available'] = function (assert) {\n var _this19 = this;\n\n this.router.map(function () {\n this.route('home', { path: '/' });\n });\n\n this.addTemplate('home', 'home: {{myValue}}
');\n\n this.add('route:home', _routing.Route.extend({\n controllerName: 'myController'\n }));\n\n this.add('controller:home', _controller.default.extend({\n myValue: 'home'\n }));\n\n this.add('controller:myController', _controller.default.extend({\n myValue: 'myController'\n }));\n\n return this.visit('/').then(function () {\n var homeRoute = _this19.applicationInstance.lookup('route:home');\n var myController = _this19.applicationInstance.lookup('controller:myController');\n var text = _this19.$('p').text();\n\n assert.equal(homeRoute.controller, myController, 'route controller is set by controllerName');\n\n assert.equal(text, 'home: myController', 'The homepage template was rendered with data from the custom controller');\n });\n };\n\n _class.prototype['@test The Homepage with a \\'setupController\\' hook modifying other controllers'] = function (assert) {\n var _this20 = this;\n\n this.router.map(function () {\n this.route('home', { path: '/' });\n });\n\n this.add('route:home', _routing.Route.extend({\n setupController: function () /* controller */{\n this.controllerFor('home').set('hours', ['Monday through Friday: 9am to 5pm', 'Saturday: Noon to Midnight', 'Sunday: Noon to 6pm']);\n }\n }));\n\n this.addTemplate('home', '{{model.menuItemId}}
');\n\n return this.visit('/specials/1').then(function () {\n var text = _this23.$('p').text();\n\n assert.equal(text, '1', 'The model was used to render the template');\n });\n };\n\n _class.prototype['@test The Specials Page defaults to looking models up via `find`'] = function testTheSpecialsPageDefaultsToLookingModelsUpViaFind() {\n var _this24 = this;\n\n var MenuItem = _runtime.Object.extend();\n MenuItem.reopenClass({\n find: function (id) {\n return MenuItem.create({ id: id });\n }\n });\n this.add('model:menu_item', MenuItem);\n\n this.router.map(function () {\n this.route('home', { path: '/' });\n this.route('special', { path: '/specials/:menu_item_id' });\n });\n\n this.addTemplate('special', '{{model.id}}');\n\n return this.visit('/specials/1').then(function () {\n _this24.assertText('1', 'The model was used to render the template');\n });\n };\n\n _class.prototype['@test The Special Page returning a promise puts the app into a loading state until the promise is resolved'] = function testTheSpecialPageReturningAPromisePutsTheAppIntoALoadingStateUntilThePromiseIsResolved() {\n var _this25 = this;\n\n this.router.map(function () {\n this.route('home', { path: '/' });\n this.route('special', { path: '/specials/:menu_item_id' });\n });\n\n var menuItem = void 0,\n resolve = void 0;\n\n var MenuItem = _runtime.Object.extend();\n MenuItem.reopenClass({\n find: function (id) {\n menuItem = MenuItem.create({ id: id });\n\n return new _rsvp.default.Promise(function (res) {\n resolve = res;\n });\n }\n });\n\n this.add('model:menu_item', MenuItem);\n\n this.addTemplate('special', '{{model.id}}
');\n this.addTemplate('loading', 'LOADING!
');\n\n var visited = this.visit('/specials/1');\n this.assertText('LOADING!', 'The app is in the loading state');\n\n resolve(menuItem);\n\n return visited.then(function () {\n _this25.assertText('1', 'The app is now in the specials state');\n });\n };\n\n _class.prototype['@test The loading state doesn\\'t get entered for promises that resolve on the same run loop'] = function (assert) {\n var _this26 = this;\n\n this.router.map(function () {\n this.route('home', { path: '/' });\n this.route('special', { path: '/specials/:menu_item_id' });\n });\n\n var MenuItem = _runtime.Object.extend();\n MenuItem.reopenClass({\n find: function (id) {\n return { id: id };\n }\n });\n\n this.add('model:menu_item', MenuItem);\n\n this.add('route:loading', _routing.Route.extend({\n enter: function () {\n assert.ok(false, \"LoadingRoute shouldn't have been entered.\");\n }\n }));\n\n this.addTemplate('special', '{{model.id}}
');\n this.addTemplate('loading', 'LOADING!
');\n\n return this.visit('/specials/1').then(function () {\n var text = _this26.$('p').text();\n\n assert.equal(text, '1', 'The app is now in the specials state');\n });\n };\n\n _class.prototype[\"@test The Special page returning an error invokes SpecialRoute's error handler\"] = function testTheSpecialPageReturningAnErrorInvokesSpecialRouteSErrorHandler(assert) {\n this.router.map(function () {\n this.route('home', { path: '/' });\n this.route('special', { path: '/specials/:menu_item_id' });\n });\n\n var menuItem = void 0,\n promise = void 0,\n resolve = void 0;\n\n var MenuItem = _runtime.Object.extend();\n MenuItem.reopenClass({\n find: function (id) {\n menuItem = MenuItem.create({ id: id });\n promise = new _rsvp.default.Promise(function (res) {\n return resolve = res;\n });\n\n return promise;\n }\n });\n\n this.add('model:menu_item', MenuItem);\n\n this.add('route:special', _routing.Route.extend({\n setup: function () {\n throw new Error('Setup error');\n },\n\n actions: {\n error: function (reason) {\n assert.equal(reason.message, 'Setup error', 'SpecialRoute#error received the error thrown from setup');\n return true;\n }\n }\n }));\n\n this.handleURLRejectsWith(this, assert, 'specials/1', 'Setup error');\n\n (0, _runloop.run)(function () {\n return resolve(menuItem);\n });\n };\n\n _class.prototype[\"@test ApplicationRoute's default error handler can be overridden\"] = function testApplicationRouteSDefaultErrorHandlerCanBeOverridden(assert) {\n assert.expect(2);\n\n this.router.map(function () {\n this.route('home', { path: '/' });\n this.route('special', { path: '/specials/:menu_item_id' });\n });\n\n var menuItem = void 0,\n resolve = void 0;\n\n var MenuItem = _runtime.Object.extend();\n\n MenuItem.reopenClass({\n find: function (id) {\n menuItem = MenuItem.create({ id: id });\n return new _rsvp.default.Promise(function (res) {\n return resolve = res;\n });\n }\n });\n this.add('model:menu_item', MenuItem);\n\n this.add('route:application', _routing.Route.extend({\n actions: {\n error: function (reason) {\n assert.equal(reason.message, 'Setup error', 'error was correctly passed to custom ApplicationRoute handler');\n return true;\n }\n }\n }));\n\n this.add('route:special', _routing.Route.extend({\n setup: function () {\n throw new Error('Setup error');\n }\n }));\n\n this.handleURLRejectsWith(this, assert, '/specials/1', 'Setup error');\n\n (0, _runloop.run)(function () {\n return resolve(menuItem);\n });\n };\n\n _class.prototype['@test Moving from one page to another triggers the correct callbacks'] = function testMovingFromOnePageToAnotherTriggersTheCorrectCallbacks(assert) {\n var _this27 = this;\n\n assert.expect(3);\n\n this.router.map(function () {\n this.route('home', { path: '/' });\n this.route('special', { path: '/specials/:menu_item_id' });\n });\n\n var MenuItem = _runtime.Object.extend();\n MenuItem.reopenClass({\n find: function (id) {\n return MenuItem.create({ id: id });\n }\n });\n this.add('model:menu_item', MenuItem);\n\n this.addTemplate('home', '{{model.id}}
');\n\n return this.visit('/').then(function () {\n _this27.assertText('Home', 'The app is now in the initial state');\n\n var promiseContext = MenuItem.create({ id: 1 });\n\n return _this27.visit('/specials/1', promiseContext);\n }).then(function () {\n assert.equal(_this27.currentURL, '/specials/1');\n _this27.assertText('1', 'The app is now transitioned');\n });\n };\n\n _class.prototype['@test Nested callbacks are not exited when moving to siblings'] = function testNestedCallbacksAreNotExitedWhenMovingToSiblings(assert) {\n var _this28 = this;\n\n var rootSetup = 0;\n var rootRender = 0;\n var rootModel = 0;\n var rootSerialize = 0;\n var menuItem = void 0;\n var rootElement = void 0;\n\n var MenuItem = _runtime.Object.extend();\n MenuItem.reopenClass({\n find: function (id) {\n menuItem = MenuItem.create({ id: id });\n return menuItem;\n }\n });\n\n this.router.map(function () {\n this.route('root', { path: '/' }, function () {\n this.route('special', {\n path: '/specials/:menu_item_id',\n resetNamespace: true\n });\n });\n });\n\n this.add('route:root', _routing.Route.extend({\n model: function () {\n rootModel++;\n return this._super.apply(this, arguments);\n },\n setupController: function () {\n rootSetup++;\n },\n renderTemplate: function () {\n rootRender++;\n },\n serialize: function () {\n rootSerialize++;\n return this._super.apply(this, arguments);\n }\n }));\n\n this.add('route:loading', _routing.Route.extend({}));\n this.add('route:home', _routing.Route.extend({}));\n this.add('route:special', _routing.Route.extend({\n model: function (_ref) {\n var menu_item_id = _ref.menu_item_id;\n\n return MenuItem.find(menu_item_id);\n },\n setupController: function (controller, model) {\n (0, _metal.set)(controller, 'model', model);\n }\n }));\n\n this.addTemplate('root.index', '{{model.id}}
');\n this.addTemplate('loading', 'LOADING!
');\n\n return this.visit('/').then(function () {\n rootElement = document.getElementById('qunit-fixture');\n\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('h3')), 'Home', 'The app is now in the initial state');\n assert.equal(rootSetup, 1, 'The root setup was triggered');\n assert.equal(rootRender, 1, 'The root render was triggered');\n assert.equal(rootSerialize, 0, 'The root serialize was not called');\n assert.equal(rootModel, 1, 'The root model was called');\n\n var router = _this28.applicationInstance.lookup('router:main');\n var menuItem = MenuItem.create({ id: 1 });\n\n return router.transitionTo('special', menuItem).then(function () {\n assert.equal(rootSetup, 1, 'The root setup was not triggered again');\n assert.equal(rootRender, 1, 'The root render was not triggered again');\n assert.equal(rootSerialize, 0, 'The root serialize was not called');\n\n // TODO: Should this be changed?\n assert.equal(rootModel, 1, 'The root model was called again');\n\n assert.deepEqual(router.location.path, '/specials/1');\n assert.equal(router.currentPath, 'root.special');\n });\n });\n };\n\n _class.prototype['@test Events are triggered on the controller if a matching action name is implemented'] = function testEventsAreTriggeredOnTheControllerIfAMatchingActionNameIsImplemented(assert) {\n var done = assert.async();\n\n this.router.map(function () {\n this.route('home', { path: '/' });\n });\n\n var model = { name: 'Tom Dale' };\n var stateIsNotCalled = true;\n\n this.add('route:home', _routing.Route.extend({\n model: function () {\n return model;\n },\n\n actions: {\n showStuff: function () {\n stateIsNotCalled = false;\n }\n }\n }));\n\n this.addTemplate('home', '{{name}}');\n this.add('controller:home', _controller.default.extend({\n actions: {\n showStuff: function (context) {\n assert.ok(stateIsNotCalled, 'an event on the state is not triggered');\n assert.deepEqual(context, { name: 'Tom Dale' }, 'an event with context is passed');\n done();\n }\n }\n }));\n\n this.visit('/').then(function () {\n document.getElementById('qunit-fixture').querySelector('a').click();\n });\n };\n\n _class.prototype['@test Events are triggered on the current state when defined in `actions` object'] = function testEventsAreTriggeredOnTheCurrentStateWhenDefinedInActionsObject(assert) {\n var done = assert.async();\n\n this.router.map(function () {\n this.route('home', { path: '/' });\n });\n\n var model = { name: 'Tom Dale' };\n var HomeRoute = _routing.Route.extend({\n model: function () {\n return model;\n },\n\n actions: {\n showStuff: function (obj) {\n assert.ok(this instanceof HomeRoute, 'the handler is an App.HomeRoute');\n assert.deepEqual((0, _polyfills.assign)({}, obj), { name: 'Tom Dale' }, 'the context is correct');\n done();\n }\n }\n });\n\n this.add('route:home', HomeRoute);\n this.addTemplate('home', '{{model.name}}');\n\n this.visit('/').then(function () {\n document.getElementById('qunit-fixture').querySelector('a').click();\n });\n };\n\n _class.prototype['@test Events defined in `actions` object are triggered on the current state when routes are nested'] = function testEventsDefinedInActionsObjectAreTriggeredOnTheCurrentStateWhenRoutesAreNested(assert) {\n var done = assert.async();\n\n this.router.map(function () {\n this.route('root', { path: '/' }, function () {\n this.route('index', { path: '/' });\n });\n });\n\n var model = { name: 'Tom Dale' };\n\n var RootRoute = _routing.Route.extend({\n actions: {\n showStuff: function (obj) {\n assert.ok(this instanceof RootRoute, 'the handler is an App.HomeRoute');\n assert.deepEqual((0, _polyfills.assign)({}, obj), { name: 'Tom Dale' }, 'the context is correct');\n done();\n }\n }\n });\n this.add('route:root', RootRoute);\n this.add('route:root.index', _routing.Route.extend({\n model: function () {\n return model;\n }\n }));\n\n this.addTemplate('root.index', '{{model.name}}');\n\n this.visit('/').then(function () {\n document.getElementById('qunit-fixture').querySelector('a').click();\n });\n };\n\n _class.prototype['@test Events can be handled by inherited event handlers'] = function testEventsCanBeHandledByInheritedEventHandlers(assert) {\n assert.expect(4);\n\n var SuperRoute = _routing.Route.extend({\n actions: {\n foo: function () {\n assert.ok(true, 'foo');\n },\n bar: function (msg) {\n assert.equal(msg, 'HELLO', 'bar hander in super route');\n }\n }\n });\n\n var RouteMixin = _metal.Mixin.create({\n actions: {\n bar: function (msg) {\n assert.equal(msg, 'HELLO', 'bar handler in mixin');\n this._super(msg);\n }\n }\n });\n\n this.add('route:home', SuperRoute.extend(RouteMixin, {\n actions: {\n baz: function () {\n assert.ok(true, 'baz', 'baz hander in route');\n }\n }\n }));\n this.addTemplate('home', '\\n Do foo\\n Do bar with arg\\n Do bar\\n ');\n\n return this.visit('/').then(function () {\n var rootElement = document.getElementById('qunit-fixture');\n rootElement.querySelector('.do-foo').click();\n rootElement.querySelector('.do-bar-with-arg').click();\n rootElement.querySelector('.do-baz').click();\n });\n };\n\n _class.prototype['@test Actions are not triggered on the controller if a matching action name is implemented as a method'] = function testActionsAreNotTriggeredOnTheControllerIfAMatchingActionNameIsImplementedAsAMethod(assert) {\n var done = assert.async();\n\n this.router.map(function () {\n this.route('home', { path: '/' });\n });\n\n var model = { name: 'Tom Dale' };\n var stateIsNotCalled = true;\n\n this.add('route:home', _routing.Route.extend({\n model: function () {\n return model;\n },\n\n actions: {\n showStuff: function (context) {\n assert.ok(stateIsNotCalled, 'an event on the state is not triggered');\n assert.deepEqual(context, { name: 'Tom Dale' }, 'an event with context is passed');\n done();\n }\n }\n }));\n\n this.addTemplate('home', '{{name}}');\n\n this.add('controller:home', _controller.default.extend({\n showStuff: function () {\n stateIsNotCalled = false;\n assert.ok(stateIsNotCalled, 'an event on the state is not triggered');\n }\n }));\n\n this.visit('/').then(function () {\n document.getElementById('qunit-fixture').querySelector('a').click();\n });\n };\n\n _class.prototype['@test actions can be triggered with multiple arguments'] = function testActionsCanBeTriggeredWithMultipleArguments(assert) {\n var done = assert.async();\n this.router.map(function () {\n this.route('root', { path: '/' }, function () {\n this.route('index', { path: '/' });\n });\n });\n\n var model1 = { name: 'Tilde' };\n var model2 = { name: 'Tom Dale' };\n\n var RootRoute = _routing.Route.extend({\n actions: {\n showStuff: function (obj1, obj2) {\n assert.ok(this instanceof RootRoute, 'the handler is an App.HomeRoute');\n assert.deepEqual((0, _polyfills.assign)({}, obj1), { name: 'Tilde' }, 'the first context is correct');\n assert.deepEqual((0, _polyfills.assign)({}, obj2), { name: 'Tom Dale' }, 'the second context is correct');\n done();\n }\n }\n });\n\n this.add('route:root', RootRoute);\n\n this.add('controller:root.index', _controller.default.extend({\n model1: model1,\n model2: model2\n }));\n\n this.addTemplate('root.index', '{{model1.name}}');\n\n this.visit('/').then(function () {\n document.getElementById('qunit-fixture').querySelector('a').click();\n });\n };\n\n _class.prototype['@test transitioning multiple times in a single run loop only sets the URL once'] = function testTransitioningMultipleTimesInASingleRunLoopOnlySetsTheURLOnce(assert) {\n var _this29 = this;\n\n this.router.map(function () {\n this.route('root', { path: '/' });\n this.route('foo');\n this.route('bar');\n });\n\n return this.visit('/').then(function () {\n var urlSetCount = 0;\n var router = _this29.applicationInstance.lookup('router:main');\n\n router.get('location').setURL = function (path) {\n urlSetCount++;\n (0, _metal.set)(this, 'path', path);\n };\n\n assert.equal(urlSetCount, 0);\n\n (0, _runloop.run)(function () {\n router.transitionTo('foo');\n router.transitionTo('bar');\n });\n\n assert.equal(urlSetCount, 1);\n assert.equal(router.get('location').getURL(), '/bar');\n });\n };\n\n _class.prototype['@test navigating away triggers a url property change'] = function testNavigatingAwayTriggersAUrlPropertyChange(assert) {\n var _this30 = this;\n\n assert.expect(3);\n\n this.router.map(function () {\n this.route('root', { path: '/' });\n this.route('foo', { path: '/foo' });\n this.route('bar', { path: '/bar' });\n });\n\n return this.visit('/').then(function () {\n var router = _this30.applicationInstance.lookup('router:main');\n\n (0, _metal.addObserver)(router, 'url', function () {\n assert.ok(true, 'url change event was fired');\n });\n ['foo', 'bar', '/foo'].forEach(function (destination) {\n return (0, _runloop.run)(router, 'transitionTo', destination);\n });\n });\n };\n\n _class.prototype['@test using replaceWith calls location.replaceURL if available'] = function testUsingReplaceWithCallsLocationReplaceURLIfAvailable(assert) {\n var _this31 = this;\n\n var setCount = 0;\n var replaceCount = 0;\n this.router.reopen({\n location: _routing.NoneLocation.create({\n setURL: function (path) {\n setCount++;\n (0, _metal.set)(this, 'path', path);\n },\n replaceURL: function (path) {\n replaceCount++;\n (0, _metal.set)(this, 'path', path);\n }\n })\n });\n\n this.router.map(function () {\n this.route('root', { path: '/' });\n this.route('foo');\n });\n\n return this.visit('/').then(function () {\n var router = _this31.applicationInstance.lookup('router:main');\n assert.equal(setCount, 1);\n assert.equal(replaceCount, 0);\n\n (0, _runloop.run)(function () {\n return router.replaceWith('foo');\n });\n\n assert.equal(setCount, 1, 'should not call setURL');\n assert.equal(replaceCount, 1, 'should call replaceURL once');\n assert.equal(router.get('location').getURL(), '/foo');\n });\n };\n\n _class.prototype['@test using replaceWith calls setURL if location.replaceURL is not defined'] = function testUsingReplaceWithCallsSetURLIfLocationReplaceURLIsNotDefined(assert) {\n var _this32 = this;\n\n var setCount = 0;\n\n this.router.reopen({\n location: _routing.NoneLocation.create({\n setURL: function (path) {\n setCount++;\n (0, _metal.set)(this, 'path', path);\n }\n })\n });\n\n this.router.map(function () {\n this.route('root', { path: '/' });\n this.route('foo');\n });\n\n return this.visit('/').then(function () {\n var router = _this32.applicationInstance.lookup('router:main');\n\n assert.equal(setCount, 1);\n (0, _runloop.run)(function () {\n return router.replaceWith('foo');\n });\n assert.equal(setCount, 2, 'should call setURL once');\n assert.equal(router.get('location').getURL(), '/foo');\n });\n };\n\n _class.prototype['@test Route inherits model from parent route'] = function testRouteInheritsModelFromParentRoute(assert) {\n var _this33 = this;\n\n assert.expect(9);\n\n this.router.map(function () {\n this.route('the-post', { path: '/posts/:post_id' }, function () {\n this.route('comments');\n\n this.route('shares', { path: '/shares/:share_id', resetNamespace: true }, function () {\n this.route('share');\n });\n });\n });\n\n var post1 = {};\n var post2 = {};\n var post3 = {};\n var share1 = {};\n var share2 = {};\n var share3 = {};\n\n var posts = {\n 1: post1,\n 2: post2,\n 3: post3\n };\n var shares = {\n 1: share1,\n 2: share2,\n 3: share3\n };\n\n this.add('route:the-post', _routing.Route.extend({\n model: function (params) {\n return posts[params.post_id];\n }\n }));\n\n this.add('route:the-post.comments', _routing.Route.extend({\n afterModel: function (post /*, transition */) {\n var parent_model = this.modelFor('the-post');\n\n assert.equal(post, parent_model);\n }\n }));\n\n this.add('route:shares', _routing.Route.extend({\n model: function (params) {\n return shares[params.share_id];\n }\n }));\n\n this.add('route:shares.share', _routing.Route.extend({\n afterModel: function (share /*, transition */) {\n var parent_model = this.modelFor('shares');\n\n assert.equal(share, parent_model);\n }\n }));\n\n return this.visit('/posts/1/comments').then(function () {\n assert.ok(true, 'url: /posts/1/comments was handled');\n return _this33.visit('/posts/1/shares/1');\n }).then(function () {\n assert.ok(true, 'url: /posts/1/shares/1 was handled');\n return _this33.visit('/posts/2/comments');\n }).then(function () {\n assert.ok(true, 'url: /posts/2/comments was handled');\n return _this33.visit('/posts/2/shares/2');\n }).then(function () {\n assert.ok(true, 'url: /posts/2/shares/2 was handled');\n return _this33.visit('/posts/3/comments');\n }).then(function () {\n assert.ok(true, 'url: /posts/3/shares was handled');\n return _this33.visit('/posts/3/shares/3');\n }).then(function () {\n assert.ok(true, 'url: /posts/3/shares/3 was handled');\n });\n };\n\n _class.prototype['@test Routes with { resetNamespace: true } inherits model from parent route'] = function testRoutesWithResetNamespaceTrueInheritsModelFromParentRoute(assert) {\n var _this34 = this;\n\n assert.expect(6);\n\n this.router.map(function () {\n this.route('the-post', { path: '/posts/:post_id' }, function () {\n this.route('comments', { resetNamespace: true }, function () {});\n });\n });\n\n var post1 = {};\n var post2 = {};\n var post3 = {};\n\n var posts = {\n 1: post1,\n 2: post2,\n 3: post3\n };\n\n this.add('route:the-post', _routing.Route.extend({\n model: function (params) {\n return posts[params.post_id];\n }\n }));\n\n this.add('route:comments', _routing.Route.extend({\n afterModel: function (post /*, transition */) {\n var parent_model = this.modelFor('the-post');\n\n assert.equal(post, parent_model);\n }\n }));\n\n return this.visit('/posts/1/comments').then(function () {\n assert.ok(true, '/posts/1/comments');\n return _this34.visit('/posts/2/comments');\n }).then(function () {\n assert.ok(true, '/posts/2/comments');\n return _this34.visit('/posts/3/comments');\n }).then(function () {\n assert.ok(true, '/posts/3/comments');\n });\n };\n\n _class.prototype['@test It is possible to get the model from a parent route'] = function testItIsPossibleToGetTheModelFromAParentRoute(assert) {\n var _this35 = this;\n\n assert.expect(6);\n\n this.router.map(function () {\n this.route('the-post', { path: '/posts/:post_id' }, function () {\n this.route('comments', { resetNamespace: true });\n });\n });\n\n var post1 = {};\n var post2 = {};\n var post3 = {};\n var currentPost = void 0;\n\n var posts = {\n 1: post1,\n 2: post2,\n 3: post3\n };\n\n this.add('route:the-post', _routing.Route.extend({\n model: function (params) {\n return posts[params.post_id];\n }\n }));\n\n this.add('route:comments', _routing.Route.extend({\n model: function () {\n assert.equal(this.modelFor('the-post'), currentPost);\n }\n }));\n\n currentPost = post1;\n return this.visit('/posts/1/comments').then(function () {\n assert.ok(true, '/posts/1/comments has been handled');\n currentPost = post2;\n return _this35.visit('/posts/2/comments');\n }).then(function () {\n assert.ok(true, '/posts/2/comments has been handled');\n currentPost = post3;\n return _this35.visit('/posts/3/comments');\n }).then(function () {\n assert.ok(true, '/posts/3/comments has been handled');\n });\n };\n\n _class.prototype['@test A redirection hook is provided'] = function testARedirectionHookIsProvided(assert) {\n var _this36 = this;\n\n this.router.map(function () {\n this.route('choose', { path: '/' });\n this.route('home');\n });\n\n var chooseFollowed = 0;\n var destination = 'home';\n\n this.add('route:choose', _routing.Route.extend({\n redirect: function () {\n if (destination) {\n this.transitionTo(destination);\n }\n },\n setupController: function () {\n chooseFollowed++;\n }\n }));\n\n return this.visit('/').then(function () {\n var rootElement = document.getElementById('qunit-fixture');\n assert.equal(chooseFollowed, 0, \"The choose route wasn't entered since a transition occurred\");\n assert.equal(rootElement.querySelectorAll('h3.hours').length, 1, 'The home template was rendered');\n assert.equal(_this36.applicationInstance.lookup('controller:application').get('currentPath'), 'home');\n });\n };\n\n _class.prototype['@test Redirecting from the middle of a route aborts the remainder of the routes'] = function testRedirectingFromTheMiddleOfARouteAbortsTheRemainderOfTheRoutes(assert) {\n var _this37 = this;\n\n assert.expect(3);\n\n this.router.map(function () {\n this.route('home');\n this.route('foo', function () {\n this.route('bar', { resetNamespace: true }, function () {\n this.route('baz');\n });\n });\n });\n\n this.add('route:bar', _routing.Route.extend({\n redirect: function () {\n this.transitionTo('home');\n },\n setupController: function () {\n assert.ok(false, 'Should transition before setupController');\n }\n }));\n\n this.add('route:bar-baz', _routing.Route.extend({\n enter: function () {\n assert.ok(false, 'Should abort transition getting to next route');\n }\n }));\n\n return this.visit('/').then(function () {\n var router = _this37.applicationInstance.lookup('router:main');\n _this37.handleURLAborts(assert, '/foo/bar/baz');\n assert.equal(_this37.applicationInstance.lookup('controller:application').get('currentPath'), 'home');\n assert.equal(router.get('location').getURL(), '/home');\n });\n };\n\n _class.prototype['@test Redirecting to the current target in the middle of a route does not abort initial routing'] = function testRedirectingToTheCurrentTargetInTheMiddleOfARouteDoesNotAbortInitialRouting(assert) {\n var _this38 = this;\n\n assert.expect(5);\n\n this.router.map(function () {\n this.route('home');\n this.route('foo', function () {\n this.route('bar', { resetNamespace: true }, function () {\n this.route('baz');\n });\n });\n });\n\n var successCount = 0;\n\n this.add('route:bar', _routing.Route.extend({\n redirect: function () {\n return this.transitionTo('bar.baz').then(function () {\n successCount++;\n });\n },\n setupController: function () {\n assert.ok(true, \"Should still invoke bar's setupController\");\n }\n }));\n\n this.add('route:bar.baz', _routing.Route.extend({\n setupController: function () {\n assert.ok(true, \"Should still invoke bar.baz's setupController\");\n }\n }));\n\n return this.visit('/foo/bar/baz').then(function () {\n assert.ok(true, '/foo/bar/baz has been handled');\n assert.equal(_this38.applicationInstance.lookup('controller:application').get('currentPath'), 'foo.bar.baz');\n assert.equal(successCount, 1, 'transitionTo success handler was called once');\n });\n };\n\n _class.prototype['@test Redirecting to the current target with a different context aborts the remainder of the routes'] = function testRedirectingToTheCurrentTargetWithADifferentContextAbortsTheRemainderOfTheRoutes(assert) {\n var _this39 = this;\n\n assert.expect(4);\n\n this.router.map(function () {\n this.route('home');\n this.route('foo', function () {\n this.route('bar', { path: 'bar/:id', resetNamespace: true }, function () {\n this.route('baz');\n });\n });\n });\n\n var model = { id: 2 };\n\n var count = 0;\n\n this.add('route:bar', _routing.Route.extend({\n afterModel: function () {\n if (count++ > 10) {\n assert.ok(false, 'infinite loop');\n } else {\n this.transitionTo('bar.baz', model);\n }\n }\n }));\n\n this.add('route:bar.baz', _routing.Route.extend({\n setupController: function () {\n assert.ok(true, 'Should still invoke setupController');\n }\n }));\n\n return this.visit('/').then(function () {\n _this39.handleURLAborts(assert, '/foo/bar/1/baz');\n assert.equal(_this39.applicationInstance.lookup('controller:application').get('currentPath'), 'foo.bar.baz');\n assert.equal(_this39.applicationInstance.lookup('router:main').get('location').getURL(), '/foo/bar/2/baz');\n });\n };\n\n _class.prototype['@test Transitioning from a parent event does not prevent currentPath from being set'] = function testTransitioningFromAParentEventDoesNotPreventCurrentPathFromBeingSet(assert) {\n var _this40 = this;\n\n this.router.map(function () {\n this.route('foo', function () {\n this.route('bar', { resetNamespace: true }, function () {\n this.route('baz');\n });\n this.route('qux');\n });\n });\n\n this.add('route:foo', _routing.Route.extend({\n actions: {\n goToQux: function () {\n this.transitionTo('foo.qux');\n }\n }\n }));\n\n return this.visit('/foo/bar/baz').then(function () {\n assert.ok(true, '/foo/bar/baz has been handled');\n var applicationController = _this40.applicationInstance.lookup('controller:application');\n var router = _this40.applicationInstance.lookup('router:main');\n assert.equal(applicationController.get('currentPath'), 'foo.bar.baz');\n (0, _runloop.run)(function () {\n return router.send('goToQux');\n });\n assert.equal(applicationController.get('currentPath'), 'foo.qux');\n assert.equal(router.get('location').getURL(), '/foo/qux');\n });\n };\n\n _class.prototype['@test Generated names can be customized when providing routes with dot notation'] = function testGeneratedNamesCanBeCustomizedWhenProvidingRoutesWithDotNotation(assert) {\n assert.expect(4);\n\n this.addTemplate('index', '{{name}}Bottom!
');\n\n this.router.map(function () {\n this.route('foo', { path: '/top' }, function () {\n this.route('bar', { path: '/middle', resetNamespace: true }, function () {\n this.route('baz', { path: '/bottom' });\n });\n });\n });\n\n this.add('route:foo', _routing.Route.extend({\n renderTemplate: function () {\n assert.ok(true, 'FooBarRoute was called');\n return this._super.apply(this, arguments);\n }\n }));\n\n this.add('route:bar.baz', _routing.Route.extend({\n renderTemplate: function () {\n assert.ok(true, 'BarBazRoute was called');\n return this._super.apply(this, arguments);\n }\n }));\n\n this.add('controller:bar', _controller.default.extend({\n name: 'Bar'\n }));\n\n this.add('controller:bar.baz', _controller.default.extend({\n name: 'BarBaz'\n }));\n\n return this.visit('/top/middle/bottom').then(function () {\n assert.ok(true, '/top/middle/bottom has been handled');\n var rootElement = document.getElementById('qunit-fixture');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('.main .middle .bottom p')), 'BarBazBottom!', 'The templates were rendered into their appropriate parents');\n });\n };\n\n _class.prototype[\"@test Child routes render into their parent route's template by default\"] = function testChildRoutesRenderIntoTheirParentRouteSTemplateByDefault(assert) {\n this.addTemplate('index', 'Bottom!
');\n\n this.router.map(function () {\n this.route('top', function () {\n this.route('middle', { resetNamespace: true }, function () {\n this.route('bottom');\n });\n });\n });\n\n return this.visit('/top/middle/bottom').then(function () {\n assert.ok(true, '/top/middle/bottom has been handled');\n var rootElement = document.getElementById('qunit-fixture');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('.main .middle .bottom p')), 'Bottom!', 'The templates were rendered into their appropriate parents');\n });\n };\n\n _class.prototype['@test Child routes render into specified template'] = function testChildRoutesRenderIntoSpecifiedTemplate(assert) {\n this.addTemplate('index', 'Bottom!
');\n\n this.router.map(function () {\n this.route('top', function () {\n this.route('middle', { resetNamespace: true }, function () {\n this.route('bottom');\n });\n });\n });\n\n this.add('route:middle.bottom', _routing.Route.extend({\n renderTemplate: function () {\n this.render('middle/bottom', { into: 'top' });\n }\n }));\n\n return this.visit('/top/middle/bottom').then(function () {\n assert.ok(true, '/top/middle/bottom has been handled');\n var rootElement = document.getElementById('qunit-fixture');\n assert.equal(rootElement.querySelectorAll('.main .middle .bottom p').length, 0, 'should not render into the middle template');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('.main .middle > p')), 'Bottom!', 'The template was rendered into the top template');\n });\n };\n\n _class.prototype['@test Rendering into specified template with slash notation'] = function testRenderingIntoSpecifiedTemplateWithSlashNotation(assert) {\n this.addTemplate('person.profile', 'profile {{outlet}}');\n this.addTemplate('person.details', 'details!');\n\n this.router.map(function () {\n this.route('home', { path: '/' });\n });\n\n this.add('route:home', _routing.Route.extend({\n renderTemplate: function () {\n this.render('person/profile');\n this.render('person/details', { into: 'person/profile' });\n }\n }));\n\n return this.visit('/').then(function () {\n var rootElement = document.getElementById('qunit-fixture');\n assert.equal(rootElement.textContent.trim(), 'profile details!', 'The templates were rendered');\n });\n };\n\n _class.prototype['@test Parent route context change'] = function testParentRouteContextChange(assert) {\n var _this41 = this;\n\n var editCount = 0;\n var editedPostIds = (0, _runtime.A)();\n\n this.addTemplate('application', '{{outlet}}');\n this.addTemplate('posts', '{{outlet}}');\n this.addTemplate('post', '{{outlet}}');\n this.addTemplate('post/index', 'showing');\n this.addTemplate('post/edit', 'editing');\n\n this.router.map(function () {\n this.route('posts', function () {\n this.route('post', { path: '/:postId', resetNamespace: true }, function () {\n this.route('edit');\n });\n });\n });\n\n this.add('route:posts', _routing.Route.extend({\n actions: {\n showPost: function (context) {\n this.transitionTo('post', context);\n }\n }\n }));\n\n this.add('route:post', _routing.Route.extend({\n model: function (params) {\n return { id: params.postId };\n },\n serialize: function (model) {\n return { postId: model.id };\n },\n\n actions: {\n editPost: function () {\n this.transitionTo('post.edit');\n }\n }\n }));\n\n this.add('route:post.edit', _routing.Route.extend({\n model: function () {\n var postId = this.modelFor('post').id;\n editedPostIds.push(postId);\n return null;\n },\n setup: function () {\n this._super.apply(this, arguments);\n editCount++;\n }\n }));\n\n return this.visit('/posts/1').then(function () {\n assert.ok(true, '/posts/1 has been handled');\n var router = _this41.applicationInstance.lookup('router:main');\n (0, _runloop.run)(function () {\n return router.send('editPost');\n });\n (0, _runloop.run)(function () {\n return router.send('showPost', { id: '2' });\n });\n (0, _runloop.run)(function () {\n return router.send('editPost');\n });\n assert.equal(editCount, 2, 'set up the edit route twice without failure');\n assert.deepEqual(editedPostIds, ['1', '2'], 'modelFor posts.post returns the right context');\n });\n };\n\n _class.prototype['@test Router accounts for rootURL on page load when using history location'] = function testRouterAccountsForRootURLOnPageLoadWhenUsingHistoryLocation(assert) {\n var rootURL = window.location.pathname + '/app';\n var postsTemplateRendered = false;\n var setHistory = void 0;\n\n setHistory = function (obj, path) {\n obj.set('history', { state: { path: path } });\n };\n\n var location = _routing.HistoryLocation.create({\n initState: function () {\n var path = rootURL + '/posts';\n\n setHistory(this, path);\n this.set('location', {\n pathname: path,\n href: 'http://localhost/' + path\n });\n },\n replaceState: function (path) {\n setHistory(this, path);\n },\n pushState: function (path) {\n setHistory(this, path);\n }\n });\n\n this.router.reopen({\n // location: 'historyTest',\n location: location,\n rootURL: rootURL\n });\n\n this.router.map(function () {\n this.route('posts', { path: '/posts' });\n });\n\n this.add('route:posts', _routing.Route.extend({\n model: function () {},\n renderTemplate: function () {\n postsTemplateRendered = true;\n }\n }));\n\n return this.visit('/').then(function () {\n assert.ok(postsTemplateRendered, 'Posts route successfully stripped from rootURL');\n\n (0, _internalTestHelpers.runDestroy)(location);\n location = null;\n });\n };\n\n _class.prototype['@test The rootURL is passed properly to the location implementation'] = function testTheRootURLIsPassedProperlyToTheLocationImplementation(assert) {\n assert.expect(1);\n var rootURL = '/blahzorz';\n this.add('location:history-test', _routing.HistoryLocation.extend({\n rootURL: 'this is not the URL you are looking for',\n history: {\n pushState: function () {}\n },\n initState: function () {\n assert.equal(this.get('rootURL'), rootURL);\n }\n }));\n\n this.router.reopen({\n location: 'history-test',\n rootURL: rootURL,\n // if we transition in this test we will receive failures\n // if the tests are run from a static file\n _doURLTransition: function () {\n return _rsvp.default.resolve('');\n }\n });\n\n return this.visit('/');\n };\n\n _class.prototype['@test Only use route rendered into main outlet for default into property on child'] = function testOnlyUseRouteRenderedIntoMainOutletForDefaultIntoPropertyOnChild(assert) {\n this.addTemplate('application', \"{{outlet 'menu'}}{{outlet}}\");\n this.addTemplate('posts', '{{outlet}}');\n this.addTemplate('posts.index', 'postsIndex
');\n this.addTemplate('posts.menu', ' ');\n\n this.router.map(function () {\n this.route('posts', function () {});\n });\n\n this.add('route:posts', _routing.Route.extend({\n renderTemplate: function () {\n this.render();\n this.render('posts/menu', {\n into: 'application',\n outlet: 'menu'\n });\n }\n }));\n\n return this.visit('/posts').then(function () {\n assert.ok(true, '/posts has been handled');\n var rootElement = document.getElementById('qunit-fixture');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('div.posts-menu')), 'postsMenu', 'The posts/menu template was rendered');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('p.posts-index')), 'postsIndex', 'The posts/index template was rendered');\n });\n };\n\n _class.prototype['@test Generating a URL should not affect currentModel'] = function testGeneratingAURLShouldNotAffectCurrentModel(assert) {\n var _this42 = this;\n\n this.router.map(function () {\n this.route('post', { path: '/posts/:post_id' });\n });\n\n var posts = {\n 1: { id: 1 },\n 2: { id: 2 }\n };\n\n this.add('route:post', _routing.Route.extend({\n model: function (params) {\n return posts[params.post_id];\n }\n }));\n\n return this.visit('/posts/1').then(function () {\n assert.ok(true, '/posts/1 has been handled');\n\n var route = _this42.applicationInstance.lookup('route:post');\n assert.equal(route.modelFor('post'), posts[1]);\n\n var url = _this42.applicationInstance.lookup('router:main').generate('post', posts[2]);\n assert.equal(url, '/posts/2');\n assert.equal(route.modelFor('post'), posts[1]);\n });\n };\n\n _class.prototype[\"@test Nested index route is not overridden by parent's implicit index route\"] = function testNestedIndexRouteIsNotOverriddenByParentSImplicitIndexRoute(assert) {\n var _this43 = this;\n\n this.router.map(function () {\n this.route('posts', function () {\n this.route('index', { path: ':category' });\n });\n });\n\n return this.visit('/').then(function () {\n var router = _this43.applicationInstance.lookup('router:main');\n return router.transitionTo('posts', { category: 'emberjs' });\n }).then(function () {\n var router = _this43.applicationInstance.lookup('router:main');\n assert.deepEqual(router.location.path, '/posts/emberjs');\n });\n };\n\n _class.prototype['@test Application template does not duplicate when re-rendered'] = function testApplicationTemplateDoesNotDuplicateWhenReRendered(assert) {\n this.addTemplate('application', '{{model.name}}{{foo-bar}}
');\n\n var rootElement = document.getElementById('qunit-fixture');\n return this.visit('/page/first').then(function () {\n assert.ok(true, '/page/first has been handled');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('p')), 'first');\n assert.equal(insertionCount, 1);\n return _this44.visit('/page/second');\n }).then(function () {\n assert.ok(true, '/page/second has been handled');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('p')), 'second');\n assert.equal(insertionCount, 1, 'view should have inserted only once');\n var router = _this44.applicationInstance.lookup('router:main');\n return (0, _runloop.run)(function () {\n return router.transitionTo('page', _runtime.Object.create({ name: 'third' }));\n });\n }).then(function () {\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('p')), 'third');\n assert.equal(insertionCount, 1, 'view should still have inserted only once');\n });\n };\n\n _class.prototype['@test The template is not re-rendered when two routes present the exact same template & controller'] = function testTheTemplateIsNotReRenderedWhenTwoRoutesPresentTheExactSameTemplateController(assert) {\n var _this45 = this;\n\n this.router.map(function () {\n this.route('first');\n this.route('second');\n this.route('third');\n this.route('fourth');\n });\n\n // Note add a component to test insertion\n\n var insertionCount = 0;\n this.add('component:x-input', _glimmer.Component.extend({\n didInsertElement: function () {\n insertionCount += 1;\n }\n }));\n\n var SharedRoute = _routing.Route.extend({\n setupController: function () {\n this.controllerFor('shared').set('message', 'This is the ' + this.routeName + ' message');\n },\n renderTemplate: function () {\n this.render('shared', { controller: 'shared' });\n }\n });\n\n this.add('route:shared', SharedRoute);\n this.add('route:first', SharedRoute.extend());\n this.add('route:second', SharedRoute.extend());\n this.add('route:third', SharedRoute.extend());\n this.add('route:fourth', SharedRoute.extend());\n\n this.add('controller:shared', _controller.default.extend());\n\n this.addTemplate('shared', '{{message}}{{x-input}}
');\n\n var rootElement = document.getElementById('qunit-fixture');\n return this.visit('/first').then(function () {\n assert.ok(true, '/first has been handled');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('p')), 'This is the first message');\n assert.equal(insertionCount, 1, 'expected one assertion');\n return _this45.visit('/second');\n }).then(function () {\n assert.ok(true, '/second has been handled');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('p')), 'This is the second message');\n assert.equal(insertionCount, 1, 'expected one assertion');\n return (0, _runloop.run)(function () {\n _this45.applicationInstance.lookup('router:main').transitionTo('third').then(function () {\n assert.ok(true, 'expected transition');\n }, function (reason) {\n assert.ok(false, 'unexpected transition failure: ', QUnit.jsDump.parse(reason));\n });\n });\n }).then(function () {\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('p')), 'This is the third message');\n assert.equal(insertionCount, 1, 'expected one assertion');\n return _this45.visit('fourth');\n }).then(function () {\n assert.ok(true, '/fourth has been handled');\n assert.equal(insertionCount, 1, 'expected one assertion');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('p')), 'This is the fourth message');\n });\n };\n\n _class.prototype['@test ApplicationRoute with model does not proxy the currentPath'] = function testApplicationRouteWithModelDoesNotProxyTheCurrentPath(assert) {\n var model = {};\n var currentPath = void 0;\n\n this.router.map(function () {\n this.route('index', { path: '/' });\n });\n\n this.add('route:application', _routing.Route.extend({\n model: function () {\n return model;\n }\n }));\n\n this.add('controller:application', _controller.default.extend({\n currentPathDidChange: (0, _metal.observer)('currentPath', function () {\n currentPath = this.currentPath;\n })\n }));\n\n return this.visit('/').then(function () {\n assert.equal(currentPath, 'index', 'currentPath is index');\n assert.equal('currentPath' in model, false, 'should have defined currentPath on controller');\n });\n };\n\n _class.prototype['@test Promises encountered on app load put app into loading state until resolved'] = function testPromisesEncounteredOnAppLoadPutAppIntoLoadingStateUntilResolved(assert) {\n var _this46 = this;\n\n assert.expect(2);\n\n var deferred = _rsvp.default.defer();\n this.router.map(function () {\n this.route('index', { path: '/' });\n });\n\n this.add('route:index', _routing.Route.extend({\n model: function () {\n return deferred.promise;\n }\n }));\n\n this.addTemplate('index', 'INDEX
');\n this.addTemplate('loading', 'LOADING
');\n\n (0, _runloop.run)(function () {\n return _this46.visit('/');\n });\n var rootElement = document.getElementById('qunit-fixture');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('p')), 'LOADING', 'The loading state is displaying.');\n (0, _runloop.run)(deferred.resolve);\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('p')), 'INDEX', 'The index route is display.');\n };\n\n _class.prototype['@test Route should tear down multiple outlets'] = function testRouteShouldTearDownMultipleOutlets(assert) {\n var _this47 = this;\n\n this.addTemplate('application', \"{{outlet 'menu'}}{{outlet}}{{outlet 'footer'}}\");\n this.addTemplate('posts', '{{outlet}}');\n this.addTemplate('users', 'users');\n this.addTemplate('posts.index', 'postsIndex
');\n this.addTemplate('posts.menu', ' ');\n this.addTemplate('posts.footer', ' ');\n\n this.router.map(function () {\n this.route('posts', function () {});\n this.route('users', function () {});\n });\n\n this.add('route:posts', _routing.Route.extend({\n renderTemplate: function () {\n this.render('posts/menu', {\n into: 'application',\n outlet: 'menu'\n });\n\n this.render();\n\n this.render('posts/footer', {\n into: 'application',\n outlet: 'footer'\n });\n }\n }));\n\n var rootElement = document.getElementById('qunit-fixture');\n return this.visit('/posts').then(function () {\n assert.ok(true, '/posts has been handled');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('div.posts-menu')), 'postsMenu', 'The posts/menu template was rendered');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('p.posts-index')), 'postsIndex', 'The posts/index template was rendered');\n assert.equal((0, _internalTestHelpers.getTextOf)(rootElement.querySelector('div.posts-footer')), 'postsFooter', 'The posts/footer template was rendered');\n\n return _this47.visit('/users');\n }).then(function () {\n assert.ok(true, '/users has been handled');\n assert.equal(rootElement.querySelector('div.posts-menu'), null, 'The posts/menu template was removed');\n assert.equal(rootElement.querySelector('p.posts-index'), null, 'The posts/index template was removed');\n assert.equal(rootElement.querySelector('div.posts-footer'), null, 'The posts/footer template was removed');\n });\n };\n\n _class.prototype['@test Route supports clearing outlet explicitly'] = function testRouteSupportsClearingOutletExplicitly(assert) {\n var _this48 = this;\n\n this.addTemplate('application', \"{{outlet}}{{outlet 'modal'}}\");\n this.addTemplate('posts', '{{outlet}}');\n this.addTemplate('users', 'users');\n this.addTemplate('posts.index', 'TOPLEVEL ERROR: {{model.msg}}
\\n ');\n\n return this.visit('/').then(function () {\n var text = _this14.$('#toplevel-error').text();\n assert.equal(text, 'TOPLEVEL ERROR: BAD NEWS BEARS', 'toplevel error rendered');\n reject = false;\n }).then(function () {\n return _this14.visit('/');\n }).then(function () {\n var text = _this14.$('#index').text();\n assert.equal(text, 'INDEX', 'the index route resolved');\n });\n };\n\n (0, _emberBabel.createClass)(_class, [{\n key: 'currentPath',\n get: function () {\n return this.getController('application').get('currentPath');\n }\n }]);\n\n return _class;\n }(_internalTestHelpers.ApplicationTestCase));\n\n (0, _internalTestHelpers.moduleFor)('Loading/Error Substates - nested routes', function (_ApplicationTestCase2) {\n (0, _emberBabel.inherits)(_class2, _ApplicationTestCase2);\n\n function _class2() {\n\n var _this15 = (0, _emberBabel.possibleConstructorReturn)(this, _ApplicationTestCase2.apply(this, arguments));\n\n counter = 1;\n\n _this15.addTemplate('application', '