示例#1
0
        private XmlNode GetAssertedContainerSpan(bool withStyle)
        {
            var renderer = new TestableBocReferenceValueRenderer(
                _resourceUrlFactoryStub,
                GlobalizationService,
                RenderingFeatures.Default,
                () => DropDownList);

            renderer.Render(CreateRenderingContext());

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

            containerDiv.AssertAttributeValueEquals("id", "MyReferenceValue");
            containerDiv.AssertAttributeValueContains("class", "bocReferenceValue");
            if (Control.IsReadOnly)
            {
                containerDiv.AssertAttributeValueContains("class", "readOnly");
            }
            if (!Control.Enabled)
            {
                containerDiv.AssertAttributeValueContains("class", "disabled");
            }

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

            return(containerDiv);
        }
示例#2
0
        public void RenderOptionsReadOnly()
        {
            Control.Stub(stub => stub.IsIconEnabled()).Return(true);
            Control.Stub(stub => stub.IsReadOnly).Return(true);

            var renderer = new TestableBocReferenceValueRenderer(
                _resourceUrlFactoryStub,
                GlobalizationService,
                RenderingFeatures.Default,
                () => new StubDropDownList());

            Html.Writer.AddAttribute(HtmlTextWriterAttribute.Class, "body");
            Html.Writer.RenderBeginTag(HtmlTextWriterTag.Span);
            renderer.RenderOptionsMenuTitle(CreateRenderingContext());
            Html.Writer.RenderEndTag();

            var document = Html.GetResultDocument();

            AssertReadOnlyContent(document);
        }
示例#3
0
        public void RenderOptions()
        {
            var renderer = new TestableBocReferenceValueRenderer(
                _resourceUrlFactoryStub,
                GlobalizationService,
                RenderingFeatures.Default,
                () => new StubDropDownList());

            Control.Stub(stub => stub.HasValueEmbeddedInsideOptionsMenu).Return(true);
            Control.Stub(stub => stub.HasOptionsMenu).Return(true);

            Html.Writer.AddAttribute(HtmlTextWriterAttribute.Class, "body");
            Html.Writer.RenderBeginTag(HtmlTextWriterTag.Span);
            renderer.RenderOptionsMenuTitle(CreateRenderingContext());
            Html.Writer.RenderEndTag();

            var document = Html.GetResultDocument();

            AssertControl(document, OptionMenuConfiguration.EmbeddedOptionsMenu);
        }