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); }
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); }
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); }