Skip to content

Commit

Permalink
Merge pull request #107 from frosetti/fr/optional_basic_click
Browse files Browse the repository at this point in the history
Updated Readme again
  • Loading branch information
TheOtherDude committed Feb 18, 2017
2 parents 28fca63 + 3f628ab commit ebc5810
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions addon/components/frost-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/components/frost-list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit ebc5810

Please sign in to comment.