-
-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] multiSelectRequiresKeyboard
option for toggling row selec…
#160
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ test('it renders', function(assert) { | |
assert.equal(this.$().text().trim(), ''); | ||
}); | ||
|
||
test('row selection', function(assert) { | ||
test('row selection - enable or disable', function(assert) { | ||
this.set('table', new Table(Columns, createUsers(1))); | ||
this.set('canSelect', false); | ||
|
||
|
@@ -45,7 +45,7 @@ test('row selection', function(assert) { | |
assert.ok(row.hasClass('is-selected')); | ||
}); | ||
|
||
test('row selection', function(assert) { | ||
test('row selection - ctrl-click to modify selection', function(assert) { | ||
this.set('table', new Table(Columns, createUsers(5))); | ||
|
||
this.render(hbs `{{lt-body table=table sharedOptions=sharedOptions canSelect=true multiSelect=true}}`); | ||
|
@@ -57,16 +57,40 @@ test('row selection', function(assert) { | |
assert.equal(this.$('tbody > tr').length, 5); | ||
|
||
firstRow.click(); | ||
assert.equal(this.$('tr.is-selected').length, 1); | ||
assert.equal(this.$('tr.is-selected').length, 1, 'clicking a row selects it'); | ||
|
||
lastRow.trigger(createClickEvent({shiftKey: true})); | ||
assert.equal(this.$('tr.is-selected').length, 5); | ||
assert.equal(this.$('tr.is-selected').length, 5, 'shift-clicking another row selects it and all rows between'); | ||
|
||
middleRow.trigger(createClickEvent({ctrlKey: true})); | ||
assert.equal(this.$('tr.is-selected').length, 4); | ||
assert.equal(this.$('tr.is-selected').length, 4, 'ctrl-clicking a selected row deselects it'); | ||
|
||
firstRow.click(); | ||
assert.equal(this.$('tr.is-selected').length, 0); | ||
assert.equal(this.$('tr.is-selected').length, 0, 'clicking a selected row deselects all rows'); | ||
}); | ||
|
||
test('row selection - click to modify selection', function(assert) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this new test is very much based on the standard mode test before it, exercising and documenting the differences in behavior for (nearly) identical user input |
||
this.set('table', new Table(Columns, createUsers(5))); | ||
|
||
this.render(hbs `{{lt-body table=table sharedOptions=sharedOptions canSelect=true multiSelect=true multiSelectRequiresKeyboard=false}}`); | ||
|
||
let firstRow = this.$('tr:first'); | ||
let middleRow = this.$('tr:nth-of-type(3)'); | ||
let lastRow = this.$('tr:last'); | ||
|
||
assert.equal(this.$('tbody > tr').length, 5); | ||
|
||
firstRow.click(); | ||
assert.equal(this.$('tr.is-selected').length, 1, 'clicking a row selects it'); | ||
|
||
lastRow.trigger(createClickEvent({shiftKey: true})); | ||
assert.equal(this.$('tr.is-selected').length, 5, 'shift-clicking another row selects it and all rows between'); | ||
|
||
middleRow.click(); | ||
assert.equal(this.$('tr.is-selected').length, 4, 'clicking a selected row deselects it without affecting other selected rows'); | ||
|
||
middleRow.click(); | ||
assert.equal(this.$('tr.is-selected').length, 5, 'clicking a deselected row selects it without affecting other selected rows'); | ||
}); | ||
|
||
test('row expansion', function(assert) { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than have three tests called 'row selection' I took the liberty of adding additional detail to these test names to differentiate them