22
33require "spec_helper"
44
5- RSpec . describe Superform ::Rails ::Form ::Field , type : :view do
5+ RSpec . describe Superform ::Rails ::Form ::Field do
66 let ( :user ) { User . new ( email : "test@example.com" , first_name : "John" ) }
77 let ( :form ) { Superform ::Rails ::Form . new ( user ) }
88 let ( :field ) { form . field ( :email ) }
6060 expect ( component . type ) . to eq ( "radio" )
6161 end
6262 end
63-
64- describe "block handling" do
65- # Input elements are void elements and should not accept blocks.
66- # These tests verify that blocks are properly ignored.
67-
68- it "does not render block content for text input" do
69- html = render ( field . text { "Block content" } )
70- expect ( html ) . not_to include ( "Block content" )
71- expect ( html ) . to match ( /<input[^>]*type="text"[^>]*>/ )
72- end
73-
74- it "does not render block content for email input" do
75- html = render ( field . email { "Block content" } )
76- expect ( html ) . not_to include ( "Block content" )
77- expect ( html ) . to match ( /<input[^>]*type="email"[^>]*>/ )
78- end
79-
80- it "does not render block content for password input" do
81- html = render ( field . password { "Block content" } )
82- expect ( html ) . not_to include ( "Block content" )
83- expect ( html ) . to match ( /<input[^>]*type="password"[^>]*>/ )
84- end
85-
86- it "does not render block content for hidden input" do
87- html = render ( field . hidden { "Block content" } )
88- expect ( html ) . not_to include ( "Block content" )
89- expect ( html ) . to match ( /<input[^>]*type="hidden"[^>]*>/ )
90- end
91-
92- it "does not render block content for number input" do
93- html = render ( field . number { "Block content" } )
94- expect ( html ) . not_to include ( "Block content" )
95- expect ( html ) . to match ( /<input[^>]*type="number"[^>]*>/ )
96- end
97-
98- it "does not render block content for date input" do
99- html = render ( field . date { "Block content" } )
100- expect ( html ) . not_to include ( "Block content" )
101- expect ( html ) . to match ( /<input[^>]*type="date"[^>]*>/ )
102- end
103-
104- it "does not render block content for file input" do
105- html = render ( field . file { "Block content" } )
106- expect ( html ) . not_to include ( "Block content" )
107- expect ( html ) . to match ( /<input[^>]*type="file"[^>]*>/ )
108- end
109- end
11063end
0 commit comments