Skip to content

Commit

Permalink
Fix tests for newly deprecated things.
Browse files Browse the repository at this point in the history
* `TrackedArray`  and `SubArray` are still used by the RC/AC implementation in 1.13.x,
  but it should not trigger a `TrackedArray` deprecation.
* Fix a few tests that were using `{{with}}` and `controller=`.
  • Loading branch information
rwjblue committed Aug 8, 2015
1 parent 58eff24 commit 567de7e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions packages/ember-htmlbars/tests/helpers/with_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ QUnit.test("it should wrap context with object controller [DEPRECATED]", functio
name: 'Bob Loblaw'
});

expectDeprecation(/Using the {{with}} helper with a `controller` specified/);

view = EmberView.create({
container: container,
template: compile('{{#with view.person controller="person"}}{{controllerName}}{{/with}}'),
Expand Down Expand Up @@ -379,6 +381,8 @@ QUnit.test("it should wrap keyword with object controller [DEPRECATED]", functio
});

QUnit.test("destroys the controller generated with {{with foo controller='blah'}} [DEPRECATED]", function() {
expectDeprecation(/Using the {{with}} helper with a `controller` specified/);

var destroyed = false;
var Controller = EmberController.extend({
willDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ QUnit.test("should target the current controller inside an {{each}} loop [DEPREC
QUnit.test("should target the with-controller inside an {{#with controller='person'}} [DEPRECATED]", function() {
var registeredTarget;

expectDeprecation(/Using the {{with}} helper with a `controller` specified/);

ActionHelper.registerAction = function({ node }) {
registeredTarget = node.state.target;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-runtime/lib/computed/reduce_computed.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ DependentArraysObserver.prototype = {
},

resetTransformations(dependentKey, observerContexts) {
this.trackedArraysByGuid[dependentKey] = new TrackedArray(observerContexts);
this.trackedArraysByGuid[dependentKey] = new TrackedArray(observerContexts, true);
},

trackAdd(dependentKey, index, newItems) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export function filter(dependentKey, callback) {
_suppressDeprecation: true,

initialize(array, changeMeta, instanceMeta) {
instanceMeta.filteredArrayIndexes = new SubArray();
instanceMeta.filteredArrayIndexes = new SubArray(undefined, true);
},

addedItem(array, item, changeMeta, instanceMeta) {
Expand Down
6 changes: 3 additions & 3 deletions packages/ember-runtime/lib/system/subarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export default SubArray;
@namespace Ember
@private
*/
function SubArray(length) {
function SubArray(length, _suppressDeprecation) {
Ember.deprecate(
'Ember.SubArray will be removed in 2.0.0.',
false,
_suppressDeprecation,
{ id: 'ember-metal.sub-array', until: '2.0.0' }
);

if (arguments.length < 1) { length = 0; }
if (length === undefined) { length = 0; }

if (length > 0) {
this._operations = [new Operation(RETAIN, length)];
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-runtime/lib/system/tracked_array.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export default TrackedArray;
the initial items for the starting state of retain:n.
@private
*/
function TrackedArray(items) {
function TrackedArray(items, _suppressDeprecation) {
Ember.deprecate(
'Ember.TrackedArray will be removed in 2.0.0.',
false,
_suppressDeprecation,
{ id: 'ember-metal.tracked-array', until: '2.0.0' }
);

Expand Down

0 comments on commit 567de7e

Please sign in to comment.