Пример #1
0
        public void RendersRequiredRadioButtonAttributes()
        {
            renderer.RenderRadioButtonListInput(writer, listItem, RadioButtonListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.AreEqual("<input id=\"radiobutton_0\" name=\"radiobutton\" type=\"radio\" />", writer.InnerWriter.ToString(),
                            "radio button required attributes not rendered properly");
        }
Пример #2
0
        public void RendersPostBackHandler()
        {
            control.AutoPostBack = true;
            renderer.RenderRadioButtonListInput(writer, listItem, RadioButtonListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.IsTrue(writer.InnerWriter.ToString().Contains("onclick=\"javascript:setTimeout('__doPostBack(\\'radiobutton$0\\',\\'\\')', 0)\""), "postback handler not rendered");
        }
Пример #3
0
        public void RendersTabIndex()
        {
            control.TabIndex = 4;
            renderer.RenderRadioButtonListInput(writer, listItem, RadioButtonListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.IsTrue(writer.InnerWriter.ToString().Contains("tabindex=\"4\""), "tabindex attribute not rendered");
        }
Пример #4
0
        public void RendersAccessKey()
        {
            control.AccessKey = "C";
            renderer.RenderRadioButtonListInput(writer, listItem, RadioButtonListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.IsTrue(writer.InnerWriter.ToString().Contains("accesskey=\"C\""), "accesskey attribute not rendered");
        }
Пример #5
0
        public void RendersChecked()
        {
            listItem.Selected = true;
            renderer.RenderRadioButtonListInput(writer, listItem, RadioButtonListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.IsTrue(writer.InnerWriter.ToString().Contains("checked=\"checked\""), "checked attribute not rendered");
        }
Пример #6
0
        public void RendersDisabled()
        {
            listItem.Enabled = false;
            renderer.RenderRadioButtonListInput(writer, listItem, RadioButtonListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.IsTrue(writer.InnerWriter.ToString().Contains("disabled=\"disabled\""), "disabled attribute not rendered");
        }
Пример #7
0
        public void RendersValue()
        {
            listItem.Value = "test";
            renderer.RenderRadioButtonListInput(writer, listItem, RadioButtonListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.IsTrue(writer.InnerWriter.ToString().Contains("value=\"test\""), "list item value not rendered");
        }
Пример #8
0
        public void RendersNoLabelWhenTextAndValueAreEmpty()
        {
            listItem.Text  = String.Empty;
            listItem.Value = String.Empty;
            renderer.RenderRadioButtonListLabel(writer, listItem, RadioButtonListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.AreEqual(String.Empty, writer.InnerWriter.ToString(), "label not rendered properly");
        }
Пример #9
0
        public void RendersLabelWithValue()
        {
            listItem.Text  = String.Empty;
            listItem.Value = "value";
            renderer.RenderRadioButtonListLabel(writer, listItem, RadioButtonListHtmlRenderer.GetListItemClientID(control, listItem));

            Assert.AreEqual("<label for=\"radiobutton_0\">value</label>", writer.InnerWriter.ToString(), "label not rendered properly");
        }
Пример #10
0
 public void SetUp()
 {
     writer                  = new HtmlTextWriter(new StringWriter());
     control                 = new RadioButtonList();
     control.ID              = "radiobutton";
     control.CssClass        = "someclass";
     control.RepeatDirection = RepeatDirection.Horizontal;
     listItem                = new ListItem();
     control.Items.Add(listItem);
     renderer = new RadioButtonListHtmlRenderer(control);
 }
 public void SetUp()
 {
     writer = new HtmlTextWriter(new StringWriter());
     control = new RadioButtonList();
     control.ID = "radiobutton";
     control.CssClass = "someclass";
     control.RepeatDirection = RepeatDirection.Horizontal;
     listItem = new ListItem();
     control.Items.Add(listItem);
     renderer = new RadioButtonListHtmlRenderer(control);
 }