From 103a8011f1aae9fbfdd98ece8b684cffa5259cc5 Mon Sep 17 00:00:00 2001 From: Scott Newcomer Date: Sun, 9 May 2021 15:16:17 -0500 Subject: [PATCH] [Bugfix]: get nested key when doesnt exist in underlying content (#590) --- package.json | 2 +- tests/unit/changeset-test.js | 11 +++++++++++ yarn.lock | 8 ++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 249cbb3f..3e713151 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@glimmer/tracking": "^1.0.1", "ember-auto-import": "^1.5.2", "ember-cli-babel": "^7.19.0", - "validated-changeset": "~0.14.3" + "validated-changeset": "~0.14.4" }, "devDependencies": { "@ember/optional-features": "^1.0.0", diff --git a/tests/unit/changeset-test.js b/tests/unit/changeset-test.js index 93868ea2..cc95d7c8 100644 --- a/tests/unit/changeset-test.js +++ b/tests/unit/changeset-test.js @@ -552,6 +552,17 @@ module('Unit | Utility | changeset', function (hooks) { } }); + test('#get works if content is undefined for nested key', async function (assert) { + const model = {}; + + const c = Changeset(model); + c.set('foo.bar.cat', { + color: 'red', + }); + const cat = c.get('foo.bar.cat'); + assert.equal(cat.color, 'red'); + }); + /** * #set */ diff --git a/yarn.lock b/yarn.lock index 29f308e8..f2b9c391 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13517,10 +13517,10 @@ validate-npm-package-name@~2.2.2: dependencies: builtins "0.0.7" -validated-changeset@~0.14.3: - version "0.14.3" - resolved "https://registry.yarnpkg.com/validated-changeset/-/validated-changeset-0.14.3.tgz#c17b6f493e1d03a13f9a5660e586175758151f90" - integrity sha512-D2WV7j4m8/wHW+pwFdhvVw9sPiq5r6edkSUTVcp9RadERC7dyubeoioZCo26y7TbGN0sPBzmjj9MDV0gS4r3cA== +validated-changeset@~0.14.4: + version "0.14.4" + resolved "https://registry.yarnpkg.com/validated-changeset/-/validated-changeset-0.14.4.tgz#b8314a1fed15230901e12dec6ffb0eeea6edefbd" + integrity sha512-g0DFT5gbQcvz7r7QMCxbugAQU9kvjSgNlA9JtBM+RZzFE6B1RtW7EXOF7BA/PvAycqmONaqalFbCwA7Ih3l8UQ== vary@~1.1.2: version "1.1.2"