diff --git a/.travis.yml b/.travis.yml index 0302081..f77aba4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,7 +56,7 @@ deploy: branch: master condition: "$EMBER_TRY_SCENARIO = 'default'" node: 'stable' - tags: true + tags: false after_deploy: - ".travis/publish-gh-pages.sh" notifications: diff --git a/README.md b/README.md index a618612..8126f81 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Detailed API and example usage can be found in the sample application in tests/d | `Sub Attribute` | `properties` | `array` | | Array of sortable attributes. eg. [{"label: "foo", "value": "bar"}], This is an attribute on frost-sort component.| | `Sub Attribute` | `onSort` | `action closure` | | callback functions user provided to handle sorting. This is an attribute on frost-sort component.| | `Attribute` | `itemComparator` | `action closure` | | callback functions user provided to handle custom item comparisons.| -| `Attribute` | `basicClickDisabled` | `boolean` | | Optional: set to true if you want to disable basic clicks, else false by default.| +| `Attribute` | `basicClickDisabled` | `boolean` | | Optional: set to true if you want to disable basic clicks, else false by default. Basic clicks select the item you clicked while deselecting everything else| ### Infinite scroll diff --git a/addon/components/frost-list.js b/addon/components/frost-list.js index 5c73b50..55a6f89 100644 --- a/addon/components/frost-list.js +++ b/addon/components/frost-list.js @@ -175,18 +175,16 @@ export default Component.extend({ const basicClickDisabled = this.get('basicClickDisabled') const clonedSelectedItems = A(this.get('selectedItems').slice()) const _rangeState = this.get('_rangeState') - + if (basicClickDisabled) { + isSpecificSelect = true + } // Selects are proccessed in order of precedence: specific, range, basic if (isSpecificSelect) { selection.specific(clonedSelectedItems, item, _rangeState, itemComparator) } else if (isRangeSelect) { selection.range(items, clonedSelectedItems, item, _rangeState, itemComparator) } else { - if (basicClickDisabled) { - selection.specific(clonedSelectedItems, item, _rangeState, itemComparator) - } else { - selection.basic(clonedSelectedItems, item, _rangeState, itemComparator) - } + selection.basic(clonedSelectedItems, item, _rangeState, itemComparator) } this.onSelectionChange(clonedSelectedItems) } diff --git a/tests/integration/components/frost-list-test.js b/tests/integration/components/frost-list-test.js index 7d9a569..c706fa6 100644 --- a/tests/integration/components/frost-list-test.js +++ b/tests/integration/components/frost-list-test.js @@ -345,7 +345,6 @@ describe(test.label, function () { Ember.Object.create({id: '0'}), Ember.Object.create({id: '1'}) ]) - this.set('items', testItems) const testSelectedItems = A([]) this.set('selectedItems', testSelectedItems) @@ -367,8 +366,9 @@ describe(test.label, function () { describe('when selecting both items', function () { beforeEach(function () { - $(hook('my-list-item', {index: 0})).click() - $(hook('my-list-item', {index: 1})).click() + $hook('my-list-item', {index: 0}).click() + $hook('my-list-item', {index: 1}).click() + return wait() }) it('item 0 is selected', function () { expect($hook('my-list-item-container', {index: 0}).hasClass('is-selected')).to.eql(true) @@ -379,7 +379,8 @@ describe(test.label, function () { describe('when unselecting item 0', function () { beforeEach(function () { - $(hook('my-list-item', {index: 0})).click() + $hook('my-list-item', {index: 0}).click() + return wait() }) it('item 0 is not selected', function () { expect($hook('my-list-item-container', {index: 0}).hasClass('is-selected')).to.eql(false)