Exemplo n.º 1
0
        private XmlNode GetAssertedDiv(int expectedChildElements, bool withStyle)
        {
            var renderer = new TestableBocReferenceValueQuirksModeRenderer(_resourceUrlFactory, () => DropDownList);

            Assert.That(DropDownList.ID, Is.Null);
            renderer.Render(CreateRenderingContext());
            Assert.That(DropDownList.ID, Is.EqualTo(c_valueName));

            var document = Html.GetResultDocument();
            var div      = document.GetAssertedChildElement("div", 0);

            div.AssertAttributeValueEquals("id", "MyReferenceValue");
            div.AssertAttributeValueContains("class", "bocReferenceValue");
            if (Control.IsReadOnly)
            {
                div.AssertAttributeValueContains("class", "readOnly");
            }

            div.AssertStyleAttribute("display", "inline");
            if (withStyle)
            {
                div.AssertStyleAttribute("height", Height.ToString());
                div.AssertStyleAttribute("width", Width.ToString());
            }

            div.AssertChildElementCount(expectedChildElements);
            return(div);
        }
Exemplo n.º 2
0
        public void RenderOptions()
        {
            var renderer = new TestableBocReferenceValueQuirksModeRenderer(_resourceUrlFactory, () => new StubDropDownList());

            Html.Writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            renderer.RenderOptionsMenuTitle(CreateRenderingContext());
            Html.Writer.RenderEndTag();

            var document = Html.GetResultDocument();

            AssertRow(document, false, false, false);
        }
Exemplo n.º 3
0
        public void RenderOptionsReadOnlyWithStyle()
        {
            AddStyle();
            Control.Stub(stub => stub.IsReadOnly).Return(true);

            var renderer = new TestableBocReferenceValueQuirksModeRenderer(_resourceUrlFactory);

            Html.Writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            renderer.RenderOptionsMenuTitle(CreateRenderingContext());
            Html.Writer.RenderEndTag();

            var document = Html.GetResultDocument();

            AssertRow(document, true, false, true);
        }