Skip to content

Commit 2555ca1

Browse files
fix a test for file upload
1 parent 544c74f commit 2555ca1

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

spec/dummy/test/components/previews/u_i/file_upload_input_component_preview/default.html.erb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
id: "upload_lg",
55
description: "Accepts .jpg and .png",
66
classes: "w-full"
7-
) %>
7+
) do %>
8+
<input type="file" id="upload_lg" name="upload_lg" accept=".jpg,.png">
9+
<% end %>
810

911
<h3 class="text-sm font-semibold text-content mt-4">Size: md and sm</h3>
1012
<div class="flex items-center gap-4">
@@ -13,12 +15,16 @@
1315
size: :md,
1416
description: "Accepts .jpg and .png",
1517
classes: "w-full"
16-
) %>
18+
) do %>
19+
<input type="file" id="upload_md" name="upload_md" accept=".jpg,.png">
20+
<% end %>
1721

1822
<%= render Avo::UI::FileUploadInputComponent.new(
1923
id: "upload_sm",
2024
size: :sm
21-
) %>
25+
) do %>
26+
<input type="file" id="upload_sm" name="upload_sm" >
27+
<% end %>
2228
</div>
2329

2430
<h3 class="text-sm font-semibold text-content mt-4">State: Disabled</h3>
@@ -27,5 +33,7 @@
2733
disabled: true,
2834
description: "Accepts .jpg and .png",
2935
classes: "w-full"
30-
) %>
36+
) do %>
37+
<input type="file" id="upload_disabled" name="upload_disabled" disabled>
38+
<% end %>
3139
</div>

spec/system/avo/has_field_discovery_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@
184184

185185
within('[data-field-id="cv"]') do
186186
# Verify it shows "Choose File" instead of "Choose Files"
187-
expect(page).to have_css('input[type="file"]:not([multiple])')
187+
# File input is hidden (opacity-0) for custom drag-and-drop UI
188+
expect(page).to have_css('input[type="file"]:not([multiple])', visible: false)
188189
end
189190
end
190191
end

0 commit comments

Comments
 (0)