ember-data-source 1.0.0.beta.16 → 1.0.0.beta.16.1
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 +1 -1
- data/dist/ember-data.js +143 -150
- data/dist/ember-data.js.map +1 -1
- data/dist/ember-data.min.js +4 -3
- data/dist/ember-data.prod.js +143 -150
- data/package.json +4 -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: c2747d8c74be1b9b859b4f879287d9eaf72a9b19
|
4
|
+
data.tar.gz: 5cb38e78140e261618649910b2a402da9b6ef47f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd1d59cd1dd8683da91683146820247d904c35bc43f828f3770676d625fe2f26b2399b2182da83b22a3ca369405247adef436e0b8b7578986f7ced04b5eb94df
|
7
|
+
data.tar.gz: 00132eb33299c50cfdebddd686ffdcc258893df7c6b2cfc4021c5d26e14975f9e3ab857eed6a4b82d35a9c0694bec5c4affb4154d9ac361b9beae6dfea60f1cf
|
data/dist/ember-data-tests.js
CHANGED
@@ -334,7 +334,7 @@ eval("(function() {var run = Ember.run;\nvar Container = Ember.Container;\nvar R
|
|
334
334
|
|
335
335
|
eval("(function() {var run = Ember.run;\nvar env, Post, Comment;\n\nmodule(\"integration/snapshot - DS.Snapshot\", {\n setup: function() {\n Post = DS.Model.extend({\n author: DS.attr(),\n title: DS.attr(),\n comments: DS.hasMany({ async: true })\n });\n Comment = DS.Model.extend({\n body: DS.attr(),\n post: DS.belongsTo({ async: true })\n });\n\n env = setupStore({\n post: Post,\n comment: Comment\n });\n },\n\n teardown: function() {\n run(function() {\n env.store.destroy();\n });\n }\n});\n\ntest(\"record._createSnapshot() returns a snapshot\", function() {\n expect(1);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var snapshot = post._createSnapshot();\n\n ok(snapshot instanceof DS.Snapshot, \'snapshot is an instance of DS.Snapshot\');\n });\n});\n\ntest(\"snapshot._createSnapshot() returns a snapshot (self) but is deprecated\", function() {\n expect(2);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var snapshot1 = post._createSnapshot();\n var snapshot2;\n\n expectDeprecation(function() {\n snapshot2 = snapshot1._createSnapshot();\n }, /You called _createSnapshot on what\'s already a DS.Snapshot. You shouldn\'t manually create snapshots in your adapter since the store passes snapshots to adapters by default./);\n\n ok(snapshot2 === snapshot1, \'snapshot._createSnapshot() returns self\');\n });\n\n});\n\ntest(\"snapshot.id, snapshot.type and snapshot.typeKey returns correctly\", function() {\n expect(3);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var snapshot = post._createSnapshot();\n\n equal(snapshot.id, \'1\', \'id is correct\');\n ok(DS.Model.detect(snapshot.type), \'type is correct\');\n equal(snapshot.typeKey, \'post\', \'typeKey is correct\');\n });\n});\n\ntest(\"snapshot.constructor is unique and deprecated\", function() {\n expect(4);\n\n run(function() {\n var comment = env.store.push(\'comment\', { id: 1, body: \'This is comment\' });\n var post = env.store.push(\'post\', { id: 2, title: \'Hello World\' });\n var commentSnapshot = comment._createSnapshot();\n var postSnapshot = post._createSnapshot();\n\n expectDeprecation(function() {\n equal(commentSnapshot.constructor.typeKey, \'comment\', \'constructor.typeKey is unique per type\');\n });\n\n expectDeprecation(function() {\n equal(postSnapshot.constructor.typeKey, \'post\', \'constructor.typeKey is unique per type\');\n });\n });\n});\n\ntest(\"snapshot.attr() does not change when record changes\", function() {\n expect(2);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var snapshot = post._createSnapshot();\n\n equal(snapshot.attr(\'title\'), \'Hello World\', \'snapshot title is correct\');\n post.set(\'title\', \'Tomster\');\n equal(snapshot.attr(\'title\'), \'Hello World\', \'snapshot title is still correct\');\n });\n});\n\ntest(\"snapshot.attributes() returns a copy of all attributes for the current snapshot\", function() {\n expect(1);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var snapshot = post._createSnapshot();\n\n var attributes = snapshot.attributes();\n\n deepEqual(attributes, { author: undefined, title: \'Hello World\' }, \'attributes are returned correctly\');\n });\n});\n\ntest(\"snapshot.belongsTo() returns undefined if relationship is undefined\", function() {\n expect(1);\n\n run(function() {\n var comment = env.store.push(\'comment\', { id: 1, body: \'This is comment\' });\n var snapshot = comment._createSnapshot();\n var relationship = snapshot.belongsTo(\'post\');\n\n equal(relationship, undefined, \'relationship is undefined\');\n });\n});\n\ntest(\"snapshot.belongsTo() returns a snapshot if relationship is set\", function() {\n expect(3);\n\n run(function() {\n env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var comment = env.store.push(\'comment\', { id: 2, body: \'This is comment\', post: 1 });\n var snapshot = comment._createSnapshot();\n var relationship = snapshot.belongsTo(\'post\');\n\n ok(relationship instanceof DS.Snapshot, \'snapshot is an instance of DS.Snapshot\');\n equal(relationship.id, \'1\', \'post id is correct\');\n equal(relationship.attr(\'title\'), \'Hello World\', \'post title is correct\');\n });\n});\n\ntest(\"snapshot.hasMany() returns ID if option.id is set\", function() {\n expect(1);\n\n run(function() {\n env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var comment = env.store.push(\'comment\', { id: 2, body: \'This is comment\', post: 1 });\n var snapshot = comment._createSnapshot();\n var relationship = snapshot.belongsTo(\'post\', { id: true });\n\n equal(relationship, \'1\', \'relationship ID correctly returned\');\n });\n});\n\ntest(\"snapshot.hasMany() returns empty array if relationship is undefined\", function() {\n expect(2);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var snapshot = post._createSnapshot();\n var relationship = snapshot.hasMany(\'comments\');\n\n ok(relationship instanceof Array, \'relationship is an instance of Array\');\n equal(relationship.length, 0, \'relationship is empty\');\n });\n});\n\ntest(\"snapshot.hasMany() returns array of snapshots if relationship is set\", function() {\n expect(5);\n\n run(function() {\n env.store.push(\'comment\', { id: 1, body: \'This is the first comment\' });\n env.store.push(\'comment\', { id: 2, body: \'This is the second comment\' });\n var post = env.store.push(\'post\', { id: 3, title: \'Hello World\', comments: [1, 2] });\n var snapshot = post._createSnapshot();\n var relationship = snapshot.hasMany(\'comments\');\n\n ok(relationship instanceof Array, \'relationship is an instance of Array\');\n equal(relationship.length, 2, \'relationship has two items\');\n\n var relationship1 = relationship[0];\n\n ok(relationship1 instanceof DS.Snapshot, \'relationship item is an instance of DS.Snapshot\');\n\n equal(relationship1.id, \'1\', \'relationship item id is correct\');\n equal(relationship1.attr(\'body\'), \'This is the first comment\', \'relationship item body is correct\');\n });\n});\n\ntest(\"snapshot.hasMany() returns array of IDs if option.ids is set\", function() {\n expect(1);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\', comments: [2, 3] });\n var snapshot = post._createSnapshot();\n var relationship = snapshot.hasMany(\'comments\', { ids: true });\n\n deepEqual(relationship, [\'2\', \'3\'], \'relationship IDs correctly returned\');\n });\n});\n\ntest(\"snapshot.hasMany() respects the order of items in the relationship\", function() {\n expect(3);\n\n run(function() {\n env.store.push(\'comment\', { id: 1, body: \'This is the first comment\' });\n env.store.push(\'comment\', { id: 2, body: \'This is the second comment\' });\n var comment3 = env.store.push(\'comment\', { id: 3, body: \'This is the third comment\' });\n var post = env.store.push(\'post\', { id: 4, title: \'Hello World\', comments: [1, 2, 3] });\n\n post.get(\'comments\').removeObject(comment3);\n post.get(\'comments\').insertAt(0, comment3);\n\n var snapshot = post._createSnapshot();\n var relationship = snapshot.hasMany(\'comments\');\n\n equal(relationship[0].id, \'3\', \'order of comment 3 is correct\');\n equal(relationship[1].id, \'1\', \'order of comment 1 is correct\');\n equal(relationship[2].id, \'2\', \'order of comment 2 is correct\');\n });\n});\n\ntest(\"snapshot.eachAttribute() proxies to record\", function() {\n expect(1);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var snapshot = post._createSnapshot();\n\n var attributes = [];\n snapshot.eachAttribute(function(name) {\n attributes.push(name);\n });\n deepEqual(attributes, [\'author\', \'title\'], \'attributes are iterated correctly\');\n });\n});\n\ntest(\"snapshot.eachRelationship() proxies to record\", function() {\n expect(2);\n\n var getRelationships = function(snapshot) {\n var relationships = [];\n snapshot.eachRelationship(function(name) {\n relationships.push(name);\n });\n return relationships;\n };\n\n run(function() {\n var comment = env.store.push(\'comment\', { id: 1, body: \'This is the first comment\' });\n var post = env.store.push(\'post\', { id: 2, title: \'Hello World\' });\n var snapshot;\n\n snapshot = comment._createSnapshot();\n deepEqual(getRelationships(snapshot), [\'post\'], \'relationships are iterated correctly\');\n\n snapshot = post._createSnapshot();\n deepEqual(getRelationships(snapshot), [\'comments\'], \'relationships are iterated correctly\');\n });\n});\n\ntest(\"snapshot.belongsTo() does not trigger a call to store.scheduleFetch\", function() {\n expect(0);\n\n env.store.scheduleFetch = function() {\n ok(false, \'store.scheduleFetch should not be called\');\n };\n\n run(function() {\n var comment = env.store.push(\'comment\', { id: 2, body: \'This is comment\', post: 1 });\n var snapshot = comment._createSnapshot();\n\n snapshot.belongsTo(\'post\');\n });\n});\n\ntest(\"snapshot.hasMany() does not trigger a call to store.scheduleFetch\", function() {\n expect(0);\n\n env.store.scheduleFetch = function() {\n ok(false, \'store.scheduleFetch should not be called\');\n };\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\', comments: [2, 3] });\n var snapshot = post._createSnapshot();\n\n snapshot.hasMany(\'comments\');\n });\n});\n\ntest(\"snapshot.get() is deprecated\", function() {\n expect(1);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var snapshot = post._createSnapshot();\n\n expectDeprecation(function() {\n snapshot.get(\'title\');\n }, \'Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead.\');\n });\n});\n\ntest(\"snapshot.get() returns id\", function() {\n expect(2);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var snapshot = post._createSnapshot();\n\n expectDeprecation(function() {\n equal(snapshot.get(\'id\'), \'1\', \'snapshot id is correct\');\n });\n });\n});\n\ntest(\"snapshot.get() returns attribute\", function() {\n expect(2);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var snapshot = post._createSnapshot();\n\n expectDeprecation(function() {\n equal(snapshot.get(\'title\'), \'Hello World\', \'snapshot title is correct\');\n });\n });\n});\n\ntest(\"snapshot.get() returns belongsTo\", function() {\n expect(3);\n\n run(function() {\n var comment = env.store.push(\'comment\', { id: 1, body: \'This is a comment\', post: 2 });\n var snapshot = comment._createSnapshot();\n var relationship;\n\n expectDeprecation(function() {\n relationship = snapshot.get(\'post\');\n });\n\n ok(relationship instanceof DS.Snapshot, \'relationship is an instance of DS.Snapshot\');\n equal(relationship.id, \'2\', \'relationship id is correct\');\n });\n});\n\ntest(\"snapshot.get() returns hasMany\", function() {\n expect(3);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\', comments: [2, 3] });\n var snapshot = post._createSnapshot();\n var relationship;\n\n expectDeprecation(function() {\n relationship = snapshot.get(\'comments\');\n });\n\n ok(relationship instanceof Array, \'relationship is an instance of Array\');\n equal(relationship.length, 2, \'relationship has two items\');\n });\n});\n\ntest(\"snapshot.get() proxies property to record unless identified as id, attribute or relationship\", function() {\n expect(2);\n\n run(function() {\n var post = env.store.push(\'post\', { id: 1, title: \'Hello World\' });\n var snapshot = post._createSnapshot();\n\n post.set(\'category\', \'Ember.js\'); // category is not defined as an DS.attr()\n\n expectDeprecation(function() {\n equal(snapshot.get(\'category\'), \'Ember.js\', \'snapshot proxies unknown property correctly\');\n });\n });\n});\n})();//# sourceURL=ember-data/integration/snapshot-test.js");
|
336
336
|
|
337
|
-
eval("(function() {var store, env;\n\nvar Person = DS.Model.extend({\n name: DS.attr(\'string\'),\n cars: DS.hasMany(\'car\')\n});\n\nvar run = Ember.run;\n\nPerson.toString = function() { return \"Person\"; };\n\nvar Car = DS.Model.extend({\n make: DS.attr(\'string\'),\n model: DS.attr(\'string\'),\n person: DS.belongsTo(\'person\')\n});\n\nCar.toString = function() { return \"Car\"; };\n\nfunction initializeStore(adapter) {\n env = setupStore({\n adapter: adapter\n });\n store = env.store;\n\n env.registry.register(\'model:car\', Car);\n env.registry.register(\'model:person\', Person);\n}\n\nmodule(\"integration/store - destroy\", {\n setup: function() {\n initializeStore(DS.FixtureAdapter.extend());\n }\n});\n\nfunction tap(obj, methodName, callback) {\n var old = obj[methodName];\n\n var summary = { called: [] };\n\n obj[methodName] = function() {\n var result = old.apply(obj, arguments);\n if (callback) {\n callback.apply(obj, arguments);\n }\n summary.called.push(arguments);\n return result;\n };\n\n return summary;\n}\n\nasyncTest(\"destroying record during find doesn\'t cause error\", function() {\n expect(0);\n\n var TestAdapter = DS.FixtureAdapter.extend({\n find: function(store, type, id, snapshot) {\n return new Ember.RSVP.Promise(function(resolve, reject) {\n Ember.run.next(function() {\n store.unloadAll(type);\n reject();\n });\n });\n }\n });\n\n initializeStore(TestAdapter);\n\n var type = \"car\";\n var id = 1;\n\n function done() {\n start();\n }\n\n run(function() {\n store.find(type, id).then(done, done);\n });\n});\n\nasyncTest(\"find calls do not resolve when the store is destroyed\", function() {\n expect(0);\n\n var TestAdapter = DS.FixtureAdapter.extend({\n find: function(store, type, id, snapshot) {\n store.destroy();\n Ember.RSVP.resolve(null);\n }\n });\n\n initializeStore(TestAdapter);\n\n\n var type = \"car\";\n var id = 1;\n\n store.push = function() {\n Ember.assert(\"The test should have destroyed the store by now\", store.get(\"isDestroyed\"));\n\n throw new Error(\"We shouldn\'t be pushing data into the store when it is destroyed\");\n };\n\n run(function() {\n store.find(type, id);\n });\n\n setTimeout(function() {\n start();\n }, 500);\n});\n\n\ntest(\"destroying the store correctly cleans everything up\", function() {\n var car, person;\n run(function() {\n car = store.push(\'car\', {\n id: 1,\n make: \'BMC\',\n model: \'Mini\',\n person: 1\n });\n\n person = store.push(\'person\', {\n id: 1,\n name: \'Tom Dale\',\n cars: [1]\n });\n });\n\n var personWillDestroy = tap(person, \'willDestroy\');\n var carWillDestroy = tap(car, \'willDestroy\');\n var carsWillDestroy = tap(car.get(\'person.cars\'), \'willDestroy\');\n\n env.adapter.findQuery = function() {\n return [{\n id: 2,\n name: \'Yehuda\'\n }];\n };\n var adapterPopulatedPeople, filterdPeople;\n\n run(function() {\n adapterPopulatedPeople = store.find(\'person\', {\n someCrazy: \'query\'\n });\n });\n\n run(function() {\n filterdPeople = store.filter(\'person\', function() { return true; });\n });\n\n var filterdPeopleWillDestroy = tap(filterdPeople.content, \'willDestroy\');\n var adapterPopulatedPeopleWillDestroy = tap(adapterPopulatedPeople.content, \'willDestroy\');\n\n run(function() {\n store.find(\'person\', 2);\n });\n\n equal(personWillDestroy.called.length, 0, \'expected person.willDestroy to not have been called\');\n equal(carWillDestroy.called.length, 0, \'expected car.willDestroy to not have been called\');\n equal(carsWillDestroy.called.length, 0, \'expected cars.willDestroy to not have been called\');\n equal(adapterPopulatedPeopleWillDestroy.called.length, 0, \'expected adapterPopulatedPeople.willDestroy to not have been called\');\n equal(filterdPeopleWillDestroy.called.length, 0, \'expected filterdPeople.willDestroy to not have been called\');\n\n equal(filterdPeople.get(\'length\'), 2, \'expected filterdPeople to have 2 entries\');\n\n equal(car.get(\'person\'), person, \"expected car\'s person to be the correct person\");\n equal(person.get(\'cars.firstObject\'), car, \" expected persons cars\'s firstRecord to be the correct car\");\n\n Ember.run(person, person.destroy);\n Ember.run(store, \'destroy\');\n\n equal(car.get(\'person\'), null, \"expected car.person to no longer be present\");\n\n equal(personWillDestroy.called.length, 1, \'expected person to have recieved willDestroy once\');\n equal(carWillDestroy.called.length, 1, \'expected car to recieve willDestroy once\');\n equal(carsWillDestroy.called.length, 1, \'expected cars to recieve willDestroy once\');\n equal(adapterPopulatedPeopleWillDestroy.called.length, 1, \'expected adapterPopulatedPeople to recieve willDestroy once\');\n equal(filterdPeopleWillDestroy.called.length, 1, \'expected filterdPeople.willDestroy to have been called once\');\n});\n\nmodule(\"integration/store - fetch\", {\n setup: function() {\n initializeStore(DS.RESTAdapter.extend());\n }\n});\n\nfunction ajaxResponse(value) {\n var passedUrl, passedVerb, passedHash;\n env.adapter.ajax = function(url, verb, hash) {\n passedUrl = url;\n passedVerb = verb;\n passedHash = hash;\n\n return Ember.RSVP.resolve(value);\n };\n}\n\ntest(\"Using store#fetch is deprecated\", function() {\n ajaxResponse({\n cars: [\n { id: 1, make: \'BMW\', model: \'Mini\' }\n ]\n });\n\n expectDeprecation(\n function() {\n run(function() {\n store.fetch(\'car\', 1);\n });\n },\n \'Using store.fetch() has been deprecated. Use store.fetchById for fetching individual records or store.fetchAll for collections\'\n );\n});\n\nmodule(\"integration/store - fetchById\", {\n setup: function() {\n initializeStore(DS.RESTAdapter.extend());\n }\n});\n\ntest(\"Using store#fetchById on non existing record fetches it from the server\", function() {\n expect(2);\n\n ajaxResponse({\n cars: [{\n id: 20,\n make: \'BMCW\',\n model: \'Mini\'\n }]\n });\n\n var car = store.hasRecordForId(\'car\', 20);\n ok(!car, \'Car with id=20 should not exist\');\n\n run(function() {\n store.fetchById(\'car\', 20).then(function (car) {\n equal(car.get(\'make\'), \'BMCW\', \'Car with id=20 is now loaded\');\n });\n });\n});\n\ntest(\"Using store#fetchById on existing record reloads it\", function() {\n expect(2);\n var car;\n\n run(function() {\n car = store.push(\'car\', {\n id: 1,\n make: \'BMC\',\n model: \'Mini\'\n });\n\n });\n ajaxResponse({\n cars: [{\n id: 1,\n make: \'BMCW\',\n model: \'Mini\'\n }]\n });\n\n equal(car.get(\'make\'), \'BMC\');\n\n run(function() {\n store.fetchById(\'car\', 1).then(function(car) {\n equal(car.get(\'make\'), \'BMCW\');\n });\n });\n});\n\nmodule(\"integration/store - fetchAll\", {\n setup: function() {\n initializeStore(DS.RESTAdapter.extend());\n }\n});\n\ntest(\"Using store#fetchAll with no records triggers a query\", function() {\n expect(2);\n\n ajaxResponse({\n cars: [{\n id: 1,\n make: \'BMC\',\n model: \'Mini\'\n },\n {\n id: 2,\n make: \'BMCW\',\n model: \'Isetta\'\n }]\n });\n\n var cars = store.all(\'car\');\n ok(!cars.get(\'length\'), \'There is no cars in the store\');\n\n run(function() {\n store.fetchAll(\'car\').then(function(cars) {\n equal(cars.get(\'length\'), 2, \'Two car were fetched\');\n });\n });\n});\n\ntest(\"Using store#fetchAll with existing records performs a query, updating existing records and returning new ones\", function() {\n expect(3);\n\n run(function() {\n store.push(\'car\', {\n id: 1,\n make: \'BMC\',\n model: \'Mini\'\n });\n });\n\n ajaxResponse({\n cars: [{\n id: 1,\n make: \'BMC\',\n model: \'New Mini\'\n },\n {\n id: 2,\n make: \'BMCW\',\n model: \'Isetta\'\n }]\n });\n\n var cars = store.all(\'car\');\n equal(cars.get(\'length\'), 1, \'There is one car in the store\');\n\n run(function() {\n store.fetchAll(\'car\').then(function(cars) {\n equal(cars.get(\'length\'), 2, \'There is 2 cars in the store now\');\n var mini = cars.findBy(\'id\', \'1\');\n equal(mini.get(\'model\'), \'New Mini\', \'Existing records have been updated\');\n });\n });\n});\n\ntest(\"store#fetchAll should return all known records even if they are not in the adapter response\", function() {\n expect(4);\n\n run(function() {\n store.push(\'car\', { id: 1, make: \'BMC\', model: \'Mini\' });\n store.push(\'car\', { id: 2, make: \'BMCW\', model: \'Isetta\' });\n });\n\n ajaxResponse({\n cars: [{\n id: 1,\n make: \'BMC\',\n model: \'New Mini\'\n }]\n });\n\n var cars = store.all(\'car\');\n equal(cars.get(\'length\'), 2, \'There is two cars in the store\');\n\n run(function() {\n store.fetchAll(\'car\').then(function(cars) {\n equal(cars.get(\'length\'), 2, \'It returns all cars\');\n var mini = cars.findBy(\'id\', \'1\');\n equal(mini.get(\'model\'), \'New Mini\', \'Existing records have been updated\');\n\n var carsInStore = store.all(\'car\');\n equal(carsInStore.get(\'length\'), 2, \'There is 2 cars in the store\');\n });\n });\n});\n\ntest(\"Using store#fetch on an empty record calls find\", function() {\n expect(2);\n\n ajaxResponse({\n cars: [{\n id: 20,\n make: \'BMCW\',\n model: \'Mini\'\n }]\n });\n\n run(function() {\n store.push(\'person\', {\n id: 1,\n name: \'Tom Dale\',\n cars: [20]\n });\n });\n\n var car = store.recordForId(\'car\', 20);\n ok(car.get(\'isEmpty\'), \'Car with id=20 should be empty\');\n\n run(function() {\n store.fetch(\'car\', 20).then(function (car) {\n equal(car.get(\'make\'), \'BMCW\', \'Car with id=20 is now loaded\');\n });\n });\n});\n})();//# sourceURL=ember-data/integration/store-test.js");
|
337
|
+
eval("(function() {var store, env;\n\nvar Person = DS.Model.extend({\n name: DS.attr(\'string\'),\n cars: DS.hasMany(\'car\')\n});\n\nvar run = Ember.run;\n\nPerson.toString = function() { return \"Person\"; };\n\nvar Car = DS.Model.extend({\n make: DS.attr(\'string\'),\n model: DS.attr(\'string\'),\n person: DS.belongsTo(\'person\')\n});\n\nCar.toString = function() { return \"Car\"; };\n\nfunction initializeStore(adapter) {\n env = setupStore({\n adapter: adapter\n });\n store = env.store;\n\n env.registry.register(\'model:car\', Car);\n env.registry.register(\'model:person\', Person);\n}\n\nmodule(\"integration/store - destroy\", {\n setup: function() {\n initializeStore(DS.FixtureAdapter.extend());\n }\n});\n\nfunction tap(obj, methodName, callback) {\n var old = obj[methodName];\n\n var summary = { called: [] };\n\n obj[methodName] = function() {\n var result = old.apply(obj, arguments);\n if (callback) {\n callback.apply(obj, arguments);\n }\n summary.called.push(arguments);\n return result;\n };\n\n return summary;\n}\n\nasyncTest(\"destroying record during find doesn\'t cause error\", function() {\n expect(0);\n\n var TestAdapter = DS.FixtureAdapter.extend({\n find: function(store, type, id, snapshot) {\n return new Ember.RSVP.Promise(function(resolve, reject) {\n Ember.run.next(function() {\n store.unloadAll(type);\n reject();\n });\n });\n }\n });\n\n initializeStore(TestAdapter);\n\n var type = \"car\";\n var id = 1;\n\n function done() {\n start();\n }\n\n run(function() {\n store.find(type, id).then(done, done);\n });\n});\n\nasyncTest(\"find calls do not resolve when the store is destroyed\", function() {\n expect(0);\n\n var TestAdapter = DS.FixtureAdapter.extend({\n find: function(store, type, id, snapshot) {\n store.destroy();\n Ember.RSVP.resolve(null);\n }\n });\n\n initializeStore(TestAdapter);\n\n\n var type = \"car\";\n var id = 1;\n\n store.push = function() {\n Ember.assert(\"The test should have destroyed the store by now\", store.get(\"isDestroyed\"));\n\n throw new Error(\"We shouldn\'t be pushing data into the store when it is destroyed\");\n };\n\n run(function() {\n store.find(type, id);\n });\n\n setTimeout(function() {\n start();\n }, 500);\n});\n\n\ntest(\"destroying the store correctly cleans everything up\", function() {\n var car, person;\n run(function() {\n car = store.push(\'car\', {\n id: 1,\n make: \'BMC\',\n model: \'Mini\',\n person: 1\n });\n\n person = store.push(\'person\', {\n id: 1,\n name: \'Tom Dale\',\n cars: [1]\n });\n });\n\n var personWillDestroy = tap(person, \'willDestroy\');\n var carWillDestroy = tap(car, \'willDestroy\');\n var carsWillDestroy = tap(car.get(\'person.cars\'), \'willDestroy\');\n\n env.adapter.findQuery = function() {\n return [{\n id: 2,\n name: \'Yehuda\'\n }];\n };\n var adapterPopulatedPeople, filterdPeople;\n\n run(function() {\n adapterPopulatedPeople = store.find(\'person\', {\n someCrazy: \'query\'\n });\n });\n\n run(function() {\n filterdPeople = store.filter(\'person\', function() { return true; });\n });\n\n var filterdPeopleWillDestroy = tap(filterdPeople.content, \'willDestroy\');\n var adapterPopulatedPeopleWillDestroy = tap(adapterPopulatedPeople.content, \'willDestroy\');\n\n run(function() {\n store.find(\'person\', 2);\n });\n\n equal(personWillDestroy.called.length, 0, \'expected person.willDestroy to not have been called\');\n equal(carWillDestroy.called.length, 0, \'expected car.willDestroy to not have been called\');\n equal(carsWillDestroy.called.length, 0, \'expected cars.willDestroy to not have been called\');\n equal(adapterPopulatedPeopleWillDestroy.called.length, 0, \'expected adapterPopulatedPeople.willDestroy to not have been called\');\n equal(filterdPeopleWillDestroy.called.length, 0, \'expected filterdPeople.willDestroy to not have been called\');\n\n equal(filterdPeople.get(\'length\'), 2, \'expected filterdPeople to have 2 entries\');\n\n equal(car.get(\'person\'), person, \"expected car\'s person to be the correct person\");\n equal(person.get(\'cars.firstObject\'), car, \" expected persons cars\'s firstRecord to be the correct car\");\n\n Ember.run(person, person.destroy);\n Ember.run(store, \'destroy\');\n\n equal(car.get(\'person\'), null, \"expected car.person to no longer be present\");\n\n equal(personWillDestroy.called.length, 1, \'expected person to have recieved willDestroy once\');\n equal(carWillDestroy.called.length, 1, \'expected car to recieve willDestroy once\');\n equal(carsWillDestroy.called.length, 1, \'expected cars to recieve willDestroy once\');\n equal(adapterPopulatedPeopleWillDestroy.called.length, 1, \'expected adapterPopulatedPeople to recieve willDestroy once\');\n equal(filterdPeopleWillDestroy.called.length, 1, \'expected filterdPeople.willDestroy to have been called once\');\n});\n\nmodule(\"integration/store - fetch\", {\n setup: function() {\n initializeStore(DS.RESTAdapter.extend());\n }\n});\n\nfunction ajaxResponse(value) {\n var passedUrl, passedVerb, passedHash;\n env.adapter.ajax = function(url, verb, hash) {\n passedUrl = url;\n passedVerb = verb;\n passedHash = hash;\n\n return Ember.RSVP.resolve(value);\n };\n}\n\ntest(\"Using store#fetch is deprecated\", function() {\n ajaxResponse({\n cars: [\n { id: 1, make: \'BMW\', model: \'Mini\' }\n ]\n });\n\n expectDeprecation(\n function() {\n run(function() {\n store.fetch(\'car\', 1);\n });\n },\n \'Using store.fetch() has been deprecated. Use store.fetchById for fetching individual records or store.fetchAll for collections\'\n );\n});\n\nmodule(\"integration/store - fetchById\", {\n setup: function() {\n initializeStore(DS.RESTAdapter.extend());\n }\n});\n\ntest(\"Using store#fetchById on non existing record fetches it from the server\", function() {\n expect(2);\n\n ajaxResponse({\n cars: [{\n id: 20,\n make: \'BMCW\',\n model: \'Mini\'\n }]\n });\n\n var car = store.hasRecordForId(\'car\', 20);\n ok(!car, \'Car with id=20 should not exist\');\n\n run(function() {\n store.fetchById(\'car\', 20).then(function (car) {\n equal(car.get(\'make\'), \'BMCW\', \'Car with id=20 is now loaded\');\n });\n });\n});\n\ntest(\"Using store#fetchById on existing record reloads it\", function() {\n expect(2);\n var car;\n\n run(function() {\n car = store.push(\'car\', {\n id: 1,\n make: \'BMC\',\n model: \'Mini\'\n });\n\n });\n ajaxResponse({\n cars: [{\n id: 1,\n make: \'BMCW\',\n model: \'Mini\'\n }]\n });\n\n equal(car.get(\'make\'), \'BMC\');\n\n run(function() {\n store.fetchById(\'car\', 1).then(function(car) {\n equal(car.get(\'make\'), \'BMCW\');\n });\n });\n});\n\nmodule(\"integration/store - fetchAll\", {\n setup: function() {\n initializeStore(DS.RESTAdapter.extend());\n }\n});\n\ntest(\"Using store#fetchAll with no records triggers a query\", function() {\n expect(2);\n\n ajaxResponse({\n cars: [{\n id: 1,\n make: \'BMC\',\n model: \'Mini\'\n },\n {\n id: 2,\n make: \'BMCW\',\n model: \'Isetta\'\n }]\n });\n\n var cars = store.all(\'car\');\n ok(!cars.get(\'length\'), \'There is no cars in the store\');\n\n run(function() {\n store.fetchAll(\'car\').then(function(cars) {\n equal(cars.get(\'length\'), 2, \'Two car were fetched\');\n });\n });\n});\n\ntest(\"Using store#fetchAll with existing records performs a query, updating existing records and returning new ones\", function() {\n expect(3);\n\n run(function() {\n store.push(\'car\', {\n id: 1,\n make: \'BMC\',\n model: \'Mini\'\n });\n });\n\n ajaxResponse({\n cars: [{\n id: 1,\n make: \'BMC\',\n model: \'New Mini\'\n },\n {\n id: 2,\n make: \'BMCW\',\n model: \'Isetta\'\n }]\n });\n\n var cars = store.all(\'car\');\n equal(cars.get(\'length\'), 1, \'There is one car in the store\');\n\n run(function() {\n store.fetchAll(\'car\').then(function(cars) {\n equal(cars.get(\'length\'), 2, \'There is 2 cars in the store now\');\n var mini = cars.findBy(\'id\', \'1\');\n equal(mini.get(\'model\'), \'New Mini\', \'Existing records have been updated\');\n });\n });\n});\n\ntest(\"store#fetchAll should return all known records even if they are not in the adapter response\", function() {\n expect(4);\n\n run(function() {\n store.push(\'car\', { id: 1, make: \'BMC\', model: \'Mini\' });\n store.push(\'car\', { id: 2, make: \'BMCW\', model: \'Isetta\' });\n });\n\n ajaxResponse({\n cars: [{\n id: 1,\n make: \'BMC\',\n model: \'New Mini\'\n }]\n });\n\n var cars = store.all(\'car\');\n equal(cars.get(\'length\'), 2, \'There is two cars in the store\');\n\n run(function() {\n store.fetchAll(\'car\').then(function(cars) {\n equal(cars.get(\'length\'), 2, \'It returns all cars\');\n var mini = cars.findBy(\'id\', \'1\');\n equal(mini.get(\'model\'), \'New Mini\', \'Existing records have been updated\');\n\n var carsInStore = store.all(\'car\');\n equal(carsInStore.get(\'length\'), 2, \'There is 2 cars in the store\');\n });\n });\n});\n\ntest(\"Using store#fetch on an empty record calls find\", function() {\n expect(2);\n\n ajaxResponse({\n cars: [{\n id: 20,\n make: \'BMCW\',\n model: \'Mini\'\n }]\n });\n\n run(function() {\n store.push(\'person\', {\n id: 1,\n name: \'Tom Dale\',\n cars: [20]\n });\n });\n\n var car = store.recordForId(\'car\', 20);\n ok(car.get(\'isEmpty\'), \'Car with id=20 should be empty\');\n\n run(function() {\n store.fetch(\'car\', 20).then(function (car) {\n equal(car.get(\'make\'), \'BMCW\', \'Car with id=20 is now loaded\');\n });\n });\n});\n\ntest(\"Using store#adapterFor should not throw an error when looking up the application adapter\", function() {\n expect(1);\n\n run(function() {\n var applicationAdapter = store.adapterFor(\'application\');\n ok(applicationAdapter);\n });\n});\n\n\ntest(\"Using store#serializerFor should not throw an error when looking up the application serializer\", function() {\n expect(1);\n\n run(function() {\n var applicationSerializer = store.serializerFor(\'application\');\n ok(applicationSerializer);\n });\n});\n})();//# sourceURL=ember-data/integration/store-test.js");
|
338
338
|
|
339
339
|
eval("(function() {var Person, array, store;\nvar run = Ember.run;\n\nvar adapter = DS.Adapter.extend({\n deleteRecord: function() {\n return Ember.RSVP.Promise.resolve();\n }\n});\n\nmodule(\"unit/adapter_populated_record_array - DS.AdapterPopulatedRecordArray\", {\n setup: function() {\n\n store = createStore({\n adapter: adapter\n });\n\n array = [{ id: \'1\', name: \"Scumbag Dale\" },\n { id: \'2\', name: \"Scumbag Katz\" },\n { id: \'3\', name: \"Scumbag Bryn\" }];\n\n Person = DS.Model.extend({\n name: DS.attr(\'string\')\n });\n }\n});\n\ntest(\"when a record is deleted in an adapter populated record array, it should be removed\", function() {\n var recordArray = store.recordArrayManager\n .createAdapterPopulatedRecordArray(Person, null);\n\n run(function() {\n recordArray.load(array);\n });\n\n equal(recordArray.get(\'length\'), 3, \"expected recordArray to contain exactly 3 records\");\n\n run(function() {\n recordArray.get(\'firstObject\').destroyRecord();\n });\n\n equal(recordArray.get(\'length\'), 2, \"expected recordArray to contain exactly 2 records\");\n});\n})();//# sourceURL=ember-data/unit/adapter-populated-record-array-test.js");
|
340
340
|
|
data/dist/ember-data.js
CHANGED
@@ -1595,20 +1595,22 @@
|
|
1595
1595
|
return string.endsWith(suffix);
|
1596
1596
|
}
|
1597
1597
|
}
|
1598
|
-
var ember$
|
1598
|
+
var ember$lib$main$$default = self.Ember;
|
1599
1599
|
|
1600
|
-
var ember$inflector$lib$system$inflector$$
|
1601
|
-
var ember$inflector$lib$system$inflector$$LAST_WORD_DASHED_REGEX = /(\w+[_-])([a-z\d]+$)/;
|
1602
|
-
var ember$inflector$lib$system$inflector$$LAST_WORD_CAMELIZED_REGEX = /(\w+)([A-Z][a-z\d]*$)/;
|
1603
|
-
var ember$inflector$lib$system$inflector$$CAMELIZED_REGEX = /[A-Z][a-z\d]*$/;
|
1600
|
+
var ember$inflector$lib$lib$system$inflector$$capitalize = ember$lib$main$$default.String.capitalize;
|
1604
1601
|
|
1605
|
-
|
1602
|
+
var ember$inflector$lib$lib$system$inflector$$BLANK_REGEX = /^\s*$/;
|
1603
|
+
var ember$inflector$lib$lib$system$inflector$$LAST_WORD_DASHED_REGEX = /(\w+[_-])([a-z\d]+$)/;
|
1604
|
+
var ember$inflector$lib$lib$system$inflector$$LAST_WORD_CAMELIZED_REGEX = /(\w+)([A-Z][a-z\d]*$)/;
|
1605
|
+
var ember$inflector$lib$lib$system$inflector$$CAMELIZED_REGEX = /[A-Z][a-z\d]*$/;
|
1606
|
+
|
1607
|
+
function ember$inflector$lib$lib$system$inflector$$loadUncountable(rules, uncountable) {
|
1606
1608
|
for (var i = 0, length = uncountable.length; i < length; i++) {
|
1607
1609
|
rules.uncountable[uncountable[i].toLowerCase()] = true;
|
1608
1610
|
}
|
1609
1611
|
}
|
1610
1612
|
|
1611
|
-
function ember$inflector$lib$system$inflector$$loadIrregular(rules, irregularPairs) {
|
1613
|
+
function ember$inflector$lib$lib$system$inflector$$loadIrregular(rules, irregularPairs) {
|
1612
1614
|
var pair;
|
1613
1615
|
|
1614
1616
|
for (var i = 0, length = irregularPairs.length; i < length; i++) {
|
@@ -1682,21 +1684,21 @@
|
|
1682
1684
|
@class Inflector
|
1683
1685
|
@namespace Ember
|
1684
1686
|
*/
|
1685
|
-
function ember$inflector$lib$system$inflector$$Inflector(ruleSet) {
|
1687
|
+
function ember$inflector$lib$lib$system$inflector$$Inflector(ruleSet) {
|
1686
1688
|
ruleSet = ruleSet || {};
|
1687
|
-
ruleSet.uncountable = ruleSet.uncountable || ember$inflector$lib$system$inflector$$makeDictionary();
|
1688
|
-
ruleSet.irregularPairs = ruleSet.irregularPairs || ember$inflector$lib$system$inflector$$makeDictionary();
|
1689
|
+
ruleSet.uncountable = ruleSet.uncountable || ember$inflector$lib$lib$system$inflector$$makeDictionary();
|
1690
|
+
ruleSet.irregularPairs = ruleSet.irregularPairs || ember$inflector$lib$lib$system$inflector$$makeDictionary();
|
1689
1691
|
|
1690
1692
|
var rules = this.rules = {
|
1691
1693
|
plurals: ruleSet.plurals || [],
|
1692
1694
|
singular: ruleSet.singular || [],
|
1693
|
-
irregular: ember$inflector$lib$system$inflector$$makeDictionary(),
|
1694
|
-
irregularInverse: ember$inflector$lib$system$inflector$$makeDictionary(),
|
1695
|
-
uncountable: ember$inflector$lib$system$inflector$$makeDictionary()
|
1695
|
+
irregular: ember$inflector$lib$lib$system$inflector$$makeDictionary(),
|
1696
|
+
irregularInverse: ember$inflector$lib$lib$system$inflector$$makeDictionary(),
|
1697
|
+
uncountable: ember$inflector$lib$lib$system$inflector$$makeDictionary()
|
1696
1698
|
};
|
1697
1699
|
|
1698
|
-
ember$inflector$lib$system$inflector$$loadUncountable(rules, ruleSet.uncountable);
|
1699
|
-
ember$inflector$lib$system$inflector$$loadIrregular(rules, ruleSet.irregularPairs);
|
1700
|
+
ember$inflector$lib$lib$system$inflector$$loadUncountable(rules, ruleSet.uncountable);
|
1701
|
+
ember$inflector$lib$lib$system$inflector$$loadIrregular(rules, ruleSet.irregularPairs);
|
1700
1702
|
|
1701
1703
|
this.enableCache();
|
1702
1704
|
}
|
@@ -1705,14 +1707,14 @@
|
|
1705
1707
|
throw new Error("This browser does not support Object.create(null), please polyfil with es5-sham: http://git.io/yBU2rg");
|
1706
1708
|
}
|
1707
1709
|
|
1708
|
-
function ember$inflector$lib$system$inflector$$makeDictionary() {
|
1710
|
+
function ember$inflector$lib$lib$system$inflector$$makeDictionary() {
|
1709
1711
|
var cache = Object.create(null);
|
1710
1712
|
cache['_dict'] = null;
|
1711
1713
|
delete cache['_dict'];
|
1712
1714
|
return cache;
|
1713
1715
|
}
|
1714
1716
|
|
1715
|
-
ember$inflector$lib$system$inflector$$Inflector.prototype = {
|
1717
|
+
ember$inflector$lib$lib$system$inflector$$Inflector.prototype = {
|
1716
1718
|
/**
|
1717
1719
|
@public
|
1718
1720
|
|
@@ -1742,8 +1744,8 @@
|
|
1742
1744
|
*/
|
1743
1745
|
purgeCache: function() {
|
1744
1746
|
this._cacheUsed = false;
|
1745
|
-
this._sCache = ember$inflector$lib$system$inflector$$makeDictionary();
|
1746
|
-
this._pCache = ember$inflector$lib$system$inflector$$makeDictionary();
|
1747
|
+
this._sCache = ember$inflector$lib$lib$system$inflector$$makeDictionary();
|
1748
|
+
this._pCache = ember$inflector$lib$lib$system$inflector$$makeDictionary();
|
1747
1749
|
},
|
1748
1750
|
|
1749
1751
|
/**
|
@@ -1790,7 +1792,7 @@
|
|
1790
1792
|
*/
|
1791
1793
|
uncountable: function(string) {
|
1792
1794
|
if (this._cacheUsed) { this.purgeCache(); }
|
1793
|
-
ember$inflector$lib$system$inflector$$loadUncountable(this.rules, [string.toLowerCase()]);
|
1795
|
+
ember$inflector$lib$lib$system$inflector$$loadUncountable(this.rules, [string.toLowerCase()]);
|
1794
1796
|
},
|
1795
1797
|
|
1796
1798
|
/**
|
@@ -1800,7 +1802,7 @@
|
|
1800
1802
|
*/
|
1801
1803
|
irregular: function (singular, plural) {
|
1802
1804
|
if (this._cacheUsed) { this.purgeCache(); }
|
1803
|
-
ember$inflector$lib$system$inflector$$loadIrregular(this.rules, [[singular, plural]]);
|
1805
|
+
ember$inflector$lib$lib$system$inflector$$loadIrregular(this.rules, [[singular, plural]]);
|
1804
1806
|
},
|
1805
1807
|
|
1806
1808
|
/**
|
@@ -1837,10 +1839,10 @@
|
|
1837
1839
|
inflect: function(word, typeRules, irregular) {
|
1838
1840
|
var inflection, substitution, result, lowercase, wordSplit,
|
1839
1841
|
firstPhrase, lastWord, isBlank, isCamelized, isUncountable,
|
1840
|
-
isIrregular,
|
1842
|
+
isIrregular, rule;
|
1841
1843
|
|
1842
|
-
isBlank = ember$inflector$lib$system$inflector$$BLANK_REGEX.test(word);
|
1843
|
-
isCamelized = ember$inflector$lib$system$inflector$$CAMELIZED_REGEX.test(word);
|
1844
|
+
isBlank = ember$inflector$lib$lib$system$inflector$$BLANK_REGEX.test(word);
|
1845
|
+
isCamelized = ember$inflector$lib$lib$system$inflector$$CAMELIZED_REGEX.test(word);
|
1844
1846
|
firstPhrase = "";
|
1845
1847
|
|
1846
1848
|
if (isBlank) {
|
@@ -1848,7 +1850,7 @@
|
|
1848
1850
|
}
|
1849
1851
|
|
1850
1852
|
lowercase = word.toLowerCase();
|
1851
|
-
wordSplit = ember$inflector$lib$system$inflector$$LAST_WORD_DASHED_REGEX.exec(word) || ember$inflector$lib$system$inflector$$LAST_WORD_CAMELIZED_REGEX.exec(word);
|
1853
|
+
wordSplit = ember$inflector$lib$lib$system$inflector$$LAST_WORD_DASHED_REGEX.exec(word) || ember$inflector$lib$lib$system$inflector$$LAST_WORD_CAMELIZED_REGEX.exec(word);
|
1852
1854
|
if (wordSplit){
|
1853
1855
|
firstPhrase = wordSplit[1];
|
1854
1856
|
lastWord = wordSplit[2].toLowerCase();
|
@@ -1867,7 +1869,7 @@
|
|
1867
1869
|
return isIrregular;
|
1868
1870
|
}
|
1869
1871
|
else {
|
1870
|
-
isIrregular = (isCamelized) ? ember$inflector$lib$system$inflector$$capitalize(isIrregular) : isIrregular;
|
1872
|
+
isIrregular = (isCamelized) ? ember$inflector$lib$lib$system$inflector$$capitalize(isIrregular) : isIrregular;
|
1871
1873
|
return firstPhrase + isIrregular;
|
1872
1874
|
}
|
1873
1875
|
}
|
@@ -1892,17 +1894,17 @@
|
|
1892
1894
|
}
|
1893
1895
|
};
|
1894
1896
|
|
1895
|
-
var ember$inflector$lib$system$inflector$$default = ember$inflector$lib$system$inflector$$Inflector;
|
1897
|
+
var ember$inflector$lib$lib$system$inflector$$default = ember$inflector$lib$lib$system$inflector$$Inflector;
|
1896
1898
|
|
1897
|
-
function ember$inflector$lib$system$string$$pluralize(word) {
|
1898
|
-
return ember$inflector$lib$system$inflector$$default.inflector.pluralize(word);
|
1899
|
+
function ember$inflector$lib$lib$system$string$$pluralize(word) {
|
1900
|
+
return ember$inflector$lib$lib$system$inflector$$default.inflector.pluralize(word);
|
1899
1901
|
}
|
1900
1902
|
|
1901
|
-
function ember$inflector$lib$system$string$$singularize(word) {
|
1902
|
-
return ember$inflector$lib$system$inflector$$default.inflector.singularize(word);
|
1903
|
+
function ember$inflector$lib$lib$system$string$$singularize(word) {
|
1904
|
+
return ember$inflector$lib$lib$system$inflector$$default.inflector.singularize(word);
|
1903
1905
|
}
|
1904
1906
|
|
1905
|
-
var ember$inflector$lib$system$inflections$$default = {
|
1907
|
+
var ember$inflector$lib$lib$system$inflections$$default = {
|
1906
1908
|
plurals: [
|
1907
1909
|
[/$/, 's'],
|
1908
1910
|
[/s$/i, 's'],
|
@@ -1981,109 +1983,96 @@
|
|
1981
1983
|
]
|
1982
1984
|
};
|
1983
1985
|
|
1984
|
-
ember$inflector$lib$system$inflector$$default.inflector = new ember$inflector$lib$system$inflector$$default(ember$inflector$lib$system$inflections$$default);
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
*
|
2012
|
-
* {{pluralize count myProperty}}
|
2013
|
-
* {{pluralize 1 "oxen"}}
|
2014
|
-
* {{pluralize myProperty}}
|
2015
|
-
* {{pluralize "ox"}}
|
2016
|
-
*
|
2017
|
-
* @for Ember.HTMLBars.helpers
|
2018
|
-
* @method pluralize
|
2019
|
-
* @param {Number|Property} [count] count of objects
|
2020
|
-
* @param {String|Property} word word to pluralize
|
2021
|
-
*/
|
2022
|
-
Ember.HTMLBars._registerHelper('pluralize', Ember.HTMLBars.makeBoundHelper(function(params) {
|
2023
|
-
var count, word;
|
2024
|
-
|
2025
|
-
if (params.length === 1) {
|
2026
|
-
word = params[0];
|
2027
|
-
return ember$inflector$lib$system$string$$pluralize(word);
|
2028
|
-
} else {
|
2029
|
-
count = params[0];
|
2030
|
-
word = params[1];
|
2031
|
-
|
2032
|
-
if (count !== 1) {
|
2033
|
-
word = ember$inflector$lib$system$string$$pluralize(word);
|
2034
|
-
}
|
2035
|
-
return count + " " + word;
|
2036
|
-
}
|
2037
|
-
}));
|
2038
|
-
} else {
|
2039
|
-
/**
|
2040
|
-
*
|
2041
|
-
* If you have Ember Inflector (such as if Ember Data is present),
|
2042
|
-
* singularize a word. For example, turn "oxen" into "ox".
|
2043
|
-
*
|
2044
|
-
* Example:
|
2045
|
-
*
|
2046
|
-
* {{singularize myProperty}}
|
2047
|
-
* {{singularize "oxen"}}
|
2048
|
-
*
|
2049
|
-
* @for Ember.Handlebars.helpers
|
2050
|
-
* @method singularize
|
2051
|
-
* @param {String|Property} word word to singularize
|
2052
|
-
*/
|
2053
|
-
Ember.Handlebars.helper('singularize', ember$inflector$lib$system$string$$singularize);
|
2054
|
-
|
2055
|
-
/**
|
2056
|
-
*
|
2057
|
-
* If you have Ember Inflector (such as if Ember Data is present),
|
2058
|
-
* pluralize a word. For example, turn "ox" into "oxen".
|
2059
|
-
*
|
2060
|
-
* Example:
|
2061
|
-
*
|
2062
|
-
* {{pluralize count myProperty}}
|
2063
|
-
* {{pluralize 1 "oxen"}}
|
2064
|
-
* {{pluralize myProperty}}
|
2065
|
-
* {{pluralize "ox"}}
|
2066
|
-
*
|
2067
|
-
* @for Ember.Handlebars.helpers
|
2068
|
-
* @method pluralize
|
2069
|
-
* @param {Number|Property} [count] count of objects
|
2070
|
-
* @param {String|Property} word word to pluralize
|
2071
|
-
*/
|
2072
|
-
Ember.Handlebars.helper('pluralize', function(count, word, options) {
|
2073
|
-
if(arguments.length < 3) {
|
2074
|
-
return ember$inflector$lib$system$string$$pluralize(count);
|
2075
|
-
} else {
|
2076
|
-
/* jshint eqeqeq: false */
|
2077
|
-
if(count != 1) {
|
2078
|
-
/* jshint eqeqeq: true */
|
2079
|
-
word = ember$inflector$lib$system$string$$pluralize(word);
|
1986
|
+
ember$inflector$lib$lib$system$inflector$$default.inflector = new ember$inflector$lib$lib$system$inflector$$default(ember$inflector$lib$lib$system$inflections$$default);
|
1987
|
+
|
1988
|
+
function ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration1(name, helperFunction) {
|
1989
|
+
//earlier versions of ember with htmlbars used this
|
1990
|
+
ember$lib$main$$default.HTMLBars.helpers[name] = helperFunction;
|
1991
|
+
}
|
1992
|
+
|
1993
|
+
function ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration2(name, helperFunction) {
|
1994
|
+
//registerHelper has been made private as _registerHelper
|
1995
|
+
//this is kept here if anyone is using it
|
1996
|
+
ember$lib$main$$default.HTMLBars.registerHelper(name, helperFunction);
|
1997
|
+
}
|
1998
|
+
|
1999
|
+
function ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration3(name, helperFunction) {
|
2000
|
+
//latest versin of ember uses this
|
2001
|
+
ember$lib$main$$default.HTMLBars._registerHelper(name, helperFunction);
|
2002
|
+
}
|
2003
|
+
|
2004
|
+
function ember$inflector$lib$lib$utils$register$helper$$registerHelper(name, helperFunction) {
|
2005
|
+
if (ember$lib$main$$default.HTMLBars) {
|
2006
|
+
var fn = ember$lib$main$$default.HTMLBars.makeBoundHelper(helperFunction);
|
2007
|
+
|
2008
|
+
if (ember$lib$main$$default.HTMLBars._registerHelper) {
|
2009
|
+
if (ember$lib$main$$default.HTMLBars.helpers) {
|
2010
|
+
ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration1(name, fn);
|
2011
|
+
} else {
|
2012
|
+
ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration3(name, fn);
|
2080
2013
|
}
|
2081
|
-
|
2014
|
+
} else if (ember$lib$main$$default.HTMLBars.registerHelper) {
|
2015
|
+
ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration2(name, fn);
|
2082
2016
|
}
|
2083
|
-
})
|
2017
|
+
} else if (ember$lib$main$$default.Handlebars) {
|
2018
|
+
ember$lib$main$$default.Handlebars.helper(name, helperFunction);
|
2019
|
+
}
|
2084
2020
|
}
|
2021
|
+
var ember$inflector$lib$lib$utils$register$helper$$default = ember$inflector$lib$lib$utils$register$helper$$registerHelper;
|
2085
2022
|
|
2086
|
-
|
2023
|
+
/**
|
2024
|
+
*
|
2025
|
+
* If you have Ember Inflector (such as if Ember Data is present),
|
2026
|
+
* singularize a word. For example, turn "oxen" into "ox".
|
2027
|
+
*
|
2028
|
+
* Example:
|
2029
|
+
*
|
2030
|
+
* {{singularize myProperty}}
|
2031
|
+
* {{singularize "oxen"}}
|
2032
|
+
*
|
2033
|
+
* @for Ember.HTMLBars.helpers
|
2034
|
+
* @method singularize
|
2035
|
+
* @param {String|Property} word word to singularize
|
2036
|
+
*/
|
2037
|
+
ember$inflector$lib$lib$utils$register$helper$$default('singularize', function(params){
|
2038
|
+
return ember$inflector$lib$lib$system$string$$singularize(params[0]);
|
2039
|
+
});
|
2040
|
+
|
2041
|
+
/**
|
2042
|
+
*
|
2043
|
+
* If you have Ember Inflector (such as if Ember Data is present),
|
2044
|
+
* pluralize a word. For example, turn "ox" into "oxen".
|
2045
|
+
*
|
2046
|
+
* Example:
|
2047
|
+
*
|
2048
|
+
* {{pluralize count myProperty}}
|
2049
|
+
* {{pluralize 1 "oxen"}}
|
2050
|
+
* {{pluralize myProperty}}
|
2051
|
+
* {{pluralize "ox"}}
|
2052
|
+
*
|
2053
|
+
* @for Ember.HTMLBars.helpers
|
2054
|
+
* @method pluralize
|
2055
|
+
* @param {Number|Property} [count] count of objects
|
2056
|
+
* @param {String|Property} word word to pluralize
|
2057
|
+
*/
|
2058
|
+
ember$inflector$lib$lib$utils$register$helper$$default('pluralize', function(params) {
|
2059
|
+
var count, word;
|
2060
|
+
|
2061
|
+
if (params.length === 1) {
|
2062
|
+
word = params[0];
|
2063
|
+
return ember$inflector$lib$lib$system$string$$pluralize(word);
|
2064
|
+
} else {
|
2065
|
+
count = params[0];
|
2066
|
+
word = params[1];
|
2067
|
+
|
2068
|
+
if (count !== 1) {
|
2069
|
+
word = ember$inflector$lib$lib$system$string$$pluralize(word);
|
2070
|
+
}
|
2071
|
+
return count + " " + word;
|
2072
|
+
}
|
2073
|
+
});
|
2074
|
+
|
2075
|
+
if (ember$lib$main$$default.EXTEND_PROTOTYPES === true || ember$lib$main$$default.EXTEND_PROTOTYPES.String) {
|
2087
2076
|
/**
|
2088
2077
|
See {{#crossLink "Ember.String/pluralize"}}{{/crossLink}}
|
2089
2078
|
|
@@ -2091,7 +2080,7 @@
|
|
2091
2080
|
@for String
|
2092
2081
|
*/
|
2093
2082
|
String.prototype.pluralize = function() {
|
2094
|
-
return ember$inflector$lib$system$string$$pluralize(this);
|
2083
|
+
return ember$inflector$lib$lib$system$string$$pluralize(this);
|
2095
2084
|
};
|
2096
2085
|
|
2097
2086
|
/**
|
@@ -2101,25 +2090,25 @@
|
|
2101
2090
|
@for String
|
2102
2091
|
*/
|
2103
2092
|
String.prototype.singularize = function() {
|
2104
|
-
return ember$inflector$lib$system$string$$singularize(this);
|
2093
|
+
return ember$inflector$lib$lib$system$string$$singularize(this);
|
2105
2094
|
};
|
2106
2095
|
}
|
2107
2096
|
|
2108
|
-
ember$inflector$lib$system$inflector$$default.defaultRules = ember$inflector$lib$system$inflections$$default;
|
2109
|
-
|
2097
|
+
ember$inflector$lib$lib$system$inflector$$default.defaultRules = ember$inflector$lib$lib$system$inflections$$default;
|
2098
|
+
ember$lib$main$$default.Inflector = ember$inflector$lib$lib$system$inflector$$default;
|
2110
2099
|
|
2111
|
-
|
2112
|
-
|
2100
|
+
ember$lib$main$$default.String.pluralize = ember$inflector$lib$lib$system$string$$pluralize;
|
2101
|
+
ember$lib$main$$default.String.singularize = ember$inflector$lib$lib$system$string$$singularize;
|
2113
2102
|
|
2114
|
-
var ember$inflector$lib$main$$default = ember$inflector$lib$system$inflector$$default;
|
2103
|
+
var ember$inflector$lib$main$$default = ember$inflector$lib$lib$system$inflector$$default;
|
2115
2104
|
|
2116
2105
|
if (typeof define !== 'undefined' && define.amd){
|
2117
2106
|
define('ember-inflector', ['exports'], function(__exports__){
|
2118
|
-
__exports__['default'] = ember$inflector$lib$system$inflector$$default;
|
2119
|
-
return ember$inflector$lib$system$inflector$$default;
|
2107
|
+
__exports__['default'] = ember$inflector$lib$lib$system$inflector$$default;
|
2108
|
+
return ember$inflector$lib$lib$system$inflector$$default;
|
2120
2109
|
});
|
2121
2110
|
} else if (typeof module !== 'undefined' && module['exports']){
|
2122
|
-
module['exports'] = ember$inflector$lib$system$inflector$$default;
|
2111
|
+
module['exports'] = ember$inflector$lib$lib$system$inflector$$default;
|
2123
2112
|
}
|
2124
2113
|
|
2125
2114
|
/**
|
@@ -2238,7 +2227,7 @@
|
|
2238
2227
|
pathForType: function(type) {
|
2239
2228
|
var decamelized = activemodel$adapter$lib$system$active$model$adapter$$decamelize(type);
|
2240
2229
|
var underscored = activemodel$adapter$lib$system$active$model$adapter$$underscore(decamelized);
|
2241
|
-
return ember$inflector$lib$system$string$$pluralize(underscored);
|
2230
|
+
return ember$inflector$lib$lib$system$string$$pluralize(underscored);
|
2242
2231
|
},
|
2243
2232
|
|
2244
2233
|
/**
|
@@ -3942,7 +3931,7 @@
|
|
3942
3931
|
@return {String} the model's typeKey
|
3943
3932
|
*/
|
3944
3933
|
typeForRoot: function(key) {
|
3945
|
-
return ember$data$lib$serializers$rest$serializer$$camelize(ember$inflector$lib$system$string$$singularize(key));
|
3934
|
+
return ember$data$lib$serializers$rest$serializer$$camelize(ember$inflector$lib$lib$system$string$$singularize(key));
|
3946
3935
|
},
|
3947
3936
|
|
3948
3937
|
// SERIALIZE
|
@@ -4276,7 +4265,7 @@
|
|
4276
4265
|
if (kind === "belongsTo") {
|
4277
4266
|
return key + "_id";
|
4278
4267
|
} else if (kind === "hasMany") {
|
4279
|
-
return ember$inflector$lib$system$string$$singularize(key) + "_ids";
|
4268
|
+
return ember$inflector$lib$lib$system$string$$singularize(key) + "_ids";
|
4280
4269
|
} else {
|
4281
4270
|
return key;
|
4282
4271
|
}
|
@@ -4496,7 +4485,7 @@
|
|
4496
4485
|
}
|
4497
4486
|
var activemodel$adapter$lib$setup$container$$default = activemodel$adapter$lib$setup$container$$setupActiveModelAdapter;
|
4498
4487
|
var ember$data$lib$core$$DS = Ember.Namespace.create({
|
4499
|
-
VERSION: '1.0.0-beta.16'
|
4488
|
+
VERSION: '1.0.0-beta.16.1'
|
4500
4489
|
});
|
4501
4490
|
|
4502
4491
|
if (Ember.libraries) {
|
@@ -7425,7 +7414,7 @@
|
|
7425
7414
|
```
|
7426
7415
|
|
7427
7416
|
@method attributes
|
7428
|
-
@return {
|
7417
|
+
@return {Object} All attributes of the current snapshot
|
7429
7418
|
*/
|
7430
7419
|
attributes: function() {
|
7431
7420
|
return Ember.copy(this._attributes);
|
@@ -10941,7 +10930,9 @@
|
|
10941
10930
|
@return DS.Adapter
|
10942
10931
|
*/
|
10943
10932
|
adapterFor: function(type) {
|
10944
|
-
type
|
10933
|
+
if (type !== 'application') {
|
10934
|
+
type = this.modelFor(type);
|
10935
|
+
}
|
10945
10936
|
|
10946
10937
|
var adapter = this.lookupAdapter(type.typeKey) || this.lookupAdapter('application');
|
10947
10938
|
|
@@ -10978,7 +10969,9 @@
|
|
10978
10969
|
@return {DS.Serializer}
|
10979
10970
|
*/
|
10980
10971
|
serializerFor: function(type) {
|
10981
|
-
type
|
10972
|
+
if (type !== 'application') {
|
10973
|
+
type = this.modelFor(type);
|
10974
|
+
}
|
10982
10975
|
|
10983
10976
|
var serializer = this.lookupSerializer(type.typeKey) || this.lookupSerializer('application');
|
10984
10977
|
|
@@ -11063,7 +11056,7 @@
|
|
11063
11056
|
@return {String} if the adapter can generate one, an ID
|
11064
11057
|
*/
|
11065
11058
|
_normalizeTypeKey: function(key) {
|
11066
|
-
return ember$data$lib$system$store$$camelize(ember$inflector$lib$system$string$$singularize(key));
|
11059
|
+
return ember$data$lib$system$store$$camelize(ember$inflector$lib$lib$system$string$$singularize(key));
|
11067
11060
|
}
|
11068
11061
|
});
|
11069
11062
|
|
@@ -12434,7 +12427,7 @@
|
|
12434
12427
|
typeKey = meta.type || meta.key;
|
12435
12428
|
if (typeof typeKey === 'string') {
|
12436
12429
|
if (meta.kind === 'hasMany') {
|
12437
|
-
typeKey = ember$inflector$lib$system$string$$singularize(typeKey);
|
12430
|
+
typeKey = ember$inflector$lib$lib$system$string$$singularize(typeKey);
|
12438
12431
|
}
|
12439
12432
|
type = store.modelFor(typeKey);
|
12440
12433
|
} else {
|