diff --git a/.travis.yml b/.travis.yml index 3eee6f84..13f4bdb5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,8 +51,8 @@ jobs: env: EMBER_TRY_SCENARIO=ember-3.13 - env: EMBER_TRY_SCENARIO=ember-release - env: EMBER_TRY_SCENARIO=ember-beta - - env: EMBER_TRY_SCENARIO=ember-canary - env: EMBER_TRY_SCENARIO=ember-default-with-jquery + - env: EMBER_TRY_SCENARIO=ember-canary before_install: - curl -o- -L https://yarnpkg.com/install.sh | bash diff --git a/addon/utils/merge-deep.ts b/addon/utils/merge-deep.ts index 9bcba764..f82e0b74 100644 --- a/addon/utils/merge-deep.ts +++ b/addon/utils/merge-deep.ts @@ -101,11 +101,11 @@ function mergeTargetAndSource(target: any, source: any, options: Options): any { } else { let next = source[key]; if (next && next instanceof Change) { - return target[key] = next.value; + return options.safeSet(target, key, next.value); } // if just some normal leaf value, then set - return target[key] = next; + return options.safeSet(target, key, next); } }); @@ -123,7 +123,7 @@ function mergeTargetAndSource(target: any, source: any, options: Options): any { */ export default function mergeDeep(target: any, source: any, options: Options = { safeGet: undefined, safeSet: undefined }): object | [any] { options.safeGet = options.safeGet || function (obj: any, key: string): any { return obj[key] }; - options.safeSet = options.safeSet; + options.safeSet = options.safeSet || function(obj: any, key: string, value: unknown): any { return obj[key] = value }; let sourceIsArray = Array.isArray(source); let targetIsArray = Array.isArray(target); let sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; diff --git a/config/ember-try.js b/config/ember-try.js index 814fc47b..c7663502 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -32,6 +32,7 @@ module.exports = async function() { }, { name: 'ember-canary', + allowedToFail: true, npm: { devDependencies: { 'ember-source': await getChannelURL('canary') diff --git a/tests/dummy/app/components/changeset-form.ts b/tests/dummy/app/components/changeset-form.ts new file mode 100644 index 00000000..c4a1a51a --- /dev/null +++ b/tests/dummy/app/components/changeset-form.ts @@ -0,0 +1,16 @@ +import Component from '@ember/component'; +import { action } from '@ember/object'; +import Changeset from 'ember-changeset' + +export default class ChangesetForm extends Component { + model = { + email: 'something' + } + + changeset = new Changeset(this.model) + + @action submitForm(changeset: any, event: any) { + event.preventDefault() + changeset.save() + } +} diff --git a/tests/dummy/app/templates/application.hbs b/tests/dummy/app/templates/application.hbs index a4b691ce..5df38c17 100644 --- a/tests/dummy/app/templates/application.hbs +++ b/tests/dummy/app/templates/application.hbs @@ -1,3 +1,5 @@ -