-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from AdamWard1995/fix_selection
Make selection behaviour match ember-frost-list
- Loading branch information
Showing
9 changed files
with
299 additions
and
118 deletions.
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
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* global $ */ | ||
import {expect} from 'chai' | ||
import {$hook} from 'ember-hook' | ||
|
||
function createRangeSelectEvent () { | ||
const e = $.Event('click') | ||
e.shiftKey = true | ||
return e | ||
} | ||
|
||
export function assertRowsSelected (rowHook, ...rowNumbers) { | ||
const rows = $hook(rowHook) | ||
let remainingRows = rows | ||
for (let rowNumber of rowNumbers) { | ||
const row = rows.eq(rowNumber) | ||
expect(row).to.have.class('is-selected') | ||
remainingRows = remainingRows.not(row) | ||
} | ||
|
||
// ensure remaining rows aren't selected | ||
expect(remainingRows).to.not.have.class('is-selected') | ||
} | ||
|
||
export function rowBodyRangeSelect (rowHook, row1, row2) { | ||
$hook(rowHook, {row: row1}).trigger(createRangeSelectEvent()) | ||
$hook(rowHook, {row: row2}).trigger(createRangeSelectEvent()) | ||
} | ||
|
||
export function rowBodySingleSelect (rowHook, row) { | ||
$hook(rowHook, {row}).click() | ||
} | ||
|
||
export function rowCheckboxRangeSelect (rowHook, row1, row2) { | ||
$hook(`${rowHook}-selectionCell`, {row: row1}).trigger(createRangeSelectEvent()) | ||
$hook(`${rowHook}-selectionCell`, {row: row2}).trigger(createRangeSelectEvent()) | ||
} | ||
|
||
export function rowCheckboxSingleSelect (rowHook, row) { | ||
$hook(`${rowHook}-selectionCell`, {row}).click() | ||
} |
Oops, something went wrong.