Exemplo n.º 1
0
        public HtmlDocument Index()
        {
            _document.Title = "Storyteller 3";

            writeInitialDataIntoPage(_document);

            _document.Add("div").Id("header-container");
            _document.Add("div").Id("body-pane").AddClass("container");
            _document.Add("div").Id("main");

            if (File.Exists(_files.RootPath.AppendPath("public", "stylesheets", "storyteller.css")))
            {
                var stylesheets = new[] { "bootstrap.min.css", "storyteller.css", "font-awesome.min.css" };
                var tags        = stylesheets.Select(file =>
                {
                    var path = $"/public/stylesheets/{file}";
                    return(new HtmlTag("link").Attr("rel", "stylesheet").Attr("href", path));
                });

                _document.Head.Append(tags);
            }
            else
            {
                BatchResultsWriter.WriteCSS(_document);
                _document.Head.Add("link")
                .Attr("rel", "stylesheet")
                .Attr("href", "//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css");
            }

            var scriptTag = new HtmlTag("script").Attr("type", "text/javascript").Attr("src", "/bundle.js");

            _document.Body.Append(scriptTag);

            return(_document);
        }
Exemplo n.º 2
0
        public HtmlDocument get_samples()
        {
            var document = new HtmlDocument {
                Title = "All Samples"
            };



            _cache.All().GroupBy(x => x.File).Each(group =>
            {
                var path = group.Key.PathRelativeTo(_settings.Root);
                document.Add("h3").Text(path);

                foreach (Sample sample in group)
                {
                    document.Add("h5").Text("{0} ({1})".ToFormat(sample.Name, sample.Language));
                    document.Add(new SampleTag(sample));
                }

                document.Add("hr");
            });


            return(document);
        }
        protected override void ConfigureDocument(HtmlDocument document)
        {
            document.Add(new HtmlTag("input", tag =>
            {
                tag.Value(TheText);
                tag.Id(TextboxId);
            }));

            document.Add(new SelectTag(tag =>
            {
                tag.Id(SelectId);
            }));

            document.Add(new HtmlTag("input", tag =>
            {
                tag.Value("Submit button");
                tag.Id(SubmitId);
                tag.Attr("type", "submit");
            }));

            document.Add(new HtmlTag("input", tag =>
            {
                tag.Value(TheText);
                tag.Id(PasswordTextboxId);
                tag.Attr("type", "password");
            }));
        }
Exemplo n.º 4
0
        public string Generate(Topic topic)
        {
            if (topic.IsSplashPage())
            {
                return(_transformer.Transform(topic, new FileSystem().ReadStringFromFile(topic.File)));
            }

            try
            {
                return(generate(topic));
            }
            catch (Exception e)
            {
                ConsoleWriter.Write(ConsoleColor.Yellow, "Failed to transform topic at " + topic.File);
                ConsoleWriter.Write(ConsoleColor.Red, e.ToString());

                var document = new HtmlDocument
                {
                    Title = "Error!"
                };

                document.Add("h1").Text("Error!");

                document.Add("pre").Text(e.ToString());


                return(document.ToString());
            }
        }
Exemplo n.º 5
0
        protected override void ConfigureDocument(HtmlDocument document)
        {
            document.Add("h1").AddClass("root-marker").Text(RootText);

            document.Add(BuildTestDiv(new Stack <int>(new[] { 0 }), 0));

            document.ReferenceJavaScriptFile("file:///" + "jquery-2.0.3.min.js".ToFullPath());
        }
Exemplo n.º 6
0
        protected override void ConfigureDocument(HtmlDocument document)
        {
            document.Add("input").Attr("type", "text").Name("Direction");
            document.Add("input").Attr("type", "text").Name("Blank")
            .Attr("onclick", "document.getElementById('clickTarget').innerHTML = 'clicked'");

            document.Add("div").Id("clickTarget");
            document.Add("button").Id("happyPath").Text("Hey there!").Attr("onclick", "document.getElementById('clickTarget').innerHTML = 'clicked'");
        }
Exemplo n.º 7
0
        protected override void ConfigureDocument(HtmlDocument doc)
        {
            doc.Add("div").Id("clickTarget");
            doc.Add("button").Id("happyPath").Text("Hey there!").Attr("onclick", "document.getElementById('clickTarget').innerHTML = 'clicked'");

            doc.Add("button").Id("disabled").Text("disabled").Attr("disabled", true);

            doc.Add("button").Id("hidden").Text("hidden").Style("display", "none");
        }
Exemplo n.º 8
0
        private static void Main()
        {
            var document = new HtmlDocument();

            document.Add(new HeadingNode());
            document.Add(new AnchorNode());

            document.Execute(new HighlightOperation());
            document.Execute(new PlainTextOperation());
        }
Exemplo n.º 9
0
        public HtmlDocument Index()
        {
            var doc = new HtmlDocument {
                Title = "Asp.Net HttpContext"
            };

            doc.Add("h1")
            .Text(
                "The list below is the result of requesting an HttpContext lifecycled object from the container 5 times.  You should see the same Guid all 5 times.  If you refresh, you should see a different Guid");


            doc.Push("ul");
            doc.Add("li").Text(_container.GetInstance <HttpContextTracked>().Name.ToString());
            doc.Add("li").Text(_container.GetInstance <HttpContextTracked>().Name.ToString());
            doc.Add("li").Text(_container.GetInstance <HttpContextTracked>().Name.ToString());
            doc.Add("li").Text(_container.GetInstance <HttpContextTracked>().Name.ToString());
            doc.Add("li").Text(_container.GetInstance <HttpContextTracked>().Name.ToString());


            doc.Pop();


            doc.Add("hr");
            doc.Add("p").Text("The following is a list of previously disposed HttpContextTraced objects");
            doc.Push("ul");

            DisposeTracker.DisposedThings.Each(x => doc.Add("li").Text(x.Name.ToString()));


            return(doc);
        }
Exemplo n.º 10
0
        public void SetUp()
        {
            var document = new HtmlDocument();

            document.Add(new SelectTag(tag =>
            {
                tag.Option("a", "a");
                tag.Option("b", "2").Id("b");
                tag.Option("c", 3).Id("c");

                tag.SelectByValue("2");
            }).Name("select1").Id("select1"));

            document.Add(new SelectTag(tag =>
            {
                tag.Option("a", "a");
                tag.Option("b", 2).Id("b");
                tag.Option("c", 3).Id("c");
            }).Name("select2").Id("select2"));

            document.Add(new SelectTag(tag =>
            {
                tag.Add("option").Text("a");
                tag.Add("option").Text("b").Attr("selected", "selected");
                tag.Add("option").Text("c");
            }).Name("select3").Id("select3"));

            document.Add(new SelectTag(tag =>
            {
                tag.Option("a", "a");
                tag.Option("b", 2).Id("b");
                tag.Option("c", 3).Id("c");
                tag.Option("value", "b").Id("c");

                tag.SelectByValue(2);
            }).Name("select4").Id("select4"));

            document.WriteToFile("select.htm");

            try
            {
                startDriver();
            }
            catch (Exception)
            {
                Thread.Sleep(2000);
                startDriver();
            }

            select1 = theDriver.FindElement(By.Id("select1"));
            nothingSelectedElement = theDriver.FindElement(By.Id("select2"));
            select3 = theDriver.FindElement(By.Id("select3"));
            select4 = theDriver.FindElement(By.Id("select4"));
        }
Exemplo n.º 11
0
        private static void ExecuteVisitor()
        {
            var htmlDocument = new HtmlDocument();

            htmlDocument.Add(new AnchorNode());
            htmlDocument.Add(new HeadingNode());
            //var highlightOperation = new HighlighOperation();
            var textOperation = new PlainTextOperation();

            htmlDocument.Execute(textOperation);
        }
        public HtmlDocument get_reloaded()
        {
            var document = new HtmlDocument();

            document.Title = "Manual Test Harness for reloading";
            document.Add("h1").Text("Loaded at " + _reloaded.Timestamp);

            document.Add(new AutoReloadingTag());

            return(document);
        }
Exemplo n.º 13
0
        private void writeFailedFixture(HtmlDocument document, FixtureGraph fixture)
        {
            document.Add("h3").Text("Fixture:  " + fixture.Name);

            fixture.Errors.Each(e =>
            {
                document.Add("div").Append(new ExceptionTag(e.ErrorText));
            });

            document.Add("hr");
        }
Exemplo n.º 14
0
        public HtmlDocument Index()
        {
            var document = new HtmlDocument();

            document.Title = "Serenity/Storyteller Harness";
            document.Add("h1").Text("Serenity/Storyteller Harness");

            document.Add("input").Attr("name", "foo").Id("foo").Attr("value", "bar");

            return(document);
        }
Exemplo n.º 15
0
        public HtmlDocument get_login(LoginRequest request)
        {
            var document = new HtmlDocument();

            document.Title = "Login Page";

            document.Add("h1").Text("This is the login page");

            document.Add("div").Id("message").Text(request.Message);

            return(document);
        }
Exemplo n.º 16
0
 protected override void ConfigureDocument(HtmlDocument document)
 {
     document.Add(new CheckboxTag(true).Id(CheckedAttr));
     document.Add(new CheckboxTag(false).Id(NotChecked));
     document.Add(new CheckboxTag(false).Attr(Disabled, Disabled).Id(Disabled));
     document.Add(new CheckboxTag(true).Id(Enabled));
     document.Add(new CheckboxTag(false).Id(Target1));
     document.Add(new CheckboxTag(false).Id(Target2));
     document.Add(new CheckboxTag(true).Id(Target3));
     document.Add(new CheckboxTag(false).Id(Target4));
     document.Add(new DivTag(Div1));
     document.Add(new TextboxTag().Id(Text1));
 }
Exemplo n.º 17
0
        public HtmlDocument ShowView(ViewInput input)
        {
            var document = new HtmlDocument();

            document.Title = input.Name;

            document.Push("p");
            document.Add("span").Text("The input was '");
            document.Add("span").Id("name").Text(input.Name);
            document.Add("span").Text("'");

            return(document);
        }
Exemplo n.º 18
0
        public static void Behavioral_Visitor()
        {
            var document = new HtmlDocument();

            document.Add(new HeadingNode());
            document.Add(new AnchorNode());

            document.Execute(new HighlightOperation()); // Highlight operation

            document.Execute(new PlainTextOperation()); // Plain text Operation

            // If we need to add a new operation just create a new class that implements IOperation interface
        }
Exemplo n.º 19
0
        public HtmlDocument get_failure_page(SamlResponse response)
        {
            var document = new HtmlDocument();

            document.Title = "Failure Page";

            document.Add("h1").Text("This is the failure page");

            document.Push("ul");

            response.Errors.Each(x => document.Add("li").Text(x.Message));

            return(document);
        }
Exemplo n.º 20
0
        private void measure_and_report()
        {
            create_timings(1000);
            create_timings(10000);
            create_timings(100000);
            //create_timings(1000000);

            var document = new HtmlDocument();
            document.Add("h1").Text("Marten Where Timings");

            document.Add(reportForSerializer(typeof (JsonNetSerializer)));
            document.Add(reportForSerializer(typeof (TestsSerializer)));

            document.OpenInBrowser();
        }
Exemplo n.º 21
0
        protected override void configureDocument(HtmlDocument document)
        {
            document.Add(new TextboxTag("emptytextbox", string.Empty));
            document.Add(new TextboxTag("textbox", "initial"));

            document.Add(new TextboxTag("disabled", "something").Attr("disabled", true));
            document.Add(new TextboxTag("hidden", "something").Style("display", "none"));

            document.Add(new SelectTag(tag =>
            {
                tag.Option("a", "a");
                tag.Option("b", 2).Id("b");
                tag.Option("c", 3).Id("c");
            }).Name("select1"));
        }
Exemplo n.º 22
0
        private void addTemplates(HtmlDocument document, FixtureLibrary library)
        {
            var     writer    = new GrammarWriter(library);
            HtmlTag templates = writer.Build();

            document.Add(templates);
        }
Exemplo n.º 23
0
        protected override void configureDocument(HtmlDocument document)
        {
            document.Add(new TextboxTag("emptytextbox", string.Empty).Id("emptytextbox"));
            document.Add(new TextboxTag("textbox", "initial").Id("textbox"));

            document.Add(new SelectTag(tag =>
            {
                tag.Option("a", "a");
                tag.Option("b", 2).Id("b");
                tag.Option("c", 3).Id("c");

                tag.SelectByValue("2");
            }).Name("select1").Id("select1"));

            document.Add("div").Id("div1").Text("the div text");
        }
Exemplo n.º 24
0
        public virtual HtmlDocument BuildView(IUrlRegistry urls, IOutputWriter writer, LoginRequest request)
        {
            // TODO -- Revisit all of this when we get HTML conventions everywhere
            var view = new HtmlDocument();
            var form = new FormTag(urls.UrlFor <LoginRequest>("POST"));

            form.Append(new HtmlTag("legend").Text(LoginKeys.Login));

            if (request.Message.IsNotEmpty())
            {
                form.Append(new HtmlTag("p").Text(request.Message).Style("color", "red"));
            }

            form.Append(new TextboxTag("UserName", request.UserName));
            form.Append(new TextboxTag("Password", request.Password));
            form.Append(new CheckboxTag(request.RememberMe).Name("RememberMe"));


            form.Append(new DivTag().Text(request.Message).Id("login-message"));



            form.Append(new HiddenTag().Name("Url").Attr("value", request.Url));

            form.Append(new HtmlTag("input").Attr("type", "submit").Attr("value", LoginKeys.Login).Id("login-submit"));

            view.Add(form);

            return(view);
        }
Exemplo n.º 25
0
        public static HtmlDocument BuildDocument(IUrlRegistry urls, string title, params HtmlTag[] tags)
        {
            string css = GetDiagnosticCss();

            var realTitle = "FubuMVC: " + title;

            var document = new HtmlDocument();

            document.Title = realTitle;

            var mainDiv = new HtmlTag("div").AddClass("main");

            mainDiv.Add("h2").Text("FubuMVC Diagnostics").Append(buildVersionTag());
            var navBar = mainDiv.Add("div").AddClass("homelink");

            if (urls != null)
            {
                navBar.Append(new LinkTag("Home", urls.UrlFor <BehaviorGraphWriter>(w => w.Index(), null)));
            }
            navBar.Add("span").Text(" > " + title);
            document.Add(mainDiv);

            mainDiv.Append(tags);

            document.AddStyle(css);

            return(document);
        }
        public HtmlDocument Index(NavigationGenericInputModel model)
        {
            var document = new HtmlDocument();

            document.Title = "Navigation Generic Endpoint";
            document.Add("h1").Text("You navigated to an endpoint using a generic!");
            return(document);
        }
 protected override void ConfigureDocument(HtmlDocument document)
 {
     document.Add(new HtmlTag("textarea", tag =>
     {
         tag.Id(Id);
         tag.Text(TheText);
     }));
 }
Exemplo n.º 28
0
        public HtmlDocument get_my_name_is_Name(NameModel input)
        {
            var document = new HtmlDocument();

            document.Title = "What's your name?";
            document.Add("h1").Text("My name is " + input.Name);
            return(document);
        }
Exemplo n.º 29
0
        public HtmlDocument get_my_name_is_Name(MyNameIsInput input)
        {
            var document = new HtmlDocument();

            document.Add("h1").Text("My name is " + input.Name);

            return(document);
        }
Exemplo n.º 30
0
        private HtmlDocument buildDocument(FileUploadOutput model)
        {
            var document = new HtmlDocument();

            document.Title = "File Upload View";

            document.Add("h1").Text(model.Text);

            document.Add("form")
            .Attr("method", "post")
            .Attr("enctype", "multipart/form-data")
            .Attr("action", _urls.UrlFor <FileUploadInput>());

            document.Add("br");

            document.Push("p");
            document.Add("span").Text("File 1:  ");
            document.Add("input").Attr("type", "file").Attr("name", "File1");


            document.Add("br");
            document.Add("input").Attr("type", "submit");

            return(document);
        }