-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Dashboard] [Controls] Show document count beside options list suggestions #146241
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
Changes from all commits
3b88fac
d68b3cf
e423ed8
22afaa8
fa37b5e
f0fdfb5
2eef7c8
60b2ec2
d6033b0
70bc212
6a9967d
6424e66
3c082bf
24fac49
5ae9e80
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 |
|---|---|---|
|
|
@@ -66,7 +66,7 @@ describe('Options list popover', () => { | |
| }); | ||
|
|
||
| test('no available options', async () => { | ||
| const popover = await mountComponent({ componentState: { availableOptions: [] } }); | ||
| const popover = await mountComponent({ componentState: { availableOptions: {} } }); | ||
| const availableOptionsDiv = findTestSubject(popover, 'optionsList-control-available-options'); | ||
| const noOptionsDiv = findTestSubject( | ||
| availableOptionsDiv, | ||
|
|
@@ -118,6 +118,43 @@ describe('Options list popover', () => { | |
| expect(sortButton.prop('disabled')).toBe(true); | ||
| }); | ||
|
|
||
| test('test single invalid selection', async () => { | ||
| const popover = await mountComponent({ | ||
| explicitInput: { | ||
| selectedOptions: ['bark', 'woof'], | ||
| }, | ||
| componentState: { | ||
| availableOptions: { | ||
| bark: { doc_count: 75 }, | ||
| }, | ||
| validSelections: ['bark'], | ||
| invalidSelections: ['woof'], | ||
| }, | ||
| }); | ||
| const validSelection = findTestSubject(popover, 'optionsList-control-selection-bark'); | ||
| expect(validSelection.text()).toEqual('bark75'); | ||
| const title = findTestSubject(popover, 'optionList__ignoredSelectionLabel').text(); | ||
| expect(title).toEqual('Ignored selection'); | ||
|
Contributor
Author
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. Because I refactored the
Contributor
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 is likely a very good change anyway! Nice cleanup. |
||
| const invalidSelection = findTestSubject(popover, 'optionsList-control-ignored-selection-woof'); | ||
| expect(invalidSelection.text()).toEqual('woof'); | ||
| expect(invalidSelection.hasClass('optionsList__selectionInvalid')).toBe(true); | ||
| }); | ||
|
|
||
| test('test title when multiple invalid selections', async () => { | ||
| const popover = await mountComponent({ | ||
| explicitInput: { selectedOptions: ['bark', 'woof', 'meow'] }, | ||
| componentState: { | ||
| availableOptions: { | ||
| bark: { doc_count: 75 }, | ||
| }, | ||
| validSelections: ['bark'], | ||
| invalidSelections: ['woof', 'meow'], | ||
| }, | ||
| }); | ||
| const title = findTestSubject(popover, 'optionList__ignoredSelectionLabel').text(); | ||
| expect(title).toEqual('Ignored selections'); | ||
| }); | ||
|
|
||
| test('should default to exclude = false', async () => { | ||
| const popover = await mountComponent(); | ||
| const includeButton = findTestSubject(popover, 'optionsList__includeResults'); | ||
|
|
@@ -172,7 +209,7 @@ describe('Options list popover', () => { | |
|
|
||
| test('if existsSelected = false and no suggestions, then "Exists" does not show up', async () => { | ||
| const popover = await mountComponent({ | ||
| componentState: { availableOptions: [] }, | ||
| componentState: { availableOptions: {} }, | ||
| explicitInput: { existsSelected: false }, | ||
| }); | ||
| const existsOption = findTestSubject(popover, 'optionsList-control-selection-exists'); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,7 +112,11 @@ export const OptionsListPopoverActionBar = ({ | |
| display={showOnlySelected ? 'base' : 'empty'} | ||
| onClick={() => setShowOnlySelected(!showOnlySelected)} | ||
| data-test-subj="optionsList-control-show-only-selected" | ||
| aria-label={OptionsListStrings.popover.getClearAllSelectionsButtonTitle()} | ||
| aria-label={ | ||
| showOnlySelected | ||
| ? OptionsListStrings.popover.getAllOptionsButtonTitle() | ||
| : OptionsListStrings.popover.getSelectedOptionsButtonTitle() | ||
| } | ||
|
Comment on lines
+115
to
+119
Contributor
Author
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 must have somehow grabbed the wrong |
||
| /> | ||
| </EuiToolTip> | ||
| </EuiFlexItem> | ||
|
|
||
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.
I noticed that, after this comment was made for the sort PR, I only renamed the specific options list types - however, as I was working on this PR, I figured this rule should apply to options list constants as well. Hence, renaming this to be more specific.