Skip to content

Commit

Permalink
[CLEANUP] Removes and updates deprecated API tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Garrett committed Apr 3, 2019
1 parent a2be294 commit 56fbe98
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 51 deletions.
26 changes: 0 additions & 26 deletions packages/@ember/-internals/meta/tests/listeners_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,31 +172,5 @@ moduleFor(
'one reopen call after mutating parents and flattening out of order'
);
}

['@test REMOVE_ALL does not interfere with future adds'](assert) {
expectDeprecation(() => {
let t = {};
let m = meta({});

m.addToListeners('hello', t, 'm', 0);
let matching = m.matchingListeners('hello');

assert.equal(matching.length, 3);
assert.equal(matching[0], t);

// Remove all listeners
m.removeAllListeners('hello');

matching = m.matchingListeners('hello');
assert.equal(matching, undefined);

m.addToListeners('hello', t, 'm', 0);
matching = m.matchingListeners('hello');

// listener was added back successfully
assert.equal(matching.length, 3);
assert.equal(matching[0], t);
});
}
}
);
18 changes: 0 additions & 18 deletions packages/@ember/-internals/metal/tests/events_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,6 @@ moduleFor(
assert.equal(hasListeners(obj, 'event!'), true, 'has listeners');
}

['@test calling removeListener without method should remove all listeners'](assert) {
expectDeprecation(() => {
let obj = {};
function F() {}
function F2() {}

assert.equal(hasListeners(obj, 'event!'), false, 'no listeners at first');

addListener(obj, 'event!', F);
addListener(obj, 'event!', F2);

assert.equal(hasListeners(obj, 'event!'), true, 'has listeners');
removeListener(obj, 'event!');

assert.equal(hasListeners(obj, 'event!'), false, 'has no more listeners');
}, /The remove all functionality of removeListener and removeObserver has been deprecated/);
}

['@test a listener can be added as part of a mixin'](assert) {
let triggered = 0;
let MyMixin = Mixin.create({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import { moduleFor, AbstractTestCase, buildOwner } from 'internal-test-helpers';
moduleFor(
'Ember.CoreObject',
class extends AbstractTestCase {
['@test throws deprecation with new (one arg)']() {
expectDeprecation(() => {
['@test throws an error with new (one arg)']() {
expectAssertion(() => {
new CoreObject({
firstName: 'Stef',
lastName: 'Penner',
});
}, /using `new` with EmberObject has been deprecated/);
}, /You may have either used `new` instead of `.create\(\)`/);
}

['@test throws deprecation with new (> 1 arg)']() {
expectDeprecation(() => {
['@test throws an error with new (> 1 arg)']() {
expectAssertion(() => {
new CoreObject(
{
firstName: 'Stef',
Expand All @@ -26,7 +26,7 @@ moduleFor(
other: 'name',
}
);
}, /using `new` with EmberObject has been deprecated/);
}, /You may have either used `new` instead of `.create\(\)`/);
}

['@test toString should be not be added as a property when calling toString()'](assert) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ moduleFor(
}

['@test new Ember.A'](assert) {
expectDeprecation(() => {
expectAssertion(() => {
assert.deepEqual(new A([1, 2]), [1, 2], 'array values were not be modified');
assert.deepEqual(new A(), [], 'returned an array with no arguments');
assert.deepEqual(new A(null), [], 'returned an array with a null argument');
Expand Down

0 comments on commit 56fbe98

Please sign in to comment.