Skip to content

Commit

Permalink
revert is-empty flag change, leave todo (#5540)
Browse files Browse the repository at this point in the history
* revert is-empty flag change, leave todo

* fix tests
  • Loading branch information
runspired authored Jul 26, 2018
1 parent c754fd6 commit 387cf92
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion addon/-legacy-private/system/model/states.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ const RootState = {
loading: {
// FLAGS
isLoading: true,
isEmpty: true,

exit(internalModel) {
internalModel._promiseProxy = null;
Expand Down
1 change: 0 additions & 1 deletion addon/-record-data-private/system/model/states.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ const RootState = {
// XHR to retrieve the data.
loading: {
// FLAGS
isEmpty: true,
isLoading: true,

exit(internalModel) {
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/todo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function todo(description, callback) {
let todos = [];
hijackAssert(assert, todos);

await callback(assert);
await callback.call(this, assert);

assertTestStatus(assert, todos);
});
Expand Down
9 changes: 6 additions & 3 deletions tests/integration/records/load-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import JSONAPIAdapter from 'ember-data/adapters/json-api';
import JSONAPISerializer from 'ember-data/serializers/json-api';
import { attr, belongsTo } from '@ember-decorators/data';
import { run } from '@ember/runloop';
import todo from '../../helpers/todo';

class Person extends Model {
@attr name;
Expand Down Expand Up @@ -40,7 +41,9 @@ module('integration/load - Loading Records', function(hooks) {
});
});

test('Empty records remain in the empty state while data is being fetched', async function(assert) {
todo('Empty records remain in the empty state while data is being fetched', async function(
assert
) {
let payloads = [
{
data: {
Expand Down Expand Up @@ -125,7 +128,7 @@ module('integration/load - Loading Records', function(hooks) {
let recordPromise = store.findRecord('person', '1');

// test that during the initial load our state is correct
assert.equal(
assert.todo.equal(
internalModel.isEmpty(),
true,
'awaiting first fetch: We remain in the empty state'
Expand Down Expand Up @@ -180,7 +183,7 @@ module('integration/load - Loading Records', function(hooks) {

// test that during a reload-due-to-unload our state is correct
// This requires a retainer (the async bestFriend relationship)
assert.equal(internalModel.isEmpty(), true, 'awaiting second find: We remain empty');
assert.todo.equal(internalModel.isEmpty(), true, 'awaiting second find: We remain empty');
assert.equal(internalModel.isLoading(), true, 'awaiting second find: We are loading again');
assert.equal(internalModel.isReloading, false, 'awaiting second find: We are not reloading');

Expand Down

0 comments on commit 387cf92

Please sign in to comment.