-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
130 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
From 48aad1d2379cb41a111e37f93b271f646fcd7092 Mon Sep 17 00:00:00 2001 | ||
From: Stefan Penner <[email protected]> | ||
Date: Tue, 19 May 2015 14:31:12 -0700 | ||
Subject: [PATCH] fix tests for #11213 | ||
|
||
--- | ||
packages/ember-metal/tests/set_properties_test.js | 14 ++++++------- | ||
.../legacy_1x/mixins/observable/observable_test.js | 24 +++++++++++----------- | ||
2 files changed, 18 insertions(+), 20 deletions(-) | ||
|
||
diff --git a/packages/ember-metal/tests/set_properties_test.js b/packages/ember-metal/tests/set_properties_test.js | ||
index c397b9b..afc3091 100644 | ||
--- a/packages/ember-metal/tests/set_properties_test.js | ||
+++ b/packages/ember-metal/tests/set_properties_test.js | ||
@@ -6,21 +6,19 @@ QUnit.test("supports setting multiple attributes at once", function() { | ||
deepEqual(setProperties(null, null), null, 'noop for null properties and null object'); | ||
deepEqual(setProperties(undefined, undefined), undefined, 'noop for undefined properties and undefined object'); | ||
|
||
- deepEqual(setProperties({}), {}, 'noop for no properties'); | ||
- deepEqual(setProperties({}, undefined), {}, 'noop for undefined'); | ||
- deepEqual(setProperties({}, null), {}, 'noop for null'); | ||
- deepEqual(setProperties({}, NaN), {}, 'noop for NaN'); | ||
+ deepEqual(setProperties({}), undefined, 'noop for no properties'); | ||
+ deepEqual(setProperties({}, undefined), undefined, 'noop for undefined'); | ||
+ deepEqual(setProperties({}, null), null, 'noop for null'); | ||
+ deepEqual(setProperties({}, NaN), NaN, 'noop for NaN'); | ||
deepEqual(setProperties({}, {}), {}, 'meh'); | ||
|
||
deepEqual(setProperties({}, { foo: 1 }), { foo: 1 }, 'Set a single property'); | ||
|
||
deepEqual(setProperties({}, { foo: 1, bar: 1 }), { foo: 1, bar: 1 }, 'Set multiple properties'); | ||
|
||
- deepEqual(setProperties({ foo: 2, baz: 2 }, { foo: 1 }), { foo: 1, baz: 2 }, 'Set one of multiple properties'); | ||
+ deepEqual(setProperties({ foo: 2, baz: 2 }, { foo: 1 }), { foo: 1 }, 'Set one of multiple properties'); | ||
|
||
deepEqual(setProperties({ foo: 2, baz: 2 }, { bar: 2 }), { | ||
- bar: 2, | ||
- foo: 2, | ||
- baz: 2 | ||
+ bar: 2 | ||
}, 'Set an additional, previously unset property'); | ||
}); | ||
diff --git a/packages/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js b/packages/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js | ||
index 26ba600..0c4095f 100644 | ||
--- a/packages/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js | ||
+++ b/packages/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js | ||
@@ -274,41 +274,41 @@ QUnit.module("object.set()", { | ||
|
||
}); | ||
|
||
-QUnit.test("should change normal properties and return this", function() { | ||
+QUnit.test("should change normal properties and return the value", function() { | ||
var ret = object.set("normal", "changed"); | ||
equal(object.normal, "changed"); | ||
- equal(ret, object); | ||
+ equal(ret, "changed"); | ||
}); | ||
|
||
-QUnit.test("should call computed properties passing value and return this", function() { | ||
+QUnit.test("should call computed properties passing value and return the value", function() { | ||
var ret = object.set("computed", "changed"); | ||
equal(object._computed, "changed"); | ||
- equal(ret, object); | ||
+ equal(ret, "changed"); | ||
}); | ||
|
||
QUnit.test("should change normal properties when passing undefined", function() { | ||
var ret = object.set('normal', undefined); | ||
equal(object.normal, undefined); | ||
- equal(ret, object); | ||
+ equal(ret, undefined); | ||
}); | ||
|
||
-QUnit.test("should replace the function for a non-computed property and return this", function() { | ||
+QUnit.test("should replace the function for a non-computed property and return the value", function() { | ||
var ret = object.set("method", "changed"); | ||
equal(object._method, "method"); // make sure this was NOT run | ||
ok(typeof object.method !== 'function'); | ||
- equal(ret, object); | ||
+ equal(ret, "changed"); | ||
}); | ||
|
||
QUnit.test("should replace prover when property value is null", function() { | ||
var ret = object.set("nullProperty", "changed"); | ||
equal(object.nullProperty, "changed"); | ||
- equal(ret, object); | ||
+ equal(ret, "changed"); | ||
}); | ||
|
||
QUnit.test("should call unknownProperty with value when property is undefined", function() { | ||
var ret = object.set("unknown", "changed"); | ||
equal(object._unknown, "changed"); | ||
- equal(ret, object); | ||
+ equal(ret, "changed"); | ||
}); | ||
|
||
// .......................................................... | ||
@@ -453,11 +453,11 @@ QUnit.test("setting values should call function return value", function() { | ||
|
||
forEach(keys, function(key) { | ||
|
||
- equal(object.set(key, values[0]), object, fmt('Try #1: object.set(%@, %@) should run function', [key, values[0]])); | ||
+ equal(object.set(key, values[0]), values[0], fmt('Try #1: object.set(%@, %@) should run function', [key, values[0]])); | ||
|
||
- equal(object.set(key, values[1]), object, fmt('Try #2: object.set(%@, %@) should run function', [key, values[1]])); | ||
+ equal(object.set(key, values[1]), values[1], fmt('Try #2: object.set(%@, %@) should run function', [key, values[1]])); | ||
|
||
- equal(object.set(key, values[1]), object, fmt('Try #3: object.set(%@, %@) should not run function since it is setting same value as before', [key, values[1]])); | ||
+ equal(object.set(key, values[1]), values[1], fmt('Try #3: object.set(%@, %@) should not run function since it is setting same value as before', [key, values[1]])); | ||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters