/*! * @overview Ember - JavaScript Application Framework * @copyright Copyright 2011-2015 Tilde Inc. and contributors * Portions Copyright 2006-2011 Strobe Inc. * Portions Copyright 2008-2011 Apple Inc. All rights reserved. * @license Licensed under MIT license * See https://raw.github.com/emberjs/ember.js/master/LICENSE * @version 2.0.3 */ (function() { var enifed, requireModule, eriuqer, requirejs, Ember; var mainContext = this; (function() { var isNode = typeof window === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; if (!isNode) { Ember = this.Ember = this.Ember || {}; } if (typeof Ember === 'undefined') { Ember = {}; }; if (typeof Ember.__loader === 'undefined') { var registry = {}; var seen = {}; enifed = function(name, deps, callback) { var value = { }; if (!callback) { value.deps = []; value.callback = deps; } else { value.deps = deps; value.callback = callback; } registry[name] = value; }; requirejs = eriuqer = requireModule = function(name) { return internalRequire(name, null); } function internalRequire(name, referrerName) { var exports = seen[name]; if (exports !== undefined) { return exports; } exports = seen[name] = {}; if (!registry[name]) { if (referrerName) { throw new Error('Could not find module ' + name + ' required by: ' + referrerName); } else { throw new Error('Could not find module ' + name); } } var mod = registry[name]; var deps = mod.deps; var callback = mod.callback; var reified = []; var length = deps.length; for (var i=0; i'; }; Klass.create = create; Klass.extend = extend; Klass.reopen = extend; Klass.reopenClass = reopenClass; return Klass; function create(options) { return new this.prototype.constructor(options); } function reopenClass(options) { setProperties(this, options); } function extend(options) { var Child = function (options) { Klass.call(this, options); }; var Parent = this; Child.prototype = new Parent(); Child.prototype.constructor = Child; setProperties(Child, Klass); setProperties(Child.prototype, options); Child.create = create; Child.extend = extend; Child.reopen = extend; Child.reopenClass = reopenClass; return Child; } }; exports.factory = factory; exports.setProperties = setProperties; }); enifed('container/tests/container_helper.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - container/tests'); test('container/tests/container_helper.js should pass jscs', function () { ok(true, 'container/tests/container_helper.js should pass jscs.'); }); }); enifed('container/tests/container_helper.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - container/tests'); QUnit.test('container/tests/container_helper.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'container/tests/container_helper.js should pass jshint.'); }); }); enifed('container/tests/container_test', ['exports', 'ember-metal/core', 'container/registry', 'container/tests/container_helper'], function (exports, _emberMetalCore, _containerRegistry, _containerTestsContainer_helper) { 'use strict'; var originalModelInjections; QUnit.module('Container', { setup: function () { originalModelInjections = _emberMetalCore.default.MODEL_FACTORY_INJECTIONS; }, teardown: function () { _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = originalModelInjections; } }); QUnit.test('A registered factory returns the same instance each time', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); var postController = container.lookup('controller:post'); ok(postController instanceof PostController, 'The lookup is an instance of the factory'); equal(postController, container.lookup('controller:post')); }); QUnit.test('A registered factory is returned from lookupFactory', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); var PostControllerFactory = container.lookupFactory('controller:post'); ok(PostControllerFactory, 'factory is returned'); ok(PostControllerFactory.create() instanceof PostController, 'The return of factory.create is an instance of PostController'); }); QUnit.test('A registered factory is returned from lookupFactory is the same factory each time', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); deepEqual(container.lookupFactory('controller:post'), container.lookupFactory('controller:post'), 'The return of lookupFactory is always the same'); }); QUnit.test('A factory returned from lookupFactory has a debugkey', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); var PostFactory = container.lookupFactory('controller:post'); ok(!PostFactory.container, 'factory instance receives a container'); equal(PostFactory._debugContainerKey, 'controller:post', 'factory instance receives _debugContainerKey'); }); QUnit.test('fallback for to create time injections if factory has no extend', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var AppleController = _containerTestsContainer_helper.factory(); var PostController = _containerTestsContainer_helper.factory(); PostController.extend = undefined; // remove extend registry.register('controller:apple', AppleController); registry.register('controller:post', PostController); registry.injection('controller:post', 'apple', 'controller:apple'); var postController = container.lookup('controller:post'); ok(postController.container, 'instance receives a container'); equal(postController.container, container, 'instance receives the correct container'); equal(postController._debugContainerKey, 'controller:post', 'instance receives _debugContainerKey'); ok(postController.apple instanceof AppleController, 'instance receives an apple of instance AppleController'); }); QUnit.test('The descendants of a factory returned from lookupFactory have a container and debugkey', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); var instance; registry.register('controller:post', PostController); instance = container.lookupFactory('controller:post').create(); ok(instance.container, 'factory instance receives a container'); equal(instance._debugContainerKey, 'controller:post', 'factory instance receives _debugContainerKey'); ok(instance instanceof PostController, 'factory instance is instance of factory'); }); QUnit.test('A registered factory returns a fresh instance if singleton: false is passed as an option', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); var postController1 = container.lookup('controller:post'); var postController2 = container.lookup('controller:post', { singleton: false }); var postController3 = container.lookup('controller:post', { singleton: false }); var postController4 = container.lookup('controller:post'); equal(postController1.toString(), postController4.toString(), 'Singleton factories looked up normally return the same value'); notEqual(postController1.toString(), postController2.toString(), 'Singleton factories are not equal to factories looked up with singleton: false'); notEqual(postController2.toString(), postController3.toString(), 'Two factories looked up with singleton: false are not equal'); notEqual(postController3.toString(), postController4.toString(), 'A singleton factory looked up after a factory called with singleton: false is not equal'); ok(postController1 instanceof PostController, 'All instances are instances of the registered factory'); ok(postController2 instanceof PostController, 'All instances are instances of the registered factory'); ok(postController3 instanceof PostController, 'All instances are instances of the registered factory'); ok(postController4 instanceof PostController, 'All instances are instances of the registered factory'); }); QUnit.test('A container lookup has access to the container', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); var postController = container.lookup('controller:post'); equal(postController.container, container); }); QUnit.test('A factory type with a registered injection\'s instances receive that injection', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); var Store = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); registry.register('store:main', Store); registry.typeInjection('controller', 'store', 'store:main'); var postController = container.lookup('controller:post'); var store = container.lookup('store:main'); equal(postController.store, store); }); QUnit.test('An individual factory with a registered injection receives the injection', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); var Store = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); registry.register('store:main', Store); registry.injection('controller:post', 'store', 'store:main'); var postController = container.lookup('controller:post'); var store = container.lookup('store:main'); equal(store.container, container); equal(store._debugContainerKey, 'store:main'); equal(postController.container, container); equal(postController._debugContainerKey, 'controller:post'); equal(postController.store, store, 'has the correct store injected'); }); QUnit.test('A factory with both type and individual injections', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); var Store = _containerTestsContainer_helper.factory(); var Router = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); registry.register('store:main', Store); registry.register('router:main', Router); registry.injection('controller:post', 'store', 'store:main'); registry.typeInjection('controller', 'router', 'router:main'); var postController = container.lookup('controller:post'); var store = container.lookup('store:main'); var router = container.lookup('router:main'); equal(postController.store, store); equal(postController.router, router); }); QUnit.test('A factory with both type and individual factoryInjections', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); var Store = _containerTestsContainer_helper.factory(); var Router = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); registry.register('store:main', Store); registry.register('router:main', Router); registry.factoryInjection('controller:post', 'store', 'store:main'); registry.factoryTypeInjection('controller', 'router', 'router:main'); var PostControllerFactory = container.lookupFactory('controller:post'); var store = container.lookup('store:main'); var router = container.lookup('router:main'); equal(PostControllerFactory.store, store, 'PostControllerFactory has the instance of store'); equal(PostControllerFactory.router, router, 'PostControllerFactory has the route instance'); }); QUnit.test('A non-singleton instance is never cached', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostView = _containerTestsContainer_helper.factory(); registry.register('view:post', PostView, { singleton: false }); var postView1 = container.lookup('view:post'); var postView2 = container.lookup('view:post'); ok(postView1 !== postView2, 'Non-singletons are not cached'); }); QUnit.test('A non-instantiated property is not instantiated', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var template = function () {}; registry.register('template:foo', template, { instantiate: false }); equal(container.lookup('template:foo'), template); }); QUnit.test('A failed lookup returns undefined', function () { var registry = new _containerRegistry.default(); var container = registry.container(); equal(container.lookup('doesnot:exist'), undefined); }); QUnit.test('An invalid factory throws an error', function () { var registry = new _containerRegistry.default(); var container = registry.container(); registry.register('controller:foo', {}); throws(function () { container.lookup('controller:foo'); }, /Failed to create an instance of \'controller:foo\'/); }); QUnit.test('Injecting a failed lookup raises an error', function () { _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = true; var registry = new _containerRegistry.default(); var container = registry.container(); var fooInstance = {}; var fooFactory = {}; var Foo = { create: function (args) { return fooInstance; }, extend: function (args) { return fooFactory; } }; registry.register('model:foo', Foo); registry.injection('model:foo', 'store', 'store:main'); throws(function () { container.lookup('model:foo'); }); }); QUnit.test('Injecting a falsy value does not raise an error', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var ApplicationController = _containerTestsContainer_helper.factory(); registry.register('controller:application', ApplicationController); registry.register('user:current', null, { instantiate: false }); registry.injection('controller:application', 'currentUser', 'user:current'); equal(container.lookup('controller:application').currentUser, null); }); QUnit.test('Destroying the container destroys any cached singletons', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); var PostView = _containerTestsContainer_helper.factory(); var template = function () {}; registry.register('controller:post', PostController); registry.register('view:post', PostView, { singleton: false }); registry.register('template:post', template, { instantiate: false }); registry.injection('controller:post', 'postView', 'view:post'); var postController = container.lookup('controller:post'); var postView = postController.postView; ok(postView instanceof PostView, 'The non-singleton was injected'); container.destroy(); ok(postController.isDestroyed, 'Singletons are destroyed'); ok(!postView.isDestroyed, 'Non-singletons are not destroyed'); }); QUnit.test('The container can use a registry hook to resolve factories lazily', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); registry.resolver = function (fullName) { if (fullName === 'controller:post') { return PostController; } }; var postController = container.lookup('controller:post'); ok(postController instanceof PostController, 'The correct factory was provided'); }); QUnit.test('The container normalizes names before resolving', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); registry.normalizeFullName = function (fullName) { return 'controller:post'; }; registry.register('controller:post', PostController); var postController = container.lookup('controller:normalized'); ok(postController instanceof PostController, 'Normalizes the name before resolving'); }); QUnit.test('The container normalizes names when looking factory up', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); registry.normalizeFullName = function (fullName) { return 'controller:post'; }; registry.register('controller:post', PostController); var fact = container.lookupFactory('controller:normalized'); equal(fact.toString() === PostController.extend().toString(), true, 'Normalizes the name when looking factory up'); }); QUnit.test('The container can get options that should be applied to a given factory', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostView = _containerTestsContainer_helper.factory(); registry.resolver = function (fullName) { if (fullName === 'view:post') { return PostView; } }; registry.options('view:post', { instantiate: true, singleton: false }); var postView1 = container.lookup('view:post'); var postView2 = container.lookup('view:post'); ok(postView1 instanceof PostView, 'The correct factory was provided'); ok(postView2 instanceof PostView, 'The correct factory was provided'); ok(postView1 !== postView2, 'The two lookups are different'); }); QUnit.test('The container can get options that should be applied to all factories for a given type', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostView = _containerTestsContainer_helper.factory(); registry.resolver = function (fullName) { if (fullName === 'view:post') { return PostView; } }; registry.optionsForType('view', { singleton: false }); var postView1 = container.lookup('view:post'); var postView2 = container.lookup('view:post'); ok(postView1 instanceof PostView, 'The correct factory was provided'); ok(postView2 instanceof PostView, 'The correct factory was provided'); ok(postView1 !== postView2, 'The two lookups are different'); }); QUnit.test('factory resolves are cached', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); var resolveWasCalled = []; registry.resolve = function (fullName) { resolveWasCalled.push(fullName); return PostController; }; deepEqual(resolveWasCalled, []); container.lookupFactory('controller:post'); deepEqual(resolveWasCalled, ['controller:post']); container.lookupFactory('controller:post'); deepEqual(resolveWasCalled, ['controller:post']); }); QUnit.test('factory for non extendables (MODEL) resolves are cached', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = _containerTestsContainer_helper.factory(); var resolveWasCalled = []; registry.resolve = function (fullName) { resolveWasCalled.push(fullName); return PostController; }; deepEqual(resolveWasCalled, []); container.lookupFactory('model:post'); deepEqual(resolveWasCalled, ['model:post']); container.lookupFactory('model:post'); deepEqual(resolveWasCalled, ['model:post']); }); QUnit.test('factory for non extendables resolves are cached', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var PostController = {}; var resolveWasCalled = []; registry.resolve = function (fullName) { resolveWasCalled.push(fullName); return PostController; }; deepEqual(resolveWasCalled, []); container.lookupFactory('foo:post'); deepEqual(resolveWasCalled, ['foo:post']); container.lookupFactory('foo:post'); deepEqual(resolveWasCalled, ['foo:post']); }); QUnit.test('The `_onLookup` hook is called on factories when looked up the first time', function () { expect(2); var registry = new _containerRegistry.default(); var container = registry.container(); var Apple = _containerTestsContainer_helper.factory(); Apple.reopenClass({ _onLookup: function (fullName) { equal(fullName, 'apple:main', 'calls lazy injection method with the lookup full name'); equal(this, Apple, 'calls lazy injection method in the factory context'); } }); registry.register('apple:main', Apple); container.lookupFactory('apple:main'); container.lookupFactory('apple:main'); }); QUnit.test('A factory\'s lazy injections are validated when first instantiated', function () { var registry = new _containerRegistry.default(); var container = registry.container(); var Apple = _containerTestsContainer_helper.factory(); var Orange = _containerTestsContainer_helper.factory(); Apple.reopenClass({ _lazyInjections: function () { return ['orange:main', 'banana:main']; } }); registry.register('apple:main', Apple); registry.register('orange:main', Orange); throws(function () { container.lookup('apple:main'); }, /Attempting to inject an unknown injection: `banana:main`/); }); QUnit.test('Lazy injection validations are cached', function () { expect(1); var registry = new _containerRegistry.default(); var container = registry.container(); var Apple = _containerTestsContainer_helper.factory(); var Orange = _containerTestsContainer_helper.factory(); Apple.reopenClass({ _lazyInjections: function () { ok(true, 'should call lazy injection method'); return ['orange:main']; } }); registry.register('apple:main', Apple); registry.register('orange:main', Orange); container.lookup('apple:main'); container.lookup('apple:main'); }); }); enifed('container/tests/container_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - container/tests'); test('container/tests/container_test.js should pass jscs', function () { ok(true, 'container/tests/container_test.js should pass jscs.'); }); }); enifed('container/tests/container_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - container/tests'); QUnit.test('container/tests/container_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'container/tests/container_test.js should pass jshint.'); }); }); enifed('container/tests/registry_test', ['exports', 'ember-metal/core', 'container', 'container/tests/container_helper'], function (exports, _emberMetalCore, _container, _containerTestsContainer_helper) { 'use strict'; var originalModelInjections; QUnit.module('Registry', { setup: function () { originalModelInjections = _emberMetalCore.default.MODEL_FACTORY_INJECTIONS; }, teardown: function () { _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = originalModelInjections; } }); QUnit.test('A registered factory is returned from resolve', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); var PostControllerFactory = registry.resolve('controller:post'); ok(PostControllerFactory, 'factory is returned'); ok(PostControllerFactory.create() instanceof PostController, 'The return of factory.create is an instance of PostController'); }); QUnit.test('The registered factory returned from resolve is the same factory each time', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); deepEqual(registry.resolve('controller:post'), registry.resolve('controller:post'), 'The return of resolve is always the same'); }); QUnit.test('A registered factory returns true for `has` if an item is registered', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); equal(registry.has('controller:post'), true, 'The `has` method returned true for registered factories'); equal(registry.has('controller:posts'), false, 'The `has` method returned false for unregistered factories'); }); QUnit.test('Throw exception when trying to inject `type:thing` on all type(s)', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); throws(function () { registry.typeInjection('controller', 'injected', 'controller:post'); }, 'Cannot inject a `controller:post` on other controller(s).'); }); QUnit.test('The registry can take a hook to resolve factories lazily', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); registry.resolver = function (fullName) { if (fullName === 'controller:post') { return PostController; } }; strictEqual(registry.resolve('controller:post'), PostController, 'The correct factory was provided'); }); QUnit.test('The registry respects the resolver hook for `has`', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); registry.resolver = function (fullName) { if (fullName === 'controller:post') { return PostController; } }; ok(registry.has('controller:post'), 'the `has` method uses the resolver hook'); }); QUnit.test('The registry normalizes names when resolving', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); registry.normalizeFullName = function (fullName) { return 'controller:post'; }; registry.register('controller:post', PostController); var type = registry.resolve('controller:normalized'); strictEqual(type, PostController, 'Normalizes the name when resolving'); }); QUnit.test('The registry normalizes names when checking if the factory is registered', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); registry.normalizeFullName = function (fullName) { return 'controller:post'; }; registry.register('controller:post', PostController); var isPresent = registry.has('controller:normalized'); equal(isPresent, true, 'Normalizes the name when checking if the factory or instance is present'); }); QUnit.test('validateFullName throws an error if name is incorrect', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); registry.normalize = function (fullName) { return 'controller:post'; }; registry.register('controller:post', PostController); throws(function () { registry.resolve('post'); }, 'TypeError: Invalid Fullname, expected: `type:name` got: post'); }); QUnit.test('The registry normalizes names when injecting', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); var user = { name: 'Stef' }; registry.normalize = function (fullName) { return 'controller:post'; }; registry.register('controller:post', PostController); registry.register('user:post', user, { instantiate: false }); registry.injection('controller:post', 'user', 'controller:normalized'); deepEqual(registry.resolve('controller:post'), user, 'Normalizes the name when injecting'); }); QUnit.test('cannot register an `undefined` factory', function () { var registry = new _container.Registry(); throws(function () { registry.register('controller:apple', undefined); }, ''); }); QUnit.test('can re-register a factory', function () { var registry = new _container.Registry(); var FirstApple = _containerTestsContainer_helper.factory('first'); var SecondApple = _containerTestsContainer_helper.factory('second'); registry.register('controller:apple', FirstApple); registry.register('controller:apple', SecondApple); ok(registry.resolve('controller:apple').create() instanceof SecondApple); }); QUnit.test('cannot re-register a factory if it has been resolved', function () { var registry = new _container.Registry(); var FirstApple = _containerTestsContainer_helper.factory('first'); var SecondApple = _containerTestsContainer_helper.factory('second'); registry.register('controller:apple', FirstApple); strictEqual(registry.resolve('controller:apple'), FirstApple); throws(function () { registry.register('controller:apple', SecondApple); }, 'Cannot re-register: `controller:apple`, as it has already been resolved.'); strictEqual(registry.resolve('controller:apple'), FirstApple); }); QUnit.test('registry.has should not accidentally cause injections on that factory to be run. (Mitigate merely on observing)', function () { expect(1); var registry = new _container.Registry(); var FirstApple = _containerTestsContainer_helper.factory('first'); var SecondApple = _containerTestsContainer_helper.factory('second'); SecondApple.extend = function (a, b, c) { ok(false, 'should not extend or touch the injected model, merely to inspect existence of another'); }; registry.register('controller:apple', FirstApple); registry.register('controller:second-apple', SecondApple); registry.injection('controller:apple', 'badApple', 'controller:second-apple'); ok(registry.has('controller:apple')); }); QUnit.test('once resolved, always return the same result', function () { expect(1); var registry = new _container.Registry(); registry.resolver = function () { return 'bar'; }; var Bar = registry.resolve('models:bar'); registry.resolver = function () { return 'not bar'; }; equal(registry.resolve('models:bar'), Bar); }); QUnit.test('factory resolves are cached', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); var resolveWasCalled = []; registry.resolver = function (fullName) { resolveWasCalled.push(fullName); return PostController; }; deepEqual(resolveWasCalled, []); registry.resolve('controller:post'); deepEqual(resolveWasCalled, ['controller:post']); registry.resolve('controller:post'); deepEqual(resolveWasCalled, ['controller:post']); }); QUnit.test('factory for non extendables (MODEL) resolves are cached', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); var resolveWasCalled = []; registry.resolver = function (fullName) { resolveWasCalled.push(fullName); return PostController; }; deepEqual(resolveWasCalled, []); registry.resolve('model:post'); deepEqual(resolveWasCalled, ['model:post']); registry.resolve('model:post'); deepEqual(resolveWasCalled, ['model:post']); }); QUnit.test('factory for non extendables resolves are cached', function () { var registry = new _container.Registry(); var PostController = {}; var resolveWasCalled = []; registry.resolver = function (fullName) { resolveWasCalled.push(fullName); return PostController; }; deepEqual(resolveWasCalled, []); registry.resolve('foo:post'); deepEqual(resolveWasCalled, ['foo:post']); registry.resolve('foo:post'); deepEqual(resolveWasCalled, ['foo:post']); }); QUnit.test('registry.container creates a container', function () { var registry = new _container.Registry(); var PostController = _containerTestsContainer_helper.factory(); registry.register('controller:post', PostController); var container = registry.container(); var postController = container.lookup('controller:post'); ok(postController instanceof PostController, 'The lookup is an instance of the registered factory'); }); QUnit.test('`resolve` can be handled by a fallback registry', function () { var fallback = new _container.Registry(); var registry = new _container.Registry({ fallback: fallback }); var PostController = _containerTestsContainer_helper.factory(); fallback.register('controller:post', PostController); var PostControllerFactory = registry.resolve('controller:post'); ok(PostControllerFactory, 'factory is returned'); ok(PostControllerFactory.create() instanceof PostController, 'The return of factory.create is an instance of PostController'); }); QUnit.test('`has` can be handled by a fallback registry', function () { var fallback = new _container.Registry(); var registry = new _container.Registry({ fallback: fallback }); var PostController = _containerTestsContainer_helper.factory(); fallback.register('controller:post', PostController); equal(registry.has('controller:post'), true, 'Fallback registry is checked for registration'); }); QUnit.test('`getInjections` includes injections from a fallback registry', function () { var fallback = new _container.Registry(); var registry = new _container.Registry({ fallback: fallback }); equal(registry.getInjections('model:user').length, 0, 'No injections in the primary registry'); fallback.injection('model:user', 'post', 'model:post'); equal(registry.getInjections('model:user').length, 1, 'Injections from the fallback registry are merged'); }); QUnit.test('`getTypeInjections` includes type injections from a fallback registry', function () { var fallback = new _container.Registry(); var registry = new _container.Registry({ fallback: fallback }); equal(registry.getTypeInjections('model').length, 0, 'No injections in the primary registry'); fallback.injection('model', 'source', 'source:main'); equal(registry.getTypeInjections('model').length, 1, 'Injections from the fallback registry are merged'); }); QUnit.test('`getFactoryInjections` includes factory injections from a fallback registry', function () { var fallback = new _container.Registry(); var registry = new _container.Registry({ fallback: fallback }); equal(registry.getFactoryInjections('model:user').length, 0, 'No factory injections in the primary registry'); fallback.factoryInjection('model:user', 'store', 'store:main'); equal(registry.getFactoryInjections('model:user').length, 1, 'Factory injections from the fallback registry are merged'); }); QUnit.test('`getFactoryTypeInjections` includes factory type injections from a fallback registry', function () { var fallback = new _container.Registry(); var registry = new _container.Registry({ fallback: fallback }); equal(registry.getFactoryTypeInjections('model').length, 0, 'No factory type injections in the primary registry'); fallback.factoryInjection('model', 'store', 'store:main'); equal(registry.getFactoryTypeInjections('model').length, 1, 'Factory type injections from the fallback registry are merged'); }); QUnit.test('`knownForType` contains keys for each item of a given type', function () { var registry = new _container.Registry(); registry.register('foo:bar-baz', 'baz'); registry.register('foo:qux-fez', 'fez'); var found = registry.knownForType('foo'); deepEqual(found, { 'foo:bar-baz': true, 'foo:qux-fez': true }); }); QUnit.test('`knownForType` includes fallback registry results', function () { var fallback = new _container.Registry(); var registry = new _container.Registry({ fallback: fallback }); registry.register('foo:bar-baz', 'baz'); registry.register('foo:qux-fez', 'fez'); fallback.register('foo:zurp-zorp', 'zorp'); var found = registry.knownForType('foo'); deepEqual(found, { 'foo:bar-baz': true, 'foo:qux-fez': true, 'foo:zurp-zorp': true }); }); QUnit.test('`knownForType` is called on the resolver if present', function () { expect(3); function resolver() {} resolver.knownForType = function (type) { ok(true, 'knownForType called on the resolver'); equal(type, 'foo', 'the type was passed through'); return { 'foo:yorp': true }; }; var registry = new _container.Registry({ resolver: resolver }); registry.register('foo:bar-baz', 'baz'); var found = registry.knownForType('foo'); deepEqual(found, { 'foo:yorp': true, 'foo:bar-baz': true }); }); }); enifed('container/tests/registry_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - container/tests'); test('container/tests/registry_test.js should pass jscs', function () { ok(true, 'container/tests/registry_test.js should pass jscs.'); }); }); enifed('container/tests/registry_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - container/tests'); QUnit.test('container/tests/registry_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'container/tests/registry_test.js should pass jshint.'); }); }); enifed('ember-application.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - .'); test('ember-application.js should pass jscs', function () { ok(true, 'ember-application.js should pass jscs.'); }); }); enifed('ember-application.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - .'); QUnit.test('ember-application.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application.js should pass jshint.'); }); }); enifed('ember-application/system/application-instance.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/system'); test('ember-application/system/application-instance.js should pass jscs', function () { ok(true, 'ember-application/system/application-instance.js should pass jscs.'); }); }); enifed('ember-application/system/application-instance.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/system'); QUnit.test('ember-application/system/application-instance.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/system/application-instance.js should pass jshint.'); }); }); enifed('ember-application/system/application.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/system'); test('ember-application/system/application.js should pass jscs', function () { ok(true, 'ember-application/system/application.js should pass jscs.'); }); }); enifed('ember-application/system/application.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/system'); QUnit.test('ember-application/system/application.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/system/application.js should pass jshint.'); }); }); enifed('ember-application/system/resolver.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/system'); test('ember-application/system/resolver.js should pass jscs', function () { ok(true, 'ember-application/system/resolver.js should pass jscs.'); }); }); enifed('ember-application/system/resolver.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/system'); QUnit.test('ember-application/system/resolver.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/system/resolver.js should pass jshint.'); }); }); enifed('ember-application/tests/system/application_test', ['exports', 'ember-metal/core', 'ember-metal/run_loop', 'ember-application/system/application', 'ember-application/system/resolver', 'ember-routing/system/router', 'ember-views/views/view', 'ember-runtime/controllers/controller', 'ember-routing/location/none_location', 'ember-runtime/system/object', 'ember-routing/system/route', 'ember-views/system/jquery', 'ember-template-compiler/system/compile', 'ember-runtime/system/lazy_load'], function (exports, _emberMetalCore, _emberMetalRun_loop, _emberApplicationSystemApplication, _emberApplicationSystemResolver, _emberRoutingSystemRouter, _emberViewsViewsView, _emberRuntimeControllersController, _emberRoutingLocationNone_location, _emberRuntimeSystemObject, _emberRoutingSystemRoute, _emberViewsSystemJquery, _emberTemplateCompilerSystemCompile, _emberRuntimeSystemLazy_load) { /*globals EmberDev */ 'use strict'; var trim = _emberViewsSystemJquery.default.trim; var app, application, originalLookup, originalDebug; QUnit.module('Ember.Application', { setup: function () { originalLookup = _emberMetalCore.default.lookup; originalDebug = _emberMetalCore.default.debug; _emberViewsSystemJquery.default('#qunit-fixture').html('
HI
HI
'); _emberMetalRun_loop.default(function () { application = _emberApplicationSystemApplication.default.create({ rootElement: '#one', router: null }); }); }, teardown: function () { _emberViewsSystemJquery.default('#qunit-fixture').empty(); _emberMetalCore.default.debug = originalDebug; _emberMetalCore.default.lookup = originalLookup; if (application) { _emberMetalRun_loop.default(application, 'destroy'); } if (app) { _emberMetalRun_loop.default(app, 'destroy'); } } }); QUnit.test('you can make a new application in a non-overlapping element', function () { _emberMetalRun_loop.default(function () { app = _emberApplicationSystemApplication.default.create({ rootElement: '#two', router: null }); }); _emberMetalRun_loop.default(app, 'destroy'); ok(true, 'should not raise'); }); QUnit.test('you cannot make a new application that is a parent of an existing application', function () { expectAssertion(function () { _emberMetalRun_loop.default(function () { _emberApplicationSystemApplication.default.create({ rootElement: '#qunit-fixture' }); }); }); }); QUnit.test('you cannot make a new application that is a descendent of an existing application', function () { expectAssertion(function () { _emberMetalRun_loop.default(function () { _emberApplicationSystemApplication.default.create({ rootElement: '#one-child' }); }); }); }); QUnit.test('you cannot make a new application that is a duplicate of an existing application', function () { expectAssertion(function () { _emberMetalRun_loop.default(function () { _emberApplicationSystemApplication.default.create({ rootElement: '#one' }); }); }); }); QUnit.test('you cannot make two default applications without a rootElement error', function () { expectAssertion(function () { _emberMetalRun_loop.default(function () { _emberApplicationSystemApplication.default.create({ router: false }); }); }); }); QUnit.test('acts like a namespace', function () { var lookup = _emberMetalCore.default.lookup = {}; _emberMetalRun_loop.default(function () { app = lookup.TestApp = _emberApplicationSystemApplication.default.create({ rootElement: '#two', router: false }); }); _emberMetalCore.default.BOOTED = false; app.Foo = _emberRuntimeSystemObject.default.extend(); equal(app.Foo.toString(), 'TestApp.Foo', 'Classes pick up their parent namespace'); }); QUnit.module('Ember.Application initialization', { teardown: function () { if (app) { _emberMetalRun_loop.default(app, 'destroy'); } _emberMetalCore.default.TEMPLATES = {}; } }); QUnit.test('initialized application go to initial route', function () { _emberMetalRun_loop.default(function () { app = _emberApplicationSystemApplication.default.create({ rootElement: '#qunit-fixture' }); app.Router.reopen({ location: 'none' }); app.register('template:application', _emberTemplateCompilerSystemCompile.default('{{outlet}}')); _emberMetalCore.default.TEMPLATES.index = _emberTemplateCompilerSystemCompile.default('

Hi from index

'); }); equal(_emberViewsSystemJquery.default('#qunit-fixture h1').text(), 'Hi from index'); }); QUnit.test('ready hook is called before routing begins', function () { expect(2); _emberMetalRun_loop.default(function () { function registerRoute(application, name, callback) { var route = _emberRoutingSystemRoute.default.extend({ activate: callback }); application.register('route:' + name, route); } var MyApplication = _emberApplicationSystemApplication.default.extend({ ready: function () { registerRoute(this, 'index', function () { ok(true, 'last-minite route is activated'); }); } }); app = MyApplication.create({ rootElement: '#qunit-fixture' }); app.Router.reopen({ location: 'none' }); registerRoute(app, 'application', function () { ok(true, 'normal route is activated'); }); }); }); QUnit.test('initialize application via initialize call', function () { _emberMetalRun_loop.default(function () { app = _emberApplicationSystemApplication.default.create({ rootElement: '#qunit-fixture' }); app.Router.reopen({ location: 'none' }); app.ApplicationView = _emberViewsViewsView.default.extend({ template: _emberTemplateCompilerSystemCompile.default('

Hello!

') }); }); // This is not a public way to access the container; we just // need to make some assertions about the created router var router = app.__container__.lookup('router:main'); equal(router instanceof _emberRoutingSystemRouter.default, true, 'Router was set from initialize call'); equal(router.location instanceof _emberRoutingLocationNone_location.default, true, 'Location was set from location implementation name'); }); QUnit.test('initialize application with stateManager via initialize call from Router class', function () { _emberMetalRun_loop.default(function () { app = _emberApplicationSystemApplication.default.create({ rootElement: '#qunit-fixture' }); app.Router.reopen({ location: 'none' }); app.register('template:application', _emberTemplateCompilerSystemCompile.default('

Hello!

')); }); var router = app.__container__.lookup('router:main'); equal(router instanceof _emberRoutingSystemRouter.default, true, 'Router was set from initialize call'); equal(_emberViewsSystemJquery.default('#qunit-fixture h1').text(), 'Hello!'); }); QUnit.test('ApplicationView is inserted into the page', function () { _emberMetalRun_loop.default(function () { app = _emberApplicationSystemApplication.default.create({ rootElement: '#qunit-fixture' }); app.ApplicationView = _emberViewsViewsView.default.extend({ template: _emberTemplateCompilerSystemCompile.default('

Hello!

') }); app.ApplicationController = _emberRuntimeControllersController.default.extend(); app.Router.reopen({ location: 'none' }); }); equal(_emberViewsSystemJquery.default('#qunit-fixture h1').text(), 'Hello!'); }); QUnit.test('Minimal Application initialized with just an application template', function () { _emberViewsSystemJquery.default('#qunit-fixture').html(''); _emberMetalRun_loop.default(function () { app = _emberApplicationSystemApplication.default.create({ rootElement: '#qunit-fixture' }); }); equal(trim(_emberViewsSystemJquery.default('#qunit-fixture').text()), 'Hello World'); }); QUnit.test('enable log of libraries with an ENV var', function () { if (EmberDev && EmberDev.runningProdBuild) { ok(true, 'Logging does not occur in production builds'); return; } var debug = _emberMetalCore.default.debug; var messages = []; _emberMetalCore.default.LOG_VERSION = true; _emberMetalCore.default.debug = function (message) { messages.push(message); }; _emberMetalCore.default.libraries.register('my-lib', '2.0.0a'); _emberMetalRun_loop.default(function () { app = _emberApplicationSystemApplication.default.create({ rootElement: '#qunit-fixture' }); }); equal(messages[1], 'Ember : ' + _emberMetalCore.default.VERSION); equal(messages[2], 'jQuery : ' + _emberViewsSystemJquery.default().jquery); equal(messages[3], 'my-lib : ' + '2.0.0a'); _emberMetalCore.default.libraries.deRegister('my-lib'); _emberMetalCore.default.LOG_VERSION = false; _emberMetalCore.default.debug = debug; }); QUnit.test('disable log version of libraries with an ENV var', function () { var logged = false; _emberMetalCore.default.LOG_VERSION = false; _emberMetalCore.default.debug = function (message) { logged = true; }; _emberViewsSystemJquery.default('#qunit-fixture').empty(); _emberMetalRun_loop.default(function () { app = _emberApplicationSystemApplication.default.create({ rootElement: '#qunit-fixture' }); app.Router.reopen({ location: 'none' }); }); ok(!logged, 'library version logging skipped'); }); QUnit.test('can resolve custom router', function () { var CustomRouter = _emberRoutingSystemRouter.default.extend(); var CustomResolver = _emberApplicationSystemResolver.default.extend({ resolveMain: function (parsedName) { if (parsedName.type === 'router') { return CustomRouter; } else { return this._super(parsedName); } } }); app = _emberMetalRun_loop.default(function () { return _emberApplicationSystemApplication.default.create({ Resolver: CustomResolver }); }); ok(app.__container__.lookup('router:main') instanceof CustomRouter, 'application resolved the correct router'); }); QUnit.test('can specify custom router', function () { var CustomRouter = _emberRoutingSystemRouter.default.extend(); app = _emberMetalRun_loop.default(function () { return _emberApplicationSystemApplication.default.create({ Router: CustomRouter }); }); ok(app.__container__.lookup('router:main') instanceof CustomRouter, 'application resolved the correct router'); }); QUnit.test('registers controls onto to container', function () { _emberMetalRun_loop.default(function () { app = _emberApplicationSystemApplication.default.create({ rootElement: '#qunit-fixture' }); }); ok(app.__container__.lookup('view:select'), 'Select control is registered into views'); }); QUnit.test('does not leak itself in onLoad._loaded', function () { equal(_emberRuntimeSystemLazy_load._loaded.application, undefined); var app = _emberMetalRun_loop.default(_emberApplicationSystemApplication.default, 'create'); equal(_emberRuntimeSystemLazy_load._loaded.application, app); _emberMetalRun_loop.default(app, 'destroy'); equal(_emberRuntimeSystemLazy_load._loaded.application, undefined); }); }); enifed('ember-application/tests/system/application_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/tests/system'); test('ember-application/tests/system/application_test.js should pass jscs', function () { ok(true, 'ember-application/tests/system/application_test.js should pass jscs.'); }); }); enifed('ember-application/tests/system/application_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/tests/system'); QUnit.test('ember-application/tests/system/application_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/tests/system/application_test.js should pass jshint.'); }); }); enifed('ember-application/tests/system/dependency_injection/custom_resolver_test', ['exports', 'ember-views/system/jquery', 'ember-metal/run_loop', 'ember-application/system/application', 'ember-application/system/resolver', 'ember-template-compiler/system/compile'], function (exports, _emberViewsSystemJquery, _emberMetalRun_loop, _emberApplicationSystemApplication, _emberApplicationSystemResolver, _emberTemplateCompilerSystemCompile) { 'use strict'; var application; QUnit.module('Ember.Application Dependency Injection – customResolver', { setup: function () { var fallbackTemplate = _emberTemplateCompilerSystemCompile.default('

Fallback

'); var Resolver = _emberApplicationSystemResolver.default.extend({ resolveTemplate: function (resolvable) { var resolvedTemplate = this._super(resolvable); if (resolvedTemplate) { return resolvedTemplate; } if (resolvable.fullNameWithoutType === 'application') { return fallbackTemplate; } else { return; } } }); application = _emberMetalRun_loop.default(function () { return _emberApplicationSystemApplication.default.create({ Resolver: Resolver, rootElement: '#qunit-fixture' }); }); }, teardown: function () { _emberMetalRun_loop.default(application, 'destroy'); } }); QUnit.test('a resolver can be supplied to application', function () { equal(_emberViewsSystemJquery.default('h1', application.rootElement).text(), 'Fallback'); }); }); enifed('ember-application/tests/system/dependency_injection/custom_resolver_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/tests/system/dependency_injection'); test('ember-application/tests/system/dependency_injection/custom_resolver_test.js should pass jscs', function () { ok(true, 'ember-application/tests/system/dependency_injection/custom_resolver_test.js should pass jscs.'); }); }); enifed('ember-application/tests/system/dependency_injection/custom_resolver_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/tests/system/dependency_injection'); QUnit.test('ember-application/tests/system/dependency_injection/custom_resolver_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/tests/system/dependency_injection/custom_resolver_test.js should pass jshint.'); }); }); enifed('ember-application/tests/system/dependency_injection/default_resolver_test', ['exports', 'ember-metal/core', 'ember-metal/run_loop', 'ember-metal/logger', 'ember-runtime/controllers/controller', 'ember-routing/system/route', 'ember-views/views/component', 'ember-views/views/view', 'ember-runtime/system/service', 'ember-runtime/system/object', 'ember-runtime/system/namespace', 'ember-application/system/application', 'ember-htmlbars/helper', 'ember-htmlbars/system/make_bound_helper', 'ember-htmlbars/helpers'], function (exports, _emberMetalCore, _emberMetalRun_loop, _emberMetalLogger, _emberRuntimeControllersController, _emberRoutingSystemRoute, _emberViewsViewsComponent, _emberViewsViewsView, _emberRuntimeSystemService, _emberRuntimeSystemObject, _emberRuntimeSystemNamespace, _emberApplicationSystemApplication, _emberHtmlbarsHelper, _emberHtmlbarsSystemMake_bound_helper, _emberHtmlbarsHelpers) { 'use strict'; var registry, locator, application, originalLookup, originalLoggerInfo; QUnit.module('Ember.Application Dependency Injection - default resolver', { setup: function () { originalLookup = _emberMetalCore.default.lookup; application = _emberMetalRun_loop.default(_emberApplicationSystemApplication.default, 'create'); registry = application.registry; locator = application.__container__; originalLoggerInfo = _emberMetalLogger.default.info; }, teardown: function () { _emberMetalCore.default.TEMPLATES = {}; _emberMetalCore.default.lookup = originalLookup; _emberMetalRun_loop.default(application, 'destroy'); var UserInterfaceNamespace = _emberRuntimeSystemNamespace.default.NAMESPACES_BY_ID['UserInterface']; if (UserInterfaceNamespace) { _emberMetalRun_loop.default(UserInterfaceNamespace, 'destroy'); } _emberMetalLogger.default.info = originalLoggerInfo; } }); QUnit.test('the default resolver can look things up in other namespaces', function () { var UserInterface = _emberMetalCore.default.lookup.UserInterface = _emberRuntimeSystemNamespace.default.create(); UserInterface.NavigationController = _emberRuntimeControllersController.default.extend(); var nav = locator.lookup('controller:userInterface/navigation'); ok(nav instanceof UserInterface.NavigationController, 'the result should be an instance of the specified class'); }); QUnit.test('the default resolver looks up templates in Ember.TEMPLATES', function () { function fooTemplate() {} function fooBarTemplate() {} function fooBarBazTemplate() {} _emberMetalCore.default.TEMPLATES['foo'] = fooTemplate; _emberMetalCore.default.TEMPLATES['fooBar'] = fooBarTemplate; _emberMetalCore.default.TEMPLATES['fooBar/baz'] = fooBarBazTemplate; equal(locator.lookup('template:foo'), fooTemplate, 'resolves template:foo'); equal(locator.lookup('template:fooBar'), fooBarTemplate, 'resolves template:foo_bar'); equal(locator.lookup('template:fooBar.baz'), fooBarBazTemplate, 'resolves template:foo_bar.baz'); }); QUnit.test('the default resolver looks up basic name as no prefix', function () { ok(_emberRuntimeControllersController.default.detect(locator.lookup('controller:basic')), 'locator looksup correct controller'); }); function detectEqual(first, second, message) { ok(first.detect(second), message); } QUnit.test('the default resolver looks up arbitrary types on the namespace', function () { application.FooManager = _emberRuntimeSystemObject.default.extend({}); detectEqual(application.FooManager, registry.resolver('manager:foo'), 'looks up FooManager on application'); }); QUnit.test('the default resolver resolves models on the namespace', function () { application.Post = _emberRuntimeSystemObject.default.extend({}); detectEqual(application.Post, locator.lookupFactory('model:post'), 'looks up Post model on application'); }); QUnit.test('the default resolver resolves *:main on the namespace', function () { application.FooBar = _emberRuntimeSystemObject.default.extend({}); detectEqual(application.FooBar, locator.lookupFactory('foo-bar:main'), 'looks up FooBar type without name on application'); }); QUnit.test('the default resolver resolves helpers', function () { expect(2); function fooresolvertestHelper() { ok(true, 'found fooresolvertestHelper'); } function barBazResolverTestHelper() { ok(true, 'found barBazResolverTestHelper'); } _emberHtmlbarsHelpers.registerHelper('fooresolvertest', fooresolvertestHelper); _emberHtmlbarsHelpers.registerHelper('bar-baz-resolver-test', barBazResolverTestHelper); fooresolvertestHelper(); barBazResolverTestHelper(); }); QUnit.test('the default resolver resolves container-registered helpers', function () { var shorthandHelper = _emberHtmlbarsHelper.helper(function () {}); var helper = _emberHtmlbarsHelper.default.extend(); application.register('helper:shorthand', shorthandHelper); application.register('helper:complete', helper); var lookedUpShorthandHelper = locator.lookupFactory('helper:shorthand'); ok(lookedUpShorthandHelper.isHelperInstance, 'shorthand helper isHelper'); var lookedUpHelper = locator.lookupFactory('helper:complete'); ok(lookedUpHelper.isHelperFactory, 'complete helper is factory'); ok(helper.detect(lookedUpHelper), 'looked up complete helper'); }); QUnit.test('the default resolver resolves helpers on the namespace', function () { var ShorthandHelper = _emberHtmlbarsHelper.helper(function () {}); var CompleteHelper = _emberHtmlbarsHelper.default.extend(); var LegacyHTMLBarsBoundHelper = undefined; expectDeprecation(function () { LegacyHTMLBarsBoundHelper = _emberHtmlbarsSystemMake_bound_helper.default(function () {}); }, 'Using `Ember.HTMLBars.makeBoundHelper` is deprecated. Please refactor to using `Ember.Helper` or `Ember.Helper.helper`.'); application.ShorthandHelper = ShorthandHelper; application.CompleteHelper = CompleteHelper; application.LegacyHtmlBarsBoundHelper = LegacyHTMLBarsBoundHelper; // Must use lowered "tml" in "HTMLBars" for resolver to find this var resolvedShorthand = registry.resolve('helper:shorthand'); var resolvedComplete = registry.resolve('helper:complete'); var resolvedLegacyHTMLBars = registry.resolve('helper:legacy-html-bars-bound'); equal(resolvedShorthand, ShorthandHelper, 'resolve fetches the shorthand helper factory'); equal(resolvedComplete, CompleteHelper, 'resolve fetches the complete helper factory'); equal(resolvedLegacyHTMLBars, LegacyHTMLBarsBoundHelper, 'resolves legacy HTMLBars bound helper'); }); QUnit.test('the default resolver resolves to the same instance no matter the notation ', function () { application.NestedPostController = _emberRuntimeControllersController.default.extend({}); equal(locator.lookup('controller:nested-post'), locator.lookup('controller:nested_post'), 'looks up NestedPost controller on application'); }); QUnit.test('the default resolver throws an error if the fullName to resolve is invalid', function () { throws(function () { registry.resolve(undefined); }, TypeError, /Invalid fullName/); throws(function () { registry.resolve(null); }, TypeError, /Invalid fullName/); throws(function () { registry.resolve(''); }, TypeError, /Invalid fullName/); throws(function () { registry.resolve(''); }, TypeError, /Invalid fullName/); throws(function () { registry.resolve(':'); }, TypeError, /Invalid fullName/); throws(function () { registry.resolve('model'); }, TypeError, /Invalid fullName/); throws(function () { registry.resolve('model:'); }, TypeError, /Invalid fullName/); throws(function () { registry.resolve(':type'); }, TypeError, /Invalid fullName/); }); QUnit.test('the default resolver logs hits if `LOG_RESOLVER` is set', function () { expect(3); application.LOG_RESOLVER = true; application.ScoobyDoo = _emberRuntimeSystemObject.default.extend(); application.toString = function () { return 'App'; }; _emberMetalLogger.default.info = function (symbol, name, padding, lookupDescription) { equal(symbol, '[✓]', 'proper symbol is printed when a module is found'); equal(name, 'doo:scooby', 'proper lookup value is logged'); equal(lookupDescription, 'App.ScoobyDoo'); }; registry.resolve('doo:scooby'); }); QUnit.test('the default resolver logs misses if `LOG_RESOLVER` is set', function () { expect(3); application.LOG_RESOLVER = true; application.toString = function () { return 'App'; }; _emberMetalLogger.default.info = function (symbol, name, padding, lookupDescription) { equal(symbol, '[ ]', 'proper symbol is printed when a module is not found'); equal(name, 'doo:scooby', 'proper lookup value is logged'); equal(lookupDescription, 'App.ScoobyDoo'); }; registry.resolve('doo:scooby'); }); QUnit.test('doesn\'t log without LOG_RESOLVER', function () { var infoCount = 0; application.ScoobyDoo = _emberRuntimeSystemObject.default.extend(); _emberMetalLogger.default.info = function (symbol, name) { infoCount = infoCount + 1; }; registry.resolve('doo:scooby'); registry.resolve('doo:scrappy'); equal(infoCount, 0, 'Logger.info should not be called if LOG_RESOLVER is not set'); }); QUnit.test('lookup description', function () { application.toString = function () { return 'App'; }; equal(registry.describe('controller:foo'), 'App.FooController', 'Type gets appended at the end'); equal(registry.describe('controller:foo.bar'), 'App.FooBarController', 'dots are removed'); equal(registry.describe('model:foo'), 'App.Foo', 'models don\'t get appended at the end'); }); QUnit.test('assertion for routes without isRouteFactory property', function () { application.FooRoute = _emberViewsViewsComponent.default.extend(); expectAssertion(function () { registry.resolve('route:foo'); }, /to resolve to an Ember.Route/, 'Should assert'); }); QUnit.test('no assertion for routes that extend from Ember.Route', function () { expect(0); application.FooRoute = _emberRoutingSystemRoute.default.extend(); registry.resolve('route:foo'); }); QUnit.test('deprecation warning for service factories without isServiceFactory property', function () { expectDeprecation(/service factories must have an `isServiceFactory` property/); application.FooService = _emberRuntimeSystemObject.default.extend(); registry.resolve('service:foo'); }); QUnit.test('no deprecation warning for service factories that extend from Ember.Service', function () { expectNoDeprecation(); application.FooService = _emberRuntimeSystemService.default.extend(); registry.resolve('service:foo'); }); QUnit.test('deprecation warning for view factories without isViewFactory property', function () { expectDeprecation(/view factories must have an `isViewFactory` property/); application.FooView = _emberRuntimeSystemObject.default.extend(); registry.resolve('view:foo'); }); QUnit.test('no deprecation warning for view factories that extend from Ember.View', function () { expectNoDeprecation(); application.FooView = _emberViewsViewsView.default.extend(); registry.resolve('view:foo'); }); QUnit.test('deprecation warning for component factories without isComponentFactory property', function () { expectDeprecation(/component factories must have an `isComponentFactory` property/); application.FooComponent = _emberViewsViewsView.default.extend(); registry.resolve('component:foo'); }); QUnit.test('no deprecation warning for component factories that extend from Ember.Component', function () { expectNoDeprecation(); application.FooView = _emberViewsViewsComponent.default.extend(); registry.resolve('component:foo'); }); QUnit.test('knownForType returns each item for a given type found', function () { application.FooBarHelper = 'foo'; application.BazQuxHelper = 'bar'; var found = registry.resolver.knownForType('helper'); deepEqual(found, { 'helper:foo-bar': true, 'helper:baz-qux': true }); }); QUnit.test('knownForType is not required to be present on the resolver', function () { delete registry.resolver.__resolver__.knownForType; registry.resolver.knownForType('helper', function () {}); ok(true, 'does not error'); }); }); // Ember.TEMPLATES enifed('ember-application/tests/system/dependency_injection/default_resolver_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/tests/system/dependency_injection'); test('ember-application/tests/system/dependency_injection/default_resolver_test.js should pass jscs', function () { ok(true, 'ember-application/tests/system/dependency_injection/default_resolver_test.js should pass jscs.'); }); }); enifed('ember-application/tests/system/dependency_injection/default_resolver_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/tests/system/dependency_injection'); QUnit.test('ember-application/tests/system/dependency_injection/default_resolver_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/tests/system/dependency_injection/default_resolver_test.js should pass jshint.'); }); }); enifed('ember-application/tests/system/dependency_injection/normalization_test', ['exports', 'ember-metal/run_loop', 'ember-application/system/application'], function (exports, _emberMetalRun_loop, _emberApplicationSystemApplication) { 'use strict'; var application, registry; QUnit.module('Ember.Application Dependency Injection – normalization', { setup: function () { application = _emberMetalRun_loop.default(_emberApplicationSystemApplication.default, 'create'); registry = application.registry; }, teardown: function () { _emberMetalRun_loop.default(application, 'destroy'); } }); QUnit.test('normalization', function () { ok(registry.normalize, 'registry#normalize is present'); equal(registry.normalize('foo:bar'), 'foo:bar'); equal(registry.normalize('controller:posts'), 'controller:posts'); equal(registry.normalize('controller:posts_index'), 'controller:postsIndex'); equal(registry.normalize('controller:posts.index'), 'controller:postsIndex'); equal(registry.normalize('controller:posts-index'), 'controller:postsIndex'); equal(registry.normalize('controller:posts.post.index'), 'controller:postsPostIndex'); equal(registry.normalize('controller:posts_post.index'), 'controller:postsPostIndex'); equal(registry.normalize('controller:posts.post_index'), 'controller:postsPostIndex'); equal(registry.normalize('controller:posts.post-index'), 'controller:postsPostIndex'); equal(registry.normalize('controller:postsIndex'), 'controller:postsIndex'); equal(registry.normalize('controller:blogPosts.index'), 'controller:blogPostsIndex'); equal(registry.normalize('controller:blog/posts.index'), 'controller:blog/postsIndex'); equal(registry.normalize('controller:blog/posts-index'), 'controller:blog/postsIndex'); equal(registry.normalize('controller:blog/posts.post.index'), 'controller:blog/postsPostIndex'); equal(registry.normalize('controller:blog/posts_post.index'), 'controller:blog/postsPostIndex'); equal(registry.normalize('controller:blog/posts_post-index'), 'controller:blog/postsPostIndex'); equal(registry.normalize('template:blog/posts_index'), 'template:blog/posts_index'); }); QUnit.test('normalization is indempotent', function () { var examples = ['controller:posts', 'controller:posts.post.index', 'controller:blog/posts.post_index', 'template:foo_bar']; examples.forEach(function (example) { equal(registry.normalize(registry.normalize(example)), registry.normalize(example)); }); }); }); enifed('ember-application/tests/system/dependency_injection/normalization_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/tests/system/dependency_injection'); test('ember-application/tests/system/dependency_injection/normalization_test.js should pass jscs', function () { ok(true, 'ember-application/tests/system/dependency_injection/normalization_test.js should pass jscs.'); }); }); enifed('ember-application/tests/system/dependency_injection/normalization_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/tests/system/dependency_injection'); QUnit.test('ember-application/tests/system/dependency_injection/normalization_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/tests/system/dependency_injection/normalization_test.js should pass jshint.'); }); }); enifed('ember-application/tests/system/dependency_injection/to_string_test', ['exports', 'ember-metal/core', 'ember-metal/run_loop', 'ember-application/system/application', 'ember-runtime/system/object', 'ember-application/system/resolver', 'ember-metal/utils'], function (exports, _emberMetalCore, _emberMetalRun_loop, _emberApplicationSystemApplication, _emberRuntimeSystemObject, _emberApplicationSystemResolver, _emberMetalUtils) { 'use strict'; var originalLookup, App, originalModelInjections; QUnit.module('Ember.Application Dependency Injection – toString', { setup: function () { originalModelInjections = _emberMetalCore.default.MODEL_FACTORY_INJECTIONS; _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = true; originalLookup = _emberMetalCore.default.lookup; _emberMetalRun_loop.default(function () { App = _emberApplicationSystemApplication.default.create(); _emberMetalCore.default.lookup = { App: App }; }); App.Post = _emberRuntimeSystemObject.default.extend(); }, teardown: function () { _emberMetalCore.default.lookup = originalLookup; _emberMetalRun_loop.default(App, 'destroy'); _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = originalModelInjections; } }); QUnit.test('factories', function () { var PostFactory = App.__container__.lookupFactory('model:post'); equal(PostFactory.toString(), 'App.Post', 'expecting the model to be post'); }); QUnit.test('instances', function () { var post = App.__container__.lookup('model:post'); var guid = _emberMetalUtils.guidFor(post); equal(post.toString(), '', 'expecting the model to be post'); }); QUnit.test('with a custom resolver', function () { _emberMetalRun_loop.default(App, 'destroy'); _emberMetalRun_loop.default(function () { App = _emberApplicationSystemApplication.default.create({ Resolver: _emberApplicationSystemResolver.default.extend({ makeToString: function (factory, fullName) { return fullName; } }) }); }); App.registry.register('model:peter', _emberRuntimeSystemObject.default.extend()); var peter = App.__container__.lookup('model:peter'); var guid = _emberMetalUtils.guidFor(peter); equal(peter.toString(), '', 'expecting the supermodel to be peter'); }); }); // lookup, etc enifed('ember-application/tests/system/dependency_injection/to_string_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/tests/system/dependency_injection'); test('ember-application/tests/system/dependency_injection/to_string_test.js should pass jscs', function () { ok(true, 'ember-application/tests/system/dependency_injection/to_string_test.js should pass jscs.'); }); }); enifed('ember-application/tests/system/dependency_injection/to_string_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/tests/system/dependency_injection'); QUnit.test('ember-application/tests/system/dependency_injection/to_string_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/tests/system/dependency_injection/to_string_test.js should pass jshint.'); }); }); enifed('ember-application/tests/system/dependency_injection_test', ['exports', 'ember-metal/core', 'ember-metal/run_loop', 'ember-runtime/system/object', 'ember-application/system/application'], function (exports, _emberMetalCore, _emberMetalRun_loop, _emberRuntimeSystemObject, _emberApplicationSystemApplication) { 'use strict'; var EmberApplication = _emberApplicationSystemApplication.default; var originalLookup = _emberMetalCore.default.lookup; var registry, locator, lookup, application, originalModelInjections; QUnit.module('Ember.Application Dependency Injection', { setup: function () { originalModelInjections = _emberMetalCore.default.MODEL_FACTORY_INJECTIONS; _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = true; application = _emberMetalRun_loop.default(EmberApplication, 'create'); application.Person = _emberRuntimeSystemObject.default.extend({}); application.Orange = _emberRuntimeSystemObject.default.extend({}); application.Email = _emberRuntimeSystemObject.default.extend({}); application.User = _emberRuntimeSystemObject.default.extend({}); application.PostIndexController = _emberRuntimeSystemObject.default.extend({}); application.register('model:person', application.Person, { singleton: false }); application.register('model:user', application.User, { singleton: false }); application.register('fruit:favorite', application.Orange); application.register('communication:main', application.Email, { singleton: false }); application.register('controller:postIndex', application.PostIndexController, { singleton: true }); registry = application.registry; locator = application.__container__; lookup = _emberMetalCore.default.lookup = {}; }, teardown: function () { _emberMetalRun_loop.default(application, 'destroy'); application = locator = null; _emberMetalCore.default.lookup = originalLookup; _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = originalModelInjections; } }); QUnit.test('container lookup is normalized', function () { var dotNotationController = locator.lookup('controller:post.index'); var camelCaseController = locator.lookup('controller:postIndex'); ok(dotNotationController instanceof application.PostIndexController); ok(camelCaseController instanceof application.PostIndexController); equal(dotNotationController, camelCaseController); }); QUnit.test('registered entities can be looked up later', function () { equal(registry.resolve('model:person'), application.Person); equal(registry.resolve('model:user'), application.User); equal(registry.resolve('fruit:favorite'), application.Orange); equal(registry.resolve('communication:main'), application.Email); equal(registry.resolve('controller:postIndex'), application.PostIndexController); equal(locator.lookup('fruit:favorite'), locator.lookup('fruit:favorite'), 'singleton lookup worked'); ok(locator.lookup('model:user') !== locator.lookup('model:user'), 'non-singleton lookup worked'); }); QUnit.test('injections', function () { application.inject('model', 'fruit', 'fruit:favorite'); application.inject('model:user', 'communication', 'communication:main'); var user = locator.lookup('model:user'); var person = locator.lookup('model:person'); var fruit = locator.lookup('fruit:favorite'); equal(user.get('fruit'), fruit); equal(person.get('fruit'), fruit); ok(application.Email.detectInstance(user.get('communication'))); }); }); enifed('ember-application/tests/system/dependency_injection_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/tests/system'); test('ember-application/tests/system/dependency_injection_test.js should pass jscs', function () { ok(true, 'ember-application/tests/system/dependency_injection_test.js should pass jscs.'); }); }); enifed('ember-application/tests/system/dependency_injection_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/tests/system'); QUnit.test('ember-application/tests/system/dependency_injection_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/tests/system/dependency_injection_test.js should pass jshint.'); }); }); enifed('ember-application/tests/system/initializers_test', ['exports', 'ember-metal/core', 'ember-metal/run_loop', 'ember-application/system/application', 'ember-views/system/jquery', 'container/registry'], function (exports, _emberMetalCore, _emberMetalRun_loop, _emberApplicationSystemApplication, _emberViewsSystemJquery, _containerRegistry) { 'use strict'; var app; QUnit.module('Ember.Application initializers', { setup: function () {}, teardown: function () { if (app) { _emberMetalRun_loop.default(function () { app.destroy(); }); } } }); QUnit.test('initializers require proper \'name\' and \'initialize\' properties', function () { var MyApplication = _emberApplicationSystemApplication.default.extend(); expectAssertion(function () { _emberMetalRun_loop.default(function () { MyApplication.initializer({ name: 'initializer' }); }); }); expectAssertion(function () { _emberMetalRun_loop.default(function () { MyApplication.initializer({ initialize: _emberMetalCore.default.K }); }); }); }); QUnit.test('initializers are passed a registry and App', function () { var MyApplication = _emberApplicationSystemApplication.default.extend(); MyApplication.initializer({ name: 'initializer', initialize: function (registry, App) { ok(registry instanceof _containerRegistry.default, 'initialize is passed a registry'); ok(App instanceof _emberApplicationSystemApplication.default, 'initialize is passed an Application'); } }); _emberMetalRun_loop.default(function () { app = MyApplication.create({ router: false, rootElement: '#qunit-fixture' }); }); }); QUnit.test('initializers can be registered in a specified order', function () { var order = []; var MyApplication = _emberApplicationSystemApplication.default.extend(); MyApplication.initializer({ name: 'fourth', after: 'third', initialize: function (registry) { order.push('fourth'); } }); MyApplication.initializer({ name: 'second', after: 'first', before: 'third', initialize: function (registry) { order.push('second'); } }); MyApplication.initializer({ name: 'fifth', after: 'fourth', before: 'sixth', initialize: function (registry) { order.push('fifth'); } }); MyApplication.initializer({ name: 'first', before: 'second', initialize: function (registry) { order.push('first'); } }); MyApplication.initializer({ name: 'third', initialize: function (registry) { order.push('third'); } }); MyApplication.initializer({ name: 'sixth', initialize: function (registry) { order.push('sixth'); } }); _emberMetalRun_loop.default(function () { app = MyApplication.create({ router: false, rootElement: '#qunit-fixture' }); }); deepEqual(order, ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']); }); QUnit.test('initializers can be registered in a specified order as an array', function () { var order = []; var MyApplication = _emberApplicationSystemApplication.default.extend(); MyApplication.initializer({ name: 'third', initialize: function (registry) { order.push('third'); } }); MyApplication.initializer({ name: 'second', after: 'first', before: ['third', 'fourth'], initialize: function (registry) { order.push('second'); } }); MyApplication.initializer({ name: 'fourth', after: ['second', 'third'], initialize: function (registry) { order.push('fourth'); } }); MyApplication.initializer({ name: 'fifth', after: 'fourth', before: 'sixth', initialize: function (registry) { order.push('fifth'); } }); MyApplication.initializer({ name: 'first', before: ['second'], initialize: function (registry) { order.push('first'); } }); MyApplication.initializer({ name: 'sixth', initialize: function (registry) { order.push('sixth'); } }); _emberMetalRun_loop.default(function () { app = MyApplication.create({ router: false, rootElement: '#qunit-fixture' }); }); deepEqual(order, ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']); }); QUnit.test('initializers can have multiple dependencies', function () { var order = []; var a = { name: 'a', before: 'b', initialize: function (registry) { order.push('a'); } }; var b = { name: 'b', initialize: function (registry) { order.push('b'); } }; var c = { name: 'c', after: 'b', initialize: function (registry) { order.push('c'); } }; var afterB = { name: 'after b', after: 'b', initialize: function (registry) { order.push('after b'); } }; var afterC = { name: 'after c', after: 'c', initialize: function (registry) { order.push('after c'); } }; _emberApplicationSystemApplication.default.initializer(b); _emberApplicationSystemApplication.default.initializer(a); _emberApplicationSystemApplication.default.initializer(afterC); _emberApplicationSystemApplication.default.initializer(afterB); _emberApplicationSystemApplication.default.initializer(c); _emberMetalRun_loop.default(function () { app = _emberApplicationSystemApplication.default.create({ router: false, rootElement: '#qunit-fixture' }); }); ok(order.indexOf(a.name) < order.indexOf(b.name), 'a < b'); ok(order.indexOf(b.name) < order.indexOf(c.name), 'b < c'); ok(order.indexOf(b.name) < order.indexOf(afterB.name), 'b < afterB'); ok(order.indexOf(c.name) < order.indexOf(afterC.name), 'c < afterC'); }); QUnit.test('initializers set on Application subclasses should not be shared between apps', function () { var firstInitializerRunCount = 0; var secondInitializerRunCount = 0; var FirstApp = _emberApplicationSystemApplication.default.extend(); var firstApp, secondApp; FirstApp.initializer({ name: 'first', initialize: function (registry) { firstInitializerRunCount++; } }); var SecondApp = _emberApplicationSystemApplication.default.extend(); SecondApp.initializer({ name: 'second', initialize: function (registry) { secondInitializerRunCount++; } }); _emberViewsSystemJquery.default('#qunit-fixture').html('
'); _emberMetalRun_loop.default(function () { firstApp = FirstApp.create({ router: false, rootElement: '#qunit-fixture #first' }); }); equal(firstInitializerRunCount, 1, 'first initializer only was run'); equal(secondInitializerRunCount, 0, 'first initializer only was run'); _emberMetalRun_loop.default(function () { secondApp = SecondApp.create({ router: false, rootElement: '#qunit-fixture #second' }); }); equal(firstInitializerRunCount, 1, 'second initializer only was run'); equal(secondInitializerRunCount, 1, 'second initializer only was run'); _emberMetalRun_loop.default(function () { firstApp.destroy(); secondApp.destroy(); }); }); QUnit.test('initializers are concatenated', function () { var firstInitializerRunCount = 0; var secondInitializerRunCount = 0; var FirstApp = _emberApplicationSystemApplication.default.extend(); var firstApp, secondApp; FirstApp.initializer({ name: 'first', initialize: function (registry) { firstInitializerRunCount++; } }); var SecondApp = FirstApp.extend(); SecondApp.initializer({ name: 'second', initialize: function (registry) { secondInitializerRunCount++; } }); _emberViewsSystemJquery.default('#qunit-fixture').html('
'); _emberMetalRun_loop.default(function () { firstApp = FirstApp.create({ router: false, rootElement: '#qunit-fixture #first' }); }); equal(firstInitializerRunCount, 1, 'first initializer only was run when base class created'); equal(secondInitializerRunCount, 0, 'first initializer only was run when base class created'); firstInitializerRunCount = 0; _emberMetalRun_loop.default(function () { secondApp = SecondApp.create({ router: false, rootElement: '#qunit-fixture #second' }); }); equal(firstInitializerRunCount, 1, 'first initializer was run when subclass created'); equal(secondInitializerRunCount, 1, 'second initializers was run when subclass created'); _emberMetalRun_loop.default(function () { firstApp.destroy(); secondApp.destroy(); }); }); QUnit.test('initializers are per-app', function () { expect(0); var FirstApp = _emberApplicationSystemApplication.default.extend(); FirstApp.initializer({ name: 'shouldNotCollide', initialize: function (registry) {} }); var SecondApp = _emberApplicationSystemApplication.default.extend(); SecondApp.initializer({ name: 'shouldNotCollide', initialize: function (registry) {} }); }); QUnit.test('initializers should be executed in their own context', function () { expect(1); var MyApplication = _emberApplicationSystemApplication.default.extend(); MyApplication.initializer({ name: 'coolInitializer', myProperty: 'cool', initialize: function (registry, application) { equal(this.myProperty, 'cool', 'should have access to its own context'); } }); _emberMetalRun_loop.default(function () { app = MyApplication.create({ router: false, rootElement: '#qunit-fixture' }); }); }); }); enifed('ember-application/tests/system/initializers_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/tests/system'); test('ember-application/tests/system/initializers_test.js should pass jscs', function () { ok(true, 'ember-application/tests/system/initializers_test.js should pass jscs.'); }); }); enifed('ember-application/tests/system/initializers_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/tests/system'); QUnit.test('ember-application/tests/system/initializers_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/tests/system/initializers_test.js should pass jshint.'); }); }); enifed('ember-application/tests/system/instance_initializers_test', ['exports', 'ember-metal/core', 'ember-metal/run_loop', 'ember-application/system/application', 'ember-application/system/application-instance', 'ember-views/system/jquery'], function (exports, _emberMetalCore, _emberMetalRun_loop, _emberApplicationSystemApplication, _emberApplicationSystemApplicationInstance, _emberViewsSystemJquery) { 'use strict'; var app; QUnit.module('Ember.Application instance initializers', { setup: function () {}, teardown: function () { if (app) { _emberMetalRun_loop.default(function () { app.destroy(); }); } } }); QUnit.test('initializers require proper \'name\' and \'initialize\' properties', function () { var MyApplication = _emberApplicationSystemApplication.default.extend(); expectAssertion(function () { _emberMetalRun_loop.default(function () { MyApplication.instanceInitializer({ name: 'initializer' }); }); }); expectAssertion(function () { _emberMetalRun_loop.default(function () { MyApplication.instanceInitializer({ initialize: _emberMetalCore.default.K }); }); }); }); QUnit.test('initializers are passed an app instance', function () { var MyApplication = _emberApplicationSystemApplication.default.extend(); MyApplication.instanceInitializer({ name: 'initializer', initialize: function (instance) { ok(instance instanceof _emberApplicationSystemApplicationInstance.default, 'initialize is passed an application instance'); } }); _emberMetalRun_loop.default(function () { app = MyApplication.create({ router: false, rootElement: '#qunit-fixture' }); }); }); QUnit.test('initializers can be registered in a specified order', function () { var order = []; var MyApplication = _emberApplicationSystemApplication.default.extend(); MyApplication.instanceInitializer({ name: 'fourth', after: 'third', initialize: function (registry) { order.push('fourth'); } }); MyApplication.instanceInitializer({ name: 'second', after: 'first', before: 'third', initialize: function (registry) { order.push('second'); } }); MyApplication.instanceInitializer({ name: 'fifth', after: 'fourth', before: 'sixth', initialize: function (registry) { order.push('fifth'); } }); MyApplication.instanceInitializer({ name: 'first', before: 'second', initialize: function (registry) { order.push('first'); } }); MyApplication.instanceInitializer({ name: 'third', initialize: function (registry) { order.push('third'); } }); MyApplication.instanceInitializer({ name: 'sixth', initialize: function (registry) { order.push('sixth'); } }); _emberMetalRun_loop.default(function () { app = MyApplication.create({ router: false, rootElement: '#qunit-fixture' }); }); deepEqual(order, ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']); }); QUnit.test('initializers can be registered in a specified order as an array', function () { var order = []; var MyApplication = _emberApplicationSystemApplication.default.extend(); MyApplication.instanceInitializer({ name: 'third', initialize: function (registry) { order.push('third'); } }); MyApplication.instanceInitializer({ name: 'second', after: 'first', before: ['third', 'fourth'], initialize: function (registry) { order.push('second'); } }); MyApplication.instanceInitializer({ name: 'fourth', after: ['second', 'third'], initialize: function (registry) { order.push('fourth'); } }); MyApplication.instanceInitializer({ name: 'fifth', after: 'fourth', before: 'sixth', initialize: function (registry) { order.push('fifth'); } }); MyApplication.instanceInitializer({ name: 'first', before: ['second'], initialize: function (registry) { order.push('first'); } }); MyApplication.instanceInitializer({ name: 'sixth', initialize: function (registry) { order.push('sixth'); } }); _emberMetalRun_loop.default(function () { app = MyApplication.create({ router: false, rootElement: '#qunit-fixture' }); }); deepEqual(order, ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']); }); QUnit.test('initializers can have multiple dependencies', function () { var order = []; var a = { name: 'a', before: 'b', initialize: function (registry) { order.push('a'); } }; var b = { name: 'b', initialize: function (registry) { order.push('b'); } }; var c = { name: 'c', after: 'b', initialize: function (registry) { order.push('c'); } }; var afterB = { name: 'after b', after: 'b', initialize: function (registry) { order.push('after b'); } }; var afterC = { name: 'after c', after: 'c', initialize: function (registry) { order.push('after c'); } }; _emberApplicationSystemApplication.default.instanceInitializer(b); _emberApplicationSystemApplication.default.instanceInitializer(a); _emberApplicationSystemApplication.default.instanceInitializer(afterC); _emberApplicationSystemApplication.default.instanceInitializer(afterB); _emberApplicationSystemApplication.default.instanceInitializer(c); _emberMetalRun_loop.default(function () { app = _emberApplicationSystemApplication.default.create({ router: false, rootElement: '#qunit-fixture' }); }); ok(order.indexOf(a.name) < order.indexOf(b.name), 'a < b'); ok(order.indexOf(b.name) < order.indexOf(c.name), 'b < c'); ok(order.indexOf(b.name) < order.indexOf(afterB.name), 'b < afterB'); ok(order.indexOf(c.name) < order.indexOf(afterC.name), 'c < afterC'); }); QUnit.test('initializers set on Application subclasses should not be shared between apps', function () { var firstInitializerRunCount = 0; var secondInitializerRunCount = 0; var FirstApp = _emberApplicationSystemApplication.default.extend(); var firstApp, secondApp; FirstApp.instanceInitializer({ name: 'first', initialize: function (registry) { firstInitializerRunCount++; } }); var SecondApp = _emberApplicationSystemApplication.default.extend(); SecondApp.instanceInitializer({ name: 'second', initialize: function (registry) { secondInitializerRunCount++; } }); _emberViewsSystemJquery.default('#qunit-fixture').html('
'); _emberMetalRun_loop.default(function () { firstApp = FirstApp.create({ router: false, rootElement: '#qunit-fixture #first' }); }); equal(firstInitializerRunCount, 1, 'first initializer only was run'); equal(secondInitializerRunCount, 0, 'first initializer only was run'); _emberMetalRun_loop.default(function () { secondApp = SecondApp.create({ router: false, rootElement: '#qunit-fixture #second' }); }); equal(firstInitializerRunCount, 1, 'second initializer only was run'); equal(secondInitializerRunCount, 1, 'second initializer only was run'); _emberMetalRun_loop.default(function () { firstApp.destroy(); secondApp.destroy(); }); }); QUnit.test('initializers are concatenated', function () { var firstInitializerRunCount = 0; var secondInitializerRunCount = 0; var FirstApp = _emberApplicationSystemApplication.default.extend(); var firstApp, secondApp; FirstApp.instanceInitializer({ name: 'first', initialize: function (registry) { firstInitializerRunCount++; } }); var SecondApp = FirstApp.extend(); SecondApp.instanceInitializer({ name: 'second', initialize: function (registry) { secondInitializerRunCount++; } }); _emberViewsSystemJquery.default('#qunit-fixture').html('
'); _emberMetalRun_loop.default(function () { firstApp = FirstApp.create({ router: false, rootElement: '#qunit-fixture #first' }); }); equal(firstInitializerRunCount, 1, 'first initializer only was run when base class created'); equal(secondInitializerRunCount, 0, 'first initializer only was run when base class created'); firstInitializerRunCount = 0; _emberMetalRun_loop.default(function () { secondApp = SecondApp.create({ router: false, rootElement: '#qunit-fixture #second' }); }); equal(firstInitializerRunCount, 1, 'first initializer was run when subclass created'); equal(secondInitializerRunCount, 1, 'second initializers was run when subclass created'); _emberMetalRun_loop.default(function () { firstApp.destroy(); secondApp.destroy(); }); }); QUnit.test('initializers are per-app', function () { expect(0); var FirstApp = _emberApplicationSystemApplication.default.extend(); FirstApp.instanceInitializer({ name: 'shouldNotCollide', initialize: function (registry) {} }); var SecondApp = _emberApplicationSystemApplication.default.extend(); SecondApp.instanceInitializer({ name: 'shouldNotCollide', initialize: function (registry) {} }); }); QUnit.test('initializers are run before ready hook', function () { expect(2); var readyWasCalled = false; var MyApplication = _emberApplicationSystemApplication.default.extend({ ready: function () { ok(true, 'ready is called'); readyWasCalled = true; } }); MyApplication.instanceInitializer({ name: 'initializer', initialize: function () { ok(!readyWasCalled, 'ready is not yet called'); } }); _emberMetalRun_loop.default(function () { app = MyApplication.create({ router: false, rootElement: '#qunit-fixture' }); }); }); QUnit.test('initializers should be executed in their own context', function () { expect(1); var MyApplication = _emberApplicationSystemApplication.default.extend(); MyApplication.instanceInitializer({ name: 'coolInitializer', myProperty: 'cool', initialize: function (registry, application) { equal(this.myProperty, 'cool', 'should have access to its own context'); } }); _emberMetalRun_loop.default(function () { app = MyApplication.create({ router: false, rootElement: '#qunit-fixture' }); }); }); QUnit.test('Initializers get an instance on app reset', function () { expect(2); var MyApplication = _emberApplicationSystemApplication.default.extend(); MyApplication.instanceInitializer({ name: 'giveMeAnInstance', initialize: function (instance) { ok(!!instance, 'Initializer got an instance'); } }); _emberMetalRun_loop.default(function () { app = MyApplication.create({ router: false, rootElement: '#qunit-fixture' }); }); _emberMetalRun_loop.default(app, 'reset'); }); }); enifed('ember-application/tests/system/instance_initializers_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/tests/system'); test('ember-application/tests/system/instance_initializers_test.js should pass jscs', function () { ok(true, 'ember-application/tests/system/instance_initializers_test.js should pass jscs.'); }); }); enifed('ember-application/tests/system/instance_initializers_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/tests/system'); QUnit.test('ember-application/tests/system/instance_initializers_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/tests/system/instance_initializers_test.js should pass jshint.'); }); }); enifed('ember-application/tests/system/logging_test', ['exports', 'ember-metal/core', 'ember-metal/run_loop', 'ember-application/system/application', 'ember-views/views/view', 'ember-runtime/controllers/controller', 'ember-routing/system/route', 'ember-runtime/ext/rsvp', 'ember-template-compiler/system/compile', 'ember-routing'], function (exports, _emberMetalCore, _emberMetalRun_loop, _emberApplicationSystemApplication, _emberViewsViewsView, _emberRuntimeControllersController, _emberRoutingSystemRoute, _emberRuntimeExtRsvp, _emberTemplateCompilerSystemCompile, _emberRouting) { /*globals EmberDev */ 'use strict'; var App, logs, originalLogger; QUnit.module('Ember.Application – logging of generated classes', { setup: function () { logs = {}; originalLogger = _emberMetalCore.default.Logger.info; _emberMetalCore.default.Logger.info = function () { var fullName = arguments[1].fullName; logs[fullName] = logs[fullName] || 0; logs[fullName]++; }; _emberMetalRun_loop.default(function () { App = _emberApplicationSystemApplication.default.create({ LOG_ACTIVE_GENERATION: true }); App.Router.reopen({ location: 'none' }); App.Router.map(function () { this.route('posts', { resetNamespace: true }); }); App.deferReadiness(); }); }, teardown: function () { _emberMetalCore.default.Logger.info = originalLogger; _emberMetalRun_loop.default(App, 'destroy'); logs = App = null; } }); function visit(path) { QUnit.stop(); var promise = _emberMetalRun_loop.default(function () { return new _emberRuntimeExtRsvp.default.Promise(function (resolve, reject) { var router = App.__container__.lookup('router:main'); resolve(router.handleURL(path).then(function (value) { QUnit.start(); ok(true, 'visited: `' + path + '`'); return value; }, function (reason) { QUnit.start(); ok(false, 'failed to visit:`' + path + '` reason: `' + QUnit.jsDump.parse(reason)); throw reason; })); }); }); return { then: function (resolve, reject) { _emberMetalRun_loop.default(promise, 'then', resolve, reject); } }; } QUnit.test('log class generation if logging enabled', function () { if (EmberDev && EmberDev.runningProdBuild) { ok(true, 'Logging does not occur in production builds'); return; } _emberMetalRun_loop.default(App, 'advanceReadiness'); visit('/posts').then(function () { equal(Object.keys(logs).length, 6, 'expected logs'); }); }); QUnit.test('do NOT log class generation if logging disabled', function () { App.reopen({ LOG_ACTIVE_GENERATION: false }); _emberMetalRun_loop.default(App, 'advanceReadiness'); visit('/posts').then(function () { equal(Object.keys(logs).length, 0, 'expected no logs'); }); }); QUnit.test('actively generated classes get logged', function () { if (EmberDev && EmberDev.runningProdBuild) { ok(true, 'Logging does not occur in production builds'); return; } _emberMetalRun_loop.default(App, 'advanceReadiness'); visit('/posts').then(function () { equal(logs['controller:application'], 1, 'expected: ApplicationController was generated'); equal(logs['controller:posts'], 1, 'expected: PostsController was generated'); equal(logs['route:application'], 1, 'expected: ApplicationRoute was generated'); equal(logs['route:posts'], 1, 'expected: PostsRoute was generated'); }); }); QUnit.test('predefined classes do not get logged', function () { App.ApplicationController = _emberRuntimeControllersController.default.extend(); App.PostsController = _emberRuntimeControllersController.default.extend(); App.ApplicationRoute = _emberRoutingSystemRoute.default.extend(); App.PostsRoute = _emberRoutingSystemRoute.default.extend(); _emberMetalRun_loop.default(App, 'advanceReadiness'); visit('/posts').then(function () { ok(!logs['controller:application'], 'did not expect: ApplicationController was generated'); ok(!logs['controller:posts'], 'did not expect: PostsController was generated'); ok(!logs['route:application'], 'did not expect: ApplicationRoute was generated'); ok(!logs['route:posts'], 'did not expect: PostsRoute was generated'); }); }); QUnit.module('Ember.Application – logging of view lookups', { setup: function () { logs = {}; originalLogger = _emberMetalCore.default.Logger.info; _emberMetalCore.default.Logger.info = function () { var fullName = arguments[1].fullName; logs[fullName] = logs[fullName] || 0; logs[fullName]++; }; _emberMetalRun_loop.default(function () { App = _emberApplicationSystemApplication.default.create({ LOG_VIEW_LOOKUPS: true }); App.Router.reopen({ location: 'none' }); App.Router.map(function () { this.route('posts', { resetNamespace: true }); }); App.deferReadiness(); }); }, teardown: function () { _emberMetalCore.default.Logger.info = originalLogger; _emberMetalRun_loop.default(App, 'destroy'); logs = App = null; } }); QUnit.test('log when template and view are missing when flag is active', function () { if (EmberDev && EmberDev.runningProdBuild) { ok(true, 'Logging does not occur in production builds'); return; } App.register('template:application', _emberTemplateCompilerSystemCompile.default('{{outlet}}')); _emberMetalRun_loop.default(App, 'advanceReadiness'); visit('/posts').then(function () { equal(logs['template:application'], undefined, 'expected: Should not log template:application since it exists.'); equal(logs['template:index'], 1, 'expected: Could not find "index" template or view.'); equal(logs['template:posts'], 1, 'expected: Could not find "posts" template or view.'); }); }); QUnit.test('do not log when template and view are missing when flag is not true', function () { App.reopen({ LOG_VIEW_LOOKUPS: false }); _emberMetalRun_loop.default(App, 'advanceReadiness'); visit('/posts').then(function () { equal(Object.keys(logs).length, 0, 'expected no logs'); }); }); QUnit.test('log which view is used with a template', function () { if (EmberDev && EmberDev.runningProdBuild) { ok(true, 'Logging does not occur in production builds'); return; } App.register('template:application', _emberTemplateCompilerSystemCompile.default('{{outlet}}')); App.register('template:foo', _emberTemplateCompilerSystemCompile.default('Template with custom view')); App.register('view:posts', _emberViewsViewsView.default.extend({ templateName: 'foo' })); _emberMetalRun_loop.default(App, 'advanceReadiness'); visit('/posts').then(function () { equal(logs['view:application'], 1, 'toplevel view always get an element'); equal(logs['view:index'], undefined, 'expected: Should not log when index is not present.'); equal(logs['view:posts'], 1, 'expected: Rendering posts with PostsView.'); }); }); QUnit.test('do not log which views are used with templates when flag is not true', function () { App.reopen({ LOG_VIEW_LOOKUPS: false }); _emberMetalRun_loop.default(App, 'advanceReadiness'); visit('/posts').then(function () { equal(Object.keys(logs).length, 0, 'expected no logs'); }); }); }); enifed('ember-application/tests/system/logging_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/tests/system'); test('ember-application/tests/system/logging_test.js should pass jscs', function () { ok(true, 'ember-application/tests/system/logging_test.js should pass jscs.'); }); }); enifed('ember-application/tests/system/logging_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/tests/system'); QUnit.test('ember-application/tests/system/logging_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/tests/system/logging_test.js should pass jshint.'); }); }); enifed('ember-application/tests/system/readiness_test', ['exports', 'ember-metal/run_loop', 'ember-application/system/application'], function (exports, _emberMetalRun_loop, _emberApplicationSystemApplication) { 'use strict'; var jQuery, application, Application; var readyWasCalled, domReady, readyCallbacks; // We are using a small mock of jQuery because jQuery is third-party code with // very well-defined semantics, and we want to confirm that a jQuery stub run // in a more minimal server environment that implements this behavior will be // sufficient for Ember's requirements. QUnit.module('Application readiness', { setup: function () { readyWasCalled = 0; readyCallbacks = []; var jQueryInstance = { ready: function (callback) { readyCallbacks.push(callback); if (jQuery.isReady) { domReady(); } } }; jQuery = function () { return jQueryInstance; }; jQuery.isReady = false; var domReadyCalled = 0; domReady = function () { if (domReadyCalled !== 0) { return; } domReadyCalled++; var i; for (i = 0; i < readyCallbacks.length; i++) { readyCallbacks[i](); } }; Application = _emberApplicationSystemApplication.default.extend({ $: jQuery, ready: function () { readyWasCalled++; } }); }, teardown: function () { if (application) { _emberMetalRun_loop.default(function () { application.destroy(); }); } } }); // These tests are confirming that if the callbacks passed into jQuery's ready hook is called // synchronously during the application's initialization, we get the same behavior as if // it was triggered after initialization. QUnit.test('Ember.Application\'s ready event is called right away if jQuery is already ready', function () { jQuery.isReady = true; _emberMetalRun_loop.default(function () { application = Application.create({ router: false }); equal(readyWasCalled, 0, 'ready is not called until later'); }); equal(readyWasCalled, 1, 'ready was called'); domReady(); equal(readyWasCalled, 1, 'application\'s ready was not called again'); }); QUnit.test('Ember.Application\'s ready event is called after the document becomes ready', function () { _emberMetalRun_loop.default(function () { application = Application.create({ router: false }); }); equal(readyWasCalled, 0, 'ready wasn\'t called yet'); domReady(); equal(readyWasCalled, 1, 'ready was called now that DOM is ready'); }); QUnit.test('Ember.Application\'s ready event can be deferred by other components', function () { _emberMetalRun_loop.default(function () { application = Application.create({ router: false }); application.deferReadiness(); }); equal(readyWasCalled, 0, 'ready wasn\'t called yet'); domReady(); equal(readyWasCalled, 0, 'ready wasn\'t called yet'); _emberMetalRun_loop.default(function () { application.advanceReadiness(); equal(readyWasCalled, 0); }); equal(readyWasCalled, 1, 'ready was called now all readiness deferrals are advanced'); }); QUnit.test('Ember.Application\'s ready event can be deferred by other components', function () { jQuery.isReady = false; _emberMetalRun_loop.default(function () { application = Application.create({ router: false }); application.deferReadiness(); equal(readyWasCalled, 0, 'ready wasn\'t called yet'); }); domReady(); equal(readyWasCalled, 0, 'ready wasn\'t called yet'); _emberMetalRun_loop.default(function () { application.advanceReadiness(); }); equal(readyWasCalled, 1, 'ready was called now all readiness deferrals are advanced'); expectAssertion(function () { application.deferReadiness(); }); }); }); enifed('ember-application/tests/system/readiness_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/tests/system'); test('ember-application/tests/system/readiness_test.js should pass jscs', function () { ok(true, 'ember-application/tests/system/readiness_test.js should pass jscs.'); }); }); enifed('ember-application/tests/system/readiness_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/tests/system'); QUnit.test('ember-application/tests/system/readiness_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/tests/system/readiness_test.js should pass jshint.'); }); }); enifed('ember-application/tests/system/reset_test', ['exports', 'ember-metal/run_loop', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-application/system/application', 'ember-runtime/system/object', 'ember-routing/system/router', 'ember-views/views/view', 'ember-runtime/controllers/controller', 'ember-views/system/jquery', 'container/registry'], function (exports, _emberMetalRun_loop, _emberMetalProperty_get, _emberMetalProperty_set, _emberApplicationSystemApplication, _emberRuntimeSystemObject, _emberRoutingSystemRouter, _emberViewsViewsView, _emberRuntimeControllersController, _emberViewsSystemJquery, _containerRegistry) { 'use strict'; var application, Application; QUnit.module('Ember.Application - resetting', { setup: function () { Application = _emberApplicationSystemApplication.default.extend({ name: 'App', rootElement: '#qunit-fixture' }); }, teardown: function () { Application = null; if (application) { _emberMetalRun_loop.default(application, 'destroy'); } } }); QUnit.test('Brings its own run-loop if not provided', function () { application = _emberMetalRun_loop.default(Application, 'create'); application.ready = function () { QUnit.start(); ok(true, 'app booted'); }; QUnit.stop(); application.reset(); }); QUnit.test('does not bring its own run loop if one is already provided', function () { expect(3); var didBecomeReady = false; application = _emberMetalRun_loop.default(Application, 'create'); _emberMetalRun_loop.default(function () { application.ready = function () { didBecomeReady = true; }; application.reset(); application.deferReadiness(); ok(!didBecomeReady, 'app is not ready'); }); ok(!didBecomeReady, 'app is not ready'); _emberMetalRun_loop.default(application, 'advanceReadiness'); ok(didBecomeReady, 'app is ready'); }); QUnit.test('When an application is reset, new instances of controllers are generated', function () { _emberMetalRun_loop.default(function () { application = Application.create(); application.AcademicController = _emberRuntimeControllersController.default.extend(); }); var firstController = application.__container__.lookup('controller:academic'); var secondController = application.__container__.lookup('controller:academic'); application.reset(); var thirdController = application.__container__.lookup('controller:academic'); strictEqual(firstController, secondController, 'controllers looked up in succession should be the same instance'); ok(firstController.isDestroying, 'controllers are destroyed when their application is reset'); notStrictEqual(firstController, thirdController, 'controllers looked up after the application is reset should not be the same instance'); }); QUnit.test('When an application is reset, the eventDispatcher is destroyed and recreated', function () { var eventDispatcherWasSetup, eventDispatcherWasDestroyed; eventDispatcherWasSetup = 0; eventDispatcherWasDestroyed = 0; var mock_event_dispatcher = { create: function () { return { setup: function () { eventDispatcherWasSetup++; }, destroy: function () { eventDispatcherWasDestroyed++; } }; } }; // this is pretty awful. We should make this less Global-ly. var originalRegister = _containerRegistry.default.prototype.register; _containerRegistry.default.prototype.register = function (name, type, options) { if (name === 'event_dispatcher:main') { return mock_event_dispatcher; } else { return originalRegister.call(this, name, type, options); } }; try { _emberMetalRun_loop.default(function () { application = Application.create(); equal(eventDispatcherWasSetup, 0); equal(eventDispatcherWasDestroyed, 0); }); equal(eventDispatcherWasSetup, 1); equal(eventDispatcherWasDestroyed, 0); application.reset(); equal(eventDispatcherWasDestroyed, 1); equal(eventDispatcherWasSetup, 2, 'setup called after reset'); } catch (error) { _containerRegistry.default.prototype.register = originalRegister; } _containerRegistry.default.prototype.register = originalRegister; }); QUnit.test('When an application is reset, the ApplicationView is torn down', function () { _emberMetalRun_loop.default(function () { application = Application.create(); application.ApplicationView = _emberViewsViewsView.default.extend({ elementId: 'application-view' }); }); equal(_emberViewsSystemJquery.default('#qunit-fixture #application-view').length, 1, 'precond - the application view is rendered'); var originalView = _emberViewsViewsView.default.views['application-view']; application.reset(); var resettedView = _emberViewsViewsView.default.views['application-view']; equal(_emberViewsSystemJquery.default('#qunit-fixture #application-view').length, 1, 'the application view is rendered'); notStrictEqual(originalView, resettedView, 'The view object has changed'); }); QUnit.test('When an application is reset, the router URL is reset to `/`', function () { var location, router; _emberMetalRun_loop.default(function () { application = Application.create(); application.Router = _emberRoutingSystemRouter.default.extend({ location: 'none' }); application.Router.map(function () { this.route('one'); this.route('two'); }); }); router = application.__container__.lookup('router:main'); location = router.get('location'); _emberMetalRun_loop.default(function () { location.handleURL('/one'); }); application.reset(); var applicationController = application.__container__.lookup('controller:application'); router = application.__container__.lookup('router:main'); location = router.get('location'); equal(location.getURL(), ''); equal(_emberMetalProperty_get.get(applicationController, 'currentPath'), 'index'); location = application.__container__.lookup('router:main').get('location'); _emberMetalRun_loop.default(function () { location.handleURL('/one'); }); equal(_emberMetalProperty_get.get(applicationController, 'currentPath'), 'one'); }); QUnit.test('When an application with advance/deferReadiness is reset, the app does correctly become ready after reset', function () { var readyCallCount; readyCallCount = 0; _emberMetalRun_loop.default(function () { application = Application.create({ ready: function () { readyCallCount++; } }); application.deferReadiness(); equal(readyCallCount, 0, 'ready has not yet been called'); }); _emberMetalRun_loop.default(function () { application.advanceReadiness(); }); equal(readyCallCount, 1, 'ready was called once'); application.reset(); equal(readyCallCount, 2, 'ready was called twice'); }); QUnit.test('With ember-data like initializer and constant', function () { var readyCallCount; readyCallCount = 0; var DS = { Store: _emberRuntimeSystemObject.default.extend({ init: function () { if (!_emberMetalProperty_get.get(DS, 'defaultStore')) { _emberMetalProperty_set.set(DS, 'defaultStore', this); } this._super.apply(this, arguments); }, willDestroy: function () { if (_emberMetalProperty_get.get(DS, 'defaultStore') === this) { _emberMetalProperty_set.set(DS, 'defaultStore', null); } } }) }; Application.initializer({ name: 'store', initialize: function (registry, application) { registry.unregister('store:main'); registry.register('store:main', application.Store); application.__container__.lookup('store:main'); } }); _emberMetalRun_loop.default(function () { application = Application.create(); application.Store = DS.Store; }); ok(DS.defaultStore, 'has defaultStore'); application.reset(); ok(DS.defaultStore, 'still has defaultStore'); ok(application.__container__.lookup('store:main'), 'store is still present'); }); QUnit.test('Ensure that the hashchange event listener is removed', function () { var listeners; _emberViewsSystemJquery.default(window).off('hashchange'); // ensure that any previous listeners are cleared _emberMetalRun_loop.default(function () { application = Application.create(); }); listeners = _emberViewsSystemJquery.default._data(_emberViewsSystemJquery.default(window)[0], 'events'); equal(listeners['hashchange'].length, 1, 'hashchange event listener was setup'); application.reset(); listeners = _emberViewsSystemJquery.default._data(_emberViewsSystemJquery.default(window)[0], 'events'); equal(listeners['hashchange'].length, 1, 'hashchange event only exists once'); }); }); enifed('ember-application/tests/system/reset_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/tests/system'); test('ember-application/tests/system/reset_test.js should pass jscs', function () { ok(true, 'ember-application/tests/system/reset_test.js should pass jscs.'); }); }); enifed('ember-application/tests/system/reset_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/tests/system'); QUnit.test('ember-application/tests/system/reset_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/tests/system/reset_test.js should pass jshint.'); }); }); enifed('ember-application/tests/system/visit_test', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/run_loop', 'ember-application/system/application', 'ember-application/system/application-instance', 'ember-routing/system/router', 'ember-views/views/view', 'ember-template-compiler/system/compile'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalRun_loop, _emberApplicationSystemApplication, _emberApplicationSystemApplicationInstance, _emberRoutingSystemRouter, _emberViewsViewsView, _emberTemplateCompilerSystemCompile) { 'use strict'; function createApplication() { var App = _emberApplicationSystemApplication.default.extend().create({ autoboot: false, LOG_TRANSITIONS: true, LOG_TRANSITIONS_INTERNAL: true, LOG_ACTIVE_GENERATION: true }); App.Router = _emberRoutingSystemRouter.default.extend(); return App; } }); // This tests whether the application is "autobooted" by registering an // instance initializer and asserting it never gets run. Since this is // inherently testing that async behavior *doesn't* happen, we set a // 500ms timeout to verify that when autoboot is set to false, the // instance initializer that would normally get called on DOM ready // does not fire. // Start the timeout // Create an instance initializer that should *not* get run. enifed('ember-application/tests/system/visit_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/tests/system'); test('ember-application/tests/system/visit_test.js should pass jscs', function () { ok(true, 'ember-application/tests/system/visit_test.js should pass jscs.'); }); }); enifed('ember-application/tests/system/visit_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/tests/system'); QUnit.test('ember-application/tests/system/visit_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/tests/system/visit_test.js should pass jshint.'); }); }); enifed('ember-application/utils/validate-type.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-application/utils'); test('ember-application/utils/validate-type.js should pass jscs', function () { ok(true, 'ember-application/utils/validate-type.js should pass jscs.'); }); }); enifed('ember-application/utils/validate-type.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-application/utils'); QUnit.test('ember-application/utils/validate-type.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-application/utils/validate-type.js should pass jshint.'); }); }); enifed('ember-debug.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - .'); test('ember-debug.js should pass jscs', function () { ok(true, 'ember-debug.js should pass jscs.'); }); }); enifed('ember-debug.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - .'); QUnit.test('ember-debug.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-debug.js should pass jshint.'); }); }); enifed('ember-debug/deprecation-manager.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-debug'); test('ember-debug/deprecation-manager.js should pass jscs', function () { ok(true, 'ember-debug/deprecation-manager.js should pass jscs.'); }); }); enifed('ember-debug/deprecation-manager.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-debug'); QUnit.test('ember-debug/deprecation-manager.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-debug/deprecation-manager.js should pass jshint.'); }); }); enifed('ember-debug/tests/main_test', ['exports', 'ember-metal/core', 'ember-debug/deprecation-manager'], function (exports, _emberMetalCore, _emberDebugDeprecationManager) { 'use strict'; var originalEnvValue = undefined; var originalDeprecationDefault = undefined; var originalDeprecationLevels = undefined; QUnit.module('ember-debug', { setup: function () { originalDeprecationDefault = _emberDebugDeprecationManager.default.defaultLevel; originalDeprecationLevels = _emberDebugDeprecationManager.default.individualLevels; originalEnvValue = _emberMetalCore.default.ENV.RAISE_ON_DEPRECATION; _emberMetalCore.default.ENV.RAISE_ON_DEPRECATION = false; _emberDebugDeprecationManager.default.setDefaultLevel(_emberDebugDeprecationManager.deprecationLevels.RAISE); }, teardown: function () { _emberDebugDeprecationManager.default.defaultLevel = originalDeprecationDefault; _emberDebugDeprecationManager.default.individualLevels = originalDeprecationLevels; _emberMetalCore.default.ENV.RAISE_ON_DEPRECATION = originalEnvValue; } }); QUnit.test('Ember.deprecate does not throw if default level is silence', function (assert) { assert.expect(1); _emberDebugDeprecationManager.default.setDefaultLevel(_emberDebugDeprecationManager.deprecationLevels.SILENCE); try { _emberMetalCore.default.deprecate('Should not throw', false); assert.ok(true, 'Ember.deprecate did not throw'); } catch (e) { assert.ok(false, 'Expected Ember.deprecate not to throw but it did: ' + e.message); } }); QUnit.test('Ember.deprecate re-sets deprecation level to RAISE if ENV.RAISE_ON_DEPRECATION is set', function (assert) { assert.expect(2); _emberDebugDeprecationManager.default.setDefaultLevel(_emberDebugDeprecationManager.deprecationLevels.SILENCE); _emberMetalCore.default.ENV.RAISE_ON_DEPRECATION = true; assert.throws(function () { _emberMetalCore.default.deprecate('Should throw', false); }, /Should throw/); assert.equal(_emberDebugDeprecationManager.default.defaultLevel, _emberDebugDeprecationManager.deprecationLevels.RAISE, 'default level re-set to RAISE'); }); QUnit.test('When ENV.RAISE_ON_DEPRECATION is true, it is still possible to silence a deprecation by id', function (assert) { assert.expect(3); _emberMetalCore.default.ENV.RAISE_ON_DEPRECATION = true; _emberDebugDeprecationManager.default.setLevel('my-deprecation', _emberDebugDeprecationManager.deprecationLevels.SILENCE); try { _emberMetalCore.default.deprecate('should be silenced with matching id', false, { id: 'my-deprecation' }); assert.ok(true, 'Did not throw when level is set by id'); } catch (e) { assert.ok(false, 'Expected Ember.deprecate not to throw but it did: ' + e.message); } assert.throws(function () { _emberMetalCore.default.deprecate('Should throw with no id', false); }, /Should throw with no id/); assert.throws(function () { _emberMetalCore.default.deprecate('Should throw with non-matching id', false, { id: 'other-id' }); }, /Should throw with non-matching id/); }); QUnit.test('Ember.deprecate throws deprecation if second argument is falsy', function () { expect(3); throws(function () { _emberMetalCore.default.deprecate('Deprecation is thrown', false); }); throws(function () { _emberMetalCore.default.deprecate('Deprecation is thrown', ''); }); throws(function () { _emberMetalCore.default.deprecate('Deprecation is thrown', 0); }); }); QUnit.test('Ember.deprecate does not throw deprecation if second argument is a function and it returns true', function () { expect(1); _emberMetalCore.default.deprecate('Deprecation is thrown', function () { return true; }); ok(true, 'deprecation was not thrown'); }); QUnit.test('Ember.deprecate throws if second argument is a function and it returns false', function () { expect(1); throws(function () { _emberMetalCore.default.deprecate('Deprecation is thrown', function () { return false; }); }); }); QUnit.test('Ember.deprecate does not throw deprecations if second argument is truthy', function () { expect(1); _emberMetalCore.default.deprecate('Deprecation is thrown', true); _emberMetalCore.default.deprecate('Deprecation is thrown', '1'); _emberMetalCore.default.deprecate('Deprecation is thrown', 1); ok(true, 'deprecations were not thrown'); }); QUnit.test('Ember.assert throws if second argument is falsy', function () { expect(3); throws(function () { _emberMetalCore.default.assert('Assertion is thrown', false); }); throws(function () { _emberMetalCore.default.assert('Assertion is thrown', ''); }); throws(function () { _emberMetalCore.default.assert('Assertion is thrown', 0); }); }); QUnit.test('Ember.assert does not throw if second argument is a function and it returns true', function () { expect(1); _emberMetalCore.default.assert('Assertion is thrown', function () { return true; }); ok(true, 'assertion was not thrown'); }); QUnit.test('Ember.assert throws if second argument is a function and it returns false', function () { expect(1); throws(function () { _emberMetalCore.default.assert('Assertion is thrown', function () { return false; }); }); }); QUnit.test('Ember.assert does not throw if second argument is truthy', function () { expect(1); _emberMetalCore.default.assert('Assertion is thrown', true); _emberMetalCore.default.assert('Assertion is thrown', '1'); _emberMetalCore.default.assert('Assertion is thrown', 1); ok(true, 'assertions were not thrown'); }); QUnit.test('Ember.assert does not throw if second argument is an object', function () { expect(1); var Igor = _emberMetalCore.default.Object.extend(); _emberMetalCore.default.assert('is truthy', Igor); _emberMetalCore.default.assert('is truthy', Igor.create()); ok(true, 'assertions were not thrown'); }); QUnit.test('Ember.deprecate does not throw a deprecation at log and silence levels', function () { expect(4); var id = 'ABC'; _emberDebugDeprecationManager.default.setLevel(id, _emberDebugDeprecationManager.deprecationLevels.LOG); try { _emberMetalCore.default.deprecate('Deprecation for testing purposes', false, { id: id }); ok(true, 'Deprecation did not throw'); } catch (e) { ok(false, 'Deprecation was thrown despite being added to blacklist'); } _emberDebugDeprecationManager.default.setLevel(id, _emberDebugDeprecationManager.deprecationLevels.SILENCE); try { _emberMetalCore.default.deprecate('Deprecation for testing purposes', false, { id: id }); ok(true, 'Deprecation did not throw'); } catch (e) { ok(false, 'Deprecation was thrown despite being added to blacklist'); } _emberDebugDeprecationManager.default.setLevel(id, _emberDebugDeprecationManager.deprecationLevels.RAISE); throws(function () { _emberMetalCore.default.deprecate('Deprecation is thrown', false, { id: id }); }); _emberDebugDeprecationManager.default.setLevel(id, null); throws(function () { _emberMetalCore.default.deprecate('Deprecation is thrown', false, { id: id }); }); }); }); enifed('ember-debug/tests/main_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-debug/tests'); test('ember-debug/tests/main_test.js should pass jscs', function () { ok(true, 'ember-debug/tests/main_test.js should pass jscs.'); }); }); enifed('ember-debug/tests/main_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-debug/tests'); QUnit.test('ember-debug/tests/main_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-debug/tests/main_test.js should pass jshint.'); }); }); enifed('ember-debug/tests/warn_if_using_stripped_feature_flags_test', ['exports', 'ember-metal/core', 'ember-debug'], function (exports, _emberMetalCore, _emberDebug) { 'use strict'; var oldWarn, oldRunInDebug, origEnvFeatures, origEnableAll, origEnableOptional; function confirmWarns(expectedMsg) { var featuresWereStripped = true; var FEATURES = _emberMetalCore.default.ENV.FEATURES; _emberMetalCore.default.warn = function (msg, test) { if (!test) { equal(msg, expectedMsg); } }; _emberMetalCore.default.runInDebug = function (func) { func(); }; // Should trigger our 1 warning _emberDebug._warnIfUsingStrippedFeatureFlags(FEATURES, featuresWereStripped); // Shouldn't trigger any warnings now that we're "in canary" featuresWereStripped = false; _emberDebug._warnIfUsingStrippedFeatureFlags(FEATURES, featuresWereStripped); } QUnit.module('ember-debug - _warnIfUsingStrippedFeatureFlags', { setup: function () { oldWarn = _emberMetalCore.default.warn; oldRunInDebug = _emberMetalCore.default.runInDebug; origEnvFeatures = _emberMetalCore.default.ENV.FEATURES; origEnableAll = _emberMetalCore.default.ENV.ENABLE_ALL_FEATURES; origEnableOptional = _emberMetalCore.default.ENV.ENABLE_OPTIONAL_FEATURES; }, teardown: function () { _emberMetalCore.default.warn = oldWarn; _emberMetalCore.default.runInDebug = oldRunInDebug; _emberMetalCore.default.ENV.FEATURES = origEnvFeatures; _emberMetalCore.default.ENV.ENABLE_ALL_FEATURES = origEnableAll; _emberMetalCore.default.ENV.ENABLE_OPTIONAL_FEATURES = origEnableOptional; } }); QUnit.test('Setting Ember.ENV.ENABLE_ALL_FEATURES truthy in non-canary, debug build causes a warning', function () { expect(1); _emberMetalCore.default.ENV.ENABLE_ALL_FEATURES = true; _emberMetalCore.default.ENV.ENABLE_OPTIONAL_FEATURES = false; _emberMetalCore.default.ENV.FEATURES = {}; confirmWarns('Ember.ENV.ENABLE_ALL_FEATURES is only available in canary builds.'); }); QUnit.test('Setting Ember.ENV.ENABLE_OPTIONAL_FEATURES truthy in non-canary, debug build causes a warning', function () { expect(1); _emberMetalCore.default.ENV.ENABLE_ALL_FEATURES = false; _emberMetalCore.default.ENV.ENABLE_OPTIONAL_FEATURES = true; _emberMetalCore.default.ENV.FEATURES = {}; confirmWarns('Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.'); }); QUnit.test('Enabling a FEATURES flag in non-canary, debug build causes a warning', function () { expect(1); _emberMetalCore.default.ENV.ENABLE_ALL_FEATURES = false; _emberMetalCore.default.ENV.ENABLE_OPTIONAL_FEATURES = false; _emberMetalCore.default.ENV.FEATURES = { 'fred': true, 'barney': false, 'wilma': null }; confirmWarns('FEATURE["fred"] is set as enabled, but FEATURE flags are only available in canary builds.'); }); }); enifed('ember-debug/tests/warn_if_using_stripped_feature_flags_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-debug/tests'); test('ember-debug/tests/warn_if_using_stripped_feature_flags_test.js should pass jscs', function () { ok(true, 'ember-debug/tests/warn_if_using_stripped_feature_flags_test.js should pass jscs.'); }); }); enifed('ember-debug/tests/warn_if_using_stripped_feature_flags_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-debug/tests'); QUnit.test('ember-debug/tests/warn_if_using_stripped_feature_flags_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-debug/tests/warn_if_using_stripped_feature_flags_test.js should pass jshint.'); }); }); enifed("ember-dev/test-helper/assertion", ["exports", "./method-call-expectation", "./utils"], function (exports, _methodCallExpectation, _utils) { /* globals QUnit */ "use strict"; function AssertExpectation(Ember, message) { _methodCallExpectation.default.call(this, Ember, 'assert'); this.expectedMessage = message; } AssertExpectation.Error = function () {}; AssertExpectation.prototype = _utils.o_create(_methodCallExpectation.default.prototype); AssertExpectation.prototype.handleCall = function (message, test) { var noAssertion = typeof test === 'function' ? test() : test; this.sawCall = true; if (noAssertion) { return; } this.actualMessage = message; // Halt execution throw new AssertExpectation.Error(); }; AssertExpectation.prototype.assert = function (fn) { try { this.runWithStub(fn); } catch (e) { if (!(e instanceof AssertExpectation.Error)) { throw e; } } // Run assertions in an order that is useful when debugging a test failure. // if (!this.sawCall) { QUnit.ok(false, "Expected Ember.assert to be called (Not called with any value)."); } else if (!this.actualMessage) { QUnit.ok(false, 'Expected a failing Ember.assert (Ember.assert called, but without a failing test).'); } else { if (this.expectedMessage) { if (this.expectedMessage instanceof RegExp) { QUnit.ok(this.expectedMessage.test(this.actualMessage), "Expected failing Ember.assert: '" + this.expectedMessage + "', but got '" + this.actualMessage + "'."); } else { QUnit.equal(this.actualMessage, this.expectedMessage, "Expected failing Ember.assert: '" + this.expectedMessage + "', but got '" + this.actualMessage + "'."); } } else { // Positive assertion that assert was called QUnit.ok(true, 'Expected a failing Ember.assert.'); } } }; var AssertionAssert = function (env) { this.env = env; }; AssertionAssert.prototype = { reset: function () {}, inject: function () { var assertion = this; // Looks for an exception raised within the fn. // // expectAssertion(function(){ // Ember.assert("Homie don't roll like that"); // } /* , optionalMessageStringOrRegex */); // window.expectAssertion = function expectAssertion(fn, message) { if (assertion.env.runningProdBuild) { QUnit.ok(true, 'Assertions disabled in production builds.'); return; } // do not assert as the production builds do not contain Ember.assert new AssertExpectation(assertion.env.Ember, message).assert(fn); }; window.ignoreAssertion = function ignoreAssertion(fn) { var stubber = new _methodCallExpectation.default(assertion.env.Ember, 'assert'), noop = function () {}; stubber.runWithStub(fn, noop); }; }, assert: function () {}, restore: function () { window.expectAssertion = null; window.ignoreAssertion = null; } }; exports.default = AssertionAssert; }); enifed('ember-dev/test-helper/deprecation', ['exports', './method-call-expectation'], function (exports, _methodCallExpectation) { /* globals QUnit */ 'use strict'; var NONE = function () {}; var DeprecationAssert = function (env) { this.env = env; this.reset(); }; DeprecationAssert.prototype = { reset: function () { this.expecteds = null; this.actuals = null; }, stubEmber: function () { if (!this._previousEmberDeprecate && this._previousEmberDeprecate !== this.env.Ember.deprecate) { this._previousEmberDeprecate = this.env.Ember.deprecate; } var assertion = this; this.env.Ember.deprecate = function (msg, test) { var resultOfTest = typeof test === 'function' ? test() : test; var shouldDeprecate = !resultOfTest; assertion.actuals = assertion.actuals || []; if (shouldDeprecate) { assertion.actuals.push([msg, resultOfTest]); } }; }, inject: function () { var assertion = this; // Expects no deprecation to happen from the time of calling until // the end of the test. // // expectNoDeprecation(/* optionalStringOrRegex */); // Ember.deprecate("Old And Busted"); // window.expectNoDeprecation = function () { if (assertion.expecteds != null && typeof assertion.expecteds === 'object') { throw new Error("expectNoDeprecation was called after expectDeprecation was called!"); } assertion.stubEmber(); assertion.expecteds = NONE; }; // Expect a deprecation to happen within a function, or if no function // is pass, from the time of calling until the end of the test. Can be called // multiple times to assert deprecations with different specific messages // were fired. // // expectDeprecation(function(){ // Ember.deprecate("Old And Busted"); // }, /* optionalStringOrRegex */); // // expectDeprecation(/* optionalStringOrRegex */); // Ember.deprecate("Old And Busted"); // window.expectDeprecation = function (fn, message) { var originalExpecteds, originalActuals; if (assertion.expecteds === NONE) { throw new Error("expectDeprecation was called after expectNoDeprecation was called!"); } assertion.stubEmber(); assertion.expecteds = assertion.expecteds || []; if (fn && typeof fn !== 'function') { // fn is a message assertion.expecteds.push(fn); } else { originalExpecteds = assertion.expecteds.slice(); originalActuals = assertion.actuals ? assertion.actuals.slice() : assertion.actuals; assertion.expecteds.push(message || /.*/); if (fn) { fn(); assertion.assert(); assertion.expecteds = originalExpecteds; assertion.actuals = originalActuals; } } }; window.ignoreDeprecation = function ignoreDeprecation(fn) { var stubber = new _methodCallExpectation.default(assertion.env.Ember, 'deprecate'), noop = function () {}; stubber.runWithStub(fn, noop); }; }, // Forces an assert the deprecations occurred, and resets the globals // storing asserts for the next run. // // expectNoDeprecation(/Old/); // setTimeout(function(){ // Ember.deprecate("Old And Busted"); // assertDeprecation(); // }); // // assertDeprecation is called after each test run to catch any expectations // without explicit asserts. // assert: function () { var expecteds = this.expecteds || [], actuals = this.actuals || []; var o, i; if (expecteds !== NONE && expecteds.length === 0 && actuals.length === 0) { return; } if (this.env.runningProdBuild) { QUnit.ok(true, 'deprecations disabled in production builds.'); return; } if (expecteds === NONE) { var actualMessages = []; for (i = 0; i < actuals.length; i++) { actualMessages.push(actuals[i][0]); } QUnit.ok(actuals.length === 0, "Expected no deprecation calls, got " + actuals.length + ": " + actualMessages.join(', ')); return; } var expected, actual, match; for (o = 0; o < expecteds.length; o++) { expected = expecteds[o]; for (i = 0; i < actuals.length; i++) { actual = actuals[i]; if (!actual[1]) { if (expected instanceof RegExp) { if (expected.test(actual[0])) { match = actual; break; } } else { if (expected === actual[0]) { match = actual; break; } } } } if (!actual) { QUnit.ok(false, "Recieved no deprecate calls at all, expecting: " + expected); } else if (match && !match[1]) { QUnit.ok(true, "Recieved failing deprecation with message: " + match[0]); } else if (match && match[1]) { QUnit.ok(false, "Expected failing deprecation, got succeeding with message: " + match[0]); } else if (actual[1]) { QUnit.ok(false, "Did not receive failing deprecation matching '" + expected + "', last was success with '" + actual[0] + "'"); } else if (!actual[1]) { QUnit.ok(false, "Did not receive failing deprecation matching '" + expected + "', last was failure with '" + actual[0] + "'"); } } }, restore: function () { if (this._previousEmberDeprecate) { this.env.Ember.deprecate = this._previousEmberDeprecate; this._previousEmberDeprecate = null; } window.expectNoDeprecation = null; } }; exports.default = DeprecationAssert; }); enifed("ember-dev/test-helper/index", ["exports", "./deprecation", "./remaining-view", "./remaining-template", "./assertion", "./run-loop", "./utils"], function (exports, _deprecation, _remainingView, _remainingTemplate, _assertion, _runLoop, _utils) { "use strict"; var EmberDevTestHelperAssert = _utils.buildCompositeAssert([_deprecation.default, _remainingView.default, _remainingTemplate.default, _assertion.default, _runLoop.default]); exports.default = EmberDevTestHelperAssert; }); enifed("ember-dev/test-helper/method-call-expectation", ["exports"], function (exports) { /* globals QUnit */ // A light class for stubbing // "use strict"; function MethodCallExpectation(target, property) { this.target = target; this.property = property; } MethodCallExpectation.prototype = { handleCall: function () { this.sawCall = true; return this.originalMethod.apply(this.target, arguments); }, stubMethod: function (replacementFunc) { var context = this, property = this.property; this.originalMethod = this.target[property]; if (typeof replacementFunc === 'function') { this.target[property] = replacementFunc; } else { this.target[property] = function () { return context.handleCall.apply(context, arguments); }; } }, restoreMethod: function () { this.target[this.property] = this.originalMethod; }, runWithStub: function (fn, replacementFunc) { try { this.stubMethod(replacementFunc); fn(); } finally { this.restoreMethod(); } }, assert: function () { this.runWithStub.apply(this, arguments); QUnit.ok(this.sawCall, "Expected " + this.property + " to be called."); } }; exports.default = MethodCallExpectation; }); enifed("ember-dev/test-helper/remaining-template", ["exports"], function (exports) { /* globals QUnit */ "use strict"; var RemainingTemplateAssert = function (env) { this.env = env; }; RemainingTemplateAssert.prototype = { reset: function () {}, inject: function () {}, assert: function () { if (this.env.Ember && this.env.Ember.TEMPLATES) { var templateNames = [], name; for (name in this.env.Ember.TEMPLATES) { if (this.env.Ember.TEMPLATES[name] != null) { templateNames.push(name); } } if (templateNames.length > 0) { QUnit.deepEqual(templateNames, [], "Ember.TEMPLATES should be empty"); this.env.Ember.TEMPLATES = {}; } } }, restore: function () {} }; exports.default = RemainingTemplateAssert; }); enifed("ember-dev/test-helper/remaining-view", ["exports"], function (exports) { /* globals QUnit */ "use strict"; var RemainingViewAssert = function (env) { this.env = env; }; RemainingViewAssert.prototype = { reset: function () {}, inject: function () {}, assert: function () { if (this.env.Ember && this.env.Ember.View) { var viewIds = [], id; for (id in this.env.Ember.View.views) { if (this.env.Ember.View.views[id] != null) { viewIds.push(id); } } if (viewIds.length > 0) { QUnit.deepEqual(viewIds, [], "Ember.View.views should be empty"); this.env.Ember.View.views = []; } } }, restore: function () {} }; exports.default = RemainingViewAssert; }); enifed("ember-dev/test-helper/run-loop", ["exports"], function (exports) { /* globals QUnit */ "use strict"; function RunLoopAssertion(env) { this.env = env; } RunLoopAssertion.prototype = { reset: function () {}, inject: function () {}, assert: function () { var run = this.env.Ember.run; if (run.currentRunLoop) { QUnit.ok(false, "Should not be in a run loop at end of test"); while (run.currentRunLoop) { run.end(); } } if (run.hasScheduledTimers()) { QUnit.ok(false, "Ember run should not have scheduled timers at end of test"); run.cancelTimers(); } }, restore: function () {} }; exports.default = RunLoopAssertion; }); enifed("ember-dev/test-helper/setup-qunit", ["exports"], function (exports) { /* globals QUnit */ "use strict"; exports.default = setupQUnit; function setupQUnit(assertion, _qunitGlobal) { var qunitGlobal = QUnit; if (_qunitGlobal) { qunitGlobal = _qunitGlobal; } var originalModule = qunitGlobal.module; qunitGlobal.module = function (name, _options) { var options = _options || {}; var originalSetup = options.setup || function () {}; var originalTeardown = options.teardown || function () {}; options.setup = function () { assertion.reset(); assertion.inject(); originalSetup.call(this); }; options.teardown = function () { originalTeardown.call(this); assertion.assert(); assertion.restore(); }; return originalModule(name, options); }; } }); enifed('ember-dev/test-helper/utils', ['exports'], function (exports) { 'use strict'; exports.buildCompositeAssert = buildCompositeAssert; function callForEach(prop, func) { return function () { for (var i = 0, l = this[prop].length; i < l; i++) { this[prop][i][func](); } }; } function buildCompositeAssert(klasses) { var Composite = function (emberKlass, runningProdBuild) { this.asserts = []; for (var i = 0, l = klasses.length; i < l; i++) { this.asserts.push(new klasses[i]({ Ember: emberKlass, runningProdBuild: runningProdBuild })); } }; Composite.prototype = { reset: callForEach('asserts', 'reset'), inject: callForEach('asserts', 'inject'), assert: callForEach('asserts', 'assert'), restore: callForEach('asserts', 'restore') }; return Composite; } var o_create = Object.create || (function () { function F() {} return function (o) { if (arguments.length !== 1) { throw new Error('Object.create implementation only accepts one parameter.'); } F.prototype = o; return new F(); }; })(); var o_create; exports.o_create = o_create; }); enifed('ember-extension-support.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - .'); test('ember-extension-support.js should pass jscs', function () { ok(true, 'ember-extension-support.js should pass jscs.'); }); }); enifed('ember-extension-support.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - .'); QUnit.test('ember-extension-support.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-extension-support.js should pass jshint.'); }); }); enifed('ember-extension-support/container_debug_adapter.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-extension-support'); test('ember-extension-support/container_debug_adapter.js should pass jscs', function () { ok(true, 'ember-extension-support/container_debug_adapter.js should pass jscs.'); }); }); enifed('ember-extension-support/container_debug_adapter.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-extension-support'); QUnit.test('ember-extension-support/container_debug_adapter.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-extension-support/container_debug_adapter.js should pass jshint.'); }); }); enifed('ember-extension-support/data_adapter.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-extension-support'); test('ember-extension-support/data_adapter.js should pass jscs', function () { ok(true, 'ember-extension-support/data_adapter.js should pass jscs.'); }); }); enifed('ember-extension-support/data_adapter.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-extension-support'); QUnit.test('ember-extension-support/data_adapter.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-extension-support/data_adapter.js should pass jshint.'); }); }); enifed('ember-extension-support/tests/container_debug_adapter_test', ['exports', 'ember-metal/run_loop', 'ember-runtime/controllers/controller', 'ember-extension-support', 'ember-application/system/application'], function (exports, _emberMetalRun_loop, _emberRuntimeControllersController, _emberExtensionSupport, _emberApplicationSystemApplication) { 'use strict'; var adapter, App; function boot() { _emberMetalRun_loop.default(App, 'advanceReadiness'); } QUnit.module('Container Debug Adapter', { setup: function () { _emberMetalRun_loop.default(function () { App = _emberApplicationSystemApplication.default.create(); // ES6TODO: this comes from the ember-application package NOT ember-runtime App.toString = function () { return 'App'; }; App.deferReadiness(); }); boot(); _emberMetalRun_loop.default(function () { adapter = App.__container__.lookup('container-debug-adapter:main'); }); }, teardown: function () { _emberMetalRun_loop.default(function () { adapter.destroy(); App.destroy(); App = null; }); } }); QUnit.test('the default ContainerDebugAdapter cannot catalog certain entries by type', function () { equal(adapter.canCatalogEntriesByType('model'), false, 'canCatalogEntriesByType should return false for model'); equal(adapter.canCatalogEntriesByType('template'), false, 'canCatalogEntriesByType should return false for template'); }); QUnit.test('the default ContainerDebugAdapter can catalog typical entries by type', function () { equal(adapter.canCatalogEntriesByType('controller'), true, 'canCatalogEntriesByType should return true for controller'); equal(adapter.canCatalogEntriesByType('route'), true, 'canCatalogEntriesByType should return true for route'); equal(adapter.canCatalogEntriesByType('view'), true, 'canCatalogEntriesByType should return true for view'); }); QUnit.test('the default ContainerDebugAdapter catalogs controller entries', function () { App.PostController = _emberRuntimeControllersController.default.extend(); var controllerClasses = adapter.catalogEntriesByType('controller'); equal(controllerClasses.length, 1, 'found 1 class'); equal(controllerClasses[0], 'post', 'found the right class'); }); }); // Must be required to export Ember.ContainerDebugAdapter enifed('ember-extension-support/tests/container_debug_adapter_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-extension-support/tests'); test('ember-extension-support/tests/container_debug_adapter_test.js should pass jscs', function () { ok(true, 'ember-extension-support/tests/container_debug_adapter_test.js should pass jscs.'); }); }); enifed('ember-extension-support/tests/container_debug_adapter_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-extension-support/tests'); QUnit.test('ember-extension-support/tests/container_debug_adapter_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-extension-support/tests/container_debug_adapter_test.js should pass jshint.'); }); }); enifed('ember-extension-support/tests/data_adapter_test', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/run_loop', 'ember-metal/observer', 'ember-runtime/system/object', 'ember-extension-support/data_adapter', 'ember-application/system/application', 'ember-application/system/resolver'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalRun_loop, _emberMetalObserver, _emberRuntimeSystemObject, _emberExtensionSupportData_adapter, _emberApplicationSystemApplication, _emberApplicationSystemResolver) { 'use strict'; var adapter, App; var Model = _emberRuntimeSystemObject.default.extend(); var DataAdapter = _emberExtensionSupportData_adapter.default.extend({ detect: function (klass) { return klass !== Model && Model.detect(klass); } }); QUnit.module('Data Adapter', { setup: function () { _emberMetalRun_loop.default(function () { App = _emberApplicationSystemApplication.default.create(); App.toString = function () { return 'App'; }; App.deferReadiness(); App.registry.register('data-adapter:main', DataAdapter); }); }, teardown: function () { _emberMetalRun_loop.default(function () { adapter.destroy(); App.destroy(); }); } }); QUnit.test('Model types added with DefaultResolver', function () { App.Post = Model.extend(); adapter = App.__container__.lookup('data-adapter:main'); adapter.reopen({ getRecords: function () { return _emberMetalCore.default.A([1, 2, 3]); }, columnsForType: function () { return [{ name: 'title', desc: 'Title' }]; } }); _emberMetalRun_loop.default(App, 'advanceReadiness'); var modelTypesAdded = function (types) { equal(types.length, 1); var postType = types[0]; equal(postType.name, 'post', 'Correctly sets the name'); equal(postType.count, 3, 'Correctly sets the record count'); strictEqual(postType.object, App.Post, 'Correctly sets the object'); deepEqual(postType.columns, [{ name: 'title', desc: 'Title' }], 'Correctly sets the columns'); }; adapter.watchModelTypes(modelTypesAdded); }); QUnit.test('getRecords gets a model name as second argument', function () { App.Post = Model.extend(); adapter = App.__container__.lookup('data-adapter:main'); adapter.reopen({ getRecords: function (klass, name) { equal(name, 'post'); return _emberMetalCore.default.A([]); } }); adapter.watchModelTypes(function () {}); }); QUnit.test('Model types added with custom container-debug-adapter', function () { var PostClass = Model.extend(); var StubContainerDebugAdapter = _emberApplicationSystemResolver.default.extend({ canCatalogEntriesByType: function (type) { return true; }, catalogEntriesByType: function (type) { return [PostClass]; } }); App.registry.register('container-debug-adapter:main', StubContainerDebugAdapter); adapter = App.__container__.lookup('data-adapter:main'); adapter.reopen({ getRecords: function () { return _emberMetalCore.default.A([1, 2, 3]); }, columnsForType: function () { return [{ name: 'title', desc: 'Title' }]; } }); _emberMetalRun_loop.default(App, 'advanceReadiness'); var modelTypesAdded = function (types) { equal(types.length, 1); var postType = types[0]; equal(postType.name, PostClass.toString(), 'Correctly sets the name'); equal(postType.count, 3, 'Correctly sets the record count'); strictEqual(postType.object, PostClass, 'Correctly sets the object'); deepEqual(postType.columns, [{ name: 'title', desc: 'Title' }], 'Correctly sets the columns'); }; adapter.watchModelTypes(modelTypesAdded); }); QUnit.test('Model Types Updated', function () { App.Post = Model.extend(); adapter = App.__container__.lookup('data-adapter:main'); var records = _emberMetalCore.default.A([1, 2, 3]); adapter.reopen({ getRecords: function () { return records; } }); _emberMetalRun_loop.default(App, 'advanceReadiness'); var modelTypesAdded = function () { _emberMetalRun_loop.default(function () { records.pushObject(4); }); }; var modelTypesUpdated = function (types) { var postType = types[0]; equal(postType.count, 4, 'Correctly updates the count'); }; adapter.watchModelTypes(modelTypesAdded, modelTypesUpdated); }); QUnit.test('Records Added', function () { expect(8); var countAdded = 1; App.Post = Model.extend(); var post = App.Post.create(); var recordList = _emberMetalCore.default.A([post]); adapter = App.__container__.lookup('data-adapter:main'); adapter.reopen({ getRecords: function () { return recordList; }, getRecordColor: function () { return 'blue'; }, getRecordColumnValues: function () { return { title: 'Post ' + countAdded }; }, getRecordKeywords: function () { return ['Post ' + countAdded]; } }); var recordsAdded = function (records) { var record = records[0]; equal(record.color, 'blue', 'Sets the color correctly'); deepEqual(record.columnValues, { title: 'Post ' + countAdded }, 'Sets the column values correctly'); deepEqual(record.searchKeywords, ['Post ' + countAdded], 'Sets search keywords correctly'); strictEqual(record.object, post, 'Sets the object to the record instance'); }; adapter.watchRecords(App.Post, recordsAdded); countAdded++; post = App.Post.create(); recordList.pushObject(post); }); QUnit.test('Observes and releases a record correctly', function () { var updatesCalled = 0; App.Post = Model.extend(); var post = App.Post.create({ title: 'Post' }); var recordList = _emberMetalCore.default.A([post]); adapter = App.__container__.lookup('data-adapter:main'); adapter.reopen({ getRecords: function () { return recordList; }, observeRecord: function (record, recordUpdated) { var self = this; var callback = function () { recordUpdated(self.wrapRecord(record)); }; _emberMetalObserver.addObserver(record, 'title', callback); return function () { _emberMetalObserver.removeObserver(record, 'title', callback); }; }, getRecordColumnValues: function (record) { return { title: _emberMetalProperty_get.get(record, 'title') }; } }); var recordsAdded = function () { _emberMetalProperty_set.set(post, 'title', 'Post Modified'); }; var recordsUpdated = function (records) { updatesCalled++; equal(records[0].columnValues.title, 'Post Modified'); }; var release = adapter.watchRecords(App.Post, recordsAdded, recordsUpdated); release(); _emberMetalProperty_set.set(post, 'title', 'New Title'); equal(updatesCalled, 1, 'Release function removes observers'); }); }); enifed('ember-extension-support/tests/data_adapter_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-extension-support/tests'); test('ember-extension-support/tests/data_adapter_test.js should pass jscs', function () { ok(true, 'ember-extension-support/tests/data_adapter_test.js should pass jscs.'); }); }); enifed('ember-extension-support/tests/data_adapter_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-extension-support/tests'); QUnit.test('ember-extension-support/tests/data_adapter_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-extension-support/tests/data_adapter_test.js should pass jshint.'); }); }); enifed('ember-htmlbars.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - .'); test('ember-htmlbars.js should pass jscs', function () { ok(true, 'ember-htmlbars.js should pass jscs.'); }); }); enifed('ember-htmlbars.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - .'); QUnit.test('ember-htmlbars.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars.js should pass jshint.'); }); }); enifed('ember-htmlbars/compat.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars'); test('ember-htmlbars/compat.js should pass jscs', function () { ok(true, 'ember-htmlbars/compat.js should pass jscs.'); }); }); enifed('ember-htmlbars/compat.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars'); QUnit.test('ember-htmlbars/compat.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/compat.js should pass jshint.'); }); }); enifed('ember-htmlbars/env.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars'); test('ember-htmlbars/env.js should pass jscs', function () { ok(true, 'ember-htmlbars/env.js should pass jscs.'); }); }); enifed('ember-htmlbars/env.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars'); QUnit.test('ember-htmlbars/env.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/env.js should pass jshint.'); }); }); enifed('ember-htmlbars/helper.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars'); test('ember-htmlbars/helper.js should pass jscs', function () { ok(true, 'ember-htmlbars/helper.js should pass jscs.'); }); }); enifed('ember-htmlbars/helper.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars'); QUnit.test('ember-htmlbars/helper.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helper.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars'); test('ember-htmlbars/helpers.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars'); QUnit.test('ember-htmlbars/helpers.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers/-concat.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/helpers'); test('ember-htmlbars/helpers/-concat.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers/-concat.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers/-concat.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/helpers'); QUnit.test('ember-htmlbars/helpers/-concat.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers/-concat.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers/-html-safe.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/helpers'); test('ember-htmlbars/helpers/-html-safe.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers/-html-safe.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers/-html-safe.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/helpers'); QUnit.test('ember-htmlbars/helpers/-html-safe.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers/-html-safe.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers/-join-classes.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/helpers'); test('ember-htmlbars/helpers/-join-classes.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers/-join-classes.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers/-join-classes.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/helpers'); QUnit.test('ember-htmlbars/helpers/-join-classes.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers/-join-classes.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers/-legacy-each-with-controller.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/helpers'); test('ember-htmlbars/helpers/-legacy-each-with-controller.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers/-legacy-each-with-controller.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers/-legacy-each-with-controller.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/helpers'); QUnit.test('ember-htmlbars/helpers/-legacy-each-with-controller.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers/-legacy-each-with-controller.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers/-legacy-each-with-keyword.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/helpers'); test('ember-htmlbars/helpers/-legacy-each-with-keyword.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers/-legacy-each-with-keyword.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers/-legacy-each-with-keyword.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/helpers'); QUnit.test('ember-htmlbars/helpers/-legacy-each-with-keyword.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers/-legacy-each-with-keyword.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers/-normalize-class.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/helpers'); test('ember-htmlbars/helpers/-normalize-class.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers/-normalize-class.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers/-normalize-class.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/helpers'); QUnit.test('ember-htmlbars/helpers/-normalize-class.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers/-normalize-class.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers/each-in.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/helpers'); test('ember-htmlbars/helpers/each-in.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers/each-in.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers/each-in.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/helpers'); QUnit.test('ember-htmlbars/helpers/each-in.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers/each-in.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers/each.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/helpers'); test('ember-htmlbars/helpers/each.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers/each.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers/each.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/helpers'); QUnit.test('ember-htmlbars/helpers/each.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers/each.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers/if_unless.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/helpers'); test('ember-htmlbars/helpers/if_unless.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers/if_unless.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers/if_unless.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/helpers'); QUnit.test('ember-htmlbars/helpers/if_unless.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers/if_unless.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers/loc.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/helpers'); test('ember-htmlbars/helpers/loc.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers/loc.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers/loc.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/helpers'); QUnit.test('ember-htmlbars/helpers/loc.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers/loc.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers/log.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/helpers'); test('ember-htmlbars/helpers/log.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers/log.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers/log.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/helpers'); QUnit.test('ember-htmlbars/helpers/log.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers/log.js should pass jshint.'); }); }); enifed('ember-htmlbars/helpers/with.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/helpers'); test('ember-htmlbars/helpers/with.js should pass jscs', function () { ok(true, 'ember-htmlbars/helpers/with.js should pass jscs.'); }); }); enifed('ember-htmlbars/helpers/with.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/helpers'); QUnit.test('ember-htmlbars/helpers/with.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/helpers/with.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/bind-local.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/bind-local.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/bind-local.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/bind-local.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/bind-local.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/bind-local.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/bind-scope.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/bind-scope.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/bind-scope.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/bind-scope.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/bind-scope.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/bind-scope.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/bind-self.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/bind-self.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/bind-self.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/bind-self.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/bind-self.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/bind-self.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/bind-shadow-scope.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/bind-shadow-scope.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/bind-shadow-scope.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/bind-shadow-scope.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/bind-shadow-scope.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/bind-shadow-scope.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/classify.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/classify.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/classify.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/classify.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/classify.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/classify.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/cleanup-render-node.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/cleanup-render-node.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/cleanup-render-node.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/cleanup-render-node.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/cleanup-render-node.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/cleanup-render-node.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/component.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/component.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/component.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/component.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/component.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/component.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/concat.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/concat.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/concat.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/concat.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/concat.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/concat.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/create-fresh-scope.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/create-fresh-scope.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/create-fresh-scope.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/create-fresh-scope.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/create-fresh-scope.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/create-fresh-scope.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/destroy-render-node.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/destroy-render-node.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/destroy-render-node.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/destroy-render-node.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/destroy-render-node.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/destroy-render-node.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/did-cleanup-tree.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/did-cleanup-tree.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/did-cleanup-tree.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/did-cleanup-tree.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/did-cleanup-tree.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/did-cleanup-tree.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/did-render-node.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/did-render-node.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/did-render-node.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/did-render-node.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/did-render-node.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/did-render-node.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/element.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/element.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/element.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/element.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/element.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/element.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/get-cell-or-value.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/get-cell-or-value.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/get-cell-or-value.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/get-cell-or-value.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/get-cell-or-value.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/get-cell-or-value.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/get-child.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/get-child.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/get-child.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/get-child.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/get-child.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/get-child.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/get-root.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/get-root.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/get-root.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/get-root.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/get-root.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/get-root.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/get-value.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/get-value.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/get-value.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/get-value.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/get-value.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/get-value.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/has-helper.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/has-helper.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/has-helper.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/has-helper.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/has-helper.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/has-helper.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/invoke-helper.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/invoke-helper.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/invoke-helper.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/invoke-helper.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/invoke-helper.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/invoke-helper.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/link-render-node.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/link-render-node.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/link-render-node.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/link-render-node.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/link-render-node.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/link-render-node.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/lookup-helper.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/lookup-helper.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/lookup-helper.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/lookup-helper.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/lookup-helper.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/lookup-helper.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/subexpr.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/subexpr.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/subexpr.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/subexpr.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/subexpr.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/subexpr.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/update-self.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/update-self.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/update-self.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/update-self.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/update-self.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/update-self.js should pass jshint.'); }); }); enifed('ember-htmlbars/hooks/will-cleanup-tree.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/hooks'); test('ember-htmlbars/hooks/will-cleanup-tree.js should pass jscs', function () { ok(true, 'ember-htmlbars/hooks/will-cleanup-tree.js should pass jscs.'); }); }); enifed('ember-htmlbars/hooks/will-cleanup-tree.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/hooks'); QUnit.test('ember-htmlbars/hooks/will-cleanup-tree.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/hooks/will-cleanup-tree.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars'); test('ember-htmlbars/keywords.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars'); QUnit.test('ember-htmlbars/keywords.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/collection.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/collection.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/collection.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/collection.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/collection.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/collection.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/component.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/component.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/component.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/component.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/component.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/component.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/debugger.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/debugger.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/debugger.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/debugger.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/debugger.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/debugger.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/each.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/each.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/each.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/each.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/each.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/each.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/get.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/get.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/get.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/get.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/get.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/get.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/input.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/input.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/input.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/input.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/input.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/input.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/legacy-yield.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/legacy-yield.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/legacy-yield.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/legacy-yield.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/legacy-yield.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/legacy-yield.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/mut.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/mut.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/mut.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/mut.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/mut.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/mut.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/outlet.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/outlet.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/outlet.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/outlet.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/outlet.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/outlet.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/partial.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/partial.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/partial.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/partial.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/partial.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/partial.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/readonly.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/readonly.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/readonly.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/readonly.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/readonly.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/readonly.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/textarea.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/textarea.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/textarea.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/textarea.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/textarea.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/textarea.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/unbound.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/unbound.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/unbound.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/unbound.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/unbound.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/unbound.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/view.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/view.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/view.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/view.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/view.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/view.js should pass jshint.'); }); }); enifed('ember-htmlbars/keywords/with.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/keywords'); test('ember-htmlbars/keywords/with.js should pass jscs', function () { ok(true, 'ember-htmlbars/keywords/with.js should pass jscs.'); }); }); enifed('ember-htmlbars/keywords/with.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/keywords'); QUnit.test('ember-htmlbars/keywords/with.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/keywords/with.js should pass jshint.'); }); }); enifed('ember-htmlbars/morphs/attr-morph.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/morphs'); test('ember-htmlbars/morphs/attr-morph.js should pass jscs', function () { ok(true, 'ember-htmlbars/morphs/attr-morph.js should pass jscs.'); }); }); enifed('ember-htmlbars/morphs/attr-morph.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/morphs'); QUnit.test('ember-htmlbars/morphs/attr-morph.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/morphs/attr-morph.js should pass jshint.'); }); }); enifed('ember-htmlbars/morphs/morph.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/morphs'); test('ember-htmlbars/morphs/morph.js should pass jscs', function () { ok(true, 'ember-htmlbars/morphs/morph.js should pass jscs.'); }); }); enifed('ember-htmlbars/morphs/morph.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/morphs'); QUnit.test('ember-htmlbars/morphs/morph.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/morphs/morph.js should pass jshint.'); }); }); enifed('ember-htmlbars/node-managers/component-node-manager.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/node-managers'); test('ember-htmlbars/node-managers/component-node-manager.js should pass jscs', function () { ok(true, 'ember-htmlbars/node-managers/component-node-manager.js should pass jscs.'); }); }); enifed('ember-htmlbars/node-managers/component-node-manager.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/node-managers'); QUnit.test('ember-htmlbars/node-managers/component-node-manager.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/node-managers/component-node-manager.js should pass jshint.'); }); }); enifed('ember-htmlbars/node-managers/view-node-manager.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/node-managers'); test('ember-htmlbars/node-managers/view-node-manager.js should pass jscs', function () { ok(true, 'ember-htmlbars/node-managers/view-node-manager.js should pass jscs.'); }); }); enifed('ember-htmlbars/node-managers/view-node-manager.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/node-managers'); QUnit.test('ember-htmlbars/node-managers/view-node-manager.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/node-managers/view-node-manager.js should pass jshint.'); }); }); enifed('ember-htmlbars/streams/built-in-helper.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/streams'); test('ember-htmlbars/streams/built-in-helper.js should pass jscs', function () { ok(true, 'ember-htmlbars/streams/built-in-helper.js should pass jscs.'); }); }); enifed('ember-htmlbars/streams/built-in-helper.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/streams'); QUnit.test('ember-htmlbars/streams/built-in-helper.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/streams/built-in-helper.js should pass jshint.'); }); }); enifed('ember-htmlbars/streams/helper-factory.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/streams'); test('ember-htmlbars/streams/helper-factory.js should pass jscs', function () { ok(true, 'ember-htmlbars/streams/helper-factory.js should pass jscs.'); }); }); enifed('ember-htmlbars/streams/helper-factory.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/streams'); QUnit.test('ember-htmlbars/streams/helper-factory.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/streams/helper-factory.js should pass jshint.'); }); }); enifed('ember-htmlbars/streams/helper-instance.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/streams'); test('ember-htmlbars/streams/helper-instance.js should pass jscs', function () { ok(true, 'ember-htmlbars/streams/helper-instance.js should pass jscs.'); }); }); enifed('ember-htmlbars/streams/helper-instance.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/streams'); QUnit.test('ember-htmlbars/streams/helper-instance.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/streams/helper-instance.js should pass jshint.'); }); }); enifed('ember-htmlbars/streams/utils.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/streams'); test('ember-htmlbars/streams/utils.js should pass jscs', function () { ok(true, 'ember-htmlbars/streams/utils.js should pass jscs.'); }); }); enifed('ember-htmlbars/streams/utils.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/streams'); QUnit.test('ember-htmlbars/streams/utils.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/streams/utils.js should pass jshint.'); }); }); enifed('ember-htmlbars/system/append-templated-view.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/system'); test('ember-htmlbars/system/append-templated-view.js should pass jscs', function () { ok(true, 'ember-htmlbars/system/append-templated-view.js should pass jscs.'); }); }); enifed('ember-htmlbars/system/append-templated-view.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/system'); QUnit.test('ember-htmlbars/system/append-templated-view.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/system/append-templated-view.js should pass jshint.'); }); }); enifed('ember-htmlbars/system/bootstrap.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/system'); test('ember-htmlbars/system/bootstrap.js should pass jscs', function () { ok(true, 'ember-htmlbars/system/bootstrap.js should pass jscs.'); }); }); enifed('ember-htmlbars/system/bootstrap.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/system'); QUnit.test('ember-htmlbars/system/bootstrap.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/system/bootstrap.js should pass jshint.'); }); }); enifed('ember-htmlbars/system/discover-known-helpers.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/system'); test('ember-htmlbars/system/discover-known-helpers.js should pass jscs', function () { ok(true, 'ember-htmlbars/system/discover-known-helpers.js should pass jscs.'); }); }); enifed('ember-htmlbars/system/discover-known-helpers.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/system'); QUnit.test('ember-htmlbars/system/discover-known-helpers.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/system/discover-known-helpers.js should pass jshint.'); }); }); enifed('ember-htmlbars/system/dom-helper.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/system'); test('ember-htmlbars/system/dom-helper.js should pass jscs', function () { ok(true, 'ember-htmlbars/system/dom-helper.js should pass jscs.'); }); }); enifed('ember-htmlbars/system/dom-helper.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/system'); QUnit.test('ember-htmlbars/system/dom-helper.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/system/dom-helper.js should pass jshint.'); }); }); enifed('ember-htmlbars/system/instrumentation-support.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/system'); test('ember-htmlbars/system/instrumentation-support.js should pass jscs', function () { ok(true, 'ember-htmlbars/system/instrumentation-support.js should pass jscs.'); }); }); enifed('ember-htmlbars/system/instrumentation-support.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/system'); QUnit.test('ember-htmlbars/system/instrumentation-support.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/system/instrumentation-support.js should pass jshint.'); }); }); enifed('ember-htmlbars/system/invoke-helper.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/system'); test('ember-htmlbars/system/invoke-helper.js should pass jscs', function () { ok(true, 'ember-htmlbars/system/invoke-helper.js should pass jscs.'); }); }); enifed('ember-htmlbars/system/invoke-helper.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/system'); QUnit.test('ember-htmlbars/system/invoke-helper.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/system/invoke-helper.js should pass jshint.'); }); }); enifed('ember-htmlbars/system/lookup-helper.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/system'); test('ember-htmlbars/system/lookup-helper.js should pass jscs', function () { ok(true, 'ember-htmlbars/system/lookup-helper.js should pass jscs.'); }); }); enifed('ember-htmlbars/system/lookup-helper.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/system'); QUnit.test('ember-htmlbars/system/lookup-helper.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/system/lookup-helper.js should pass jshint.'); }); }); enifed('ember-htmlbars/system/make_bound_helper.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/system'); test('ember-htmlbars/system/make_bound_helper.js should pass jscs', function () { ok(true, 'ember-htmlbars/system/make_bound_helper.js should pass jscs.'); }); }); enifed('ember-htmlbars/system/make_bound_helper.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/system'); QUnit.test('ember-htmlbars/system/make_bound_helper.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/system/make_bound_helper.js should pass jshint.'); }); }); enifed('ember-htmlbars/system/render-env.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/system'); test('ember-htmlbars/system/render-env.js should pass jscs', function () { ok(true, 'ember-htmlbars/system/render-env.js should pass jscs.'); }); }); enifed('ember-htmlbars/system/render-env.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/system'); QUnit.test('ember-htmlbars/system/render-env.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/system/render-env.js should pass jshint.'); }); }); enifed('ember-htmlbars/system/render-view.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/system'); test('ember-htmlbars/system/render-view.js should pass jscs', function () { ok(true, 'ember-htmlbars/system/render-view.js should pass jscs.'); }); }); enifed('ember-htmlbars/system/render-view.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/system'); QUnit.test('ember-htmlbars/system/render-view.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/system/render-view.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/boolean_test', ['exports', 'ember-metal/features', 'ember-views/views/view', 'ember-metal/run_loop', 'ember-template-compiler/system/compile', 'htmlbars-test-helpers'], function (exports, _emberMetalFeatures, _emberViewsViewsView, _emberMetalRun_loop, _emberTemplateCompilerSystemCompile, _htmlbarsTestHelpers) { 'use strict'; var view; function appendView(view) { _emberMetalRun_loop.default(function () { view.appendTo('#qunit-fixture'); }); } // jscs:disable validateIndentation QUnit.module('ember-htmlbars: boolean attribute', { teardown: function () { if (view) { _emberMetalRun_loop.default(view, view.destroy); } } }); QUnit.test('disabled property can be set true', function () { view = _emberViewsViewsView.default.create({ context: { isDisabled: true }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); equal(view.element.firstChild.hasAttribute('disabled'), true, 'attribute is output'); equal(view.element.firstChild.disabled, true, 'boolean property is set true'); }); QUnit.test('disabled property can be set false with a blank string', function () { view = _emberViewsViewsView.default.create({ context: { isDisabled: '' }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); equal(view.element.firstChild.hasAttribute('disabled'), false, 'attribute is not output'); equal(view.element.firstChild.disabled, false, 'boolean property is set false'); }); QUnit.test('disabled property can be set false', function () { view = _emberViewsViewsView.default.create({ context: { isDisabled: false }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '', 'attribute is not output'); equal(view.element.firstChild.disabled, false, 'boolean property is set false'); }); QUnit.test('disabled property can be set true with a string', function () { view = _emberViewsViewsView.default.create({ context: { isDisabled: 'oh, no a string' }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); equal(view.element.firstChild.hasAttribute('disabled'), true, 'attribute is output'); equal(view.element.firstChild.disabled, true, 'boolean property is set true'); }); QUnit.test('disabled attribute turns a value to a string', function () { view = _emberViewsViewsView.default.create({ context: { isDisabled: false }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); equal(view.element.firstChild.hasAttribute('disabled'), true, 'attribute is output'); equal(view.element.firstChild.disabled, true, 'boolean property is set true'); }); QUnit.test('disabled attribute preserves a blank string value', function () { view = _emberViewsViewsView.default.create({ context: { isDisabled: '' }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '', 'attribute is not output'); equal(view.element.firstChild.disabled, false, 'boolean property is set false'); }); // jscs:enable validateIndentation }); enifed('ember-htmlbars/tests/attr_nodes/boolean_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/attr_nodes'); test('ember-htmlbars/tests/attr_nodes/boolean_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/attr_nodes/boolean_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/boolean_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/attr_nodes'); QUnit.test('ember-htmlbars/tests/attr_nodes/boolean_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/attr_nodes/boolean_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/class_test', ['exports', 'ember-metal/features', 'ember-views/views/view', 'ember-metal/run_loop', 'ember-template-compiler/system/compile', 'htmlbars-test-helpers'], function (exports, _emberMetalFeatures, _emberViewsViewsView, _emberMetalRun_loop, _emberTemplateCompilerSystemCompile, _htmlbarsTestHelpers) { 'use strict'; var view; function appendView(view) { _emberMetalRun_loop.default(function () { view.appendTo('#qunit-fixture'); }); } var isInlineIfEnabled = false; isInlineIfEnabled = true; // jscs:disable validateIndentation QUnit.module('ember-htmlbars: class attribute', { teardown: function () { if (view) { _emberMetalRun_loop.default(view, view.destroy); } } }); QUnit.test('class renders before didInsertElement', function () { var matchingElement; view = _emberViewsViewsView.default.create({ didInsertElement: function () { matchingElement = this.$('div.blue'); }, context: { color: 'blue' }, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); appendView(view); equal(view.element.firstChild.className, 'blue', 'attribute is output'); equal(matchingElement.length, 1, 'element is in the DOM when didInsertElement'); }); QUnit.test('class property can contain multiple classes', function () { view = _emberViewsViewsView.default.create({ context: { classes: 'large blue' }, template: _emberTemplateCompilerSystemCompile.default('
') }); appendView(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
', 'attribute is output'); ok(view.$('.large')[0], 'first class found'); ok(view.$('.blue')[0], 'second class found'); }); QUnit.test('class property is removed when updated with a null value', function () { view = _emberViewsViewsView.default.create({ context: { class: 'large' }, template: _emberTemplateCompilerSystemCompile.default('
') }); appendView(view); equal(view.element.firstChild.className, 'large', 'attribute is output'); _emberMetalRun_loop.default(view, view.set, 'context.class', null); equal(view.element.firstChild.className, '', 'attribute is removed'); }); QUnit.test('class attribute concats bound values', function () { view = _emberViewsViewsView.default.create({ context: { size: 'large', color: 'blue' }, template: _emberTemplateCompilerSystemCompile.default('
') }); appendView(view); strictEqual(view.element.firstChild.className, 'large blue round', 'classes are set'); }); if (isInlineIfEnabled) { QUnit.test('class attribute accepts nested helpers, and updates', function () { view = _emberViewsViewsView.default.create({ context: { size: 'large', hasColor: true, hasShape: false, shape: 'round' }, template: _emberTemplateCompilerSystemCompile.default('
') }); appendView(view); strictEqual(view.element.firstChild.className, 'large blue no-shape', 'classes are set'); _emberMetalRun_loop.default(view, view.set, 'context.hasColor', false); _emberMetalRun_loop.default(view, view.set, 'context.hasShape', true); strictEqual(view.element.firstChild.className, 'large round', 'classes are updated'); }); } QUnit.test('class attribute can accept multiple classes from a single value, and update', function () { view = _emberViewsViewsView.default.create({ context: { size: 'large small' }, template: _emberTemplateCompilerSystemCompile.default('
') }); appendView(view); strictEqual(view.element.firstChild.className, 'large small', 'classes are set'); _emberMetalRun_loop.default(view, view.set, 'context.size', 'medium'); strictEqual(view.element.firstChild.className, 'medium', 'classes are updated'); }); QUnit.test('class attribute can grok concatted classes, and update', function () { view = _emberViewsViewsView.default.create({ context: { size: 'large', prefix: 'pre-pre pre', postfix: 'post' }, template: _emberTemplateCompilerSystemCompile.default('
') }); appendView(view); strictEqual(view.element.firstChild.className, 'btn-large pre-pre pre-post whoop', 'classes are set'); _emberMetalRun_loop.default(view, view.set, 'context.prefix', ''); strictEqual(view.element.firstChild.className, 'btn-large -post whoop', 'classes are updated'); }); QUnit.test('class attribute stays in order', function () { view = _emberViewsViewsView.default.create({ context: { showA: 'a', showB: 'b' }, template: _emberTemplateCompilerSystemCompile.default('
') }); appendView(view); _emberMetalRun_loop.default(view, view.set, 'context.showB', false); _emberMetalRun_loop.default(view, view.set, 'context.showB', 'b'); strictEqual(view.element.firstChild.className, 'r b a c', 'classes are in the right order'); }); // jscs:enable validateIndentation }); enifed('ember-htmlbars/tests/attr_nodes/class_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/attr_nodes'); test('ember-htmlbars/tests/attr_nodes/class_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/attr_nodes/class_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/class_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/attr_nodes'); QUnit.test('ember-htmlbars/tests/attr_nodes/class_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/attr_nodes/class_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/data_test', ['exports', 'ember-metal/features', 'ember-views/views/view', 'ember-metal/run_loop', 'ember-runtime/system/object', 'ember-template-compiler/system/compile', 'ember-metal-views/renderer', 'htmlbars-test-helpers', 'ember-htmlbars/env', 'ember-runtime/tests/utils'], function (exports, _emberMetalFeatures, _emberViewsViewsView, _emberMetalRun_loop, _emberRuntimeSystemObject, _emberTemplateCompilerSystemCompile, _emberMetalViewsRenderer, _htmlbarsTestHelpers, _emberHtmlbarsEnv, _emberRuntimeTestsUtils) { 'use strict'; var view, originalSetAttribute, setAttributeCalls, renderer; QUnit.module('ember-htmlbars: data attribute', { teardown: function () { _emberRuntimeTestsUtils.runDestroy(view); } }); QUnit.test('property is output', function () { view = _emberViewsViewsView.default.create({ context: { name: 'erik' }, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'attribute is output'); }); QUnit.test('property set before didInsertElement', function () { var matchingElement; view = _emberViewsViewsView.default.create({ didInsertElement: function () { matchingElement = this.$('div[data-name=erik]'); }, context: { name: 'erik' }, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'attribute is output'); equal(matchingElement.length, 1, 'element is in the DOM when didInsertElement'); }); QUnit.test('quoted attributes are concatenated', function () { view = _emberViewsViewsView.default.create({ context: { firstName: 'max', lastName: 'jackson' }, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'attribute is output'); }); QUnit.test('quoted attributes are updated when changed', function () { view = _emberViewsViewsView.default.create({ context: { firstName: 'max', lastName: 'jackson' }, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'precond - attribute is output'); _emberMetalRun_loop.default(view, view.set, 'context.firstName', 'james'); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'attribute is output'); }); QUnit.test('quoted attributes are not removed when value is null', function () { view = _emberViewsViewsView.default.create({ context: { firstName: 'max', lastName: 'jackson' }, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.element.firstChild.getAttribute('data-name'), 'max', 'precond - attribute is output'); _emberMetalRun_loop.default(view, view.set, 'context.firstName', null); equal(view.element.firstChild.getAttribute('data-name'), '', 'attribute is output'); }); QUnit.test('unquoted attributes are removed when value is null', function () { view = _emberViewsViewsView.default.create({ context: { firstName: 'max' }, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.element.firstChild.getAttribute('data-name'), 'max', 'precond - attribute is output'); _emberMetalRun_loop.default(view, view.set, 'context.firstName', null); ok(!view.element.firstChild.hasAttribute('data-name'), 'attribute is removed output'); }); QUnit.test('unquoted attributes that are null are not added', function () { view = _emberViewsViewsView.default.create({ context: { firstName: null }, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'attribute is not present'); }); QUnit.test('unquoted attributes are added when changing from null', function () { view = _emberViewsViewsView.default.create({ context: { firstName: null }, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'precond - attribute is not present'); _emberMetalRun_loop.default(view, view.set, 'context.firstName', 'max'); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'attribute is added output'); }); QUnit.test('property value is directly added to attribute', function () { view = _emberViewsViewsView.default.create({ context: { name: '"" data-foo="blah"' }, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.element.firstChild.getAttribute('data-name'), '"" data-foo="blah"', 'attribute is output'); }); QUnit.test('path is output', function () { view = _emberViewsViewsView.default.create({ context: { name: { firstName: 'erik' } }, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'attribute is output'); }); QUnit.test('changed property updates', function () { var context = _emberRuntimeSystemObject.default.create({ name: 'erik' }); view = _emberViewsViewsView.default.create({ context: context, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'precond - attribute is output'); _emberMetalRun_loop.default(context, context.set, 'name', 'mmun'); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'attribute is updated output'); }); QUnit.test('updates are scheduled in the render queue', function () { expect(4); var context = _emberRuntimeSystemObject.default.create({ name: 'erik' }); view = _emberViewsViewsView.default.create({ context: context, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'precond - attribute is output'); _emberMetalRun_loop.default(function () { _emberMetalRun_loop.default.schedule('render', function () { _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'precond - attribute is not updated sync'); }); context.set('name', 'mmun'); _emberMetalRun_loop.default.schedule('render', function () { _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'attribute is updated output'); }); }); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'attribute is updated output'); }); QUnit.test('updates fail silently after an element is destroyed', function () { var context = _emberRuntimeSystemObject.default.create({ name: 'erik' }); view = _emberViewsViewsView.default.create({ context: context, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '
Hi!
', 'precond - attribute is output'); _emberMetalRun_loop.default(function () { context.set('name', 'mmun'); _emberRuntimeTestsUtils.runDestroy(view); }); }); QUnit.module('ember-htmlbars: {{attribute}} helper -- setAttribute', { setup: function () { renderer = new _emberMetalViewsRenderer.default(_emberHtmlbarsEnv.domHelper); originalSetAttribute = _emberHtmlbarsEnv.domHelper.setAttribute; _emberHtmlbarsEnv.domHelper.setAttribute = function (element, name, value) { if (name.substr(0, 5) === 'data-') { setAttributeCalls.push([name, value]); } originalSetAttribute.call(_emberHtmlbarsEnv.domHelper, element, name, value); }; setAttributeCalls = []; }, teardown: function () { _emberHtmlbarsEnv.domHelper.setAttribute = originalSetAttribute; _emberRuntimeTestsUtils.runDestroy(view); } }); QUnit.test('calls setAttribute for new values', function () { var context = _emberRuntimeSystemObject.default.create({ name: 'erik' }); view = _emberViewsViewsView.default.create({ renderer: renderer, context: context, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); _emberMetalRun_loop.default(context, context.set, 'name', 'mmun'); var expected = [['data-name', 'erik'], ['data-name', 'mmun']]; deepEqual(setAttributeCalls, expected); }); QUnit.test('does not call setAttribute if the same value is set', function () { var context = _emberRuntimeSystemObject.default.create({ name: 'erik' }); view = _emberViewsViewsView.default.create({ renderer: renderer, context: context, template: _emberTemplateCompilerSystemCompile.default('
Hi!
') }); _emberRuntimeTestsUtils.runAppend(view); _emberMetalRun_loop.default(function () { context.set('name', 'mmun'); context.set('name', 'erik'); }); var expected = [['data-name', 'erik']]; deepEqual(setAttributeCalls, expected); }); }); enifed('ember-htmlbars/tests/attr_nodes/data_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/attr_nodes'); test('ember-htmlbars/tests/attr_nodes/data_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/attr_nodes/data_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/data_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/attr_nodes'); QUnit.test('ember-htmlbars/tests/attr_nodes/data_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/attr_nodes/data_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/href_test', ['exports', 'ember-metal/features', 'ember-views/views/view', 'ember-metal/run_loop', 'ember-template-compiler/system/compile', 'htmlbars-test-helpers'], function (exports, _emberMetalFeatures, _emberViewsViewsView, _emberMetalRun_loop, _emberTemplateCompilerSystemCompile, _htmlbarsTestHelpers) { 'use strict'; var view; function appendView(view) { _emberMetalRun_loop.default(function () { view.appendTo('#qunit-fixture'); }); } // jscs:disable validateIndentation QUnit.module('ember-htmlbars: href attribute', { teardown: function () { if (view) { _emberMetalRun_loop.default(view, view.destroy); } } }); QUnit.test('href is set', function () { view = _emberViewsViewsView.default.create({ context: { url: 'http://example.com' }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '', 'attribute is output'); }); // jscs:enable validateIndentation }); enifed('ember-htmlbars/tests/attr_nodes/href_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/attr_nodes'); test('ember-htmlbars/tests/attr_nodes/href_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/attr_nodes/href_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/href_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/attr_nodes'); QUnit.test('ember-htmlbars/tests/attr_nodes/href_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/attr_nodes/href_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/property_test', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-views/views/view', 'ember-metal/run_loop', 'ember-template-compiler/system/compile'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberViewsViewsView, _emberMetalRun_loop, _emberTemplateCompilerSystemCompile) { 'use strict'; var view; function appendView(view) { _emberMetalRun_loop.default(function () { view.appendTo('#qunit-fixture'); }); } function canSetFalsyMaxLength() { var input = document.createElement('input'); input.maxLength = 0; return input.maxLength === 0; } // jscs:disable validateIndentation QUnit.module('ember-htmlbars: property', { teardown: function () { if (view) { _emberMetalRun_loop.default(view, view.destroy); } } }); QUnit.test('maxlength sets the property and attribute', function () { view = _emberViewsViewsView.default.create({ context: { length: 5 }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); equal(view.element.firstChild.maxLength, 5); _emberMetalCore.default.run(view, view.set, 'context.length', 1); equal(view.element.firstChild.maxLength, 1); }); QUnit.test('quoted maxlength sets the attribute and is reflected as a property', function () { view = _emberViewsViewsView.default.create({ context: { length: 5 }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); equal(view.element.firstChild.maxLength, '5'); if (canSetFalsyMaxLength()) { _emberMetalCore.default.run(view, view.set, 'context.length', null); equal(view.element.firstChild.maxLength, document.createElement('input').maxLength); } else { _emberMetalCore.default.run(view, view.set, 'context.length', 1); equal(view.element.firstChild.maxLength, 1); } }); QUnit.test('array value can be set as property', function () { view = _emberViewsViewsView.default.create({ context: {}, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); _emberMetalCore.default.run(view, view.set, 'context.items', [4, 5]); ok(true, 'no legacy assertion prohibited setting an array'); }); // jscs:enable validateIndentation }); enifed('ember-htmlbars/tests/attr_nodes/property_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/attr_nodes'); test('ember-htmlbars/tests/attr_nodes/property_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/attr_nodes/property_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/property_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/attr_nodes'); QUnit.test('ember-htmlbars/tests/attr_nodes/property_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/attr_nodes/property_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/sanitized_test', ['exports', 'ember-metal/features', 'ember-views/views/view', 'ember-template-compiler/system/compile', 'ember-htmlbars/utils/string', 'ember-runtime/tests/utils', 'ember-metal/environment'], function (exports, _emberMetalFeatures, _emberViewsViewsView, _emberTemplateCompilerSystemCompile, _emberHtmlbarsUtilsString, _emberRuntimeTestsUtils, _emberMetalEnvironment) { /* jshint scripturl:true */ 'use strict'; var view; QUnit.module('ember-htmlbars: sanitized attribute', { teardown: function () { _emberRuntimeTestsUtils.runDestroy(view); } }); // jscs:disable validateIndentation // jscs:disable disallowTrailingWhitespace var badTags = [{ tag: 'a', attr: 'href', unquotedTemplate: _emberTemplateCompilerSystemCompile.default(''), quotedTemplate: _emberTemplateCompilerSystemCompile.default(''), multipartTemplate: _emberTemplateCompilerSystemCompile.default('') }, { tag: 'base', attr: 'href', unquotedTemplate: _emberTemplateCompilerSystemCompile.default(''), quotedTemplate: _emberTemplateCompilerSystemCompile.default(''), multipartTemplate: _emberTemplateCompilerSystemCompile.default('') }, { tag: 'embed', attr: 'src', unquotedTemplate: _emberTemplateCompilerSystemCompile.default(''), quotedTemplate: _emberTemplateCompilerSystemCompile.default(''), multipartTemplate: _emberTemplateCompilerSystemCompile.default('') }, { tag: 'body', attr: 'background', unquotedTemplate: _emberTemplateCompilerSystemCompile.default(''), quotedTemplate: _emberTemplateCompilerSystemCompile.default(''), multipartTemplate: _emberTemplateCompilerSystemCompile.default('') }, { tag: 'link', attr: 'href', unquotedTemplate: _emberTemplateCompilerSystemCompile.default(''), quotedTemplate: _emberTemplateCompilerSystemCompile.default(''), multipartTemplate: _emberTemplateCompilerSystemCompile.default('') }, { tag: 'img', attr: 'src', unquotedTemplate: _emberTemplateCompilerSystemCompile.default(''), quotedTemplate: _emberTemplateCompilerSystemCompile.default(''), multipartTemplate: _emberTemplateCompilerSystemCompile.default('') }, { tag: 'iframe', attr: 'src', // Setting an iframe with a bad protocol results in the browser // being redirected. in IE8. Skip the iframe tests on that platform. skip: _emberMetalEnvironment.default.hasDOM && document.documentMode && document.documentMode <= 8, unquotedTemplate: _emberTemplateCompilerSystemCompile.default(''), quotedTemplate: _emberTemplateCompilerSystemCompile.default(''), multipartTemplate: _emberTemplateCompilerSystemCompile.default('') }]; for (var i = 0, l = badTags.length; i < l; i++) { (function () { var subject = badTags[i]; if (subject.skip) { return; } QUnit.test(subject.tag + ' ' + subject.attr + ' is sanitized when using blacklisted protocol', function () { view = _emberViewsViewsView.default.create({ context: { url: 'javascript://example.com' }, template: subject.unquotedTemplate }); view.createElement(); equal(view.element.firstChild.getAttribute(subject.attr), 'unsafe:javascript://example.com', 'attribute is output'); }); QUnit.test(subject.tag + ' ' + subject.attr + ' is sanitized when using quoted non-whitelisted protocol', function () { view = _emberViewsViewsView.default.create({ context: { url: 'javascript://example.com' }, template: subject.quotedTemplate }); view.createElement(); equal(view.element.firstChild.getAttribute(subject.attr), 'unsafe:javascript://example.com', 'attribute is output'); }); QUnit.test(subject.tag + ' ' + subject.attr + ' is not sanitized when using non-whitelisted protocol with a SafeString', function () { view = _emberViewsViewsView.default.create({ context: { url: new _emberHtmlbarsUtilsString.SafeString('javascript://example.com') }, template: subject.unquotedTemplate }); try { view.createElement(); equal(view.element.firstChild.getAttribute(subject.attr), 'javascript://example.com', 'attribute is output'); } catch (e) { // IE does not allow javascript: to be set on img src ok(true, 'caught exception ' + e); } }); QUnit.test(subject.tag + ' ' + subject.attr + ' is sanitized when using quoted+concat non-whitelisted protocol', function () { view = _emberViewsViewsView.default.create({ context: { protocol: 'javascript:', path: '//example.com' }, template: subject.multipartTemplate }); view.createElement(); equal(view.element.firstChild.getAttribute(subject.attr), 'unsafe:javascript://example.com', 'attribute is output'); }); })(); //jshint ignore:line } // jscs:enable disallowTrailingWhitespace // jscs:enable validateIndentation }); enifed('ember-htmlbars/tests/attr_nodes/sanitized_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/attr_nodes'); test('ember-htmlbars/tests/attr_nodes/sanitized_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/attr_nodes/sanitized_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/sanitized_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/attr_nodes'); QUnit.test('ember-htmlbars/tests/attr_nodes/sanitized_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(false, 'ember-htmlbars/tests/attr_nodes/sanitized_test.js should pass jshint.\nember-htmlbars/tests/attr_nodes/sanitized_test.js: line 63, col 6, Don\'t make functions within a loop.\n\n1 error'); }); }); enifed('ember-htmlbars/tests/attr_nodes/style_test', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-views/views/view', 'ember-template-compiler/system/compile', 'ember-htmlbars/utils/string', 'ember-runtime/tests/utils', 'ember-htmlbars/morphs/attr-morph'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberViewsViewsView, _emberTemplateCompilerSystemCompile, _emberHtmlbarsUtilsString, _emberRuntimeTestsUtils, _emberHtmlbarsMorphsAttrMorph) { /* globals EmberDev */ 'use strict'; var view, originalWarn, warnings; QUnit.module('ember-htmlbars: style attribute', { setup: function () { warnings = []; originalWarn = _emberMetalCore.default.warn; _emberMetalCore.default.warn = function (message, test) { if (!test) { warnings.push(message); } }; }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(view); _emberMetalCore.default.warn = originalWarn; } }); // jscs:disable validateIndentation if (!EmberDev.runningProdBuild) { QUnit.test('specifying `
` generates a warning', function () { view = _emberViewsViewsView.default.create({ userValue: 'width: 42px', template: _emberTemplateCompilerSystemCompile.default('
') }); _emberRuntimeTestsUtils.runAppend(view); deepEqual(warnings, [_emberHtmlbarsMorphsAttrMorph.styleWarning]); }); QUnit.test('specifying `attributeBindings: ["style"]` generates a warning', function () { view = _emberViewsViewsView.default.create({ userValue: 'width: 42px', template: _emberTemplateCompilerSystemCompile.default('
') }); _emberRuntimeTestsUtils.runAppend(view); deepEqual(warnings, [_emberHtmlbarsMorphsAttrMorph.styleWarning]); }); } QUnit.test('specifying `
` works properly without a warning', function () { view = _emberViewsViewsView.default.create({ userValue: 'width: 42px', template: _emberTemplateCompilerSystemCompile.default('
') }); _emberRuntimeTestsUtils.runAppend(view); deepEqual(warnings, []); }); QUnit.test('specifying `
` works properly with a SafeString', function () { view = _emberViewsViewsView.default.create({ userValue: new _emberHtmlbarsUtilsString.SafeString('width: 42px'), template: _emberTemplateCompilerSystemCompile.default('
') }); _emberRuntimeTestsUtils.runAppend(view); deepEqual(warnings, []); }); // jscs:enable validateIndentation }); enifed('ember-htmlbars/tests/attr_nodes/style_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/attr_nodes'); test('ember-htmlbars/tests/attr_nodes/style_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/attr_nodes/style_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/style_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/attr_nodes'); QUnit.test('ember-htmlbars/tests/attr_nodes/style_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/attr_nodes/style_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/svg_test', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-views/views/view', 'ember-metal/run_loop', 'ember-template-compiler/system/compile', 'htmlbars-test-helpers'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberViewsViewsView, _emberMetalRun_loop, _emberTemplateCompilerSystemCompile, _htmlbarsTestHelpers) { 'use strict'; var view; function appendView(view) { _emberMetalRun_loop.default(function () { view.appendTo('#qunit-fixture'); }); } // jscs:disable validateIndentation QUnit.module('ember-htmlbars: svg attribute', { teardown: function () { if (view) { _emberMetalRun_loop.default(view, view.destroy); } } }); QUnit.test('unquoted viewBox property is output', function () { var viewBoxString = '0 0 100 100'; view = _emberViewsViewsView.default.create({ context: { viewBoxString: viewBoxString }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '', 'attribute is output'); _emberMetalCore.default.run(view, view.set, 'context.viewBoxString', null); equal(view.element.getAttribute('svg'), null, 'attribute is removed'); }); QUnit.test('quoted viewBox property is output', function () { var viewBoxString = '0 0 100 100'; view = _emberViewsViewsView.default.create({ context: { viewBoxString: viewBoxString }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '', 'attribute is output'); }); QUnit.test('quoted viewBox property is concat', function () { var viewBoxString = '100 100'; view = _emberViewsViewsView.default.create({ context: { viewBoxString: viewBoxString }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '', 'attribute is output'); var newViewBoxString = '200 200'; _emberMetalCore.default.run(view, view.set, 'context.viewBoxString', newViewBoxString); _htmlbarsTestHelpers.equalInnerHTML(view.element, '', 'attribute is output'); }); QUnit.test('class is output', function () { view = _emberViewsViewsView.default.create({ context: { color: 'blue' }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); _htmlbarsTestHelpers.equalInnerHTML(view.element, '', 'attribute is output'); _emberMetalCore.default.run(view, view.set, 'context.color', 'red'); _htmlbarsTestHelpers.equalInnerHTML(view.element, '', 'attribute is output'); }); // jscs:enable validateIndentation }); enifed('ember-htmlbars/tests/attr_nodes/svg_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/attr_nodes'); test('ember-htmlbars/tests/attr_nodes/svg_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/attr_nodes/svg_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/svg_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/attr_nodes'); QUnit.test('ember-htmlbars/tests/attr_nodes/svg_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/attr_nodes/svg_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/value_test', ['exports', 'ember-metal/features', 'ember-views/views/view', 'ember-metal/run_loop', 'ember-template-compiler/system/compile'], function (exports, _emberMetalFeatures, _emberViewsViewsView, _emberMetalRun_loop, _emberTemplateCompilerSystemCompile) { 'use strict'; var view; function appendView(view) { _emberMetalRun_loop.default(function () { view.appendTo('#qunit-fixture'); }); } // jscs:disable validateIndentation QUnit.module('ember-htmlbars: value attribute', { teardown: function () { if (view) { _emberMetalRun_loop.default(view, view.destroy); } } }); QUnit.test('property is output', function () { view = _emberViewsViewsView.default.create({ context: { name: 'rick' }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); equal(view.element.firstChild.tagName, 'INPUT', 'input element is created'); equal(view.element.firstChild.value, 'rick', 'property is set true'); }); QUnit.test('string property is output', function () { view = _emberViewsViewsView.default.create({ context: { name: 'rick' }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); equal(view.element.firstChild.tagName, 'INPUT', 'input element is created'); equal(view.element.firstChild.value, 'rick', 'property is set true'); }); QUnit.test('blank property is output', function () { view = _emberViewsViewsView.default.create({ context: { name: '' }, template: _emberTemplateCompilerSystemCompile.default('') }); appendView(view); equal(view.element.firstChild.tagName, 'INPUT', 'input element is created'); equal(view.element.firstChild.value, '', 'property is set true'); }); // jscs:enable validateIndentation }); enifed('ember-htmlbars/tests/attr_nodes/value_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/attr_nodes'); test('ember-htmlbars/tests/attr_nodes/value_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/attr_nodes/value_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/attr_nodes/value_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/attr_nodes'); QUnit.test('ember-htmlbars/tests/attr_nodes/value_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/attr_nodes/value_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/compat/controller_keyword_test', ['exports', 'ember-metal/core', 'ember-views/views/component', 'ember-runtime/tests/utils', 'ember-template-compiler/system/compile', 'ember-htmlbars/tests/utils', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-template-compiler/plugins/assert-no-view-and-controller-paths'], function (exports, _emberMetalCore, _emberViewsViewsComponent, _emberRuntimeTestsUtils, _emberTemplateCompilerSystemCompile, _emberHtmlbarsTestsUtils, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths) { 'use strict'; var component = undefined; QUnit.module('ember-htmlbars: compat - controller keyword (use as a path)', { setup: function () { _emberMetalCore.default.ENV._ENABLE_LEGACY_CONTROLLER_SUPPORT = false; _emberHtmlbarsTestsUtils.registerAstPlugin(_emberTemplateCompilerPluginsAssertNoViewAndControllerPaths.default); component = null; }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(component); _emberHtmlbarsTestsUtils.removeAstPlugin(_emberTemplateCompilerPluginsAssertNoViewAndControllerPaths.default); _emberMetalCore.default.ENV._ENABLE_LEGACY_CONTROLLER_SUPPORT = true; } }); QUnit.test('reading the controller keyword fails assertion', function () { var text = 'a-prop'; expectAssertion(function () { component = _emberViewsViewsComponent.default.extend({ prop: text, layout: _emberTemplateCompilerSystemCompile.default('{{controller.prop}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); }, /Using `{{controller}}` or any path based on it .*/); }); QUnit.module('ember-htmlbars: compat - controller keyword (use as a path) [LEGACY]', { setup: function () { _emberHtmlbarsTestsUtils.registerAstPlugin(_emberTemplateCompilerPluginsTransformEachIntoCollection.default); component = null; }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(component); _emberHtmlbarsTestsUtils.removeAstPlugin(_emberTemplateCompilerPluginsTransformEachIntoCollection.default); } }); QUnit.test('reading the controller keyword works [LEGACY]', function () { var text = 'a-prop'; ignoreAssertion(function () { component = _emberViewsViewsComponent.default.extend({ prop: text, layout: _emberTemplateCompilerSystemCompile.default('{{controller.prop}}') }).create(); }, /Using `{{controller}}` or any path based on it .*/); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), text, 'controller keyword is read'); }); QUnit.test('reading the controller keyword for hash [LEGACY]', function () { ignoreAssertion(function () { component = _emberViewsViewsComponent.default.extend({ prop: true, layout: _emberTemplateCompilerSystemCompile.default('{{if true \'hiho\' option=controller.prop}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); }, /Using `{{controller}}` or any path based on it .*/); ok(true, 'access keyword'); }); QUnit.test('reading the controller keyword for param [LEGACY]', function () { var text = 'a-prop'; ignoreAssertion(function () { component = _emberViewsViewsComponent.default.extend({ prop: true, layout: _emberTemplateCompilerSystemCompile.default('{{if controller.prop \'' + text + '\'}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); }, /Using `{{controller}}` or any path based on it .*/); equal(component.$().text(), text, 'controller keyword is read'); }); QUnit.test('reading the controller keyword for param with block fails assertion [LEGACY]', function () { ignoreAssertion(function () { component = _emberViewsViewsComponent.default.extend({ prop: true, layout: _emberTemplateCompilerSystemCompile.default('{{#each controller as |things|}}{{/each}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); }, /Using `{{controller}}` or any path based on it .*/); ok(true, 'access keyword'); }); }); enifed('ember-htmlbars/tests/compat/controller_keyword_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/compat'); test('ember-htmlbars/tests/compat/controller_keyword_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/compat/controller_keyword_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/compat/controller_keyword_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/compat'); QUnit.test('ember-htmlbars/tests/compat/controller_keyword_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/compat/controller_keyword_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/compat/view_helper_test', ['exports', 'ember-metal/core', 'ember-views/views/component', 'ember-views/views/view', 'ember-views/views/select', 'ember-runtime/tests/utils', 'ember-template-compiler/system/compile', 'container/registry', 'ember-htmlbars/tests/utils', 'ember-template-compiler/plugins/assert-no-view-helper', 'ember-htmlbars/keywords/view'], function (exports, _emberMetalCore, _emberViewsViewsComponent, _emberViewsViewsView, _emberViewsViewsSelect, _emberRuntimeTestsUtils, _emberTemplateCompilerSystemCompile, _containerRegistry, _emberHtmlbarsTestsUtils, _emberTemplateCompilerPluginsAssertNoViewHelper, _emberHtmlbarsKeywordsView) { 'use strict'; var component = undefined, registry = undefined, container = undefined, originalViewKeyword = undefined; QUnit.module('ember-htmlbars: compat - view helper', { setup: function () { _emberMetalCore.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT = false; _emberHtmlbarsTestsUtils.registerAstPlugin(_emberTemplateCompilerPluginsAssertNoViewHelper.default); originalViewKeyword = _emberHtmlbarsTestsUtils.registerKeyword('view', _emberHtmlbarsKeywordsView.default); registry = new _containerRegistry.default(); container = registry.container(); }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(component); _emberRuntimeTestsUtils.runDestroy(container); _emberHtmlbarsTestsUtils.removeAstPlugin(_emberTemplateCompilerPluginsAssertNoViewHelper.default); _emberMetalCore.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT = true; registry = container = component = null; _emberHtmlbarsTestsUtils.resetKeyword('view', originalViewKeyword); } }); QUnit.test('using the view helper fails assertion', function (assert) { var ViewClass = _emberViewsViewsView.default.extend({ template: _emberTemplateCompilerSystemCompile.default('fooView') }); registry.register('view:foo', ViewClass); expectAssertion(function () { component = _emberViewsViewsComponent.default.extend({ layout: _emberTemplateCompilerSystemCompile.default('{{view \'foo\'}}'), container: container }).create(); _emberRuntimeTestsUtils.runAppend(component); }, /Using the `{{view "string"}}` helper/); }); QUnit.module('ember-htmlbars: compat - view helper [LEGACY]', { setup: function () { originalViewKeyword = _emberHtmlbarsTestsUtils.registerKeyword('view', _emberHtmlbarsKeywordsView.default); registry = new _containerRegistry.default(); container = registry.container(); }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(component); _emberRuntimeTestsUtils.runDestroy(container); registry = container = component = null; _emberHtmlbarsTestsUtils.resetKeyword('view', originalViewKeyword); } }); QUnit.test('using the view helper with a string (inline form) fails assertion [LEGACY]', function (assert) { var ViewClass = _emberViewsViewsView.default.extend({ template: _emberTemplateCompilerSystemCompile.default('fooView') }); registry.register('view:foo', ViewClass); ignoreAssertion(function () { component = _emberViewsViewsComponent.default.extend({ layout: _emberTemplateCompilerSystemCompile.default('{{view \'foo\'}}'), container: container }).create(); _emberRuntimeTestsUtils.runAppend(component); }); assert.equal(component.$().text(), 'fooView', 'view helper is still rendered'); }); QUnit.test('using the view helper with a string (block form) fails assertion [LEGACY]', function (assert) { var ViewClass = _emberViewsViewsView.default.extend({ template: _emberTemplateCompilerSystemCompile.default('Foo says: {{yield}}') }); registry.register('view:foo', ViewClass); ignoreAssertion(function () { component = _emberViewsViewsComponent.default.extend({ layout: _emberTemplateCompilerSystemCompile.default('{{#view \'foo\'}}I am foo{{/view}}'), container: container }).create(); _emberRuntimeTestsUtils.runAppend(component); }); assert.equal(component.$().text(), 'Foo says: I am foo', 'view helper is still rendered'); }); QUnit.test('using the view helper with string "select" fails assertion [LEGACY]', function (assert) { registry.register('view:select', _emberViewsViewsSelect.default); ignoreAssertion(function () { component = _emberViewsViewsComponent.default.extend({ layout: _emberTemplateCompilerSystemCompile.default('{{view \'select\'}}'), container: container }).create(); _emberRuntimeTestsUtils.runAppend(component); }); assert.ok(!!component.$('select').length, 'still renders select'); }); }); enifed('ember-htmlbars/tests/compat/view_helper_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/compat'); test('ember-htmlbars/tests/compat/view_helper_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/compat/view_helper_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/compat/view_helper_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/compat'); QUnit.test('ember-htmlbars/tests/compat/view_helper_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/compat/view_helper_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/compat/view_keyword_test', ['exports', 'ember-metal/core', 'ember-views/views/component', 'ember-runtime/tests/utils', 'ember-template-compiler/system/compile', 'ember-htmlbars/tests/utils', 'ember-template-compiler/plugins/assert-no-view-and-controller-paths'], function (exports, _emberMetalCore, _emberViewsViewsComponent, _emberRuntimeTestsUtils, _emberTemplateCompilerSystemCompile, _emberHtmlbarsTestsUtils, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths) { 'use strict'; var component = undefined; QUnit.module('ember-htmlbars: compat - view keyword (use as a path)', { setup: function () { _emberMetalCore.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT = false; _emberHtmlbarsTestsUtils.registerAstPlugin(_emberTemplateCompilerPluginsAssertNoViewAndControllerPaths.default); component = null; }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(component); _emberHtmlbarsTestsUtils.removeAstPlugin(_emberTemplateCompilerPluginsAssertNoViewAndControllerPaths.default); _emberMetalCore.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT = true; } }); QUnit.test('reading the view keyword fails assertion', function () { var text = 'a-prop'; expectAssertion(function () { component = _emberViewsViewsComponent.default.extend({ prop: text, layout: _emberTemplateCompilerSystemCompile.default('{{view.prop}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); }, /Using `{{view}}` or any path based on it .*/); }); }); enifed('ember-htmlbars/tests/compat/view_keyword_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/compat'); test('ember-htmlbars/tests/compat/view_keyword_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/compat/view_keyword_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/compat/view_keyword_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/compat'); QUnit.test('ember-htmlbars/tests/compat/view_keyword_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/compat/view_keyword_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/helpers/-html-safe-test', ['exports', 'ember-metal/core', 'ember-runtime/system/container', 'ember-views/views/component', 'ember-template-compiler/system/compile', 'ember-runtime/tests/utils'], function (exports, _emberMetalCore, _emberRuntimeSystemContainer, _emberViewsViewsComponent, _emberTemplateCompilerSystemCompile, _emberRuntimeTestsUtils) { /* globals EmberDev */ 'use strict'; var component, registry, container, warnings, originalWarn; QUnit.module('ember-htmlbars: {{-html-safe}} helper', { setup: function () { registry = new _emberRuntimeSystemContainer.Registry(); container = registry.container(); registry.optionsForType('helper', { instantiate: false }); warnings = []; originalWarn = _emberMetalCore.default.warn; _emberMetalCore.default.warn = function (message, test) { if (!test) { warnings.push(message); } }; }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(container); _emberRuntimeTestsUtils.runDestroy(component); _emberMetalCore.default.warn = originalWarn; } }); QUnit.test('adds the attribute to the element', function () { component = _emberViewsViewsComponent.default.create({ container: container, layout: _emberTemplateCompilerSystemCompile.default('
') }); _emberRuntimeTestsUtils.runAppend(component); equal(component.$('div').css('display'), 'none', 'attribute was set'); }); if (!EmberDev.runningProdBuild) { QUnit.test('no warnings are triggered from setting style attribute', function () { component = _emberViewsViewsComponent.default.create({ container: container, layout: _emberTemplateCompilerSystemCompile.default('
') }); _emberRuntimeTestsUtils.runAppend(component); deepEqual(warnings, [], 'no warnings were triggered'); }); } }); enifed('ember-htmlbars/tests/helpers/-html-safe-test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/helpers'); test('ember-htmlbars/tests/helpers/-html-safe-test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/helpers/-html-safe-test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/helpers/-html-safe-test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/helpers'); QUnit.test('ember-htmlbars/tests/helpers/-html-safe-test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/helpers/-html-safe-test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/helpers/collection_test', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/run_loop', 'ember-metal/computed', 'ember-runtime/system/object', 'ember-runtime/system/array_proxy', 'ember-runtime/system/namespace', 'ember-runtime/system/container', 'ember-runtime/system/native_array', 'ember-runtime/tests/utils', 'ember-views/views/collection_view', 'ember-views/views/view', 'ember-views/system/jquery', 'ember-template-compiler/system/compile', 'ember-htmlbars/tests/utils', 'ember-htmlbars/keywords/view'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalRun_loop, _emberMetalComputed, _emberRuntimeSystemObject, _emberRuntimeSystemArray_proxy, _emberRuntimeSystemNamespace, _emberRuntimeSystemContainer, _emberRuntimeSystemNative_array, _emberRuntimeTestsUtils, _emberViewsViewsCollection_view, _emberViewsViewsView, _emberViewsSystemJquery, _emberTemplateCompilerSystemCompile, _emberHtmlbarsTestsUtils, _emberHtmlbarsKeywordsView) { /*jshint newcap:false*/ 'use strict'; var trim = _emberViewsSystemJquery.default.trim; var view; var originalLookup = _emberMetalCore.default.lookup; var TemplateTests, registry, container, lookup, originalViewKeyword; function nthChild(view, nth) { return _emberMetalProperty_get.get(view, 'childViews').objectAt(nth || 0); } var firstChild = nthChild; function firstGrandchild(view) { return _emberMetalProperty_get.get(_emberMetalProperty_get.get(view, 'childViews').objectAt(0), 'childViews').objectAt(0); } QUnit.module('collection helper [LEGACY]', { setup: function () { originalViewKeyword = _emberHtmlbarsTestsUtils.registerKeyword('view', _emberHtmlbarsKeywordsView.default); _emberMetalCore.default.lookup = lookup = {}; lookup.TemplateTests = TemplateTests = _emberRuntimeSystemNamespace.default.create(); registry = new _emberRuntimeSystemContainer.Registry(); container = registry.container(); registry.optionsForType('template', { instantiate: false }); registry.register('view:toplevel', _emberViewsViewsView.default.extend()); }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(container); _emberRuntimeTestsUtils.runDestroy(view); registry = container = view = null; _emberMetalCore.default.lookup = lookup = originalLookup; TemplateTests = null; _emberHtmlbarsTestsUtils.resetKeyword('view', originalViewKeyword); } }); QUnit.test('Collection views that specify an example view class have their children be of that class', function () { var ExampleViewCollection = _emberViewsViewsCollection_view.default.extend({ itemViewClass: _emberViewsViewsView.default.extend({ isCustom: true }), content: _emberRuntimeSystemNative_array.A(['foo']) }); view = _emberViewsViewsView.default.create({ exampleViewCollection: ExampleViewCollection, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.exampleViewCollection}}OHAI{{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); ok(firstGrandchild(view).isCustom, 'uses the example view class'); }); QUnit.test('itemViewClass works in the #collection helper with a property', function () { var ExampleItemView = _emberViewsViewsView.default.extend({ isAlsoCustom: true }); var ExampleCollectionView = _emberViewsViewsCollection_view.default; view = _emberViewsViewsView.default.create({ possibleItemView: ExampleItemView, exampleCollectionView: ExampleCollectionView, exampleController: _emberRuntimeSystemArray_proxy.default.create({ content: _emberRuntimeSystemNative_array.A(['alpha']) }), template: _emberTemplateCompilerSystemCompile.default('{{#collection view.exampleCollectionView content=view.exampleController itemViewClass=view.possibleItemView}}beta{{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); ok(firstGrandchild(view).isAlsoCustom, 'uses the example view class specified in the #collection helper'); }); QUnit.test('itemViewClass works in the #collection via container', function () { registry.register('view:example-item', _emberViewsViewsView.default.extend({ isAlsoCustom: true })); view = _emberViewsViewsView.default.create({ container: container, exampleCollectionView: _emberViewsViewsCollection_view.default.extend(), exampleController: _emberRuntimeSystemArray_proxy.default.create({ content: _emberRuntimeSystemNative_array.A(['alpha']) }), template: _emberTemplateCompilerSystemCompile.default('{{#collection view.exampleCollectionView content=view.exampleController itemViewClass="example-item"}}beta{{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); ok(firstGrandchild(view).isAlsoCustom, 'uses the example view class specified in the #collection helper'); }); QUnit.test('passing a block to the collection helper sets it as the template for example views', function () { var CollectionTestView = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A(['foo', 'bar', 'baz']) }); view = _emberViewsViewsView.default.create({ collectionTestView: CollectionTestView, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.collectionTestView}} {{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('label').length, 3, 'one label element is created for each content item'); }); QUnit.test('collection helper should try to use container to resolve view', function () { var registry = new _emberRuntimeSystemContainer.Registry(); var container = registry.container(); var ACollectionView = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A(['foo', 'bar', 'baz']) }); registry.register('view:collectionTest', ACollectionView); view = _emberViewsViewsView.default.create({ container: container, template: _emberTemplateCompilerSystemCompile.default('{{#collection "collectionTest"}} {{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('label').length, 3, 'one label element is created for each content item'); }); QUnit.test('collection helper should accept relative paths', function () { view = _emberViewsViewsView.default.create({ template: _emberTemplateCompilerSystemCompile.default('{{#collection view.collection}} {{/collection}}'), collection: _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A(['foo', 'bar', 'baz']) }) }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('label').length, 3, 'one label element is created for each content item'); }); QUnit.test('empty views should be removed when content is added to the collection (regression, ht: msofaer)', function () { var EmptyView = _emberViewsViewsView.default.extend({ template: _emberTemplateCompilerSystemCompile.default('No Rows Yet') }); var ListView = _emberViewsViewsCollection_view.default.extend({ emptyView: EmptyView }); var listController = _emberRuntimeSystemArray_proxy.default.create({ content: _emberRuntimeSystemNative_array.A() }); view = _emberViewsViewsView.default.create({ _viewRegistry: {}, listView: ListView, listController: listController, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.listView content=view.listController tagName="table"}} {{view.content.title}} {{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('tr').length, 1, 'Make sure the empty view is there (regression)'); _emberMetalRun_loop.default(function () { listController.pushObject({ title: 'Go Away, Placeholder Row!' }); }); equal(view.$('tr').length, 1, 'has one row'); equal(view.$('tr:nth-child(1) td').text(), 'Go Away, Placeholder Row!', 'The content is the updated data.'); }); QUnit.test('should be able to specify which class should be used for the empty view', function () { var registry = new _emberRuntimeSystemContainer.Registry(); var App; _emberMetalRun_loop.default(function () { lookup.App = App = _emberRuntimeSystemNamespace.default.create(); }); var EmptyView = _emberViewsViewsView.default.extend({ template: _emberTemplateCompilerSystemCompile.default('This is an empty view') }); registry.register('view:empty-view', EmptyView); view = _emberViewsViewsView.default.create({ container: registry.container(), template: _emberTemplateCompilerSystemCompile.default('{{collection emptyViewClass="empty-view"}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$().text(), 'This is an empty view', 'Empty view should be rendered.'); _emberRuntimeTestsUtils.runDestroy(App); }); QUnit.test('if no content is passed, and no \'else\' is specified, nothing is rendered', function () { var CollectionTestView = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A() }); view = _emberViewsViewsView.default.create({ collectionTestView: CollectionTestView, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.collectionTestView}} {{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('li').length, 0, 'if no "else" is specified, nothing is rendered'); }); QUnit.test('if no content is passed, and \'else\' is specified, the else block is rendered', function () { var CollectionTestView = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A() }); view = _emberViewsViewsView.default.create({ collectionTestView: CollectionTestView, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.collectionTestView}} {{ else }} {{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('li:has(del)').length, 1, 'the else block is rendered'); }); QUnit.test('a block passed to a collection helper defaults to the content property of the context', function () { var CollectionTestView = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A(['foo', 'bar', 'baz']) }); view = _emberViewsViewsView.default.create({ collectionTestView: CollectionTestView, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.collectionTestView}} {{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('li:nth-child(1) label').length, 1); equal(view.$('li:nth-child(1) label').text(), 'foo'); equal(view.$('li:nth-child(2) label').length, 1); equal(view.$('li:nth-child(2) label').text(), 'bar'); equal(view.$('li:nth-child(3) label').length, 1); equal(view.$('li:nth-child(3) label').text(), 'baz'); }); QUnit.test('a block passed to a collection helper defaults to the view', function () { var CollectionTestView = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A(['foo', 'bar', 'baz']) }); view = _emberViewsViewsView.default.create({ collectionTestView: CollectionTestView, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.collectionTestView}} {{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); // Preconds equal(view.$('li:nth-child(1) label').length, 1); equal(view.$('li:nth-child(1) label').text(), 'foo'); equal(view.$('li:nth-child(2) label').length, 1); equal(view.$('li:nth-child(2) label').text(), 'bar'); equal(view.$('li:nth-child(3) label').length, 1); equal(view.$('li:nth-child(3) label').text(), 'baz'); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(firstChild(view), 'content', _emberRuntimeSystemNative_array.A()); }); equal(view.$('label').length, 0, 'all list item views should be removed from DOM'); }); QUnit.test('should include an id attribute if id is set in the options hash', function () { var CollectionTestView = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A(['foo', 'bar', 'baz']) }); view = _emberViewsViewsView.default.create({ collectionTestView: CollectionTestView, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.collectionTestView id="baz"}}foo{{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('ul#baz').length, 1, 'adds an id attribute'); }); QUnit.test('should give its item views the class specified by itemClass', function () { var ItemClassTestCollectionView = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A(['foo', 'bar', 'baz']) }); view = _emberViewsViewsView.default.create({ itemClassTestCollectionView: ItemClassTestCollectionView, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.itemClassTestCollectionView itemClass="baz"}}foo{{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('ul li.baz').length, 3, 'adds class attribute'); }); QUnit.test('should give its item views the class specified by itemClass binding', function () { var ItemClassBindingTestCollectionView = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A([_emberRuntimeSystemObject.default.create({ isBaz: false }), _emberRuntimeSystemObject.default.create({ isBaz: true }), _emberRuntimeSystemObject.default.create({ isBaz: true })]) }); view = _emberViewsViewsView.default.create({ itemClassBindingTestCollectionView: ItemClassBindingTestCollectionView, isBar: true, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.itemClassBindingTestCollectionView itemClass=view.isBar}}foo{{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('ul li.is-bar').length, 3, 'adds class on initial rendering'); // NOTE: in order to bind an item's class to a property of the item itself (e.g. `isBaz` above), it will be necessary // to introduce a new keyword that could be used from within `itemClassBinding`. For instance, `itemClassBinding="item.isBaz"`. }); QUnit.test('should give its item views the property specified by itemProperty', function () { var registry = new _emberRuntimeSystemContainer.Registry(); var ItemPropertyBindingTestItemView = _emberViewsViewsView.default.extend({ tagName: 'li' }); registry.register('view:item-property-binding-test-item-view', ItemPropertyBindingTestItemView); // Use preserveContext=false so the itemView handlebars context is the view context // Set itemView bindings using item* view = _emberViewsViewsView.default.create({ baz: 'baz', content: _emberRuntimeSystemNative_array.A([_emberRuntimeSystemObject.default.create(), _emberRuntimeSystemObject.default.create(), _emberRuntimeSystemObject.default.create()]), container: registry.container(), template: _emberTemplateCompilerSystemCompile.default('{{#collection content=view.content tagName="ul" itemViewClass="item-property-binding-test-item-view" itemProperty=view.baz preserveContext=false}}{{view.property}}{{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('ul li').length, 3, 'adds 3 itemView'); view.$('ul li').each(function (i, li) { equal(_emberViewsSystemJquery.default(li).text(), 'baz', 'creates the li with the property = baz'); }); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(view, 'baz', 'yobaz'); }); equal(view.$('ul li:first').text(), 'yobaz', 'change property of sub view'); }); QUnit.test('should work inside a bound {{#if}}', function () { var testData = _emberRuntimeSystemNative_array.A([_emberRuntimeSystemObject.default.create({ isBaz: false }), _emberRuntimeSystemObject.default.create({ isBaz: true }), _emberRuntimeSystemObject.default.create({ isBaz: true })]); var IfTestCollectionView = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: testData }); view = _emberViewsViewsView.default.create({ ifTestCollectionView: IfTestCollectionView, template: _emberTemplateCompilerSystemCompile.default('{{#if view.shouldDisplay}}{{#collection view.ifTestCollectionView}}{{content.isBaz}}{{/collection}}{{/if}}'), shouldDisplay: true }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('ul li').length, 3, 'renders collection when conditional is true'); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(view, 'shouldDisplay', false); }); equal(view.$('ul li').length, 0, 'removes collection when conditional changes to false'); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(view, 'shouldDisplay', true); }); equal(view.$('ul li').length, 3, 'collection renders when conditional changes to true'); }); QUnit.test('should pass content as context when using {{#each}} helper [DEPRECATED]', function () { view = _emberViewsViewsView.default.create({ template: _emberTemplateCompilerSystemCompile.default('{{#each view.releases as |release|}}Mac OS X {{release.version}}: {{release.name}} {{/each}}'), releases: _emberRuntimeSystemNative_array.A([{ version: '10.7', name: 'Lion' }, { version: '10.6', name: 'Snow Leopard' }, { version: '10.5', name: 'Leopard' }]) }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$().text(), 'Mac OS X 10.7: Lion Mac OS X 10.6: Snow Leopard Mac OS X 10.5: Leopard ', 'prints each item in sequence'); }); QUnit.test('should re-render when the content object changes', function () { var RerenderTest = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A() }); view = _emberViewsViewsView.default.create({ rerenderTestView: RerenderTest, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.rerenderTestView}}{{view.content}}{{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(firstChild(view), 'content', _emberRuntimeSystemNative_array.A(['bing', 'bat', 'bang'])); }); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(firstChild(view), 'content', _emberRuntimeSystemNative_array.A(['ramalamadingdong'])); }); equal(view.$('li').length, 1, 'rerenders with correct number of items'); equal(trim(view.$('li:eq(0)').text()), 'ramalamadingdong'); }); QUnit.test('select tagName on collection helper automatically sets child tagName to option', function () { var RerenderTest = _emberViewsViewsCollection_view.default.extend({ content: _emberRuntimeSystemNative_array.A(['foo']) }); view = _emberViewsViewsView.default.create({ rerenderTestView: RerenderTest, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.rerenderTestView tagName="select"}}{{view.content}}{{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('option').length, 1, 'renders the correct child tag name'); }); QUnit.test('tagName works in the #collection helper', function () { var RerenderTest = _emberViewsViewsCollection_view.default.extend({ content: _emberRuntimeSystemNative_array.A(['foo', 'bar']) }); view = _emberViewsViewsView.default.create({ rerenderTestView: RerenderTest, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.rerenderTestView tagName="ol"}}{{view.content}}{{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('ol').length, 1, 'renders the correct tag name'); equal(view.$('li').length, 2, 'rerenders with correct number of items'); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(firstChild(view), 'content', _emberRuntimeSystemNative_array.A(['bing', 'bat', 'bang'])); }); equal(view.$('li').length, 3, 'rerenders with correct number of items'); equal(trim(view.$('li:eq(0)').text()), 'bing'); }); QUnit.test('itemClassNames adds classes to items', function () { view = _emberViewsViewsView.default.create({ context: { list: _emberRuntimeSystemNative_array.A(['one', 'two']) }, template: _emberTemplateCompilerSystemCompile.default('{{#collection content=list itemClassNames="some-class"}}{{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('div > .some-class').length, 2, 'should have two items with the class'); }); QUnit.test('should render nested collections', function () { var registry = new _emberRuntimeSystemContainer.Registry(); var container = registry.container(); registry.register('view:inner-list', _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A(['one', 'two', 'three']) })); registry.register('view:outer-list', _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', content: _emberRuntimeSystemNative_array.A(['foo']) })); view = _emberViewsViewsView.default.create({ container: container, template: _emberTemplateCompilerSystemCompile.default('{{#collection "outer-list" class="outer"}}{{content}}{{#collection "inner-list" class="inner"}}{{content}}{{/collection}}{{/collection}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('ul.outer > li').length, 1, 'renders the outer list with correct number of items'); equal(view.$('ul.inner').length, 1, 'the inner list exsits'); equal(view.$('ul.inner > li').length, 3, 'renders the inner list with correct number of items'); }); QUnit.test('should render multiple, bound nested collections (#68)', function () { var view; _emberMetalRun_loop.default(function () { TemplateTests.contentController = _emberRuntimeSystemArray_proxy.default.create({ content: _emberRuntimeSystemNative_array.A(['foo', 'bar']) }); var InnerList = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', contentBinding: 'parentView.innerListContent' }); var OuterListItem = _emberViewsViewsView.default.extend({ innerListView: InnerList, template: _emberTemplateCompilerSystemCompile.default('{{#collection view.innerListView class="inner"}}{{content}}{{/collection}}{{content}}'), innerListContent: _emberMetalComputed.computed(function () { return _emberRuntimeSystemNative_array.A([1, 2, 3]); }) }); var OuterList = _emberViewsViewsCollection_view.default.extend({ tagName: 'ul', contentBinding: 'TemplateTests.contentController', itemViewClass: OuterListItem }); view = _emberViewsViewsView.default.create({ outerListView: OuterList, template: _emberTemplateCompilerSystemCompile.default('{{collection view.outerListView class="outer"}}') }); }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$('ul.outer > li').length, 2, 'renders the outer list with correct number of items'); equal(view.$('ul.inner').length, 2, 'renders the correct number of inner lists'); equal(view.$('ul.inner:first > li').length, 3, 'renders the first inner list with correct number of items'); equal(view.$('ul.inner:last > li').length, 3, 'renders the second list with correct number of items'); _emberRuntimeTestsUtils.runDestroy(view); }); QUnit.test('should allow view objects to be swapped out without throwing an error (#78)', function () { var view, dataset, secondDataset; _emberMetalRun_loop.default(function () { TemplateTests.datasetController = _emberRuntimeSystemObject.default.create(); var ExampleCollectionView = _emberViewsViewsCollection_view.default.extend({ contentBinding: 'parentView.items', tagName: 'ul', _itemViewTemplate: _emberTemplateCompilerSystemCompile.default('{{view.content}}') }); var ReportingView = _emberViewsViewsView.default.extend({ exampleCollectionView: ExampleCollectionView, datasetBinding: 'TemplateTests.datasetController.dataset', readyBinding: 'dataset.ready', itemsBinding: 'dataset.items', template: _emberTemplateCompilerSystemCompile.default('{{#if view.ready}}{{collection view.exampleCollectionView}}{{else}}Loading{{/if}}') }); view = ReportingView.create(); }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$().text(), 'Loading', 'renders the loading text when the dataset is not ready'); _emberMetalRun_loop.default(function () { dataset = _emberRuntimeSystemObject.default.create({ ready: true, items: _emberRuntimeSystemNative_array.A([1, 2, 3]) }); TemplateTests.datasetController.set('dataset', dataset); }); equal(view.$('ul > li').length, 3, 'renders the collection with the correct number of items when the dataset is ready'); _emberMetalRun_loop.default(function () { secondDataset = _emberRuntimeSystemObject.default.create({ ready: false }); TemplateTests.datasetController.set('dataset', secondDataset); }); equal(view.$().text(), 'Loading', 'renders the loading text when the second dataset is not ready'); _emberRuntimeTestsUtils.runDestroy(view); }); QUnit.test('context should be content', function () { var view; registry = new _emberRuntimeSystemContainer.Registry(); container = registry.container(); var items = _emberRuntimeSystemNative_array.A([_emberRuntimeSystemObject.default.create({ name: 'Dave' }), _emberRuntimeSystemObject.default.create({ name: 'Mary' }), _emberRuntimeSystemObject.default.create({ name: 'Sara' })]); registry.register('view:an-item', _emberViewsViewsView.default.extend({ template: _emberTemplateCompilerSystemCompile.default('Greetings {{name}}') })); view = _emberViewsViewsView.default.create({ container: container, controller: { items: items }, template: _emberTemplateCompilerSystemCompile.default('{{collection content=items itemViewClass="an-item"}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$().text(), 'Greetings DaveGreetings MaryGreetings Sara'); _emberRuntimeTestsUtils.runDestroy(view); }); }); enifed('ember-htmlbars/tests/helpers/collection_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/helpers'); test('ember-htmlbars/tests/helpers/collection_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/helpers/collection_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/helpers/collection_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/helpers'); QUnit.test('ember-htmlbars/tests/helpers/collection_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/helpers/collection_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/helpers/component_test', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/property_set', 'ember-metal/property_get', 'ember-metal/run_loop', 'container/registry', 'ember-runtime/tests/utils', 'ember-views/component_lookup', 'ember-views/views/view', 'ember-views/views/component', 'ember-template-compiler/system/compile', 'ember-metal/computed'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalProperty_set, _emberMetalProperty_get, _emberMetalRun_loop, _containerRegistry, _emberRuntimeTestsUtils, _emberViewsComponent_lookup, _emberViewsViewsView, _emberViewsViewsComponent, _emberTemplateCompilerSystemCompile, _emberMetalComputed) { 'use strict'; var view, registry, container; QUnit.module('ember-htmlbars: {{#component}} helper', { setup: function () { registry = new _containerRegistry.default(); container = registry.container(); registry.optionsForType('template', { instantiate: false }); registry.register('component-lookup:main', _emberViewsComponent_lookup.default); }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(view); _emberRuntimeTestsUtils.runDestroy(container); registry = container = view = null; } }); QUnit.test('component helper with bound properties are updating correctly in init of component', function () { registry.register('component:foo-bar', _emberViewsViewsComponent.default.extend({ init: function () { this._super.apply(this, arguments); equal(_emberMetalProperty_get.get(this, 'location'), 'Caracas', 'location is bound on init'); } })); registry.register('component:baz-qux', _emberViewsViewsComponent.default.extend({ init: function () { this._super.apply(this, arguments); equal(_emberMetalProperty_get.get(this, 'location'), 'Loisaida', 'location is bound on init'); } })); registry.register('template:components/foo-bar', _emberTemplateCompilerSystemCompile.default('yippie! {{location}} {{yield}}')); registry.register('template:components/baz-qux', _emberTemplateCompilerSystemCompile.default('yummy {{location}} {{yield}}')); view = _emberViewsViewsView.default.extend({ container: container, dynamicComponent: _emberMetalComputed.default('location', function () { var location = _emberMetalProperty_get.get(this, 'location'); if (location === 'Caracas') { return 'foo-bar'; } else { return 'baz-qux'; } }), location: 'Caracas', template: _emberTemplateCompilerSystemCompile.default('{{#component view.dynamicComponent location=view.location}}arepas!{{/component}}') }).create(); _emberRuntimeTestsUtils.runAppend(view); equal(view.$().text(), 'yippie! Caracas arepas!', 'component was looked up and rendered'); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(view, 'location', 'Loisaida'); }); equal(view.$().text(), 'yummy Loisaida arepas!', 'component was updated and re-rendered'); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(view, 'location', 'Caracas'); }); equal(view.$().text(), 'yippie! Caracas arepas!', 'component was updated up and rendered'); }); QUnit.test('component helper with unquoted string is bound', function () { registry.register('template:components/foo-bar', _emberTemplateCompilerSystemCompile.default('yippie! {{attrs.location}} {{yield}}')); registry.register('template:components/baz-qux', _emberTemplateCompilerSystemCompile.default('yummy {{attrs.location}} {{yield}}')); view = _emberViewsViewsView.default.create({ container: container, dynamicComponent: 'foo-bar', location: 'Caracas', template: _emberTemplateCompilerSystemCompile.default('{{#component view.dynamicComponent location=view.location}}arepas!{{/component}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$().text(), 'yippie! Caracas arepas!', 'component was looked up and rendered'); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(view, 'dynamicComponent', 'baz-qux'); _emberMetalProperty_set.set(view, 'location', 'Loisaida'); }); equal(view.$().text(), 'yummy Loisaida arepas!', 'component was updated and re-rendered'); }); QUnit.test('component helper destroys underlying component when it is swapped out', function () { var currentComponent; var destroyCalls = 0; registry.register('component:foo-bar', _emberViewsViewsComponent.default.extend({ init: function () { this._super.apply(this, arguments); currentComponent = 'foo-bar'; }, willDestroy: function () { destroyCalls++; } })); registry.register('component:baz-qux', _emberViewsViewsComponent.default.extend({ init: function () { this._super.apply(this, arguments); currentComponent = 'baz-qux'; }, willDestroy: function () { destroyCalls++; } })); view = _emberViewsViewsView.default.create({ container: container, dynamicComponent: 'foo-bar', template: _emberTemplateCompilerSystemCompile.default('{{component view.dynamicComponent}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(currentComponent, 'foo-bar', 'precond - instantiates the proper component'); equal(destroyCalls, 0, 'precond - nothing destroyed yet'); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(view, 'dynamicComponent', 'baz-qux'); }); equal(currentComponent, 'baz-qux', 'changing bound value instantiates the proper component'); equal(destroyCalls, 1, 'prior component should be destroyed'); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(view, 'dynamicComponent', 'foo-bar'); }); equal(currentComponent, 'foo-bar', 'changing bound value instantiates the proper component'); equal(destroyCalls, 2, 'prior components destroyed'); }); QUnit.test('component helper with actions', function () { registry.register('template:components/foo-bar', _emberTemplateCompilerSystemCompile.default('yippie! {{yield}}')); registry.register('component:foo-bar', _emberViewsViewsComponent.default.extend({ classNames: 'foo-bar', didInsertElement: function () { // trigger action on click in absence of app's EventDispatcher var self = this; this.$().on('click', function () { self.sendAction('fooBarred'); }); }, willDestroyElement: function () { this.$().off('click'); } })); var actionTriggered = 0; var controller = _emberMetalCore.default.Controller.extend({ dynamicComponent: 'foo-bar', actions: { mappedAction: function () { actionTriggered++; } } }).create(); view = _emberViewsViewsView.default.create({ container: container, controller: controller, template: _emberTemplateCompilerSystemCompile.default('{{#component dynamicComponent fooBarred="mappedAction"}}arepas!{{/component}}') }); _emberRuntimeTestsUtils.runAppend(view); _emberMetalRun_loop.default(function () { view.$('.foo-bar').trigger('click'); }); equal(actionTriggered, 1, 'action was triggered'); }); QUnit.test('component helper maintains expected logical parentView', function () { registry.register('template:components/foo-bar', _emberTemplateCompilerSystemCompile.default('yippie! {{yield}}')); var componentInstance; registry.register('component:foo-bar', _emberViewsViewsComponent.default.extend({ didInsertElement: function () { componentInstance = this; } })); view = _emberViewsViewsView.default.create({ container: container, dynamicComponent: 'foo-bar', template: _emberTemplateCompilerSystemCompile.default('{{#component view.dynamicComponent}}arepas!{{/component}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(_emberMetalProperty_get.get(componentInstance, 'parentView'), view, 'component\'s parentView is the view invoking the helper'); }); QUnit.test('nested component helpers', function () { registry.register('template:components/foo-bar', _emberTemplateCompilerSystemCompile.default('yippie! {{attrs.location}} {{yield}}')); registry.register('template:components/baz-qux', _emberTemplateCompilerSystemCompile.default('yummy {{attrs.location}} {{yield}}')); registry.register('template:components/corge-grault', _emberTemplateCompilerSystemCompile.default('delicious {{attrs.location}} {{yield}}')); view = _emberViewsViewsView.default.create({ container: container, dynamicComponent1: 'foo-bar', dynamicComponent2: 'baz-qux', location: 'Caracas', template: _emberTemplateCompilerSystemCompile.default('{{#component view.dynamicComponent1 location=view.location}}{{#component view.dynamicComponent2 location=view.location}}arepas!{{/component}}{{/component}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$().text(), 'yippie! Caracas yummy Caracas arepas!', 'components were looked up and rendered'); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(view, 'dynamicComponent1', 'corge-grault'); _emberMetalProperty_set.set(view, 'location', 'Loisaida'); }); equal(view.$().text(), 'delicious Loisaida yummy Loisaida arepas!', 'components were updated and re-rendered'); }); QUnit.test('component helper can be used with a quoted string (though you probably would not do this)', function () { registry.register('template:components/foo-bar', _emberTemplateCompilerSystemCompile.default('yippie! {{attrs.location}} {{yield}}')); view = _emberViewsViewsView.default.create({ container: container, location: 'Caracas', template: _emberTemplateCompilerSystemCompile.default('{{#component "foo-bar" location=view.location}}arepas!{{/component}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$().text(), 'yippie! Caracas arepas!', 'component was looked up and rendered'); }); QUnit.test('component with unquoted param resolving to non-existent component', function () { view = _emberViewsViewsView.default.create({ container: container, dynamicComponent: 'does-not-exist', location: 'Caracas', template: _emberTemplateCompilerSystemCompile.default('{{#component view.dynamicComponent location=view.location}}arepas!{{/component}}') }); expectAssertion(function () { _emberRuntimeTestsUtils.runAppend(view); }, /HTMLBars error: Could not find component named "does-not-exist"./, 'Expected missing component to generate an exception'); }); QUnit.test('component with unquoted param resolving to a component, then non-existent component', function () { registry.register('template:components/foo-bar', _emberTemplateCompilerSystemCompile.default('yippie! {{attrs.location}} {{yield}}')); view = _emberViewsViewsView.default.create({ container: container, dynamicComponent: 'foo-bar', location: 'Caracas', template: _emberTemplateCompilerSystemCompile.default('{{#component view.dynamicComponent location=view.location}}arepas!{{/component}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$().text(), 'yippie! Caracas arepas!', 'component was looked up and rendered'); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(view, 'dynamicComponent', undefined); }); equal(view.$().text(), '', 'component correctly deals with falsey values set post-render'); }); QUnit.test('component with quoted param for non-existent component', function () { view = _emberViewsViewsView.default.create({ container: container, location: 'Caracas', template: _emberTemplateCompilerSystemCompile.default('{{#component "does-not-exist" location=view.location}}arepas!{{/component}}') }); expectAssertion(function () { _emberRuntimeTestsUtils.runAppend(view); }, /HTMLBars error: Could not find component named "does-not-exist"./); }); QUnit.test('component helper properly invalidates hash params inside an {{each}} invocation #11044', function () { registry.register('component:foo-bar', _emberViewsViewsComponent.default.extend({ willRender: function () { // store internally available name to ensure that the name available in `this.attrs.name` // matches the template lookup name _emberMetalProperty_set.set(this, 'internalName', this.attrs.name); } })); registry.register('template:components/foo-bar', _emberTemplateCompilerSystemCompile.default('{{internalName}} - {{attrs.name}}|')); view = _emberViewsViewsView.default.create({ container: container, items: [{ name: 'Robert' }, { name: 'Jacquie' }], template: _emberTemplateCompilerSystemCompile.default('{{#each view.items as |item|}}{{component "foo-bar" name=item.name}}{{/each}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$().text(), 'Robert - Robert|Jacquie - Jacquie|', 'component was rendered'); _emberMetalRun_loop.default(function () { _emberMetalProperty_set.set(view, 'items', [{ name: 'Max' }, { name: 'James' }]); }); equal(view.$().text(), 'Max - Max|James - James|', 'component was updated and re-rendered'); }); QUnit.test('dashless components should not be found', function () { expect(1); registry.register('template:components/dashless', _emberTemplateCompilerSystemCompile.default('Do not render me!')); view = _emberViewsViewsView.default.extend({ template: _emberTemplateCompilerSystemCompile.default('{{component "dashless"}}'), container: container }).create(); expectAssertion(function () { _emberRuntimeTestsUtils.runAppend(view); }, /You cannot use 'dashless' as a component name. Component names must contain a hyphen./); }); }); enifed('ember-htmlbars/tests/helpers/component_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/helpers'); test('ember-htmlbars/tests/helpers/component_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/helpers/component_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/helpers/component_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/helpers'); QUnit.test('ember-htmlbars/tests/helpers/component_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/helpers/component_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/helpers/concat-test', ['exports', 'ember-metal/run_loop', 'ember-runtime/system/container', 'ember-views/views/component', 'ember-template-compiler/system/compile', 'ember-htmlbars/helper', 'ember-runtime/tests/utils'], function (exports, _emberMetalRun_loop, _emberRuntimeSystemContainer, _emberViewsViewsComponent, _emberTemplateCompilerSystemCompile, _emberHtmlbarsHelper, _emberRuntimeTestsUtils) { 'use strict'; var component, registry, container; QUnit.module('ember-htmlbars: {{concat}} helper', { setup: function () { registry = new _emberRuntimeSystemContainer.Registry(); container = registry.container(); registry.optionsForType('helper', { instantiate: false }); }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(container); _emberRuntimeTestsUtils.runDestroy(component); } }); QUnit.test('concats provided params', function () { component = _emberViewsViewsComponent.default.create({ container: container, layout: _emberTemplateCompilerSystemCompile.default('{{concat "foo" " " "bar" " " "baz"}}') }); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), 'foo bar baz'); }); QUnit.test('updates for bound params', function () { component = _emberViewsViewsComponent.default.create({ container: container, firstParam: 'one', secondParam: 'two', layout: _emberTemplateCompilerSystemCompile.default('{{concat firstParam secondParam}}') }); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), 'onetwo'); _emberMetalRun_loop.default(function () { component.set('firstParam', 'three'); }); equal(component.$().text(), 'threetwo'); _emberMetalRun_loop.default(function () { component.set('secondParam', 'four'); }); equal(component.$().text(), 'threefour'); }); QUnit.test('can be used as a sub-expression', function () { function eq(_ref) { var actual = _ref[0]; var expected = _ref[1]; return actual === expected; } registry.register('helper:x-eq', _emberHtmlbarsHelper.helper(eq)); component = _emberViewsViewsComponent.default.create({ container: container, firstParam: 'one', secondParam: 'two', layout: _emberTemplateCompilerSystemCompile.default('{{#if (x-eq (concat firstParam secondParam) "onetwo")}}Truthy!{{else}}False{{/if}}') }); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), 'Truthy!'); _emberMetalRun_loop.default(function () { component.set('firstParam', 'three'); }); equal(component.$().text(), 'False'); }); }); enifed('ember-htmlbars/tests/helpers/concat-test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/helpers'); test('ember-htmlbars/tests/helpers/concat-test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/helpers/concat-test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/helpers/concat-test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/helpers'); QUnit.test('ember-htmlbars/tests/helpers/concat-test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/helpers/concat-test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/helpers/custom_helper_test', ['exports', 'ember-metal/core', 'ember-views/views/component', 'ember-htmlbars/helper', 'ember-template-compiler/system/compile', 'ember-runtime/tests/utils', 'container/registry', 'ember-metal/run_loop', 'ember-views/component_lookup'], function (exports, _emberMetalCore, _emberViewsViewsComponent, _emberHtmlbarsHelper, _emberTemplateCompilerSystemCompile, _emberRuntimeTestsUtils, _containerRegistry, _emberMetalRun_loop, _emberViewsComponent_lookup) { 'use strict'; var registry = undefined, container = undefined, component = undefined; QUnit.module('ember-htmlbars: custom app helpers', { setup: function () { registry = new _containerRegistry.default(); registry.optionsForType('template', { instantiate: false }); registry.optionsForType('helper', { singleton: false }); container = registry.container(); }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(component); _emberRuntimeTestsUtils.runDestroy(container); registry = container = component = null; } }); QUnit.test('dashed shorthand helper is resolved from container', function () { var HelloWorld = _emberHtmlbarsHelper.helper(function () { return 'hello world'; }); registry.register('helper:hello-world', HelloWorld); component = _emberViewsViewsComponent.default.extend({ container: container, layout: _emberTemplateCompilerSystemCompile.default('{{hello-world}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), 'hello world'); }); QUnit.test('dashed helper is resolved from container', function () { var HelloWorld = _emberHtmlbarsHelper.default.extend({ compute: function () { return 'hello world'; } }); registry.register('helper:hello-world', HelloWorld); component = _emberViewsViewsComponent.default.extend({ container: container, layout: _emberTemplateCompilerSystemCompile.default('{{hello-world}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), 'hello world'); }); QUnit.test('dashed helper can recompute a new value', function () { var destroyCount = 0; var count = 0; var helper; var HelloWorld = _emberHtmlbarsHelper.default.extend({ init: function () { this._super.apply(this, arguments); helper = this; }, compute: function () { return ++count; }, destroy: function () { destroyCount++; this._super(); } }); registry.register('helper:hello-world', HelloWorld); component = _emberViewsViewsComponent.default.extend({ container: container, layout: _emberTemplateCompilerSystemCompile.default('{{hello-world}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), '1'); _emberMetalRun_loop.default(function () { helper.recompute(); }); equal(component.$().text(), '2'); equal(destroyCount, 0, 'destroy is not called on recomputation'); }); QUnit.test('dashed helper with arg can recompute a new value', function () { var destroyCount = 0; var count = 0; var helper; var HelloWorld = _emberHtmlbarsHelper.default.extend({ init: function () { this._super.apply(this, arguments); helper = this; }, compute: function () { return ++count; }, destroy: function () { destroyCount++; this._super(); } }); registry.register('helper:hello-world', HelloWorld); component = _emberViewsViewsComponent.default.extend({ container: container, layout: _emberTemplateCompilerSystemCompile.default('{{hello-world "whut"}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), '1'); _emberMetalRun_loop.default(function () { helper.recompute(); }); equal(component.$().text(), '2'); equal(destroyCount, 0, 'destroy is not called on recomputation'); }); QUnit.test('dashed shorthand helper is called for param changes', function () { var count = 0; var HelloWorld = _emberHtmlbarsHelper.helper(function () { return ++count; }); registry.register('helper:hello-world', HelloWorld); component = _emberViewsViewsComponent.default.extend({ container: container, name: 'bob', layout: _emberTemplateCompilerSystemCompile.default('{{hello-world name}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), '1'); _emberMetalRun_loop.default(function () { component.set('name', 'sal'); }); equal(component.$().text(), '2'); }); QUnit.test('dashed helper compute is called for param changes', function () { var count = 0; var createCount = 0; var HelloWorld = _emberHtmlbarsHelper.default.extend({ init: function () { this._super.apply(this, arguments); // FIXME: Ideally, the helper instance does not need to be recreated // for change of params. createCount++; }, compute: function () { return ++count; } }); registry.register('helper:hello-world', HelloWorld); component = _emberViewsViewsComponent.default.extend({ container: container, name: 'bob', layout: _emberTemplateCompilerSystemCompile.default('{{hello-world name}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), '1'); _emberMetalRun_loop.default(function () { component.set('name', 'sal'); }); equal(component.$().text(), '2'); equal(createCount, 1, 'helper is only created once'); }); QUnit.test('dashed shorthand helper receives params, hash', function () { var params, hash; var HelloWorld = _emberHtmlbarsHelper.helper(function (_params, _hash) { params = _params; hash = _hash; }); registry.register('helper:hello-world', HelloWorld); component = _emberViewsViewsComponent.default.extend({ container: container, name: 'bob', layout: _emberTemplateCompilerSystemCompile.default('{{hello-world name "rich" last="sam"}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); equal(params[0], 'bob', 'first argument is bob'); equal(params[1], 'rich', 'second argument is rich'); equal(hash.last, 'sam', 'hash.last argument is sam'); }); QUnit.test('dashed helper receives params, hash', function () { var params, hash; var HelloWorld = _emberHtmlbarsHelper.default.extend({ compute: function (_params, _hash) { params = _params; hash = _hash; } }); registry.register('helper:hello-world', HelloWorld); component = _emberViewsViewsComponent.default.extend({ container: container, name: 'bob', layout: _emberTemplateCompilerSystemCompile.default('{{hello-world name "rich" last="sam"}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); equal(params[0], 'bob', 'first argument is bob'); equal(params[1], 'rich', 'second argument is rich'); equal(hash.last, 'sam', 'hash.last argument is sam'); }); QUnit.test('dashed helper usable in subexpressions', function () { var JoinWords = _emberHtmlbarsHelper.default.extend({ compute: function (params) { return params.join(' '); } }); registry.register('helper:join-words', JoinWords); component = _emberViewsViewsComponent.default.extend({ container: container, layout: _emberTemplateCompilerSystemCompile.default('{{join-words "Who"\n (join-words "overcomes" "by")\n "force"\n (join-words (join-words "hath overcome but" "half"))\n (join-words "his" (join-words "foe"))}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), 'Who overcomes by force hath overcome but half his foe'); }); QUnit.test('dashed helper not usable with a block', function () { var SomeHelper = _emberHtmlbarsHelper.helper(function () {}); registry.register('helper:some-helper', SomeHelper); component = _emberViewsViewsComponent.default.extend({ container: container, layout: _emberTemplateCompilerSystemCompile.default('{{#some-helper}}{{/some-helper}}') }).create(); expectAssertion(function () { _emberRuntimeTestsUtils.runAppend(component); }, /Helpers may not be used in the block form/); }); QUnit.test('dashed helper not usable within element', function () { var SomeHelper = _emberHtmlbarsHelper.helper(function () {}); registry.register('helper:some-helper', SomeHelper); component = _emberViewsViewsComponent.default.extend({ container: container, layout: _emberTemplateCompilerSystemCompile.default('
') }).create(); expectAssertion(function () { _emberRuntimeTestsUtils.runAppend(component); }, /Helpers may not be used in the element form/); }); QUnit.test('dashed helper is torn down', function () { var destroyCalled = 0; var SomeHelper = _emberHtmlbarsHelper.default.extend({ destroy: function () { destroyCalled++; this._super.apply(this, arguments); }, compute: function () { return 'must define a compute'; } }); registry.register('helper:some-helper', SomeHelper); component = _emberViewsViewsComponent.default.extend({ container: container, layout: _emberTemplateCompilerSystemCompile.default('{{some-helper}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); _emberRuntimeTestsUtils.runDestroy(component); equal(destroyCalled, 1, 'destroy called once'); }); QUnit.test('dashed helper used in subexpression can recompute', function () { var helper; var phrase = 'overcomes by'; var DynamicSegment = _emberHtmlbarsHelper.default.extend({ init: function () { this._super.apply(this, arguments); helper = this; }, compute: function () { return phrase; } }); var JoinWords = _emberHtmlbarsHelper.default.extend({ compute: function (params) { return params.join(' '); } }); registry.register('helper:dynamic-segment', DynamicSegment); registry.register('helper:join-words', JoinWords); component = _emberViewsViewsComponent.default.extend({ container: container, layout: _emberTemplateCompilerSystemCompile.default('{{join-words "Who"\n (dynamic-segment)\n "force"\n (join-words (join-words "hath overcome but" "half"))\n (join-words "his" (join-words "foe"))}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), 'Who overcomes by force hath overcome but half his foe'); phrase = 'believes his'; _emberMetalCore.default.run(function () { helper.recompute(); }); equal(component.$().text(), 'Who believes his force hath overcome but half his foe'); }); QUnit.test('dashed helper used in subexpression can recompute component', function () { var helper; var phrase = 'overcomes by'; var DynamicSegment = _emberHtmlbarsHelper.default.extend({ init: function () { this._super.apply(this, arguments); helper = this; }, compute: function () { return phrase; } }); var JoinWords = _emberHtmlbarsHelper.default.extend({ compute: function (params) { return params.join(' '); } }); registry.register('component-lookup:main', _emberViewsComponent_lookup.default); registry.register('component:some-component', _emberMetalCore.default.Component.extend({ layout: _emberTemplateCompilerSystemCompile.default('{{first}} {{second}} {{third}} {{fourth}} {{fifth}}') })); registry.register('helper:dynamic-segment', DynamicSegment); registry.register('helper:join-words', JoinWords); component = _emberViewsViewsComponent.default.extend({ container: container, layout: _emberTemplateCompilerSystemCompile.default('{{some-component first="Who"\n second=(dynamic-segment)\n third="force"\n fourth=(join-words (join-words "hath overcome but" "half"))\n fifth=(join-words "his" (join-words "foe"))}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); equal(component.$().text(), 'Who overcomes by force hath overcome but half his foe'); phrase = 'believes his'; _emberMetalCore.default.run(function () { helper.recompute(); }); equal(component.$().text(), 'Who believes his force hath overcome but half his foe'); }); QUnit.test('dashed helper used in subexpression is destroyed', function () { var destroyCount = 0; var DynamicSegment = _emberHtmlbarsHelper.default.extend({ phrase: 'overcomes by', compute: function () { return this.phrase; }, destroy: function () { destroyCount++; this._super.apply(this, arguments); } }); var JoinWords = _emberHtmlbarsHelper.helper(function (params) { return params.join(' '); }); registry.register('helper:dynamic-segment', DynamicSegment); registry.register('helper:join-words', JoinWords); component = _emberViewsViewsComponent.default.extend({ container: container, layout: _emberTemplateCompilerSystemCompile.default('{{join-words "Who"\n (dynamic-segment)\n "force"\n (join-words (join-words "hath overcome but" "half"))\n (join-words "his" (join-words "foe"))}}') }).create(); _emberRuntimeTestsUtils.runAppend(component); _emberRuntimeTestsUtils.runDestroy(component); equal(destroyCount, 1, 'destroy is called after a view is destroyed'); }); }); enifed('ember-htmlbars/tests/helpers/custom_helper_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/helpers'); test('ember-htmlbars/tests/helpers/custom_helper_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/helpers/custom_helper_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/helpers/custom_helper_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/helpers'); QUnit.test('ember-htmlbars/tests/helpers/custom_helper_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/helpers/custom_helper_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/helpers/debug_test', ['exports', 'ember-metal/core', 'ember-metal/logger', 'ember-views/views/view', 'ember-template-compiler/system/compile', 'ember-runtime/tests/utils'], function (exports, _emberMetalCore, _emberMetalLogger, _emberViewsViewsView, _emberTemplateCompilerSystemCompile, _emberRuntimeTestsUtils) { 'use strict'; var originalLookup = _emberMetalCore.default.lookup; var lookup; var originalLog, logCalls; var view; QUnit.module('Handlebars {{log}} helper', { setup: function () { _emberMetalCore.default.lookup = lookup = { Ember: _emberMetalCore.default }; originalLog = _emberMetalLogger.default.log; logCalls = []; _emberMetalLogger.default.log = function () { logCalls.push.apply(logCalls, arguments); }; }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(view); view = null; _emberMetalLogger.default.log = originalLog; _emberMetalCore.default.lookup = originalLookup; } }); QUnit.test('should be able to log multiple properties', function () { var context = { value: 'one', valueTwo: 'two' }; view = _emberViewsViewsView.default.create({ context: context, template: _emberTemplateCompilerSystemCompile.default('{{log value valueTwo}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$().text(), '', 'shouldn\'t render any text'); equal(logCalls[0], 'one'); equal(logCalls[1], 'two'); }); QUnit.test('should be able to log primitives', function () { var context = { value: 'one', valueTwo: 'two' }; view = _emberViewsViewsView.default.create({ context: context, template: _emberTemplateCompilerSystemCompile.default('{{log value "foo" 0 valueTwo true}}') }); _emberRuntimeTestsUtils.runAppend(view); equal(view.$().text(), '', 'shouldn\'t render any text'); strictEqual(logCalls[0], 'one'); strictEqual(logCalls[1], 'foo'); strictEqual(logCalls[2], 0); strictEqual(logCalls[3], 'two'); strictEqual(logCalls[4], true); }); }); // Ember.lookup enifed('ember-htmlbars/tests/helpers/debug_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/helpers'); test('ember-htmlbars/tests/helpers/debug_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/helpers/debug_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/helpers/debug_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/helpers'); QUnit.test('ember-htmlbars/tests/helpers/debug_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/helpers/debug_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/helpers/each_in_test', ['exports', 'ember-metal/features', 'ember-views/views/component', 'ember-template-compiler/system/compile', 'ember-metal/run_loop', 'ember-runtime/tests/utils'], function (exports, _emberMetalFeatures, _emberViewsViewsComponent, _emberTemplateCompilerSystemCompile, _emberMetalRun_loop, _emberRuntimeTestsUtils) { 'use strict'; var component; QUnit.module('ember-htmlbars: {{#each-in}} helper', { teardown: function () { if (component) { _emberRuntimeTestsUtils.runDestroy(component); } } }); function renderTemplate(_template, props) { var template = _emberTemplateCompilerSystemCompile.default(_template); component = _emberViewsViewsComponent.default.create(props, { layout: template }); _emberRuntimeTestsUtils.runAppend(component); } QUnit.test('it renders the template for each item in a hash', function (assert) { var categories = { 'Smartphones': 8203, 'JavaScript Frameworks': Infinity }; renderTemplate('\n
    \n {{#each-in categories as |category count|}}\n
  • {{category}}: {{count}}
  • \n {{/each-in}}\n
\n ', { categories: categories }); assert.equal(component.$('li').length, 2, 'renders 2 lis'); assert.equal(component.$('li').first().text(), 'Smartphones: 8203', 'renders first item correctly'); assert.equal(component.$('li:eq(1)').text(), 'JavaScript Frameworks: Infinity', 'renders second item correctly'); _emberMetalRun_loop.default(function () { component.rerender(); }); assert.equal(component.$('li').length, 2, 'renders 2 lis after rerender'); assert.equal(component.$('li').first().text(), 'Smartphones: 8203', 'renders first item correctly after rerender'); assert.equal(component.$('li:eq(1)').text(), 'JavaScript Frameworks: Infinity', 'renders second item correctly after rerender'); _emberMetalRun_loop.default(function () { component.set('categories', { 'Smartphones': 100 }); }); assert.equal(component.$('li').length, 1, 'removes unused item after data changes'); assert.equal(component.$('li').first().text(), 'Smartphones: 100', 'correctly updates item after data changes'); _emberMetalRun_loop.default(function () { component.set('categories', { 'Programming Languages': 199303, 'Good Programming Languages': 123, 'Bad Programming Languages': 456 }); }); assert.equal(component.$('li').length, 3, 'renders 3 lis after updating data'); assert.equal(component.$('li').first().text(), 'Programming Languages: 199303', 'renders first item correctly after rerender'); assert.equal(component.$('li:eq(1)').text(), 'Good Programming Languages: 123', 'renders second item correctly after rerender'); assert.equal(component.$('li:eq(2)').text(), 'Bad Programming Languages: 456', 'renders third item correctly after rerender'); }); QUnit.test('it only iterates over an object\'s own properties', function (assert) { var protoCategories = { 'Smartphones': 8203, 'JavaScript Frameworks': Infinity }; var categories = Object.create(protoCategories); categories['Televisions'] = 183; categories['Alarm Clocks'] = 999; renderTemplate('\n
    \n {{#each-in categories as |category count|}}\n
  • {{category}}: {{count}}
  • \n {{/each-in}}\n
\n ', { categories: categories }); assert.equal(component.$('li').length, 2, 'renders 2 lis'); assert.equal(component.$('li').first().text(), 'Televisions: 183', 'renders first item correctly'); assert.equal(component.$('li:eq(1)').text(), 'Alarm Clocks: 999', 'renders second item correctly'); _emberMetalRun_loop.default(function () { return component.rerender(); }); assert.equal(component.$('li').length, 2, 'renders 2 lis after rerender'); assert.equal(component.$('li').first().text(), 'Televisions: 183', 'renders first item correctly after rerender'); assert.equal(component.$('li:eq(1)').text(), 'Alarm Clocks: 999', 'renders second item correctly after rerender'); }); QUnit.test('it emits nothing if the passed argument is not an object', function (assert) { var categories = null; renderTemplate('\n
    \n {{#each-in categories as |category count|}}\n
  • {{category}}: {{count}}
  • \n {{/each-in}}\n
\n ', { categories: categories }); assert.equal(component.$('li').length, 0, 'nothing is rendered if the object is not passed'); _emberMetalRun_loop.default(function () { return component.rerender(); }); assert.equal(component.$('li').length, 0, 'nothing is rendered if the object is not passed after rerender'); }); QUnit.test('it supports rendering an inverse', function (assert) { var categories = null; renderTemplate('\n
    \n {{#each-in categories as |category count|}}\n
  • {{category}}: {{count}}
  • \n {{else}}\n
  • No categories.
  • \n {{/each-in}}\n
\n ', { categories: categories }); assert.equal(component.$('li').length, 1, 'one li is rendered'); assert.equal(component.$('li').text(), 'No categories.', 'the inverse is rendered'); _emberMetalRun_loop.default(function () { return component.rerender(); }); assert.equal(component.$('li').length, 1, 'one li is rendered'); assert.equal(component.$('li').text(), 'No categories.', 'the inverse is rendered'); _emberMetalRun_loop.default(function () { component.set('categories', { 'First Category': 123 }); }); assert.equal(component.$('li').length, 1, 'one li is rendered'); assert.equal(component.$('li').text(), 'First Category: 123', 'the list is rendered after being set'); _emberMetalRun_loop.default(function () { component.set('categories', null); }); assert.equal(component.$('li').length, 1, 'one li is rendered'); assert.equal(component.$('li').text(), 'No categories.', 'the inverse is rendered when the value becomes falsey again'); }); }); enifed('ember-htmlbars/tests/helpers/each_in_test.jscs-test', ['exports'], function (exports) { 'use strict'; module('JSCS - ember-htmlbars/tests/helpers'); test('ember-htmlbars/tests/helpers/each_in_test.js should pass jscs', function () { ok(true, 'ember-htmlbars/tests/helpers/each_in_test.js should pass jscs.'); }); }); enifed('ember-htmlbars/tests/helpers/each_in_test.jshint', ['exports'], function (exports) { 'use strict'; QUnit.module('JSHint - ember-htmlbars/tests/helpers'); QUnit.test('ember-htmlbars/tests/helpers/each_in_test.js should pass jshint', function (assert) { assert.expect(1); assert.ok(true, 'ember-htmlbars/tests/helpers/each_in_test.js should pass jshint.'); }); }); enifed('ember-htmlbars/tests/helpers/each_test', ['exports', 'ember-metal/core', 'ember-runtime/system/object', 'ember-metal/run_loop', 'ember-views/views/view', 'ember-views/views/legacy_each_view', 'ember-runtime/system/native_array', 'ember-runtime/controllers/controller', 'ember-runtime/system/container', 'ember-metal/property_set', 'ember-runtime/tests/utils', 'ember-template-compiler/system/compile', 'ember-htmlbars/tests/utils', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-htmlbars/keywords/view'], function (exports, _emberMetalCore, _emberRuntimeSystemObject, _emberMetalRun_loop, _emberViewsViewsView, _emberViewsViewsLegacy_each_view, _emberRuntimeSystemNative_array, _emberRuntimeControllersController, _emberRuntimeSystemContainer, _emberMetalProperty_set, _emberRuntimeTestsUtils, _emberTemplateCompilerSystemCompile, _emberHtmlbarsTestsUtils, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberHtmlbarsKeywordsView) { /*jshint newcap:false*/ 'use strict'; var people, view, registry, container; var template, templateMyView, MyView, MyEmptyView, templateMyEmptyView; var originalViewKeyword; var originalLookup = _emberMetalCore.default.lookup; var lookup; QUnit.module('the #each helper', { setup: function () { _emberMetalCore.default.lookup = lookup = { Ember: _emberMetalCore.default }; originalViewKeyword = _emberHtmlbarsTestsUtils.registerKeyword('view', _emberHtmlbarsKeywordsView.default); _emberHtmlbarsTestsUtils.registerAstPlugin(_emberTemplateCompilerPluginsTransformEachIntoCollection.default); template = _emberTemplateCompilerSystemCompile.default('{{#each view.people as |person|}}{{person.name}}{{/each}}'); people = _emberRuntimeSystemNative_array.A([{ name: 'Steve Holt' }, { name: 'Annabelle' }]); registry = new _emberRuntimeSystemContainer.Registry(); container = registry.container(); registry.register('view:toplevel', _emberViewsViewsView.default.extend()); registry.register('view:-legacy-each', _emberViewsViewsLegacy_each_view.default); view = _emberViewsViewsView.default.create({ container: container, template: template, people: people }); templateMyView = _emberTemplateCompilerSystemCompile.default('{{name}}'); lookup.MyView = MyView = _emberViewsViewsView.default.extend({ template: templateMyView }); registry.register('view:my-view', MyView); templateMyEmptyView = _emberTemplateCompilerSystemCompile.default('I\'m empty'); lookup.MyEmptyView = MyEmptyView = _emberViewsViewsView.default.extend({ template: templateMyEmptyView }); registry.register('view:my-empty-view', MyEmptyView); _emberRuntimeTestsUtils.runAppend(view); }, teardown: function () { _emberRuntimeTestsUtils.runDestroy(container); _emberRuntimeTestsUtils.runDestroy(view); registry = container = view = null; _emberMetalCore.default.lookup = originalLookup; _emberHtmlbarsTestsUtils.removeAstPlugin(_emberTemplateCompilerPluginsTransformEachIntoCollection.default); _emberHtmlbarsTestsUtils.resetKeyword('view', originalViewKeyword); } }); var assertHTML = function (view, expectedHTML) { var html = view.$().html(); // IE 8 (and prior?) adds the \r\n html = html.replace(/]*><\/script>/ig, '').replace(/[\r\n]/g, ''); equal(html, expectedHTML); }; var assertText = function (view, expectedText) { equal(view.$().text(), expectedText); }; QUnit.test('it renders the template for each item in an array', function () { assertHTML(view, 'Steve HoltAnnabelle'); }); QUnit.test('it updates the view if an item is added', function () { _emberMetalRun_loop.default(function () { people.pushObject({ name: 'Tom Dale' }); }); assertHTML(view, 'Steve HoltAnnabelleTom Dale'); }); QUnit.test('it updates the view if an item is removed', function () { _emberMetalRun_loop.default(function () { people.removeAt(0); }); assertHTML(view, 'Annabelle'); }); QUnit.test('it updates the view if an item is replaced', function () { _emberMetalRun_loop.default(function () { people.removeAt(0); people.insertAt(0, { name: 'Kazuki' }); }); assertHTML(view, 'KazukiAnnabelle'); }); QUnit.test('can add and replace in the same runloop', function () { _emberMetalRun_loop.default(function () { people.pushObject({ name: 'Tom Dale' }); people.removeAt(0); people.insertAt(0, { name: 'Kazuki' }); }); assertHTML(view, 'KazukiAnnabelleTom Dale'); }); QUnit.test('can add and replace the object before the add in the same runloop', function () { _emberMetalRun_loop.default(function () { people.pushObject({ name: 'Tom Dale' }); people.removeAt(1); people.insertAt(1, { name: 'Kazuki' }); }); assertHTML(view, 'Steve HoltKazukiTom Dale'); }); QUnit.test('can add and replace complicatedly', function () { _emberMetalRun_loop.default(function () { people.pushObject({ name: 'Tom Dale' }); people.removeAt(1); people.insertAt(1, { name: 'Kazuki' }); people.pushObject({ name: 'Firestone' }); people.pushObject({ name: 'McMunch' }); people.removeAt(3); }); assertHTML(view, 'Steve HoltKazukiTom DaleMcMunch'); }); QUnit.test('can add and replace complicatedly harder', function () { _emberMetalRun_loop.default(function () { people.pushObject({ name: 'Tom Dale' }); people.removeAt(1); people.insertAt(1, { name: 'Kazuki' }); people.pushObject({ name: 'Firestone' }); people.pushObject({ name: 'McMunch' }); people.removeAt(2); }); assertHTML(view, 'Steve HoltKazukiFirestoneMcMunch'); }); QUnit.test('it does not mark each option tag as selected', function () { var selectView = _emberViewsViewsView.default.create({ template: _emberTemplateCompilerSystemCompile.default(''), people: people }); _emberRuntimeTestsUtils.runAppend(selectView); equal(selectView.$('option').length, 3, 'renders 3