Skip to content

Commit 73b92be

Browse files
committed
Add FormBuilder#date_field method
1 parent f0addb2 commit 73b92be

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Diff for: app/helpers/shoelace/sl_form_builder.rb

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class SlFormBuilder < ActionView::Helpers::FormBuilder #:nodoc:
2020
cattr_accessor :default_input_slot_method
2121

2222
{
23+
date: :date,
2324
email: :email,
2425
number: :number,
2526
password: :password,

Diff for: test/helpers/form_builder/sl_input_test.rb

+8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ class FormBuilderSlInputTest < ActionView::TestCase
3232
end
3333
end
3434

35+
test "#date_field" do
36+
sl_form_for(User.new, url: "/") do |form|
37+
assert_dom_equal <<~HTML, form.date_field(:name)
38+
<sl-input label="Name" type="date" name="user[name]" id="user_name"></sl-input>
39+
HTML
40+
end
41+
end
42+
3543
test "#email_field" do
3644
sl_form_for(User.new, url: "/") do |form|
3745
assert_dom_equal <<~HTML, form.email_field(:name)

0 commit comments

Comments
 (0)