public void RenderOnlyTableBlock() { List.Stub(mock => mock.HasMenuBlock).Return(false); var renderer = new BocListRenderer( new FakeResourceUrlFactory(), GlobalizationService, RenderingFeatures.Default, _bocListCssClassDefinition, new StubRenderer("table"), new StubRenderer("navigation"), new StubRenderer("menu")); renderer.Render(new BocListRenderingContext(HttpContext, Html.Writer, List, new BocColumnRenderer[0])); var document = Html.GetResultDocument(); var div = Html.GetAssertedChildElement(document, "div", 0); Html.AssertAttribute(div, "id", "MyList"); var tableBlock = Html.GetAssertedChildElement(div, "div", 0); Html.AssertAttribute(tableBlock, "class", "bocListTableBlock"); Html.AssertChildElementCount(tableBlock, 1); Html.GetAssertedChildElement(tableBlock, "table", 0); }
public void RenderDiagnosticMetadataAttributes() { var renderer = new BocListRenderer( new FakeResourceUrlFactory(), GlobalizationService, RenderingFeatures.WithDiagnosticMetadata, _bocListCssClassDefinition, new StubRenderer("table"), new StubRenderer("navigation"), new StubRenderer("menu")); renderer.Render(new BocListRenderingContext(HttpContext, Html.Writer, List, new BocColumnRenderer[0])); var document = Html.GetResultDocument(); var div = Html.GetAssertedChildElement(document, "div", 0); Html.AssertAttribute(div, DiagnosticMetadataAttributes.ControlType, "BocList"); }
public void RenderWithMenuBlock() { List.Stub(mock => mock.HasMenuBlock).Return(true); List.Stub(mock => mock.MenuBlockWidth).Return(s_menuBlockWidth); List.Stub(mock => mock.MenuBlockOffset).Return(s_menuBlockOffset); var renderer = new BocListRenderer( new FakeResourceUrlFactory(), GlobalizationService, RenderingFeatures.Default, _bocListCssClassDefinition, new StubRenderer("table"), new StubRenderer("navigation"), new StubRenderer("menu")); renderer.Render(new BocListRenderingContext(HttpContext, Html.Writer, List, new BocColumnRenderer[0])); var document = Html.GetResultDocument(); var div = Html.GetAssertedChildElement(document, "div", 0); Html.AssertAttribute(div, "id", "MyList"); var menuBlock = Html.GetAssertedChildElement(div, "div", 0); Html.AssertAttribute(menuBlock, "class", _bocListCssClassDefinition.MenuBlock); Html.AssertStyleAttribute(menuBlock, "width", s_menuBlockWidth.ToString()); var menuBlockContent = Html.GetAssertedChildElement(menuBlock, "div", 0); Html.AssertStyleAttribute(menuBlockContent, "margin-left", s_menuBlockOffset.ToString()); Html.GetAssertedChildElement(menuBlockContent, "menu", 0); var tableBlock = Html.GetAssertedChildElement(div, "div", 1); Html.AssertAttribute(tableBlock, "class", "bocListTableBlock hasMenuBlock"); Html.AssertStyleAttribute(tableBlock, "right", s_menuBlockWidth.ToString()); Html.GetAssertedChildElement(tableBlock, "table", 0); }