-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Support selecting single run using double click. #5831
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,7 @@ import { | |
runSelectorRegexFilterChanged, | ||
runSelectorSortChanged, | ||
runTableShown, | ||
singleRunSelected, | ||
} from '../../actions'; | ||
import {DomainType} from '../../data_source/runs_data_source_types'; | ||
import {MAX_NUM_RUNS_TO_ENABLE_BY_DEFAULT, Run} from '../../store/runs_types'; | ||
|
@@ -1828,6 +1829,32 @@ describe('runs_table', () => { | |
); | ||
}); | ||
|
||
it('dispatches singleRunSelected on checkbox double click', async () => { | ||
store.overrideSelector(getRuns, [ | ||
buildRun({id: 'book1', name: "The Philosopher's Stone"}), | ||
buildRun({id: 'book2', name: 'The Chamber Of Secrets'}), | ||
buildRun({id: 'book3', name: 'The Prisoner of Azkaban'}), | ||
]); | ||
|
||
const fixture = createComponent( | ||
['rowling'], | ||
[RunsTableColumn.CHECKBOX, RunsTableColumn.RUN_NAME], | ||
true /* usePagination */ | ||
); | ||
fixture.detectChanges(); | ||
await fixture.whenStable(); | ||
|
||
const rows = fixture.nativeElement.querySelectorAll(Selector.ITEM_ROW); | ||
const book2 = rows[1].querySelector('mat-checkbox'); | ||
book2.dispatchEvent(new MouseEvent('dblclick', {relatedTarget: book2})); | ||
|
||
expect(dispatchSpy).toHaveBeenCalledWith( | ||
singleRunSelected({ | ||
runId: 'book2', | ||
}) | ||
); | ||
}); | ||
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. Would it be worth to add a test that click and dblclick event are fired in such order and we get the single selection result? 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. I think a user or machine has to actually double click on the element in the browser window in order for both events to be fired. Here I am just doing a lower-level operation pretending that some sort of double click has happened. I will explore writing a webtest for this, though, to see if I can simulate an actual double click (and both the change and dblclick events). |
||
|
||
it( | ||
'dispatches runPageSelectionToggled with current page when click on ' + | ||
'header', | ||
|
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.
Can we also add a note here that
(dblclick)
will also fire(change)
?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.
Done.