Ejemplo n.º 1
0
        public UnitTester()
        {
            var nameHeader = CreateHeaderCell("Name");
            var passedHeader = CreateHeaderCell("Passed");
            var failedHeader = CreateHeaderCell("Failed");
            var erroredHeader = CreateHeaderCell("Errored");

            header = Browser.Document.CreateElement("tr");
            header.AppendChild(nameHeader);
            header.AppendChild(passedHeader);
            header.AppendChild(failedHeader);
            header.AppendChild(erroredHeader);

            table = Browser.Document.CreateElement("table");
            table.Style.Width = "100%";
            table.AppendChild(header);

            Browser.Document.Body.AppendChild(table);
        }
Ejemplo n.º 2
0
        protected override Element CreateNode()
        {
            var table = CreateElement("table");

            var row = CreateElement("tr");
            cell = CreateElement("td");
            cell.Style.VerticalAlign = "middle";
            cell.Style.Position = "relative";
            cell.Style.ZIndex = "-1";
            container = CreateElement("div");

            cell.AppendChild(container);
            row.AppendChild(cell);
            table.AppendChild(row);

            return table;
        }
Ejemplo n.º 3
0
        private Element GetTopCell()
        {
            if (topCell == null)
            {
                topCell = Browser.Document.CreateElement("td");
                topCell.SetAttribute("colspan", "3");
                GetTopRow().AppendChild(topCell);

                topCellContent = Browser.Document.CreateElement("div");
                topCellContent.Style.Width = "100%";
                topCellContent.Style.Height = "100%";
                topCell.AppendChild(topCellContent);

                if (Spacing != 0 && (middleRow != null || bottomRow != null))
                {
                    topCellContent.Style.PaddingBottom = Spacing + "px";
                }
            }

            return topCellContent;
        }
Ejemplo n.º 4
0
        private Element GetRightCell()
        {
            if (rightCell == null)
            {
                rightCell = Browser.Document.CreateElement("td");
                rightCell.Style.Height = "100%";
                AdjustColSpan();
                GetMiddleRow().AppendChild(rightCell);

                rightCellContent = Browser.Document.CreateElement("div");
                rightCellContent.Style.Width = "100%";
                rightCellContent.Style.Height = "100%";
                rightCell.AppendChild(rightCellContent);

                if (Spacing != 0 && middleRow != null)
                {
                    rightCellContent.Style.PaddingLeft = Spacing + "px";
                }
            }
            return rightCellContent;
        }
Ejemplo n.º 5
0
        private Element GetCenterCell()
        {
            if (centerCell == null)
            {
                centerCell = Browser.Document.CreateElement("td");
                centerCell.Style.Height = "100%";
                centerCell.Style.Width = "100%";
                AdjustColSpan();
                if (leftCell != null)
                    centerCell.InsertAfter(leftCell);
                else
                    GetMiddleRow().Prepend(centerCell);

                centerCellContent = Browser.Document.CreateElement("div");
                centerCellContent.Style.Width = "100%";
                centerCellContent.Style.Height = "100%";
                centerCell.AppendChild(centerCellContent);
            }
            return centerCellContent;
        }
Ejemplo n.º 6
0
        private Element GetLeftCell()
        {
            if (leftCell == null)
            {
                leftCell = Browser.Document.CreateElement("td");
                leftCell.Style.Height = "100%";
                AdjustColSpan();
                GetMiddleRow().Prepend(leftCell);

                leftCellContent = Browser.Document.CreateElement("div");
                leftCellContent.Style.Width = "100%";
                leftCellContent.Style.Height = "100%";
                leftCell.AppendChild(leftCellContent);

                if (Spacing != 0 && (centerCell != null || rightCell != null))
                {
                    leftCellContent.Style.PaddingLeft = Spacing + "px";
                }
            }
            return leftCellContent;
        }
Ejemplo n.º 7
0
        protected override Element CreateNode()
        {
            table = Browser.Document.CreateElement("table");

            var totalNumberOfWeights = columnWidths.Where(x => x.Style == TableWidthStyle.Weight).Sum(x => x.Value);
            var totalPercent = columnWidths.Where(x => x.Style == TableWidthStyle.Percent).Sum(x => x.Value);
            var percentAvailableToWeights = 100 - totalPercent;
            if (percentAvailableToWeights < 0)
                throw new InvalidOperationException("Total amount of percent specified is greater than 100");

            var percentToEachWeight = percentAvailableToWeights / totalNumberOfWeights;
            var extraPercent = percentAvailableToWeights - percentToEachWeight*totalNumberOfWeights;

            // Define columns
            var colgroup = Browser.Document.CreateElement("colgroup");
            foreach (var width in columnWidths)
            {
                var col = Browser.Document.CreateElement("col");
                switch (width.Style)
                {
                    case TableWidthStyle.Pixels:
                        col.Style.Width = width.Value + "px";
                        break;
                    case TableWidthStyle.Weight:
                        var currentWeight = percentToEachWeight * width.Value;
                        currentWeight += extraPercent;
                        extraPercent = 0;
                        col.Style.Width = currentWeight + "%";
                        break;
                    case TableWidthStyle.Percent:
                        col.Style.Width = width.Value + "%";
                        break;
                }
                colgroup.AppendChild(col);
            }
            table.AppendChild(colgroup);

            return table;
        }