From 0ea771e29e389388eda7729e925314f0feb8c290 Mon Sep 17 00:00:00 2001 From: Gorzas Date: Mon, 16 Nov 2020 15:38:01 +0100 Subject: [PATCH 1/2] Change arrays from new to function Close #818 --- addon/components/md-pagination.js | 2 +- addon/components/md-table.js | 2 +- addon/components/md-tabs.js | 2 +- addon/components/selectable-item-group.js | 4 ++-- tests/dummy/app/controllers/application.js | 2 +- tests/dummy/app/controllers/buttons.js | 2 +- tests/dummy/app/controllers/colors.js | 16 ++++++++-------- tests/dummy/app/controllers/forms.js | 12 ++++++------ tests/dummy/app/controllers/tabs.js | 4 ++-- tests/dummy/app/routes/tables.js | 2 +- tests/unit/components/materialize-tabs-test.js | 10 +++++----- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/addon/components/md-pagination.js b/addon/components/md-pagination.js index 179dc35d..5c5cc9c9 100644 --- a/addon/components/md-pagination.js +++ b/addon/components/md-pagination.js @@ -39,7 +39,7 @@ export default Component.extend({ }), _pages: computed('windowRange.low', 'windowRange.high', 'current', function() { - const a = new A([]); + const a = A([]); const winRange = this.get('windowRange'); const current = this.get('current'); for (let i = winRange.low; i <= winRange.high; i += 1) { diff --git a/addon/components/md-table.js b/addon/components/md-table.js index 79f0de20..d51997f4 100644 --- a/addon/components/md-table.js +++ b/addon/components/md-table.js @@ -15,7 +15,7 @@ export default Component.extend(ParentComponentSupport, { }, columnComponents: computed('composableChildren', function() { - return new A(this.get('composableChildren')); + return A(this.get('composableChildren')); }).readOnly(), registerChildComponent(childComponent) { diff --git a/addon/components/md-tabs.js b/addon/components/md-tabs.js index 3c56f394..37eb5461 100644 --- a/addon/components/md-tabs.js +++ b/addon/components/md-tabs.js @@ -64,7 +64,7 @@ export default Component.extend(ParentComponentSupport, { _content: computed('content.[]', 'optionLabelPath', 'optionValuePath', function() { const labelPath = this.get('optionLabelPath'); const valuePath = this.get('optionValuePath'); - return new A( + return A( (this.get('content') || []).map(contentItem => ({ id: contentItem[valuePath], title: contentItem[labelPath] diff --git a/addon/components/selectable-item-group.js b/addon/components/selectable-item-group.js index b179c64d..1e54520a 100644 --- a/addon/components/selectable-item-group.js +++ b/addon/components/selectable-item-group.js @@ -18,7 +18,7 @@ export default Component.extend(ParentComponentSupport, { init() { this._super(...arguments); if (this.get('selection') === null && !!this.get('multiple')) { - this.set('selection', new A([])); + this.set('selection', A([])); } }, @@ -70,7 +70,7 @@ export default Component.extend(ParentComponentSupport, { _content: computed('content.[]', '_valuePath', '_labelPath', function() { const valuePath = get(this, '_valuePath'); const labelPath = get(this, '_labelPath'); - const content = get(this, 'content') || new A([]); + const content = get(this, 'content') || A([]); if (valuePath && labelPath) { return A( diff --git a/tests/dummy/app/controllers/application.js b/tests/dummy/app/controllers/application.js index a36022b4..62d46eb8 100644 --- a/tests/dummy/app/controllers/application.js +++ b/tests/dummy/app/controllers/application.js @@ -3,7 +3,7 @@ import Controller from '@ember/controller'; export default Controller.extend({ // eslint-disable-next-line - demoSections: new A([ + demoSections: A([ { name: 'Badges', route: 'badges' }, { name: 'Buttons', route: 'buttons' }, { name: 'Cards', route: 'cards' }, diff --git a/tests/dummy/app/controllers/buttons.js b/tests/dummy/app/controllers/buttons.js index ba754251..48def94d 100644 --- a/tests/dummy/app/controllers/buttons.js +++ b/tests/dummy/app/controllers/buttons.js @@ -3,7 +3,7 @@ import { A } from '@ember/array'; export default Controller.extend({ // eslint-disable-next-line - myData: new A(['hello', 'world']), + myData: A(['hello', 'world']), actions: { debug() { diff --git a/tests/dummy/app/controllers/colors.js b/tests/dummy/app/controllers/colors.js index 66f9a41b..87e662c6 100644 --- a/tests/dummy/app/controllers/colors.js +++ b/tests/dummy/app/controllers/colors.js @@ -5,7 +5,7 @@ import AnchorControllerSupport from 'ember-anchor/mixins/controller-support'; export default Controller.extend(AnchorControllerSupport, { //eslint-disable-next-line - colorBases: new A([ + colorBases: A([ 'pink', 'red', 'deep-orange', @@ -23,9 +23,9 @@ export default Controller.extend(AnchorControllerSupport, { 'deep-purple' ]), //eslint-disable-next-line - boringColorBases: new A(['brown', 'grey', 'blue-grey']), + boringColorBases: A(['brown', 'grey', 'blue-grey']), //eslint-disable-next-line - colorVariants: new A([ + colorVariants: A([ 'lighten-5', 'lighten-4', 'lighten-3', @@ -38,10 +38,10 @@ export default Controller.extend(AnchorControllerSupport, { 'darken-4' ]), //eslint-disable-next-line - accentColorVariants: new A(['accent-1', 'accent-2', 'accent-3', 'accent-4']), + accentColorVariants: A(['accent-1', 'accent-2', 'accent-3', 'accent-4']), colors: computed('colorBases.[]', 'colorVariants.[]', function() { - return new A( + return A( this.get('colorBases').map(colorBase => { let variants = this.get('colorVariants'); if (['brown', 'grey', 'blue-grey'].indexOf(colorBase) < 0) { @@ -49,14 +49,14 @@ export default Controller.extend(AnchorControllerSupport, { } return { base: colorBase, - variants: new A(variants) + variants: A(variants) }; }) ); }), boringColors: computed('boringColorBases.[]', 'colorVariants.[]', function() { - return new A( + return A( this.get('boringColorBases').map(colorBase => { let variants = this.get('colorVariants'); if (['brown', 'grey', 'blue-grey'].indexOf(colorBase) < 0) { @@ -64,7 +64,7 @@ export default Controller.extend(AnchorControllerSupport, { } return { base: colorBase, - variants: new A(variants) + variants: A(variants) }; }) ); diff --git a/tests/dummy/app/controllers/forms.js b/tests/dummy/app/controllers/forms.js index a023b5d1..0f4704ba 100644 --- a/tests/dummy/app/controllers/forms.js +++ b/tests/dummy/app/controllers/forms.js @@ -14,7 +14,7 @@ function asJSON(propKey) { export default Controller.extend({ //eslint-disable-next-line - frameworks: new A([ + frameworks: A([ { id: 1, value: 'Materialize CSS' @@ -70,7 +70,7 @@ export default Controller.extend({ radioSelection: 2, otherRadioSelection: 'green', //eslint-disable-next-line - radioChoices: new A([ + radioChoices: A([ { id: 1, text: 'One' @@ -85,9 +85,9 @@ export default Controller.extend({ radioChoicesString: asJSON('radioChoices'), //eslint-disable-next-line - checkboxSelections: new A([3, 4]), + checkboxSelections: A([3, 4]), //eslint-disable-next-line - checkboxChoices: new A([ + checkboxChoices: A([ { id: 3, label: 'Three' @@ -104,7 +104,7 @@ export default Controller.extend({ switchesChoicesString: asJSON('switchesChoices'), //eslint-disable-next-line - switchesChoices: new A([ + switchesChoices: A([ { key: 6, name: 'Six' @@ -119,7 +119,7 @@ export default Controller.extend({ } ]), //eslint-disable-next-line - switchesSelections: new A([7]), + switchesSelections: A([7]), switchesSelection: 7, switchesSelectionString: asJSON('switchesSelection'), switchesSelectionsString: asJSON('switchesSelections'), diff --git a/tests/dummy/app/controllers/tabs.js b/tests/dummy/app/controllers/tabs.js index c53af50b..ab1cf59d 100644 --- a/tests/dummy/app/controllers/tabs.js +++ b/tests/dummy/app/controllers/tabs.js @@ -3,9 +3,9 @@ import { A } from '@ember/array'; export default Controller.extend({ //eslint-disable-next-line - basicTabsContent: new A([{ id: 'a', title: 'First' }, { id: 'b', title: 'Second' }, { id: 'c', title: 'Third' }]), + basicTabsContent: A([{ id: 'a', title: 'First' }, { id: 'b', title: 'Second' }, { id: 'c', title: 'Third' }]), //eslint-disable-next-line - alternateTabsContent: new A([ + alternateTabsContent: A([ { key: 'a', label: 'First' }, { key: 'b', label: 'Second' }, { key: 'c', label: 'Third' } diff --git a/tests/dummy/app/routes/tables.js b/tests/dummy/app/routes/tables.js index 45132c9f..b33447c6 100644 --- a/tests/dummy/app/routes/tables.js +++ b/tests/dummy/app/routes/tables.js @@ -4,7 +4,7 @@ import { A } from '@ember/array'; export default Route.extend({ model() { // BEGIN-SNIPPET table-route - let content = new A([ + let content = A([ { id: 'white', name: 'Walter White', route: 'tabs' }, { id: 'pinkman', name: 'Jesse Pinkman', route: 'modal' }, { id: 'freng', name: 'Gustavo Freng', route: 'collection' } diff --git a/tests/unit/components/materialize-tabs-test.js b/tests/unit/components/materialize-tabs-test.js index 037286de..fa6309f6 100644 --- a/tests/unit/components/materialize-tabs-test.js +++ b/tests/unit/components/materialize-tabs-test.js @@ -16,7 +16,7 @@ test('it renders', function(assert) { const component = this.subject(); component.setProperties({ - content: new A([{ id: 'a', title: 'First' }, { id: 'b', title: 'Second' }, { id: 'c', title: 'Third' }]), + content: A([{ id: 'a', title: 'First' }, { id: 'b', title: 'Second' }, { id: 'c', title: 'Third' }]), selected: 'a' }); @@ -34,7 +34,7 @@ test('programatically setting selected tab', function(assert) { const component = this.subject(); component.setProperties({ - content: new A([{ id: 'a', title: 'First' }, { id: 'b', title: 'Second' }, { id: 'c', title: 'Third' }]), + content: A([{ id: 'a', title: 'First' }, { id: 'b', title: 'Second' }, { id: 'c', title: 'Third' }]), selected: 'a' }); this.render(); @@ -69,7 +69,7 @@ test('No initial selection - first tab should be selected', function(assert) { const component = this.subject(); component.setProperties({ - content: new A([{ id: 'a', title: 'First' }, { id: 'b', title: 'Second' }, { id: 'c', title: 'Third' }]) + content: A([{ id: 'a', title: 'First' }, { id: 'b', title: 'Second' }, { id: 'c', title: 'Third' }]) }); run(() => { @@ -94,7 +94,7 @@ test('Empty content - should render an empty UL', function(assert) { const component = this.subject(); component.setProperties({ - content: new A([]) + content: A([]) }); this.render(); assert.equal(component.$('.materialize-tabs-tab').length, 0, 'No tabs should be rendered'); @@ -108,7 +108,7 @@ test('Col width - should result in the correct CSS classes', function(assert) { assert.equal(component.get('colWidth'), 2, 'Default col width is 2'); component.setProperties({ colWidth: 4, - content: new A([{ id: 'a', title: 'First' }, { id: 'b', title: 'Second' }, { id: 'c', title: 'Third' }]) + content: A([{ id: 'a', title: 'First' }, { id: 'b', title: 'Second' }, { id: 'c', title: 'Third' }]) }); this.render(); assert.equal(component.get('composableChildren')[0].get('colWidth'), 4, 'Col width on tab set applies to tabs'); From 25e8b56a314d3ad758ef47ad2ea23400bc3e7d81 Mon Sep 17 00:00:00 2001 From: Gorzas Date: Tue, 17 Nov 2020 08:48:32 +0100 Subject: [PATCH 2/2] fix: update ember-composability dependency --- package.json | 2 +- yarn.lock | 42 ++++++++---------------------------------- 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index 54b1d613..d73b2bbd 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "ember-cli-uglify": "3.0.0", "ember-cli-version-checker": "3.0.1", "ember-code-snippet": "2.4.0", - "ember-composability": "1.0.1", + "ember-composability": "git://github.com/jacobq/ember-composability.git#30b10d71562b08af9ad5cecc1506953aec46392e", "ember-disable-prototype-extensions": "1.1.3", "ember-export-application-global": "2.0.1", "ember-keyboard": "4.0.0", diff --git a/yarn.lock b/yarn.lock index e86c5ab8..7bec1892 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5340,7 +5340,7 @@ debug@^3.0.1, debug@^3.1.0, debug@^3.1.1: dependencies: ms "^2.1.1" -debuglog@*, debuglog@^1.0.1: +debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= @@ -6149,10 +6149,9 @@ ember-compatibility-helpers@^1.1.1: ember-cli-version-checker "^2.1.1" semver "^5.4.1" -ember-composability@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/ember-composability/-/ember-composability-1.0.1.tgz#c9d167f7c24c67fee03ae6c91b9059c06a849b63" - integrity sha512-F+PxGBgWlaadZmEKKpKKwCn0VRXZF4wzeOlPLlCNMxP+ykbeko6cF0RdHjlfHPW+BCz+YvuwpWGCVMtuUbujdQ== +"ember-composability@git://github.com/jacobq/ember-composability.git#30b10d71562b08af9ad5cecc1506953aec46392e": + version "0.0.0-development" + resolved "git://github.com/jacobq/ember-composability.git#30b10d71562b08af9ad5cecc1506953aec46392e" dependencies: "@ember/ordered-set" "^2.0.3" ember-cli-babel "^7.0.0" @@ -8321,7 +8320,7 @@ import-lazy@^2.1.0: resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" integrity sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM= -imurmurhash@*, imurmurhash@^0.1.4: +imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= @@ -9412,11 +9411,6 @@ lodash._baseflatten@^3.0.0: lodash.isarguments "^3.0.0" lodash.isarray "^3.0.0" -lodash._baseindexof@*: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" - integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw= - lodash._baseuniq@~4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" @@ -9425,16 +9419,11 @@ lodash._baseuniq@~4.6.0: lodash._createset "~4.0.0" lodash._root "~3.0.0" -lodash._bindcallback@*, lodash._bindcallback@^3.0.0: +lodash._bindcallback@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4= -lodash._cacheindexof@*: - version "3.0.2" - resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" - integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI= - lodash._createassigner@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz#838a5bae2fdaca63ac22dee8e19fa4e6d6970b11" @@ -9444,19 +9433,12 @@ lodash._createassigner@^3.0.0: lodash._isiterateecall "^3.0.0" lodash.restparam "^3.0.0" -lodash._createcache@*: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" - integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM= - dependencies: - lodash._getnative "^3.0.0" - lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY= -lodash._getnative@*, lodash._getnative@^3.0.0: +lodash._getnative@^3.0.0: version "3.9.1" resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U= @@ -9594,7 +9576,7 @@ lodash.omit@^4.1.0: resolved "https://registry.yarnpkg.com/lodash.omit/-/lodash.omit-4.5.0.tgz#6eb19ae5a1ee1dd9df0b969e66ce0b7fa30b5e60" integrity sha1-brGa5aHuHdnfC5aeZs4Lf6MLXmA= -lodash.restparam@*, lodash.restparam@^3.0.0: +lodash.restparam@^3.0.0: version "3.6.1" resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU= @@ -10637,7 +10619,6 @@ npm@^6.10.3: cmd-shim "^3.0.3" columnify "~1.5.4" config-chain "^1.1.12" - debuglog "*" detect-indent "~5.0.0" detect-newline "^2.1.0" dezalgo "~1.0.3" @@ -10652,7 +10633,6 @@ npm@^6.10.3: has-unicode "~2.0.1" hosted-git-info "^2.8.8" iferr "^1.0.2" - imurmurhash "*" infer-owner "^1.0.4" inflight "~1.0.6" inherits "^2.0.4" @@ -10671,14 +10651,8 @@ npm@^6.10.3: libnpx "^10.2.4" lock-verify "^2.1.0" lockfile "^1.0.4" - lodash._baseindexof "*" lodash._baseuniq "~4.6.0" - lodash._bindcallback "*" - lodash._cacheindexof "*" - lodash._createcache "*" - lodash._getnative "*" lodash.clonedeep "~4.5.0" - lodash.restparam "*" lodash.union "~4.6.0" lodash.uniq "~4.5.0" lodash.without "~4.4.0"