public void RenderBasicCell() { var renderer = new BocSimpleColumnQuirksModeRenderer(new FakeResourceUrlFactory(), _bocListQuirksModeCssClassDefinition); renderer.RenderDataCell(_renderingContext, 0, false, EventArgs); var document = Html.GetResultDocument(); var td = Html.GetAssertedChildElement(document, "td", 0); Html.AssertAttribute(td, "class", _bocListQuirksModeCssClassDefinition.DataCellOdd); var span = Html.GetAssertedChildElement(td, "span", 0); Html.AssertAttribute(span, "class", _bocListQuirksModeCssClassDefinition.Content); var textWrapper = Html.GetAssertedChildElement(span, "span", 0); Html.AssertTextNode(textWrapper, "referencedObject1", 0); }
public void RenderEditModeControl() { var firstObject = (IBusinessObject)((TypeWithReference)BusinessObject).FirstValue; IEditableRow editableRow = MockRepository.GenerateMock <IEditableRow>(); editableRow.Stub(mock => mock.HasEditControl(0)).IgnoreArguments().Return(true); editableRow.Stub(mock => mock.GetEditControl(0)).IgnoreArguments().Return(MockRepository.GenerateStub <IBocTextValue>()); editableRow.Expect( mock => mock.RenderSimpleColumnCellEditModeControl( Html.Writer, Column, firstObject, 0)); List.EditModeController.Stub(mock => mock.GetEditableRow(EventArgs.ListIndex)).Return(editableRow); var renderer = new BocSimpleColumnQuirksModeRenderer(new FakeResourceUrlFactory(), _bocListQuirksModeCssClassDefinition); renderer.RenderDataCell(_renderingContext, 0, false, EventArgs); var document = Html.GetResultDocument(); var td = Html.GetAssertedChildElement(document, "td", 0); Html.AssertAttribute(td, "class", _bocListQuirksModeCssClassDefinition.DataCellOdd); var span = Html.GetAssertedChildElement(td, "span", 0); Html.AssertAttribute(span, "class", _bocListQuirksModeCssClassDefinition.Content); var clickSpan = Html.GetAssertedChildElement(span, "span", 0); Html.AssertAttribute(clickSpan, "onclick", "BocList_OnCommandClick();"); editableRow.AssertWasCalled( mock => mock.RenderSimpleColumnCellEditModeControl( Html.Writer, Column, firstObject, 0)); }
public void RenderIconCell() { var renderer = new BocSimpleColumnQuirksModeRenderer(new FakeResourceUrlFactory(), _bocListQuirksModeCssClassDefinition); renderer.RenderDataCell(_renderingContext, 0, true, EventArgs); var document = Html.GetResultDocument(); var td = Html.GetAssertedChildElement(document, "td", 0); Html.AssertAttribute(td, "class", _bocListQuirksModeCssClassDefinition.DataCellOdd); var span = Html.GetAssertedChildElement(td, "span", 0); Html.AssertAttribute(span, "class", _bocListQuirksModeCssClassDefinition.Content); Html.AssertIcon(span, EventArgs.BusinessObject, null); Html.AssertTextNode(span, HtmlHelper.WhiteSpace, 1); var textWrapper = Html.GetAssertedChildElement(span, "span", 2); Html.AssertTextNode(textWrapper, BusinessObject.GetPropertyString("FirstValue"), 0); }
public void RenderCommandCell() { Column.Command = new BocListItemCommand(CommandType.Href); Column.Command.HrefCommand.Href = "url"; var renderer = new BocSimpleColumnQuirksModeRenderer(new FakeResourceUrlFactory(), _bocListQuirksModeCssClassDefinition); renderer.RenderDataCell(_renderingContext, 5, false, EventArgs); var document = Html.GetResultDocument(); var td = Html.GetAssertedChildElement(document, "td", 0); Html.AssertAttribute(td, "class", _bocListQuirksModeCssClassDefinition.DataCellOdd); var a = Html.GetAssertedChildElement(td, "a", 0); Html.AssertAttribute(a, "id", List.ClientID + "_Column_0_Command_Row_10"); Html.AssertAttribute(a, "href", "url"); Html.AssertAttribute(a, "onclick", "BocList_OnCommandClick();"); var span = Html.GetAssertedChildElement(a, "span", 0); Html.AssertTextNode(span, "referencedObject1", 0); }