Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back m2m test #312

Merged
merged 1 commit into from
Aug 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions addon/-private/relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import ObjectProxy from '@ember/object/proxy';
import { get } from '@ember/object';
import { assert } from '@ember/debug';
import { isPresent } from '@ember/utils';
import { RELAY } from 'ember-changeset/utils/is-relay';

/*::
Expand Down Expand Up @@ -60,9 +59,9 @@ export default ObjectProxy.extend(({
let r /*: RelayDef */ = this;
r._super(...arguments);
r._changedKeys = {};
assert('changeset must be present.', isPresent(get(this, 'changeset')));
assert('content must be present.', isPresent(get(this, 'content')));
assert('key must be present.', isPresent(get(this, 'key')));
assert('changeset must be present.', !!get(this, 'changeset'));
assert('content must be present.', !!get(this, 'content'));
assert('key must be present.', !!get(this, 'key'));
},

unknownProperty(key) {
Expand Down
3 changes: 1 addition & 2 deletions addon/utils/is-relay.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// @flow

import { get } from '@ember/object';
import { isPresent } from '@ember/utils';

export const RELAY = '__RELAY__';

export default function isRelay(relay /*: mixed */) /*: boolean */ {
if (!isPresent(relay)) return false;
if (!relay) return false;
return get(relay, '__relay__') === RELAY;
}
8 changes: 4 additions & 4 deletions tests/acceptance/main-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test, skip } from 'qunit';
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { run } from '@ember/runloop';
import Changeset from 'ember-changeset';
Expand Down Expand Up @@ -58,14 +58,14 @@ module('Acceptance | main', function(hooks) {
})
});

// skipping test for now
skip('it works for hasMany / firstObject', function(assert) {
test('it works for hasMany / firstObject', function(assert) {
let user = this.dummyUser;

let changeset = new Changeset(user);
run(() => {
let newDog = this.store.createRecord('dog', { breed: 'Münsterländer' });
changeset.get('dogs').pushObjects([newDog]);
let dogs = changeset.get('dogs');
dogs.pushObjects([newDog]);
});

let dogs = changeset.get('dogs').toArray();
Expand Down