Exemple #1
0
        public void RendersRequiredCheckBoxAttributes()
        {
            renderer.RenderCheckBoxListInput(writer, listItem, CheckBoxListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.AreEqual("<input id=\"checkbox_0\" name=\"checkbox$0\" type=\"checkbox\" />", writer.InnerWriter.ToString(),
                            "checkbox required attributes not rendered properly");
        }
Exemple #2
0
        public void RendersPostBackHandler()
        {
            control.AutoPostBack = true;
            renderer.RenderCheckBoxListInput(writer, listItem, CheckBoxListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.IsTrue(writer.InnerWriter.ToString().Contains("onclick=\"javascript:setTimeout('__doPostBack(\\'checkbox$0\\',\\'\\')', 0)\""), "postback handler not rendered");
        }
Exemple #3
0
        public void RendersTabIndex()
        {
            control.TabIndex = 4;
            renderer.RenderCheckBoxListInput(writer, listItem, CheckBoxListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.IsTrue(writer.InnerWriter.ToString().Contains("tabindex=\"4\""), "tabindex attribute not rendered");
        }
Exemple #4
0
        public void RendersAccessKey()
        {
            control.AccessKey = "C";
            renderer.RenderCheckBoxListInput(writer, listItem, CheckBoxListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.IsTrue(writer.InnerWriter.ToString().Contains("accesskey=\"C\""), "accesskey attribute not rendered");
        }
Exemple #5
0
        public void RendersChecked()
        {
            listItem.Selected = true;
            renderer.RenderCheckBoxListInput(writer, listItem, CheckBoxListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.IsTrue(writer.InnerWriter.ToString().Contains("checked=\"checked\""), "checked attribute not rendered");
        }
Exemple #6
0
        public void RendersDisabled()
        {
            listItem.Enabled = false;
            renderer.RenderCheckBoxListInput(writer, listItem, CheckBoxListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.IsTrue(writer.InnerWriter.ToString().Contains("disabled=\"disabled\""), "disabled attribute not rendered");
        }
Exemple #7
0
        public void RendersValue()
        {
            listItem.Value = "test";
            renderer.RenderCheckBoxListInput(writer, listItem, CheckBoxListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.IsTrue(writer.InnerWriter.ToString().Contains("value=\"test\""), "list item value not rendered");
        }
Exemple #8
0
        public void RendersNoLabelWhenTextAndValueAreEmpty()
        {
            listItem.Text  = String.Empty;
            listItem.Value = String.Empty;
            renderer.RenderCheckBoxListLabel(writer, listItem, CheckBoxListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.AreEqual(String.Empty, writer.InnerWriter.ToString(), "label not rendered properly");
        }
Exemple #9
0
        public void RendersLabelWithValue()
        {
            listItem.Text  = String.Empty;
            listItem.Value = "value";
            renderer.RenderCheckBoxListLabel(writer, listItem, CheckBoxListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.AreEqual("<label for=\"checkbox_0\">value</label>", writer.InnerWriter.ToString(), "label not rendered properly");
        }
Exemple #10
0
 public void SetUp()
 {
     writer                  = new HtmlTextWriter(new StringWriter());
     control                 = new CheckBoxList();
     control.ID              = "checkbox";
     control.CssClass        = "someclass";
     control.RepeatDirection = RepeatDirection.Horizontal;
     listItem                = new ListItem();
     control.Items.Add(listItem);
     renderer = new CheckBoxListHtmlRenderer(control);
 }
 public void SetUp()
 {
     writer = new HtmlTextWriter(new StringWriter());
     control = new CheckBoxList();
     control.ID = "checkbox";
     control.CssClass = "someclass";
     control.RepeatDirection = RepeatDirection.Horizontal;
     listItem = new ListItem();
     control.Items.Add(listItem);
     renderer = new CheckBoxListHtmlRenderer(control);
 }