-
Notifications
You must be signed in to change notification settings - Fork 273
Add alias to hidden in query options #1220
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4b48614
feat: add alias to hidden in query options
e60d4a2
feat: add alias to hidden in config
891b293
test: complete config test with hidden feature
cb569a2
doc: add documentation for the new naming
dfcd2ed
refactor: rename includeHiddenFromAccessibility to includeHiddenElements
b4bfad2
refactor: inline includeHIddenElements computatiion
d0592ad
refactor: put better naming includeHIddenElements first in flow types
5d23ae3
doc: minimize doc about hidden option
9835e77
test: extract includeHiddenElements tests
6a1cd36
fix: handle case when using configure only with defaultHidden option
6bf81aa
chore: remove unused import
a7c9c76
Update src/helpers/findAll.ts
MattAgn c86b75c
refactor: improve defaultHidden computing
fa35bc9
refactor: pre-merge tweaks
mdjastrzebski b891395
chore: improve code coverage
mdjastrzebski 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 hidden or 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules | ||
coverage | ||
*.log | ||
.eslintcache | ||
build | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,39 @@ | ||
import React from 'react'; | ||
import { View } from 'react-native'; | ||
import { configure, render, screen } from '../..'; | ||
|
||
test('includeHiddenElements query option takes priority over hidden option and global config', () => { | ||
configure({ defaultHidden: true, defaultIncludeHiddenElements: true }); | ||
render(<View testID="view" style={{ display: 'none' }} />); | ||
expect( | ||
screen.queryByTestId('view', { includeHiddenElements: false, hidden: true }) | ||
).toBeFalsy(); | ||
}); | ||
|
||
test('hidden option takes priority over global config when includeHiddenElements is not defined', () => { | ||
configure({ defaultHidden: true, defaultIncludeHiddenElements: true }); | ||
render(<View testID="view" style={{ display: 'none' }} />); | ||
expect(screen.queryByTestId('view', { hidden: false })).toBeFalsy(); | ||
}); | ||
|
||
test('global config defaultIncludeElements option takes priority over defaultHidden when set at the same time', () => { | ||
configure({ defaultHidden: false, defaultIncludeHiddenElements: true }); | ||
render(<View testID="view" style={{ display: 'none' }} />); | ||
expect(screen.getByTestId('view')).toBeTruthy(); | ||
}); | ||
|
||
test('defaultHidden takes priority when it was set last', () => { | ||
// also simulates the case when defaultIncludeHiddenElements is true by default in the config | ||
configure({ defaultIncludeHiddenElements: true }); | ||
configure({ defaultHidden: false }); | ||
render(<View testID="view" style={{ display: 'none' }} />); | ||
expect(screen.queryByTestId('view')).toBeFalsy(); | ||
}); | ||
|
||
test('defaultIncludeHiddenElements takes priority when it was set last', () => { | ||
// also simulates the case when defaultHidden is true by default in the config | ||
configure({ defaultHidden: true }); | ||
configure({ defaultIncludeHiddenElements: false }); | ||
render(<View testID="view" style={{ display: 'none' }} />); | ||
expect(screen.queryByTestId('view')).toBeFalsy(); | ||
}); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
style: in our tests (also in other test files) I think it would be enough to use recommended
includeHiddenElements
option name and avoid polluting them withhidden
all the time. We might want to have some few separate tests that would check thathidden
alias is also used.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.
Or in case you find it useful the current way, just put the
includeHiddenElements
first as the recommended option.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.
extracting them in another test file sounds good :) (helped me find a bug in the process)