private XmlNode GetAssertedContainerSpan(bool withStyle) { var renderer = new TestableBocAutoCompleteReferenceValueRenderer( _resourceUrlFactory, GlobalizationService, RenderingFeatures.Default, () => TextBox); renderer.Render(CreateRenderingContext()); var document = Html.GetResultDocument(); var containerDiv = document.GetAssertedChildElement("span", 0); containerDiv.AssertAttributeValueEquals("id", "MyReferenceValue"); containerDiv.AssertAttributeValueContains("class", "bocAutoCompleteReferenceValue"); if (Control.IsReadOnly) { containerDiv.AssertAttributeValueContains("class", "readOnly"); } if (!Control.Enabled) { containerDiv.AssertAttributeValueContains("class", "disabled"); } // containerDiv.AssertChildElementCount (1); if (withStyle) { containerDiv.AssertStyleAttribute("width", s_width.ToString()); containerDiv.AssertStyleAttribute("height", s_height.ToString()); } return(containerDiv); }
public void RenderDiagnosticMetadataAttributes() { var renderer = new TestableBocAutoCompleteReferenceValueRenderer( _resourceUrlFactory, GlobalizationService, RenderingFeatures.WithDiagnosticMetadata, () => TextBox); TextBox.AutoPostBack = false; Control.Stub(stub => stub.Enabled).Return(true); SetUpClientScriptExpectations(); SetValue(); Control.Stub(stub => stub.TextBoxStyle).Return(new SingleRowTextBoxStyle()); Control.TextBoxStyle.AutoPostBack = true; Html.Writer.AddAttribute(HtmlTextWriterAttribute.Class, "body"); Html.Writer.RenderBeginTag(HtmlTextWriterTag.Span); renderer.Render(CreateRenderingContext()); Html.Writer.RenderEndTag(); var document = Html.GetResultDocument(); var control = document.DocumentElement.GetAssertedChildElement("span", 0); control.AssertAttributeValueEquals(DiagnosticMetadataAttributes.ControlType, "BocAutoCompleteReferenceValue"); control.AssertAttributeValueEquals(DiagnosticMetadataAttributes.TriggersPostBack, "true"); }