Sha256: effbc441337e2a56e0ff39d4055f42321fe68d61153ac247a708cebce555eddb
Contents?: true
Size: 1.06 KB
Versions: 9
Compression:
Stored size: 1.06 KB
Contents
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib') require 'test/unit' require 'nitro/builders/xhtml' class TC_BuildersXhtml < Test::Unit::TestCase # :nodoc: all def test_options x = N::XhtmlString.new options = ['Male', 'Female'] x.select(:name => 'sex') do x.options(options, 1) end res = '<select name="sex"><option value="0">Male</option>' + '<option value="1" selected="1">Female</option></select>' assert_equal res, x x = N::XhtmlString.new options = ['Male', 'Female'] x.select('-- Select sex --', :name => 'sex') do x.options(options, 1) end res = '<select name="sex"><option>-- Select sex --</option>' + '<option value="0">Male</option>' + '<option value="1" selected="1">Female</option></select>' assert_equal res, x x = N::XhtmlString.new options = {'Male' => 'm', 'Female' => 'f'} x.select(:name => 'sex') do x.options(options, 'm') end res = '<select name="sex"><option value="m" selected="1">Male</option>' + '<option value="f">Female</option></select>' assert_equal res, x end end
Version data entries
9 entries across 9 versions & 1 rubygems