From 3a00c4f39155e3486f7e9a7661cef9eac693dca7 Mon Sep 17 00:00:00 2001 From: Michael Laws Date: Sat, 6 Feb 2016 18:11:25 -0500 Subject: [PATCH 1/2] suggested resolution for deprecation causes 2 tests to fail --- addon/components/dynamic-form.js | 7 ++++--- package.json | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) mode change 100644 => 100755 package.json diff --git a/addon/components/dynamic-form.js b/addon/components/dynamic-form.js index a848266..a637cfb 100644 --- a/addon/components/dynamic-form.js +++ b/addon/components/dynamic-form.js @@ -1,4 +1,5 @@ import Ember from 'ember'; +import getOwner from 'ember-getowner-polyfill'; const TYPE_MAP = { validator: { @@ -44,7 +45,7 @@ const DynamicForm = Ember.Component.extend({ const newSchema = _.reduce(optionFields, (result, val, key) => { if(val['filter-rules']) { val['filter-rules'].forEach((element) => { - const filterRule = this.container.lookup(`${element}:dynamic-forms.filter-rules`); + const filterRule = getOwner(this).lookup(`${element}:dynamic-forms.filter-rules`); filterRule.filter(key, result); }); } @@ -71,11 +72,11 @@ const DynamicForm = Ember.Component.extend({ }, _replaceKeywordsWithFunctions(schemaObj) { - const container = this.container; + const container = getOwner(this); const replaceWithFunction = function (object, value, key) { if (TYPE_MAP.hasOwnProperty(key) && typeof value === 'string') { const type = TYPE_MAP[key]; - const typeObj = container.lookup(`${value}:${type.namespace}`); + const typeObj = getOwner(this).lookup(`${value}:${type.namespace}`); if (typeObj) { object[key] = typeObj[type.functionName]; } // else fail with a message that the given type couldn't be found diff --git a/package.json b/package.json old mode 100644 new mode 100755 index 86b79ae..e94b3d0 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "ember-disable-prototype-extensions": "^1.0.0", "ember-disable-proxy-controllers": "^1.0.1", "ember-export-application-global": "^1.0.4", + "ember-getowner-polyfill": "1.0.0", "ember-resolver": "^2.0.3", "ember-try": "~0.0.8" }, From ab5fbd66be75794c14a491b6801fe56b4a10a3be Mon Sep 17 00:00:00 2001 From: Michael Laws Date: Tue, 9 Feb 2016 19:51:31 -0500 Subject: [PATCH 2/2] fixed test failure --- addon/components/dynamic-form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/components/dynamic-form.js b/addon/components/dynamic-form.js index a637cfb..ef170bd 100644 --- a/addon/components/dynamic-form.js +++ b/addon/components/dynamic-form.js @@ -76,7 +76,7 @@ const DynamicForm = Ember.Component.extend({ const replaceWithFunction = function (object, value, key) { if (TYPE_MAP.hasOwnProperty(key) && typeof value === 'string') { const type = TYPE_MAP[key]; - const typeObj = getOwner(this).lookup(`${value}:${type.namespace}`); + const typeObj = container.lookup(`${value}:${type.namespace}`); if (typeObj) { object[key] = typeObj[type.functionName]; } // else fail with a message that the given type couldn't be found