diff --git a/FEATURES.md b/FEATURES.md index 9aed1080275..f1de3c14e0e 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -17,12 +17,6 @@ entry in `config/features.json`. Note that this feature only works when `ds-transform-pass-options` is enabled too. -- `ds-finder-include` - - Allows an `include` query parameter to be specified with using - `store.findRecord()` and `store.findAll()` as described in [RFC - 99](https://github.com/emberjs/rfcs/pull/99) - - `ds-improved-ajax` This feature allows to customize how a request is formed by overwriting diff --git a/addon/-private/system/snapshot-record-array.js b/addon/-private/system/snapshot-record-array.js index a7ccfa8c13d..8435f027a7b 100644 --- a/addon/-private/system/snapshot-record-array.js +++ b/addon/-private/system/snapshot-record-array.js @@ -52,9 +52,7 @@ export default function SnapshotRecordArray(recordArray, meta, options = {}) { */ this.adapterOptions = options.adapterOptions; - if (isEnabled('ds-finder-include')) { - this.include = options.include; - } + this.include = options.include; } /** diff --git a/addon/-private/system/snapshot.js b/addon/-private/system/snapshot.js index e594b4dd252..ebb75d8e1bf 100644 --- a/addon/-private/system/snapshot.js +++ b/addon/-private/system/snapshot.js @@ -38,9 +38,7 @@ export default function Snapshot(internalModel, options = {}) { */ this.adapterOptions = options.adapterOptions; - if (isEnabled('ds-finder-include')) { - this.include = options.include; - } + this.include = options.include; this._changedAttributes = record.changedAttributes(); } diff --git a/addon/adapters/rest.js b/addon/adapters/rest.js index e7597c91ee8..32961341753 100644 --- a/addon/adapters/rest.js +++ b/addon/adapters/rest.js @@ -1154,13 +1154,11 @@ var RESTAdapter = Adapter.extend(BuildURLMixin, { buildQuery(snapshot) { let query = {}; - if (isEnabled('ds-finder-include')) { - if (snapshot) { - const { include } = snapshot; + if (snapshot) { + const { include } = snapshot; - if (include) { - query.include = include; - } + if (include) { + query.include = include; } } diff --git a/config/features.json b/config/features.json index 5907b5e321d..e499e6ff6ed 100644 --- a/config/features.json +++ b/config/features.json @@ -1,6 +1,5 @@ { "ds-boolean-transform-allow-null": null, - "ds-finder-include": true, "ds-improved-ajax": null, "ds-transform-pass-options": true, "ds-pushpayload-return": null, diff --git a/tests/integration/adapter/rest-adapter-test.js b/tests/integration/adapter/rest-adapter-test.js index e079c8809dc..9b29c36ed0a 100644 --- a/tests/integration/adapter/rest-adapter-test.js +++ b/tests/integration/adapter/rest-adapter-test.js @@ -185,17 +185,15 @@ test("findRecord - payload with a serializer-specified attribute mapping", funct })); }); -if (isEnabled('ds-finder-include')) { - test("findRecord - passes `include` as a query parameter to ajax", function(assert) { - ajaxResponse({ - post: { id: 1, name: 'Rails is very expensive sushi' } - }); - - run(store, 'findRecord', 'post', 1, { include: 'comments' }).then(assert.wait(function() { - assert.deepEqual(passedHash.data, { include: 'comments' }, '`include` parameter sent to adapter.ajax'); - })); +test("findRecord - passes `include` as a query parameter to ajax", function(assert) { + ajaxResponse({ + post: { id: 1, name: 'Rails is very expensive sushi' } }); -} + + run(store, 'findRecord', 'post', 1, { include: 'comments' }).then(assert.wait(function() { + assert.deepEqual(passedHash.data, { include: 'comments' }, '`include` parameter sent to adapter.ajax'); + })); +}); test("createRecord - an empty payload is a basic success if an id was specified", function(assert) { ajaxResponse(); @@ -1053,17 +1051,15 @@ test("findAll - passes buildURL the requestType and snapshot", function(assert) })); }); -if (isEnabled('ds-finder-include')) { - test("findAll - passed `include` as a query parameter to ajax", function(assert) { - ajaxResponse({ - posts: [{ id: 1, name: 'Rails is very expensive sushi' }] - }); - - run(store, 'findAll', 'post', { include: 'comments' }).then(assert.wait(function() { - assert.deepEqual(passedHash.data, { include: 'comments' }, '`include` params sent to adapter.ajax'); - })); +test("findAll - passed `include` as a query parameter to ajax", function(assert) { + ajaxResponse({ + posts: [{ id: 1, name: 'Rails is very expensive sushi' }] }); -} + + run(store, 'findAll', 'post', { include: 'comments' }).then(assert.wait(function() { + assert.deepEqual(passedHash.data, { include: 'comments' }, '`include` params sent to adapter.ajax'); + })); +}); test("findAll - returning sideloaded data loads the data", function(assert) { ajaxResponse({ diff --git a/tests/integration/adapter/store-adapter-test.js b/tests/integration/adapter/store-adapter-test.js index 227518a7043..eec8b75b16b 100644 --- a/tests/integration/adapter/store-adapter-test.js +++ b/tests/integration/adapter/store-adapter-test.js @@ -4,7 +4,6 @@ import Ember from 'ember'; import {module, test} from 'qunit'; import DS from 'ember-data'; -import isEnabled from 'ember-data/-private/features'; /* This is an integration test that tests the communication between a store @@ -1319,18 +1318,16 @@ test("store.findRecord should pass adapterOptions to adapter.findRecord", functi }); }); -if (isEnabled('ds-finder-include')) { - test("store.findRecord should pass 'include' to adapter.findRecord", function(assert) { - assert.expect(1); - - env.adapter.findRecord = assert.wait((store, type, id, snapshot) => { - assert.equal(snapshot.include, 'books', 'include passed to adapter.findRecord'); - return Ember.RSVP.resolve({ id: 1 }); - }); +test("store.findRecord should pass 'include' to adapter.findRecord", function(assert) { + assert.expect(1); - run(() => store.findRecord('person', 1, { include: 'books' })); + env.adapter.findRecord = assert.wait((store, type, id, snapshot) => { + assert.equal(snapshot.include, 'books', 'include passed to adapter.findRecord'); + return Ember.RSVP.resolve({ id: 1 }); }); -} + + run(() => store.findRecord('person', 1, { include: 'books' })); +}); test("store.findAll should pass adapterOptions to the adapter.findAll method", function(assert) { assert.expect(1); @@ -1346,18 +1343,16 @@ test("store.findAll should pass adapterOptions to the adapter.findAll method", f }); }); -if (isEnabled('ds-finder-include')) { - test("store.findAll should pass 'include' to adapter.findAll", function(assert) { - assert.expect(1); - - env.adapter.findAll = assert.wait((store, type, sinceToken, arraySnapshot) => { - assert.equal(arraySnapshot.include, 'books', 'include passed to adapter.findAll'); - return Ember.RSVP.resolve([{ id: 1 }]); - }); +test("store.findAll should pass 'include' to adapter.findAll", function(assert) { + assert.expect(1); - run(() => store.findAll('person', { include: 'books' })); + env.adapter.findAll = assert.wait((store, type, sinceToken, arraySnapshot) => { + assert.equal(arraySnapshot.include, 'books', 'include passed to adapter.findAll'); + return Ember.RSVP.resolve([{ id: 1 }]); }); -} + + run(() => store.findAll('person', { include: 'books' })); +}); test("An async hasMany relationship with links should not trigger shouldBackgroundReloadRecord", function(assert) { var Post = DS.Model.extend({ diff --git a/tests/unit/adapters/rest-adapter/build-query-test.js b/tests/unit/adapters/rest-adapter/build-query-test.js index 6632346548d..ca991cc1ea9 100644 --- a/tests/unit/adapters/rest-adapter/build-query-test.js +++ b/tests/unit/adapters/rest-adapter/build-query-test.js @@ -1,6 +1,5 @@ import { module, test } from 'qunit'; import DS from 'ember-data'; -import isEnabled from 'ember-data/-private/features'; module("unit/adapters/rest-adapter/build-query - building queries"); @@ -20,13 +19,11 @@ test("buildQuery - doesn't fail without a snapshot", function(assert) { assert.deepEqual(query, {}, 'returns an empty query'); }); -if (isEnabled('ds-finder-include')) { - test("buildQuery() returns query with `include` from snapshot", function(assert) { - const adapter = DS.RESTAdapter.create(); - const snapshotStub = { include: 'comments' }; +test("buildQuery() returns query with `include` from snapshot", function(assert) { + const adapter = DS.RESTAdapter.create(); + const snapshotStub = { include: 'comments' }; - const query = adapter.buildQuery(snapshotStub); + const query = adapter.buildQuery(snapshotStub); - assert.deepEqual(query, { include: 'comments' }, 'query includes `include`'); - }); -} + assert.deepEqual(query, { include: 'comments' }, 'query includes `include`'); +});