AddStyleClass() public method

Applies a css class to the following element
public AddStyleClass ( string style ) : Element
style string The name of the style to apply
return Element
コード例 #1
0
        public void FailureReportedEventHandler(object sender, global::Concordion.Internal.Commands.FailureReportedEventArgs e)
        {
            Element element = e.Element;
            element.AddStyleClass("failure");

            Element spanExpected = new Element("del");
            spanExpected.AddStyleClass("expected");
            element.MoveChildrenTo(spanExpected);
            element.AppendChild(spanExpected);
            spanExpected.AppendNonBreakingSpaceIfBlank();

            Element spanActual = new Element("ins");
            spanActual.AddStyleClass("actual");
            if (e.Actual != null)
            {
                spanActual.AppendText(e.Actual.ToString());
            }
            else
            {
                spanActual.AppendText("(null)");
            }
            spanActual.AppendNonBreakingSpaceIfBlank();

            element.AppendText("\n");
            element.AppendChild(spanActual);
        }
コード例 #2
0
        private void AddFooterToDocument(Element rootElement, Resource resource, long timeTaken)
        {
            Element body = rootElement.GetFirstChildElement("body");

            if (body != null)
            {

                Element footer = new Element("div");
                footer.AddStyleClass("footer");
                footer.AppendText("Results generated by ");

                Element link = new Element("a");
                link.AddAttribute("href", CONCORDION_WEBSITE_URL);
                footer.AppendChild(link);

                Element img = new Element("img");
                img.AddAttribute("src", resource.GetRelativePath(TARGET_LOGO_RESOURCE));
                img.AddAttribute("alt", "Concordion");
                img.AddAttribute("border", "0");
                link.AppendChild(img);

                Element dateDiv = new Element("div");
                dateDiv.AddStyleClass("testTime");
                dateDiv.AppendText("in " + (timeTaken + 1) + " ms ");
                dateDiv.AppendText(DateTime.Now.ToString());
                footer.AppendChild(dateDiv);

                body.AppendChild(footer);
            }
        }
コード例 #3
0
        public void FailureReported(AssertFailureEvent failureEvent)
        {
            var element = failureEvent.Element;
            element.AddStyleClass("failure");

            var spanExpected = new Element("del");
            spanExpected.AddStyleClass("expected");
            element.MoveChildrenTo(spanExpected);
            element.AppendChild(spanExpected);
            spanExpected.AppendNonBreakingSpaceIfBlank();

            var spanActual = new Element("ins");
            spanActual.AddStyleClass("actual");
            spanActual.AppendText(failureEvent.Actual != null ? failureEvent.Actual.ToString() : "(null)");
            spanActual.AppendNonBreakingSpaceIfBlank();

            element.AppendText("\n");
            element.AppendChild(spanActual);
        }
コード例 #4
0
        private void AddFooterToDocument(Element rootElement, Resource resource, long timeTaken)
        {
            Element body = rootElement.GetFirstChildElement("body");

            if (body != null)
            {

                Element footer = new Element("div");
                footer.AddStyleClass("footer");
                footer.AppendText("Powered by ");

                Element link = new Element("a");
                link.AddAttribute("href", CONCORDION_WEBSITE_URL);
                footer.AppendChild(link);

                Element img = new Element("img");
                img.AddAttribute("src", resource.GetRelativePath(TARGET_LOGO_RESOURCE));
                img.AddAttribute("alt", "Concordion");
                img.AddAttribute("border", "0");
                link.AppendChild(img);

                body.AppendChild(footer);
            }
        }