Ejemplo n.º 1
0
        public void RenderDataCellForMultiSelect()
        {
            var row = new BocListRow(1, BusinessObject);

            List.Stub(mock => mock.Selection).Return(RowSelection.Multiple);
            List.Stub(mock => mock.GetSelectorControlValue(row)).Return("row1");
            IBocSelectorColumnRenderer renderer = new BocSelectorColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition);

            renderer.RenderDataCell(
                _bocListRenderingContext,
                new BocListRowRenderingContext(row, 0, false),
                "bocListTableCell");

            var document = Html.GetResultDocument();

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

            Html.AssertAttribute(td, "class", "bocListTableCell");

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

            Html.AssertAttribute(input, "type", "checkbox");
            Html.AssertAttribute(input, "id", "SelectRowControl_UnqiueID_1");
            Html.AssertAttribute(input, "name", "SelectRowControl$UnqiueID");
            Html.AssertAttribute(input, "value", "row1");
            Html.AssertAttribute(input, "alt", "Select this row");
        }
Ejemplo n.º 2
0
        public void RenderTitleCellForSingleSelect()
        {
            List.Stub(mock => mock.Selection).Return(RowSelection.SingleRadioButton);
            IBocSelectorColumnRenderer renderer = new BocSelectorColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition);

            renderer.RenderTitleCell(_bocListRenderingContext);

            var document = Html.GetResultDocument();

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

            Html.AssertAttribute(th, "class", _bocListCssClassDefinition.TitleCell);

            Html.AssertTextNode(th, HtmlHelper.WhiteSpace, 0);
        }
Ejemplo n.º 3
0
        public void TestDiagnosticMetadataRenderingInTitleCell()
        {
            List.Stub(mock => mock.Selection).Return(RowSelection.Multiple);
            IBocSelectorColumnRenderer renderer = new BocSelectorColumnRenderer(RenderingFeatures.WithDiagnosticMetadata, _bocListCssClassDefinition);

            renderer.RenderTitleCell(_bocListRenderingContext);

            var document = Html.GetResultDocument();

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

            Html.AssertAttribute(th, DiagnosticMetadataAttributesForObjectBinding.BocListCellIndex, 1.ToString());

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

            Html.AssertAttribute(input, DiagnosticMetadataAttributesForObjectBinding.BocListWellKnownSelectAllControl, "true");
        }
Ejemplo n.º 4
0
        public void TestDiagnosticMetadataRenderingInDataCell()
        {
            var row = new BocListRow(1, BusinessObject);

            List.Stub(mock => mock.Selection).Return(RowSelection.SingleRadioButton);
            List.Stub(mock => mock.GetSelectorControlValue(row)).Return("row1");
            IBocSelectorColumnRenderer renderer = new BocSelectorColumnRenderer(RenderingFeatures.WithDiagnosticMetadata, _bocListCssClassDefinition);

            renderer.RenderDataCell(
                _bocListRenderingContext,
                new BocListRowRenderingContext(row, 0, false),
                "bocListTableCell");
            var document = Html.GetResultDocument();

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

            Html.AssertAttribute(td, DiagnosticMetadataAttributesForObjectBinding.BocListCellIndex, 1.ToString());
        }
Ejemplo n.º 5
0
        public void RenderTitleCellForMultiSelect()
        {
            List.Stub(mock => mock.Selection).Return(RowSelection.Multiple);
            IBocSelectorColumnRenderer renderer = new BocSelectorColumnRenderer(RenderingFeatures.Default, _bocListCssClassDefinition);

            renderer.RenderTitleCell(_bocListRenderingContext);

            var document = Html.GetResultDocument();

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

            Html.AssertAttribute(th, "class", _bocListCssClassDefinition.TitleCell);

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

            Html.AssertAttribute(input, "type", "checkbox");
            Html.AssertAttribute(input, "name", List.GetSelectAllControlName());
            Html.AssertNoAttribute(input, "value");
            Html.AssertAttribute(input, "alt", "Select all rows");
        }