Support selecting multiple cards by using a list of numbers (separated by comma, or space)

https://3.basecamp.com/2914079/buckets/37331921/todos/8620236700#__recording_8620273944
This commit is contained in:
Jorge Manrubia
2025-05-07 11:30:44 +02:00
parent dc28f4c9c5
commit 561e9fad0c
7 changed files with 60 additions and 11 deletions
+21
View File
@@ -0,0 +1,21 @@
require "test_helper"
class Command::FilterCardsTest < ActionDispatch::IntegrationTest
include CommandTestHelper
setup do
@card_ids = cards(:logo, :layout).collect(&:id)
end
test "redirects to the cards index filtering by cards" do
result = execute_command "#{@card_ids.join(" ")}"
assert_equal cards_path(indexed_by: "newest", card_ids: @card_ids), result.url
end
test "respects existing filters" do
result = execute_command "#{@card_ids.join(",")}", context_url: "http://37signals.fizzy.localhost:3006/cards?collection_ids%5B%5D=#{collections(:writebook).id}"
assert_equal cards_path(indexed_by: "newest", collection_ids: [ collections(:writebook).id ], card_ids: @card_ids), result.url
end
end