Skip to content

Commit

Permalink
Add filter param to playground instance, rename test for clarity.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamieshark committed Aug 29, 2024
1 parent 67b8217 commit c9b6e9c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
5 changes: 3 additions & 2 deletions previews/primer/alpha/select_panel_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ def local_fetch(open_on_load: false)
#
# @snapshot interactive
# @param open_on_load toggle
def eventually_local_fetch(open_on_load: false)
render_with_template(locals: { open_on_load: open_on_load })
# @param show_filter toggle
def eventually_local_fetch(open_on_load: false, show_filter: true)
render_with_template(locals: { open_on_load: open_on_load, show_filter: show_filter })
end

# @label Remote fetch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
src: select_panel_items_path,
select_variant: :multiple,
fetch_strategy: :eventually_local,
open_on_load: open_on_load
open_on_load: open_on_load,
show_filter: show_filter,
)) do |panel| %>
<% panel.with_show_button { "Sci-fi equipment" } %>
<% panel.with_footer(show_divider: true) do %>
Expand Down
25 changes: 11 additions & 14 deletions test/system/alpha/select_panel_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,17 @@ def test_ev_loc_initial_failure
refute_selector "[data-target='select-panel.bannerErrorElement']"
end

def test_ev_loc_items_load_without_filter
visit_preview(:eventually_local_fetch, show_filter: false)

wait_for_items_to_load do
click_on_invoker_button
end

# items should render without error
assert_selector "select-panel ul li"
end

########## REMOTE TESTS ############

def test_remote_items_load
Expand Down Expand Up @@ -952,20 +963,6 @@ def test_remote_filter_failure
refute_selector "[data-target='select-panel.fragmentErrorElement']"
end

def test_filter_input_gate
visit_preview(:playground, show_filter: false)

click_on_invoker_button
refute_selector "li[data-item-id=item1] [aria-disabled=true]"

evaluate_multiline_script(<<~JS)
const panel = document.querySelector('select-panel')
panel.disableItem(panel.getItemById('item1'))
JS

assert_selector "li[data-item-id=item1] [aria-disabled=true]"
end

########## TAB INDEX TESTS ############

def test_tab_indices
Expand Down

0 comments on commit c9b6e9c

Please sign in to comment.