-
Notifications
You must be signed in to change notification settings - Fork 35
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
Make organisations field searchable #3172
Closed
Closed
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
module AutocompleteHelpers | ||
def assert_select_with_autocomplete( | ||
autocomplete_input_element:, | ||
select_element:, | ||
option_text:, | ||
option_value:, | ||
unique_partial_string: | ||
) | ||
assert_equal "", autocomplete_input_element.value | ||
assert_equal "", select_element.value | ||
|
||
# when I type a few characters from the option that are unique to that option | ||
autocomplete_input_element.fill_in with: unique_partial_string | ||
autocomplete_option = find(".autocomplete__option") | ||
|
||
# the autcomplete value reflects what I typed, a matching option appears, but the select element remains empty | ||
assert_equal unique_partial_string, autocomplete_input_element.value | ||
assert_equal option_text, autocomplete_option.text | ||
assert_equal "", select_element.value | ||
|
||
# when I click on the matching option | ||
autocomplete_option.click | ||
|
||
# the autocomplete and select elements reflect my selection | ||
assert_equal option_text, autocomplete_input_element.value | ||
assert_equal option_value, select_element.value | ||
end | ||
|
||
def assert_resets_select_when_desynced_with_autocomplete( | ||
autocomplete_input_element:, | ||
select_element:, | ||
option_text:, | ||
unique_partial_string: | ||
) | ||
autocomplete_input_element.fill_in with: unique_partial_string | ||
autocomplete_option = find(".autocomplete__option") | ||
|
||
assert_equal unique_partial_string, autocomplete_input_element.value | ||
assert_equal option_text, autocomplete_option.text | ||
assert_equal "", select_element.value | ||
|
||
autocomplete_input_element.native.send_keys :escape | ||
end | ||
|
||
def assert_clear_autocomplete_selection_by_click(autocomplete_input_element:, select_element:) | ||
click_button "Clear selection" | ||
|
||
assert_equal "", autocomplete_input_element.value | ||
assert_equal "", select_element.value | ||
end | ||
|
||
def assert_clear_autocomplete_selection_by_space(autocomplete_input_element:, select_element:) | ||
clear_button = find(".js-autocomplete__clear-button") | ||
clear_button.native.send_keys :space | ||
|
||
assert_equal "", autocomplete_input_element.value | ||
assert_equal "", select_element.value | ||
end | ||
|
||
def assert_clear_autocomplete_selection_by_enter(autocomplete_input_element:, select_element:) | ||
clear_button = find(".js-autocomplete__clear-button") | ||
clear_button.native.send_keys :enter | ||
|
||
assert_equal "", autocomplete_input_element.value | ||
assert_equal "", select_element.value | ||
end | ||
end |
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
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.
If we are going to go down a more abstracted approach with our tests, could we make method names for our helpers even more human readable? I know we're following the lead taken by Minitest here, but I'm not the biggest fan of the brevity of Minitest's DSL.
Also, forgive my ignorance but I'm not sure what desynced means!