Пример #1
0
        public void TestDiagnosticMetadataRenderingInTitleCell()
        {
            List.Stub(mock => mock.Index).Return(RowIndex.InitialOrder);
            List.Stub(mock => mock.IndexColumnTitle).Return("My_IndexColumn");

            IBocIndexColumnRenderer renderer = new BocIndexColumnRenderer(RenderingFeatures.WithDiagnosticMetadata, _bocListCssClassDefinition);

            renderer.RenderTitleCell(new BocListRenderingContext(HttpContext, Html.Writer, List, new BocColumnRenderer[0]));

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

            Html.AssertAttribute(th, DiagnosticMetadataAttributes.Content, "My_IndexColumn");
            Html.AssertAttribute(th, DiagnosticMetadataAttributesForObjectBinding.BocListCellIndex, 1.ToString());
        }
Пример #2
0
        public void RenderIndexTitleCell()
        {
            List.Stub(mock => mock.Index).Return(RowIndex.InitialOrder);

            IBocIndexColumnRenderer renderer = new BocIndexColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition);

            renderer.RenderTitleCell(new BocListRenderingContext(HttpContext, Html.Writer, List, new BocColumnRenderer[0]));

            var document = Html.GetResultDocument();

            var th = Html.GetAssertedChildElement(document, "th", 0);

            Html.AssertAttribute(th, "class", _bocListCssClassDefinition.TitleCell, HtmlHelperBase.AttributeValueCompareMode.Contains);
            Html.AssertAttribute(th, "class", _bocListCssClassDefinition.TitleCellIndex, HtmlHelperBase.AttributeValueCompareMode.Contains);

            var span = Html.GetAssertedChildElement(th, "span", 0);

            Html.AssertTextNode(span, "No.", 0);
        }
Пример #3
0
        private void RenderIndexDataCell(int indexOffset)
        {
            IBocIndexColumnRenderer renderer          = new BocIndexColumnRenderer(RenderingFeatures.WithDiagnosticMetadata, _bocListCssClassDefinition);
            const string            cssClassTableCell = "bocListTableCell";

            renderer.RenderDataCell(new BocListRenderingContext(HttpContext, Html.Writer, List, new BocColumnRenderer[0]), 0, 0, cssClassTableCell);

            var document = Html.GetResultDocument();

            var td = Html.GetAssertedChildElement(document, "td", 0);

            Html.AssertAttribute(td, "class", cssClassTableCell, HtmlHelperBase.AttributeValueCompareMode.Contains);
            Html.AssertAttribute(td, "class", _bocListCssClassDefinition.DataCellIndex, HtmlHelperBase.AttributeValueCompareMode.Contains);
            Html.AssertAttribute(td, DiagnosticMetadataAttributesForObjectBinding.BocListCellIndex, 1.ToString());

            var label = Html.GetAssertedChildElement(td, "label", 0);

            Html.AssertAttribute(label, "class", _bocListCssClassDefinition.Content);
            Html.AssertAttribute(label, "for", "SelectRowControl_UnqiueID_0");

            Html.AssertTextNode(label, (1 + indexOffset).ToString(), 0);
        }