mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 23:38:29 +08:00
FIX: If a topic title edit fails, revert to previous title.
This commit is contained in:
@ -4,34 +4,6 @@ test("mixes in Discourse.Presence", function() {
|
||||
ok(Discourse.Presence.detect(Discourse.Model.create()));
|
||||
});
|
||||
|
||||
test("mergeAttributes: merges attributes from another object", function() {
|
||||
var model = Discourse.Model.create({
|
||||
foo: "foo",
|
||||
bar: "original bar"
|
||||
});
|
||||
|
||||
model.mergeAttributes({
|
||||
bar: "merged bar",
|
||||
baz: "baz"
|
||||
});
|
||||
|
||||
equal(model.get("foo"), "foo", "leaving original attr intact when only original object contains given key");
|
||||
equal(model.get("bar"), "merged bar", "overwriting original attr when both objects contain given key");
|
||||
equal(model.get("baz"), "baz", "adding new attr to original object when only merged object contains given key");
|
||||
});
|
||||
|
||||
test("mergeAttributes: respects Ember setters (so observers etc. work)", function() {
|
||||
var observerHasFired = false;
|
||||
|
||||
var model = Discourse.Model.create({foo: "original foo"});
|
||||
model.addObserver("foo", function() {
|
||||
observerHasFired = true;
|
||||
});
|
||||
model.mergeAttributes({foo: "merged foo"});
|
||||
|
||||
ok(observerHasFired);
|
||||
});
|
||||
|
||||
test("extractByKey: converts a list of hashes into a hash of instances of specified class, indexed by their ids", function() {
|
||||
var firstObject = {id: "id_1", foo: "foo_1"};
|
||||
var secondObject = {id: "id_2", foo: "foo_2"};
|
||||
|
Reference in New Issue
Block a user