public void Dropdown_list_helper_renders_size_attribute() { var model = new DropDownListTestModel(); var helper = HtmlHelperBuilder.GetTypedHtmlHelper(model); var result = helper.DropDownList(m => m.Value, model.SelectList).Size(5).ToHtmlString(); Assert.Equal("<select id=\"Value\" name=\"Value\" size=\"5\"><option value=\"1\">a</option>\r\n<option value=\"2\">b</option>\r\n<option value=\"3\">c</option>\r\n</select>", result); }
public void Dropdown_list_helper_renders_data_attribute() { var model = new DropDownListTestModel(); var helper = HtmlHelperBuilder.GetTypedHtmlHelper(model); var result = helper.DropDownList(m => m.Value, model.SelectList).Data("superhero", "Superman").ToHtmlString(); Assert.Equal("<select data-superhero=\"Superman\" id=\"Value\" name=\"Value\"><option value=\"1\">a</option>\r\n<option value=\"2\">b</option>\r\n<option value=\"3\">c</option>\r\n</select>", result); }
public void Dropdown_list_helper_supports_attribute_combinations() { var model = new DropDownListTestModel(); var helper = HtmlHelperBuilder.GetTypedHtmlHelper(model); var result = helper.DropDownList(m => m.Value, model.SelectList, "default").Id("test-id").Class("test-class").Disabled(true).Multiple(true).Size(3).ToHtmlString(); Assert.Equal("<select class=\"test-class\" disabled=\"\" id=\"test-id\" multiple=\"\" name=\"Value\" size=\"3\"><option value=\"\">default</option>\r\n<option value=\"1\">a</option>\r\n<option value=\"2\">b</option>\r\n<option value=\"3\">c</option>\r\n</select>", result); }