Skip to content

Commit

Permalink
Merge pull request #11854 from rwjblue/deprecation-cleanup
Browse files Browse the repository at this point in the history
[CLEANUP beta] Lots of deprecation removals.
  • Loading branch information
stefanpenner committed Jul 21, 2015
2 parents 9787c73 + 836e706 commit 76f3238
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 283 deletions.
2 changes: 0 additions & 2 deletions packages/ember-htmlbars/lib/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ import partial from 'ember-htmlbars/keywords/partial';
import input from 'ember-htmlbars/keywords/input';
import textarea from 'ember-htmlbars/keywords/textarea';
import collection from 'ember-htmlbars/keywords/collection';
import templateKeyword from 'ember-htmlbars/keywords/template';
import legacyYield from 'ember-htmlbars/keywords/legacy-yield';
import mut, { privateMut } from 'ember-htmlbars/keywords/mut';
import each from 'ember-htmlbars/keywords/each';
Expand All @@ -90,7 +89,6 @@ registerKeyword('outlet', outlet);
registerKeyword('unbound', unbound);
registerKeyword('component', componentKeyword);
registerKeyword('partial', partial);
registerKeyword('template', templateKeyword);
registerKeyword('input', input);
registerKeyword('textarea', textarea);
registerKeyword('collection', collection);
Expand Down
9 changes: 0 additions & 9 deletions packages/ember-htmlbars/lib/keywords/template.js

This file was deleted.

13 changes: 1 addition & 12 deletions packages/ember-htmlbars/lib/utils/decode-each-key.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Ember from 'ember-metal/core';
import { get } from 'ember-metal/property_get';
import { guidFor } from 'ember-metal/utils';

Expand All @@ -15,20 +14,12 @@ function identity(item) {
return key;
}
export default function decodeEachKey(item, keyPath, index) {
var key, deprecatedSpecialKey;
var key;

switch (keyPath) {
case '@index':
key = index;
break;
case '@guid':
deprecatedSpecialKey = '@guid';
key = guidFor(item);
break;
case '@item':
deprecatedSpecialKey = '@item';
key = item;
break;
case '@identity':
key = identity(item);
break;
Expand All @@ -44,7 +35,5 @@ export default function decodeEachKey(item, keyPath, index) {
key = String(key);
}

Ember.deprecate(`Using '${deprecatedSpecialKey}' with the {{each}} helper, is deprecated. Switch to '@identity' or remove 'key=' from your template.`, !deprecatedSpecialKey, { id: 'ember-htmlbars.deprecated-special-each-key', until: '3.0.0' });

return key;
}
39 changes: 0 additions & 39 deletions packages/ember-htmlbars/tests/helpers/each_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -723,44 +723,6 @@ QUnit.test('can specify `@index` to represent the items index in the array being
equal(view.$().text(), '123');
});

QUnit.test('can specify `@guid` to represent the items GUID [DEPRECATED]', function() {
expectDeprecation(`Using '@guid' with the {{each}} helper, is deprecated. Switch to '@identity' or remove 'key=' from your template.`);

runDestroy(view);
view = EmberView.create({
items: [
{ id: 1 },
{ id: 2 },
{ id: 3 }
],
template: compile('{{#each view.items key=\'@guid\' as |item|}}{{item.id}}{{/each}}')
});

runAppend(view);

equal(view.$().text(), '123');
});

QUnit.test('can specify `@item` to represent primitive items', function() {
expectDeprecation(`Using '@item' with the {{each}} helper, is deprecated. Switch to '@identity' or remove 'key=' from your template.`);

runDestroy(view);
view = EmberView.create({
items: [1, 2, 3],
template: compile('{{#each view.items key=\'@item\' as |item|}}{{item}}{{/each}}')
});

runAppend(view);

equal(view.$().text(), '123');

run(function() {
set(view, 'items', ['foo', 'bar', 'baz']);
});

equal(view.$().text(), 'foobarbaz');
});

QUnit.test('can specify `@identity` to represent primitive items', function() {
runDestroy(view);
view = EmberView.create({
Expand Down Expand Up @@ -830,4 +792,3 @@ QUnit.test('pushing a new duplicate key will trigger a useful error (temporary u
`Duplicate key found ('a') for '{{each}}' helper, please use a unique key or switch to '{{#each model key="@index"}}{{/each}}'.`
);
});

63 changes: 0 additions & 63 deletions packages/ember-htmlbars/tests/helpers/template_test.js

This file was deleted.

7 changes: 0 additions & 7 deletions packages/ember-metal/lib/libraries.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ Libraries.prototype = {
index = this._registry.indexOf(lib);
this._registry.splice(index, 1);
}
},

each(callback) {
Ember.deprecate('Using Ember.libraries.each() is deprecated. Access to a list of registered libraries is currently a private API. If you are not knowingly accessing this method, your out-of-date Ember Inspector may be doing so.', false, { id: 'ember-metal.libraries-each', until: '3.0.0' });
this._registry.forEach((lib) => {
callback(lib.name, lib.version);
});
}
};

Expand Down
5 changes: 0 additions & 5 deletions packages/ember-metal/lib/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import Ember from 'ember-metal/core';
import { guidFor } from 'ember-metal/utils';
import { deprecateProperty } from 'ember-metal/deprecate_property';

function missingFunction(fn) {
throw new TypeError(`${Object.prototype.toString.call(fn)} is not a function`);
Expand Down Expand Up @@ -223,8 +222,6 @@ OrderedSet.prototype = {
}
};

deprecateProperty(OrderedSet.prototype, 'length', 'size', { id: 'ember-metal.ordered-set-length', until: '3.0.0' });

/**
A Map stores values indexed by keys. Unlike JavaScript's
default Objects, the keys of a Map can be any JavaScript
Expand Down Expand Up @@ -422,8 +419,6 @@ Map.prototype = {
}
};

deprecateProperty(Map.prototype, 'length', 'size', { id: 'ember-metal.map-length', until: '3.0.0' });

/**
@class MapWithDefault
@namespace Ember
Expand Down
19 changes: 0 additions & 19 deletions packages/ember-metal/tests/libraries_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,3 @@ QUnit.test('libraries can be de-registered', function() {
equal(registry[0].name, 'lib2');
equal(registry.length, 1);
});


QUnit.test('Libraries#each allows us to loop through each registered library (but is deprecated)', function() {
expect(5);

var items = [{ name: 'lib1', version: '1.0.0' }, { name: 'lib2', version: '2.0.0' }];

for (var i = 0, l = items.length; i < l; i++) {
libs.register(items[i].name, items[i].version);
}

expectDeprecation(function() {
libs.each(function (name, version) {
var expectedLib = items.shift();
equal(expectedLib.name, name);
equal(expectedLib.version, version);
});
}, 'Using Ember.libraries.each() is deprecated. Access to a list of registered libraries is currently a private API. If you are not knowingly accessing this method, your out-of-date Ember Inspector may be doing so.');
});
35 changes: 0 additions & 35 deletions packages/ember-metal/tests/map_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,41 +185,6 @@ function testMap(nameAndFunc) {
mapHasEntries([], map2);
});

QUnit.test('length', function() {
expectDeprecation('Usage of `length` is deprecated, use `size` instead.');

//Add a key twice
equal(map.length, 0);
map.set(string, 'a string');
equal(map.length, 1);
map.set(string, 'the same string');
equal(map.length, 1);

//Add another
map.set(number, 'a number');
equal(map.length, 2);

//Remove one that doesn't exist
map.delete('does not exist');
equal(map.length, 2);

//Check copy
var copy = map.copy();
equal(copy.length, 2);

//Remove a key twice
map.delete(number);
equal(map.length, 1);
map.delete(number);
equal(map.length, 1);

//Remove the last key
map.delete(string);
equal(map.length, 0);
map.delete(string);
equal(map.length, 0);
});

QUnit.test('size', function() {
//Add a key twice
equal(map.size, 0);
Expand Down
29 changes: 0 additions & 29 deletions packages/ember-routing/lib/location/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,35 +156,6 @@ export default {
return implementationClass.create(...arguments);
},

/**
This is deprecated in favor of using the container to register the
location implementation as desired.
Example:
```javascript
Application.initializer({
name: "history-test-location",
initialize: function(container, application) {
application.register('location:history-test', HistoryTestLocation);
}
});
```
@method registerImplementation
@param {String} name
@param {Object} implementation of the `location` API
@deprecated Register your custom location implementation with the
container directly.
@private
*/
registerImplementation(name, implementation) {
Ember.deprecate(`Using the Ember.Location.registerImplementation is no longer supported. Register your custom location implementation with the container instead.`, false, { id: 'ember-routing.register-implementation', until: '3.0.0' });

this.implementations[name] = implementation;
},

implementations: {},
_location: environment.location,

Expand Down
60 changes: 25 additions & 35 deletions packages/ember-routing/lib/system/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -1188,50 +1188,40 @@ var Route = EmberObject.extend(ActionHandler, Evented, {
this.controller = controller;
}

if (this.setupControllers) {
Ember.deprecate('Ember.Route.setupControllers is deprecated. Please use Ember.Route.setupController(controller, model) instead.', false, { id: 'ember-routing.route-setup-controllers', until: '3.0.0' });
this.setupControllers(controller, context);
} else {
var queryParams = get(this, '_qp');
var queryParams = get(this, '_qp');

var states = queryParams.states;
if (transition) {
// Update the model dep values used to calculate cache keys.
stashParamNames(this.router, transition.state.handlerInfos);
var states = queryParams.states;
if (transition) {
// Update the model dep values used to calculate cache keys.
stashParamNames(this.router, transition.state.handlerInfos);

var params = transition.params;
var allParams = queryParams.propertyNames;
var cache = this._bucketCache;
var params = transition.params;
var allParams = queryParams.propertyNames;
var cache = this._bucketCache;

allParams.forEach(function(prop) {
var aQp = queryParams.map[prop];
allParams.forEach(function(prop) {
var aQp = queryParams.map[prop];

aQp.values = params;
var cacheKey = calculateCacheKey(aQp.prefix, aQp.parts, aQp.values);
aQp.values = params;
var cacheKey = calculateCacheKey(aQp.prefix, aQp.parts, aQp.values);

if (cache) {
var value = cache.lookup(cacheKey, prop, aQp.undecoratedDefaultValue);
set(controller, prop, value);
}
});
}

controller._qpDelegate = states.allowOverrides;
if (cache) {
var value = cache.lookup(cacheKey, prop, aQp.undecoratedDefaultValue);
set(controller, prop, value);
}
});
}

if (transition) {
var qpValues = getQueryParamsFor(this, transition.state);
controller.setProperties(qpValues);
}
controller._qpDelegate = states.allowOverrides;

this.setupController(controller, context, transition);
if (transition) {
var qpValues = getQueryParamsFor(this, transition.state);
controller.setProperties(qpValues);
}

if (this.renderTemplates) {
Ember.deprecate('Ember.Route.renderTemplates is deprecated. Please use Ember.Route.renderTemplate(controller, model) instead.', false, { id: 'ember-routing.route-render-templates', until: '3.0.0' });
this.renderTemplates(context);
} else {
this.renderTemplate(controller, context);
}
this.setupController(controller, context, transition);

this.renderTemplate(controller, context);
},

/*
Expand Down
Loading

0 comments on commit 76f3238

Please sign in to comment.