Testing Weekday Select Input Generation in Simple Form
This test suite validates the WeekdayInput functionality in Simple Form, focusing on weekday select field generation and placeholder handling. The tests ensure proper HTML select element creation with appropriate attributes and classes.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
heartcombo/simple_form
test/inputs/weekday_input_test.rb
# frozen_string_literal: true
# encoding: UTF-8
require 'test_helper'
class WeekdayInputTest < ActionView::TestCase
test 'input generates a weekday select' do
if ActionView::VERSION::MAJOR >= 7
with_input_for @user, :born_at, :weekday
assert_select 'select.weekday#user_born_at'
end
end
test 'input generates a weekday select that accepts placeholder' do
if ActionView::VERSION::MAJOR >= 7
with_input_for @user, :born_at, :weekday, placeholder: 'Put in a weekday'
assert_select 'select.weekday[placeholder="Put in a weekday"]'
end
end
end