Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/dummy/app/controllers/movies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,25 @@ def index_with_blank
def index_with_blank_html
end

def update
@movie = Movie.find(params[:id])

respond_to do |format|
if @movie.update(movie_params)
format.html { redirect_to enum_url, notice: "Movie was successfully updated." }
else
format.html { render :edit, status: :unprocessable_entity }
end
end
end

private
def set_page
movies = params[:full_search] ? Movie.full_search(params[:q]) : Movie.search(params[:q])
set_page_and_extract_portion_from movies.alphabetically, per_page: 5
end

def movie_params
params.require(:movie).permit(:title, :rating)
end
end
2 changes: 2 additions & 0 deletions test/dummy/app/views/comboboxes/enum.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<%= form_with model: Movie.first do |form| %>
<%#= form.combobox :rating, Movie.ratings.keys %>
<%= form.combobox :rating, Movie.ratings %>
<%= form.submit %>
<% end %>

<%= combobox_tag "rating-enum", Movie.ratings, id: "rating-enum" %>
Expand Down
8 changes: 8 additions & 0 deletions test/system/hotwire_combobox_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,14 @@ class HotwireComboboxTest < ApplicationSystemTestCase
click_away
end

test "enum combobox with form" do
visit enum_path

open_combobox "#movie_rating"
click_on_option "R"
click_on "Update Movie"
end

test "async autocomplete selections don't trample over each other" do
visit async_path

Expand Down