ember-data-source 2.1.0.beta.2 → 2.1.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dist/ember-data-tests.js +415 -32
- data/dist/ember-data.js +244 -82
- data/dist/ember-data.js.map +1 -1
- data/dist/ember-data.min.js +4 -4
- data/dist/ember-data.prod.js +233 -77
- data/package.json +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59e57a3230e2e71ab4c87be7cc16e699be0436a5
|
4
|
+
data.tar.gz: ae8cce053c8616100e0e89efa8ae7cddaa341706
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31f0ab8615dc81bab1b40f9c0b5139af96644ed94688203a29445ad78e63ba6573390f9e7037d0f403858ca2bc0972f6d2d227e0cc78d73121c0d6b459b881bb
|
7
|
+
data.tar.gz: ffc593e02b98a555350892574a2a89ada52ca11380386cdb26e0cda027bfe474a4e0b157d667348d452ceabb4e9d29ce75c6a5d14533230dbea539e6ccb290a8
|
data/dist/ember-data-tests.js
CHANGED
@@ -4287,7 +4287,7 @@ define(
|
|
4287
4287
|
var run = Ember.run;
|
4288
4288
|
var Person, Dog, env, store, adapter;
|
4289
4289
|
|
4290
|
-
module("integration/adapter/
|
4290
|
+
module("integration/adapter/store-adapter - DS.Store and DS.Adapter integration test", {
|
4291
4291
|
setup: function () {
|
4292
4292
|
Person = DS.Model.extend({
|
4293
4293
|
updatedAt: DS.attr('string'),
|
@@ -4731,7 +4731,13 @@ define(
|
|
4731
4731
|
equal(type, Person, "the type is correct");
|
4732
4732
|
|
4733
4733
|
if (snapshot.attr('name').indexOf('Bro') === -1) {
|
4734
|
-
return Ember.RSVP.reject(new DS.InvalidError({
|
4734
|
+
return Ember.RSVP.reject(new DS.InvalidError([{
|
4735
|
+
title: 'Invalid Attribute',
|
4736
|
+
detail: 'common... name requires a "bro"',
|
4737
|
+
source: {
|
4738
|
+
pointer: '/data/attributes/name'
|
4739
|
+
}
|
4740
|
+
}]));
|
4735
4741
|
} else {
|
4736
4742
|
return Ember.RSVP.resolve();
|
4737
4743
|
}
|
@@ -4770,7 +4776,13 @@ define(
|
|
4770
4776
|
test("allows errors on arbitrary properties on create", function () {
|
4771
4777
|
adapter.createRecord = function (store, type, snapshot) {
|
4772
4778
|
if (snapshot.attr('name').indexOf('Bro') === -1) {
|
4773
|
-
return Ember.RSVP.reject(new DS.InvalidError({
|
4779
|
+
return Ember.RSVP.reject(new DS.InvalidError([{
|
4780
|
+
title: "Invalid Attribute",
|
4781
|
+
detail: "is a generally unsavoury character",
|
4782
|
+
source: {
|
4783
|
+
pointer: "/data/attributes/base"
|
4784
|
+
}
|
4785
|
+
}]));
|
4774
4786
|
} else {
|
4775
4787
|
return Ember.RSVP.resolve();
|
4776
4788
|
}
|
@@ -4816,7 +4828,13 @@ define(
|
|
4816
4828
|
saveCount++;
|
4817
4829
|
|
4818
4830
|
if (snapshot.attr('name').indexOf('Bro') === -1) {
|
4819
|
-
return Ember.RSVP.reject(new DS.InvalidError({
|
4831
|
+
return Ember.RSVP.reject(new DS.InvalidError([{
|
4832
|
+
title: 'Invalid Attribute',
|
4833
|
+
detail: 'common... name requires a "bro"',
|
4834
|
+
source: {
|
4835
|
+
pointer: '/data/attributes/name'
|
4836
|
+
}
|
4837
|
+
}]));
|
4820
4838
|
} else {
|
4821
4839
|
return Ember.RSVP.resolve();
|
4822
4840
|
}
|
@@ -4880,7 +4898,13 @@ define(
|
|
4880
4898
|
equal(type, Person, "the type is correct");
|
4881
4899
|
|
4882
4900
|
if (snapshot.attr('name').indexOf('Bro') === -1) {
|
4883
|
-
return Ember.RSVP.reject(new DS.InvalidError({
|
4901
|
+
return Ember.RSVP.reject(new DS.InvalidError([{
|
4902
|
+
title: 'Invalid Attribute',
|
4903
|
+
detail: 'common... name requires a "bro"',
|
4904
|
+
source: {
|
4905
|
+
pointer: '/data/attributes/name'
|
4906
|
+
}
|
4907
|
+
}]));
|
4884
4908
|
} else {
|
4885
4909
|
return Ember.RSVP.resolve();
|
4886
4910
|
}
|
@@ -4935,7 +4959,13 @@ define(
|
|
4935
4959
|
};
|
4936
4960
|
adapter.updateRecord = function (store, type, snapshot) {
|
4937
4961
|
if (snapshot.attr('name').indexOf('Bro') === -1) {
|
4938
|
-
return Ember.RSVP.reject(new DS.InvalidError({
|
4962
|
+
return Ember.RSVP.reject(new DS.InvalidError([{
|
4963
|
+
title: "Invalid Attribute",
|
4964
|
+
detail: "is a generally unsavoury character",
|
4965
|
+
source: {
|
4966
|
+
pointer: "/data/attributes/base"
|
4967
|
+
}
|
4968
|
+
}]));
|
4939
4969
|
} else {
|
4940
4970
|
return Ember.RSVP.resolve();
|
4941
4971
|
}
|
@@ -4997,7 +5027,13 @@ define(
|
|
4997
5027
|
equal(type, Person, "the type is correct");
|
4998
5028
|
saveCount++;
|
4999
5029
|
if (snapshot.attr('name').indexOf('Bro') === -1) {
|
5000
|
-
return Ember.RSVP.reject(new DS.InvalidError({
|
5030
|
+
return Ember.RSVP.reject(new DS.InvalidError([{
|
5031
|
+
title: 'Invalid Attribute',
|
5032
|
+
detail: 'common... name requires a "bro"',
|
5033
|
+
source: {
|
5034
|
+
pointer: '/data/attributes/name'
|
5035
|
+
}
|
5036
|
+
}]));
|
5001
5037
|
} else {
|
5002
5038
|
return Ember.RSVP.resolve();
|
5003
5039
|
}
|
@@ -9993,6 +10029,128 @@ define(
|
|
9993
10029
|
ok(user._internalModel._relationships.has('favouriteMessage'), "Newly created record with relationships in params passed in its constructor should have relationships");
|
9994
10030
|
});
|
9995
10031
|
});
|
10032
|
+
|
10033
|
+
test("Related link should be fetched when no local data is present", function () {
|
10034
|
+
expect(3);
|
10035
|
+
|
10036
|
+
Book.reopen({
|
10037
|
+
author: DS.belongsTo('author', { async: true })
|
10038
|
+
});
|
10039
|
+
|
10040
|
+
env.adapter.findBelongsTo = function (store, snapshot, url, relationship) {
|
10041
|
+
equal(url, 'author', 'url is correct');
|
10042
|
+
ok(true, "The adapter's findBelongsTo method should be called");
|
10043
|
+
return Ember.RSVP.resolve({ id: 1, name: 'This is author' });
|
10044
|
+
};
|
10045
|
+
|
10046
|
+
run(function () {
|
10047
|
+
var book = env.store.push({
|
10048
|
+
data: {
|
10049
|
+
type: 'book',
|
10050
|
+
id: '1',
|
10051
|
+
relationships: {
|
10052
|
+
author: {
|
10053
|
+
links: {
|
10054
|
+
related: 'author'
|
10055
|
+
}
|
10056
|
+
}
|
10057
|
+
}
|
10058
|
+
}
|
10059
|
+
});
|
10060
|
+
book.get('author').then(function (author) {
|
10061
|
+
equal(author.get('name'), 'This is author', 'author name is correct');
|
10062
|
+
});
|
10063
|
+
});
|
10064
|
+
});
|
10065
|
+
|
10066
|
+
test("Local data should take precedence over related link", function () {
|
10067
|
+
expect(1);
|
10068
|
+
|
10069
|
+
Book.reopen({
|
10070
|
+
author: DS.belongsTo('author', { async: true })
|
10071
|
+
});
|
10072
|
+
|
10073
|
+
env.adapter.findBelongsTo = function (store, snapshot, url, relationship) {
|
10074
|
+
ok(false, "The adapter's findBelongsTo method should not be called");
|
10075
|
+
};
|
10076
|
+
|
10077
|
+
env.adapter.findRecord = function (store, type, id, snapshot) {
|
10078
|
+
return Ember.RSVP.resolve({ id: 1, name: 'This is author' });
|
10079
|
+
};
|
10080
|
+
|
10081
|
+
run(function () {
|
10082
|
+
var book = env.store.push({
|
10083
|
+
data: {
|
10084
|
+
type: 'book',
|
10085
|
+
id: '1',
|
10086
|
+
relationships: {
|
10087
|
+
author: {
|
10088
|
+
links: {
|
10089
|
+
related: 'author'
|
10090
|
+
},
|
10091
|
+
data: { type: 'author', id: '1' }
|
10092
|
+
}
|
10093
|
+
}
|
10094
|
+
}
|
10095
|
+
});
|
10096
|
+
book.get('author').then(function (author) {
|
10097
|
+
equal(author.get('name'), 'This is author', 'author name is correct');
|
10098
|
+
});
|
10099
|
+
});
|
10100
|
+
});
|
10101
|
+
|
10102
|
+
test("Updated related link should take precedence over local data", function () {
|
10103
|
+
expect(3);
|
10104
|
+
|
10105
|
+
Book.reopen({
|
10106
|
+
author: DS.belongsTo('author', { async: true })
|
10107
|
+
});
|
10108
|
+
|
10109
|
+
env.adapter.findBelongsTo = function (store, snapshot, url, relationship) {
|
10110
|
+
equal(url, 'author-updated-link', 'url is correct');
|
10111
|
+
ok(true, "The adapter's findBelongsTo method should be called");
|
10112
|
+
return Ember.RSVP.resolve({ id: 1, name: 'This is author' });
|
10113
|
+
};
|
10114
|
+
|
10115
|
+
env.adapter.findRecord = function (store, type, id, snapshot) {
|
10116
|
+
ok(false, "The adapter's findRecord method should not be called");
|
10117
|
+
};
|
10118
|
+
|
10119
|
+
run(function () {
|
10120
|
+
var book = env.store.push({
|
10121
|
+
data: {
|
10122
|
+
type: 'book',
|
10123
|
+
id: '1',
|
10124
|
+
relationships: {
|
10125
|
+
author: {
|
10126
|
+
links: {
|
10127
|
+
related: 'author'
|
10128
|
+
},
|
10129
|
+
data: { type: 'author', id: '1' }
|
10130
|
+
}
|
10131
|
+
}
|
10132
|
+
}
|
10133
|
+
});
|
10134
|
+
|
10135
|
+
env.store.push({
|
10136
|
+
data: {
|
10137
|
+
type: 'book',
|
10138
|
+
id: '1',
|
10139
|
+
relationships: {
|
10140
|
+
author: {
|
10141
|
+
links: {
|
10142
|
+
related: 'author-updated-link'
|
10143
|
+
}
|
10144
|
+
}
|
10145
|
+
}
|
10146
|
+
}
|
10147
|
+
});
|
10148
|
+
|
10149
|
+
book.get('author').then(function (author) {
|
10150
|
+
equal(author.get('name'), 'This is author', 'author name is correct');
|
10151
|
+
});
|
10152
|
+
});
|
10153
|
+
});
|
9996
10154
|
}
|
9997
10155
|
);
|
9998
10156
|
|
@@ -12224,6 +12382,128 @@ define(
|
|
12224
12382
|
});
|
12225
12383
|
});
|
12226
12384
|
});
|
12385
|
+
|
12386
|
+
test("Related link should be fetched when no local data is present", function () {
|
12387
|
+
expect(3);
|
12388
|
+
|
12389
|
+
Post.reopen({
|
12390
|
+
comments: DS.hasMany('comment', { async: true })
|
12391
|
+
});
|
12392
|
+
|
12393
|
+
env.adapter.findHasMany = function (store, snapshot, url, relationship) {
|
12394
|
+
equal(url, 'comments', 'url is correct');
|
12395
|
+
ok(true, "The adapter's findHasMany method should be called");
|
12396
|
+
return Ember.RSVP.resolve([{ id: 1, body: 'This is comment' }]);
|
12397
|
+
};
|
12398
|
+
|
12399
|
+
run(function () {
|
12400
|
+
var post = env.store.push({
|
12401
|
+
data: {
|
12402
|
+
type: 'post',
|
12403
|
+
id: '1',
|
12404
|
+
relationships: {
|
12405
|
+
comments: {
|
12406
|
+
links: {
|
12407
|
+
related: 'comments'
|
12408
|
+
}
|
12409
|
+
}
|
12410
|
+
}
|
12411
|
+
}
|
12412
|
+
});
|
12413
|
+
post.get('comments').then(function (comments) {
|
12414
|
+
equal(comments.get('firstObject.body'), 'This is comment', 'comment body is correct');
|
12415
|
+
});
|
12416
|
+
});
|
12417
|
+
});
|
12418
|
+
|
12419
|
+
test("Local data should take precedence over related link", function () {
|
12420
|
+
expect(1);
|
12421
|
+
|
12422
|
+
Post.reopen({
|
12423
|
+
comments: DS.hasMany('comment', { async: true })
|
12424
|
+
});
|
12425
|
+
|
12426
|
+
env.adapter.findHasMany = function (store, snapshot, url, relationship) {
|
12427
|
+
ok(false, "The adapter's findHasMany method should not be called");
|
12428
|
+
};
|
12429
|
+
|
12430
|
+
env.adapter.findRecord = function (store, type, id, snapshot) {
|
12431
|
+
return Ember.RSVP.resolve({ id: 1, body: 'This is comment' });
|
12432
|
+
};
|
12433
|
+
|
12434
|
+
run(function () {
|
12435
|
+
var post = env.store.push({
|
12436
|
+
data: {
|
12437
|
+
type: 'post',
|
12438
|
+
id: '1',
|
12439
|
+
relationships: {
|
12440
|
+
comments: {
|
12441
|
+
links: {
|
12442
|
+
related: 'comments'
|
12443
|
+
},
|
12444
|
+
data: [{ type: 'comment', id: '1' }]
|
12445
|
+
}
|
12446
|
+
}
|
12447
|
+
}
|
12448
|
+
});
|
12449
|
+
post.get('comments').then(function (comments) {
|
12450
|
+
equal(comments.get('firstObject.body'), 'This is comment', 'comment body is correct');
|
12451
|
+
});
|
12452
|
+
});
|
12453
|
+
});
|
12454
|
+
|
12455
|
+
test("Updated related link should take precedence over local data", function () {
|
12456
|
+
expect(3);
|
12457
|
+
|
12458
|
+
Post.reopen({
|
12459
|
+
comments: DS.hasMany('comment', { async: true })
|
12460
|
+
});
|
12461
|
+
|
12462
|
+
env.adapter.findHasMany = function (store, snapshot, url, relationship) {
|
12463
|
+
equal(url, 'comments-updated-link', 'url is correct');
|
12464
|
+
ok(true, "The adapter's findHasMany method should be called");
|
12465
|
+
return Ember.RSVP.resolve([{ id: 1, body: 'This is comment' }]);
|
12466
|
+
};
|
12467
|
+
|
12468
|
+
env.adapter.findRecord = function (store, type, id, snapshot) {
|
12469
|
+
ok(false, "The adapter's findRecord method should not be called");
|
12470
|
+
};
|
12471
|
+
|
12472
|
+
run(function () {
|
12473
|
+
var post = env.store.push({
|
12474
|
+
data: {
|
12475
|
+
type: 'post',
|
12476
|
+
id: '1',
|
12477
|
+
relationships: {
|
12478
|
+
comments: {
|
12479
|
+
links: {
|
12480
|
+
related: 'comments'
|
12481
|
+
},
|
12482
|
+
data: [{ type: 'comment', id: '1' }]
|
12483
|
+
}
|
12484
|
+
}
|
12485
|
+
}
|
12486
|
+
});
|
12487
|
+
|
12488
|
+
env.store.push({
|
12489
|
+
data: {
|
12490
|
+
type: 'post',
|
12491
|
+
id: '1',
|
12492
|
+
relationships: {
|
12493
|
+
comments: {
|
12494
|
+
links: {
|
12495
|
+
related: 'comments-updated-link'
|
12496
|
+
}
|
12497
|
+
}
|
12498
|
+
}
|
12499
|
+
}
|
12500
|
+
});
|
12501
|
+
|
12502
|
+
post.get('comments').then(function (comments) {
|
12503
|
+
equal(comments.get('firstObject.body'), 'This is comment', 'comment body is correct');
|
12504
|
+
});
|
12505
|
+
});
|
12506
|
+
});
|
12227
12507
|
}
|
12228
12508
|
);
|
12229
12509
|
|
@@ -18228,6 +18508,24 @@ define(
|
|
18228
18508
|
equal(get(user, 'handles.lastObject.nickname'), '@wycats', 'handles.lastObject.nickname is correct');
|
18229
18509
|
});
|
18230
18510
|
});
|
18511
|
+
|
18512
|
+
test('Warns when normalizing an unknown type', function () {
|
18513
|
+
var documentHash = {
|
18514
|
+
data: {
|
18515
|
+
type: 'UnknownType',
|
18516
|
+
id: '1',
|
18517
|
+
attributes: {
|
18518
|
+
foo: 'bar'
|
18519
|
+
}
|
18520
|
+
}
|
18521
|
+
};
|
18522
|
+
|
18523
|
+
warns(function () {
|
18524
|
+
run(function () {
|
18525
|
+
env.store.serializerFor('user').normalizeResponse(env.store, User, documentHash, '1', 'findRecord');
|
18526
|
+
});
|
18527
|
+
}, /Encountered a resource object with type "UnknownType", but no model was found for model name "unknown-type"/);
|
18528
|
+
});
|
18231
18529
|
}
|
18232
18530
|
);
|
18233
18531
|
|
@@ -18415,6 +18713,25 @@ define(
|
|
18415
18713
|
});
|
18416
18714
|
});
|
18417
18715
|
|
18716
|
+
test("serializeHasMany omits unknown relationships on pushed record", function () {
|
18717
|
+
|
18718
|
+
run(function () {
|
18719
|
+
post = env.store.push({
|
18720
|
+
id: "1",
|
18721
|
+
type: "post",
|
18722
|
+
attributes: {
|
18723
|
+
title: "Rails is omakase"
|
18724
|
+
}
|
18725
|
+
});
|
18726
|
+
});
|
18727
|
+
|
18728
|
+
var json = {};
|
18729
|
+
|
18730
|
+
env.store.serializerFor("post").serializeHasMany(post._createSnapshot(), json, { key: "comments", options: {} });
|
18731
|
+
|
18732
|
+
ok(!json.hasOwnProperty("comments"), "Does not add the relationship key to json");
|
18733
|
+
});
|
18734
|
+
|
18418
18735
|
test("serializeIntoHash", function () {
|
18419
18736
|
run(function () {
|
18420
18737
|
post = env.store.createRecord('post', { title: "Rails is omakase" });
|
@@ -18924,6 +19241,20 @@ define(
|
|
18924
19241
|
deepEqual(post.included, []);
|
18925
19242
|
});
|
18926
19243
|
|
19244
|
+
test('normalizeResponse returns empty `included` payload when relationship is undefined', function () {
|
19245
|
+
env.registry.register("serializer:post", DS.JSONSerializer.extend());
|
19246
|
+
|
19247
|
+
var jsonHash = {
|
19248
|
+
id: "1",
|
19249
|
+
title: "Rails is omakase",
|
19250
|
+
comments: null
|
19251
|
+
};
|
19252
|
+
|
19253
|
+
var post = env.store.serializerFor("post").normalizeResponse(env.store, Post, jsonHash, '1', 'findRecord');
|
19254
|
+
|
19255
|
+
deepEqual(post.included, []);
|
19256
|
+
});
|
19257
|
+
|
18927
19258
|
test('normalizeResponse respects `included` items (single response)', function () {
|
18928
19259
|
env.registry.register("serializer:post", DS.JSONSerializer.extend(DS.EmbeddedRecordsMixin, {
|
18929
19260
|
attrs: {
|
@@ -21481,7 +21812,7 @@ define(
|
|
21481
21812
|
__exports__[name] = value;
|
21482
21813
|
}
|
21483
21814
|
|
21484
|
-
module("unit/adapter
|
21815
|
+
module("unit/adapter-errors - DS.AdapterError");
|
21485
21816
|
|
21486
21817
|
test("DS.AdapterError", function () {
|
21487
21818
|
var error = new DS.AdapterError();
|
@@ -21544,18 +21875,12 @@ define(
|
|
21544
21875
|
deepEqual(result, { name: ['error message'] });
|
21545
21876
|
});
|
21546
21877
|
|
21547
|
-
test("DS.InvalidError will normalize errors hash
|
21878
|
+
test("DS.InvalidError will normalize errors hash will assert", function () {
|
21548
21879
|
var error;
|
21549
21880
|
|
21550
|
-
|
21881
|
+
expectAssertion(function () {
|
21551
21882
|
error = new DS.InvalidError({ name: ['is invalid'] });
|
21552
21883
|
}, /expects json-api formatted errors/);
|
21553
|
-
|
21554
|
-
deepEqual(error.errors, [{
|
21555
|
-
title: 'Invalid Attribute',
|
21556
|
-
detail: 'is invalid',
|
21557
|
-
source: { pointer: '/data/attributes/name' }
|
21558
|
-
}]);
|
21559
21884
|
});
|
21560
21885
|
}
|
21561
21886
|
);
|
@@ -23944,7 +24269,13 @@ define(
|
|
23944
24269
|
updateRecord: function (store, type, snapshot) {
|
23945
24270
|
equal(callCount, 0, "becameInvalid callback was not called until recordWasInvalid is called");
|
23946
24271
|
|
23947
|
-
return Ember.RSVP.reject(new DS.InvalidError({
|
24272
|
+
return Ember.RSVP.reject(new DS.InvalidError([{
|
24273
|
+
title: "Invalid Attribute",
|
24274
|
+
detail: "error",
|
24275
|
+
source: {
|
24276
|
+
pointer: "/data/attributes/bar"
|
24277
|
+
}
|
24278
|
+
}]));
|
23948
24279
|
}
|
23949
24280
|
});
|
23950
24281
|
|
@@ -26956,18 +27287,21 @@ define(
|
|
26956
27287
|
var get = Ember.get;
|
26957
27288
|
var set = Ember.set;
|
26958
27289
|
var resolve = Ember.RSVP.resolve;
|
26959
|
-
var TestAdapter, store, person;
|
27290
|
+
var TestAdapter, store, person, oldFilterEnabled;
|
26960
27291
|
var run = Ember.run;
|
26961
27292
|
|
26962
27293
|
module("unit/store/adapter-interop - DS.Store working with a DS.Adapter", {
|
26963
27294
|
setup: function () {
|
26964
27295
|
TestAdapter = DS.Adapter.extend();
|
27296
|
+
oldFilterEnabled = Ember.ENV.ENABLE_DS_FILTER;
|
27297
|
+
Ember.ENV.ENABLE_DS_FILTER = false;
|
26965
27298
|
},
|
26966
27299
|
teardown: function () {
|
26967
27300
|
run(function () {
|
26968
27301
|
if (store) {
|
26969
27302
|
store.destroy();
|
26970
27303
|
}
|
27304
|
+
Ember.ENV.ENABLE_DS_FILTER = oldFilterEnabled;
|
26971
27305
|
});
|
26972
27306
|
}
|
26973
27307
|
});
|
@@ -28176,6 +28510,38 @@ define(
|
|
28176
28510
|
equal(store.peekRecord('person', 1).get('name'), 'Tom');
|
28177
28511
|
});
|
28178
28512
|
|
28513
|
+
test("store should assert of the user tries to call store.filter", function () {
|
28514
|
+
expect(1);
|
28515
|
+
|
28516
|
+
var Person = DS.Model.extend({
|
28517
|
+
name: DS.attr('string')
|
28518
|
+
});
|
28519
|
+
|
28520
|
+
store = createStore({
|
28521
|
+
person: Person
|
28522
|
+
});
|
28523
|
+
|
28524
|
+
expectAssertion(function () {
|
28525
|
+
run(function () {
|
28526
|
+
store.filter('person', {});
|
28527
|
+
});
|
28528
|
+
}, /The filter API has been moved to a plugin/);
|
28529
|
+
});
|
28530
|
+
|
28531
|
+
test("Calling adapterFor with a model class should assert", function () {
|
28532
|
+
var Person = DS.Model.extend({
|
28533
|
+
name: DS.attr('string')
|
28534
|
+
});
|
28535
|
+
|
28536
|
+
store = createStore({
|
28537
|
+
person: Person
|
28538
|
+
});
|
28539
|
+
|
28540
|
+
expectAssertion(function () {
|
28541
|
+
store.adapterFor(Person);
|
28542
|
+
}, /Passing classes to store.adapterFor has been removed/);
|
28543
|
+
});
|
28544
|
+
|
28179
28545
|
module("unit/store/adapter_interop - find preload deprecations", {
|
28180
28546
|
setup: function () {
|
28181
28547
|
var Person = DS.Model.extend({
|
@@ -29186,23 +29552,26 @@ define(
|
|
29186
29552
|
}, /You tried to push data with a type 'unknown' but no model could be found with that name/);
|
29187
29553
|
});
|
29188
29554
|
|
29189
|
-
test('Calling push with a link containing an object
|
29555
|
+
test('Calling push with a link containing an object', function () {
|
29190
29556
|
Person.reopen({
|
29191
29557
|
phoneNumbers: hasMany('phone-number', { async: true })
|
29192
29558
|
});
|
29193
29559
|
|
29194
|
-
|
29195
|
-
|
29196
|
-
|
29197
|
-
|
29198
|
-
|
29199
|
-
|
29200
|
-
|
29201
|
-
}
|
29560
|
+
run(function () {
|
29561
|
+
store.push(store.normalize('person', {
|
29562
|
+
id: '1',
|
29563
|
+
firstName: 'Tan',
|
29564
|
+
links: {
|
29565
|
+
phoneNumbers: {
|
29566
|
+
href: '/api/people/1/phone-numbers'
|
29202
29567
|
}
|
29203
|
-
}
|
29204
|
-
});
|
29205
|
-
}
|
29568
|
+
}
|
29569
|
+
}));
|
29570
|
+
});
|
29571
|
+
|
29572
|
+
var person = store.peekRecord('person', 1);
|
29573
|
+
|
29574
|
+
equal(person.get('firstName'), "Tan", "you can use links containing an object");
|
29206
29575
|
});
|
29207
29576
|
|
29208
29577
|
test('Calling push with a link containing the value null', function () {
|
@@ -29442,12 +29811,13 @@ define(
|
|
29442
29811
|
__exports__[name] = value;
|
29443
29812
|
}
|
29444
29813
|
|
29445
|
-
var container, store, registry;
|
29814
|
+
var container, store, registry, Person;
|
29446
29815
|
var run = Ember.run;
|
29447
29816
|
|
29448
29817
|
module("unit/store/serializer_for - DS.Store#serializerFor", {
|
29449
29818
|
setup: function () {
|
29450
|
-
|
29819
|
+
Person = DS.Model.extend({});
|
29820
|
+
var env = setupStore({ person: Person });
|
29451
29821
|
store = env.store;
|
29452
29822
|
container = store.container;
|
29453
29823
|
registry = env.registry;
|
@@ -29480,6 +29850,12 @@ define(
|
|
29480
29850
|
test("Calling serializerFor with a type that has not been registered and in an application that does not have an ApplicationSerializer looks up the default Ember Data serializer", function () {
|
29481
29851
|
ok(store.serializerFor('person') instanceof DS.JSONSerializer, "serializer returned from serializerFor is an instance of DS.JSONSerializer");
|
29482
29852
|
});
|
29853
|
+
|
29854
|
+
test("Calling serializerFor with a model class should assert", function () {
|
29855
|
+
expectAssertion(function () {
|
29856
|
+
store.serializerFor(Person);
|
29857
|
+
}, /Passing classes to store.serializerFor has been removed/);
|
29858
|
+
});
|
29483
29859
|
}
|
29484
29860
|
);
|
29485
29861
|
|
@@ -30257,6 +30633,13 @@ QUnit.test('ember-data/lib/system/model/states.js should pass jshint', function(
|
|
30257
30633
|
assert.ok(true, 'ember-data/lib/system/model/states.js should pass jshint.');
|
30258
30634
|
});
|
30259
30635
|
|
30636
|
+
}
|
30637
|
+
if (!QUnit.urlParams.nojshint) {
|
30638
|
+
QUnit.module('JSHint - ember-data/lib/system');
|
30639
|
+
QUnit.test('ember-data/lib/system/normalize-link.js should pass jshint', function(assert) {
|
30640
|
+
assert.ok(true, 'ember-data/lib/system/normalize-link.js should pass jshint.');
|
30641
|
+
});
|
30642
|
+
|
30260
30643
|
}
|
30261
30644
|
if (!QUnit.urlParams.nojshint) {
|
30262
30645
|
QUnit.module('JSHint - ember-data/lib/system');
|