Skip to content

Commit

Permalink
Use single quotes in ember and enforce it
Browse files Browse the repository at this point in the history
  • Loading branch information
jayphelps committed Jun 16, 2015
1 parent 6d6d9a8 commit 6e9c3f0
Show file tree
Hide file tree
Showing 592 changed files with 10,289 additions and 10,288 deletions.
1 change: 1 addition & 0 deletions .jscsrc
Expand Up @@ -35,6 +35,7 @@
"requireSpaceBeforeBlockStatements": true,
"validateIndentation": 2,
"validateParameterSeparator": ", ",
"validateQuoteMarks": "'",
"requireSpaceBeforeKeywords": [
"else",
"while",
Expand Down
4 changes: 2 additions & 2 deletions packages/container/lib/container.js
@@ -1,5 +1,5 @@
import Ember from 'ember-metal/core'; // Ember.assert
import emberKeys from "ember-metal/keys";
import emberKeys from 'ember-metal/keys';
import dictionary from 'ember-metal/dictionary';

// TODO - Temporary workaround for v0.4.0 of the ES6 transpiler, which lacks support for circular dependencies.
Expand All @@ -21,7 +21,7 @@ var Registry;
*/
function Container(registry, options) {
this._registry = registry || (function() {
Ember.deprecate("A container should only be created for an already instantiated registry. For backward compatibility, an isolated registry will be instantiated just for this container.");
Ember.deprecate('A container should only be created for an already instantiated registry. For backward compatibility, an isolated registry will be instantiated just for this container.');

// TODO - See note above about transpiler import workaround.
if (!Registry) { Registry = requireModule('container/registry')['default']; }
Expand Down
8 changes: 4 additions & 4 deletions packages/container/lib/registry.js
@@ -1,5 +1,5 @@
import Ember from 'ember-metal/core'; // Ember.assert
import isEnabled from "ember-metal/features";
import isEnabled from 'ember-metal/features';
import dictionary from 'ember-metal/dictionary';
import keys from 'ember-metal/keys';
import { assign } from 'ember-metal/merge';
Expand Down Expand Up @@ -187,7 +187,7 @@ Registry.prototype = {
Ember.assert('Create a container on the registry (with `registry.container()`) before calling `lookup`.', this._defaultContainer);

if (instanceInitializersFeatureEnabled) {
Ember.deprecate('`lookup` was called on a Registry. The `initializer` API no longer receives a container, and you should use an `instanceInitializer` to look up objects from the container.', false, { url: "http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers" });
Ember.deprecate('`lookup` was called on a Registry. The `initializer` API no longer receives a container, and you should use an `instanceInitializer` to look up objects from the container.', false, { url: 'http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers' });
}

return this._defaultContainer.lookup(fullName, options);
Expand All @@ -197,7 +197,7 @@ Registry.prototype = {
Ember.assert('Create a container on the registry (with `registry.container()`) before calling `lookupFactory`.', this._defaultContainer);

if (instanceInitializersFeatureEnabled) {
Ember.deprecate('`lookupFactory` was called on a Registry. The `initializer` API no longer receives a container, and you should use an `instanceInitializer` to look up objects from the container.', false, { url: "http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers" });
Ember.deprecate('`lookupFactory` was called on a Registry. The `initializer` API no longer receives a container, and you should use an `instanceInitializer` to look up objects from the container.', false, { url: 'http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers' });
}

return this._defaultContainer.lookupFactory(fullName);
Expand Down Expand Up @@ -749,7 +749,7 @@ Registry.prototype = {

for (var key in hash) {
if (hash.hasOwnProperty(key)) {
Ember.assert("Expected a proper full name, given '" + hash[key] + "'", this.validateFullName(hash[key]));
Ember.assert('Expected a proper full name, given \'' + hash[key] + '\'', this.validateFullName(hash[key]));

injections.push({
property: key,
Expand Down
2 changes: 1 addition & 1 deletion packages/container/tests/container_helper.js
Expand Up @@ -22,7 +22,7 @@ var factory = function() {
};

Klass.prototype.toString = function() {
return "<Factory:" + this._guid + ">";
return '<Factory:' + this._guid + '>';
};

Klass.create = create;
Expand Down
108 changes: 54 additions & 54 deletions packages/container/tests/container_test.js

Large diffs are not rendered by default.

94 changes: 47 additions & 47 deletions packages/container/tests/registry_test.js
Expand Up @@ -8,7 +8,7 @@ import {

var originalModelInjections;

QUnit.module("Registry", {
QUnit.module('Registry', {
setup() {
originalModelInjections = Ember.MODEL_FACTORY_INJECTIONS;
},
Expand All @@ -17,7 +17,7 @@ QUnit.module("Registry", {
}
});

QUnit.test("A registered factory is returned from resolve", function() {
QUnit.test('A registered factory is returned from resolve', function() {
var registry = new Registry();
var PostController = factory();

Expand All @@ -26,10 +26,10 @@ QUnit.test("A registered factory is returned from resolve", function() {
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");
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() {
QUnit.test('The registered factory returned from resolve is the same factory each time', function() {
var registry = new Registry();
var PostController = factory();

Expand All @@ -38,17 +38,17 @@ QUnit.test("The registered factory returned from resolve is the same factory eac
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() {
QUnit.test('A registered factory returns true for `has` if an item is registered', function() {
var registry = new Registry();
var PostController = 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");
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() {
QUnit.test('Throw exception when trying to inject `type:thing` on all type(s)', function() {
var registry = new Registry();
var PostController = factory();

Expand All @@ -59,7 +59,7 @@ QUnit.test("Throw exception when trying to inject `type:thing` on all type(s)",
}, 'Cannot inject a `controller:post` on other controller(s).');
});

QUnit.test("The registry can take a hook to resolve factories lazily", function() {
QUnit.test('The registry can take a hook to resolve factories lazily', function() {
var registry = new Registry();
var PostController = factory();

Expand All @@ -69,10 +69,10 @@ QUnit.test("The registry can take a hook to resolve factories lazily", function(
}
};

strictEqual(registry.resolve('controller:post'), PostController, "The correct factory was provided");
strictEqual(registry.resolve('controller:post'), PostController, 'The correct factory was provided');
});

QUnit.test("The registry respects the resolver hook for `has`", function() {
QUnit.test('The registry respects the resolver hook for `has`', function() {
var registry = new Registry();
var PostController = factory();

Expand All @@ -82,10 +82,10 @@ QUnit.test("The registry respects the resolver hook for `has`", function() {
}
};

ok(registry.has('controller:post'), "the `has` method uses the resolver hook");
ok(registry.has('controller:post'), 'the `has` method uses the resolver hook');
});

QUnit.test("The registry normalizes names when resolving", function() {
QUnit.test('The registry normalizes names when resolving', function() {
var registry = new Registry();
var PostController = factory();

Expand All @@ -96,10 +96,10 @@ QUnit.test("The registry normalizes names when resolving", function() {
registry.register('controller:post', PostController);
var type = registry.resolve('controller:normalized');

strictEqual(type, PostController, "Normalizes the name when resolving");
strictEqual(type, PostController, 'Normalizes the name when resolving');
});

QUnit.test("The registry normalizes names when checking if the factory is registered", function() {
QUnit.test('The registry normalizes names when checking if the factory is registered', function() {
var registry = new Registry();
var PostController = factory();

Expand All @@ -110,10 +110,10 @@ QUnit.test("The registry normalizes names when checking if the factory is regist
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");
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() {
QUnit.test('validateFullName throws an error if name is incorrect', function() {
var registry = new Registry();
var PostController = factory();

Expand All @@ -127,7 +127,7 @@ QUnit.test("validateFullName throws an error if name is incorrect", function() {
}, 'TypeError: Invalid Fullname, expected: `type:name` got: post');
});

QUnit.test("The registry normalizes names when injecting", function() {
QUnit.test('The registry normalizes names when injecting', function() {
var registry = new Registry();
var PostController = factory();
var user = { name: 'Stef' };
Expand All @@ -140,18 +140,18 @@ QUnit.test("The registry normalizes names when injecting", function() {
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");
deepEqual(registry.resolve('controller:post'), user, 'Normalizes the name when injecting');
});

QUnit.test("cannot register an `undefined` factory", function() {
QUnit.test('cannot register an `undefined` factory', function() {
var registry = new Registry();

throws(function() {
registry.register('controller:apple', undefined);
}, '');
});

QUnit.test("can re-register a factory", function() {
QUnit.test('can re-register a factory', function() {
var registry = new Registry();
var FirstApple = factory('first');
var SecondApple = factory('second');
Expand All @@ -162,7 +162,7 @@ QUnit.test("can re-register a factory", function() {
ok(registry.resolve('controller:apple').create() instanceof SecondApple);
});

QUnit.test("cannot re-register a factory if it has been resolved", function() {
QUnit.test('cannot re-register a factory if it has been resolved', function() {
var registry = new Registry();
var FirstApple = factory('first');
var SecondApple = factory('second');
Expand Down Expand Up @@ -213,7 +213,7 @@ QUnit.test('once resolved, always return the same result', function() {
equal(registry.resolve('models:bar'), Bar);
});

QUnit.test("factory resolves are cached", function() {
QUnit.test('factory resolves are cached', function() {
var registry = new Registry();
var PostController = factory();
var resolveWasCalled = [];
Expand All @@ -230,7 +230,7 @@ QUnit.test("factory resolves are cached", function() {
deepEqual(resolveWasCalled, ['controller:post']);
});

QUnit.test("factory for non extendables (MODEL) resolves are cached", function() {
QUnit.test('factory for non extendables (MODEL) resolves are cached', function() {
var registry = new Registry();
var PostController = factory();
var resolveWasCalled = [];
Expand All @@ -247,7 +247,7 @@ QUnit.test("factory for non extendables (MODEL) resolves are cached", function()
deepEqual(resolveWasCalled, ['model:post']);
});

QUnit.test("factory for non extendables resolves are cached", function() {
QUnit.test('factory for non extendables resolves are cached', function() {
var registry = new Registry();
var PostController = {};
var resolveWasCalled = [];
Expand All @@ -264,19 +264,19 @@ QUnit.test("factory for non extendables resolves are cached", function() {
deepEqual(resolveWasCalled, ['foo:post']);
});

QUnit.test("registry.container creates an associated container", function() {
QUnit.test('registry.container creates an associated container', function() {
var registry = new Registry();
var PostController = 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");
strictEqual(registry._defaultContainer, container, "_defaultContainer is set to the first created container and used for Ember 1.x Container compatibility");
ok(postController instanceof PostController, 'The lookup is an instance of the registered factory');
strictEqual(registry._defaultContainer, container, '_defaultContainer is set to the first created container and used for Ember 1.x Container compatibility');
});

QUnit.test("`resolve` can be handled by a fallback registry", function() {
QUnit.test('`resolve` can be handled by a fallback registry', function() {
var fallback = new Registry();

var registry = new Registry({ fallback: fallback });
Expand All @@ -287,66 +287,66 @@ QUnit.test("`resolve` can be handled by a fallback registry", function() {
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");
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() {
QUnit.test('`has` can be handled by a fallback registry', function() {
var fallback = new Registry();

var registry = new Registry({ fallback: fallback });
var PostController = factory();

fallback.register('controller:post', PostController);

equal(registry.has('controller:post'), true, "Fallback registry is checked for registration");
equal(registry.has('controller:post'), true, 'Fallback registry is checked for registration');
});

QUnit.test("`getInjections` includes injections from a fallback registry", function() {
QUnit.test('`getInjections` includes injections from a fallback registry', function() {
var fallback = new Registry();
var registry = new Registry({ fallback: fallback });

equal(registry.getInjections('model:user').length, 0, "No injections in the primary registry");
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");
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() {
QUnit.test('`getTypeInjections` includes type injections from a fallback registry', function() {
var fallback = new Registry();
var registry = new Registry({ fallback: fallback });

equal(registry.getTypeInjections('model').length, 0, "No injections in the primary registry");
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");
equal(registry.getTypeInjections('model').length, 1, 'Injections from the fallback registry are merged');
});

QUnit.test("`getFactoryInjections` includes factory injections from a fallback registry", function() {
QUnit.test('`getFactoryInjections` includes factory injections from a fallback registry', function() {
var fallback = new Registry();
var registry = new Registry({ fallback: fallback });

equal(registry.getFactoryInjections('model:user').length, 0, "No factory injections in the primary registry");
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");
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() {
QUnit.test('`getFactoryTypeInjections` includes factory type injections from a fallback registry', function() {
var fallback = new Registry();
var registry = new Registry({ fallback: fallback });

equal(registry.getFactoryTypeInjections('model').length, 0, "No factory type injections in the primary registry");
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");
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() {
QUnit.test('`knownForType` contains keys for each item of a given type', function() {
let registry = new Registry();

registry.register('foo:bar-baz', 'baz');
Expand All @@ -360,7 +360,7 @@ QUnit.test("`knownForType` contains keys for each item of a given type", functio
});
});

QUnit.test("`knownForType` includes fallback registry results", function() {
QUnit.test('`knownForType` includes fallback registry results', function() {
var fallback = new Registry();
var registry = new Registry({ fallback: fallback });

Expand All @@ -377,7 +377,7 @@ QUnit.test("`knownForType` includes fallback registry results", function() {
});
});

QUnit.test("`knownForType` is called on the resolver if present", function() {
QUnit.test('`knownForType` is called on the resolver if present', function() {
expect(3);

function resolver() { }
Expand Down

0 comments on commit 6e9c3f0

Please sign in to comment.