Exemplo n.º 1
0
        public void Is_Passed_An_Object_Of_TabbedContent_Then_Render_Returns_The_Html()
        {
            var renderer       = new TabbedContentRenderer();
            var context        = new Mock <HttpContext>();
            var tempDictionary = new Mock <ITempDataDictionary>();

            renderer.HttpContext        = context.Object;
            renderer.TempDataDictionary = tempDictionary.Object;

            var tabs          = new Tabs();
            var tabbedContent = new List <TabbedContent>
            {
                new TabbedContent
                {
                    TabTitle = "Title",
                    TabName  = "TabName",
                    Content  = new List <IHtmlControl>()
                    {
                        new Heading {
                            HeadingSize = 2, Content = new List <string>()
                            {
                                "a heading"
                            }
                        }
                    }
                }
            };

            tabs.TabbedContents = tabbedContent;

            var actual = renderer.Render(tabs);

            actual.Value.Should().NotBeNullOrWhiteSpace();
            actual.Value.Should().Be("<div class=\"fiu-tabs\" data-fiu-tabs=\"True\"><h2 class=\"fiu-tabs__title\">Contents</h2><ul class=\"fiu-tabs__list\"><li class=\"fiu-tabs__list-item fiu-tabs__list-item--selected\"><a class=\"fiu-tabs__tab\" href=\"#Title\">Title</a></li></ul><div class=\"fiu-tabs__panel\" id=\"Title\"><article class=\"fiu-article\"><h2>a heading</h2></article></div></div>");
        }
Exemplo n.º 2
0
        public static HtmlString TabbedContentToHtml(this IEnumerable <TabbedContent> control, HttpContext context, ITempDataDictionary tempDataDictionary)
        {
            var renderer = new TabbedContentRenderer
            {
                HttpContext        = context,
                TempDataDictionary = tempDataDictionary
            };

            var tabs = new Tabs()
            {
                TabbedContents = control
            };

            return(renderer.Render(tabs));
        }