Skip to content

Commit

Permalink
Apply commit 48aad1d with a patch
Browse files Browse the repository at this point in the history
  • Loading branch information
cibernox committed May 19, 2015
1 parent 2193044 commit 9703338
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 20 deletions.
112 changes: 112 additions & 0 deletions misterous-commit.patch
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]]));

});

14 changes: 6 additions & 8 deletions packages/ember-metal/tests/set_properties_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

// ..........................................................
Expand Down Expand Up @@ -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]]));

});

Expand Down

0 comments on commit 9703338

Please sign in to comment.