Exemple #1
0
        public void TestName()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Button().SetName("Name").ToHtmlString();

            Assert.AreEqual(comparer, "<input class=\"btn btn-normal\" name=\"Name\" type=\"submit\" value=\"#EmptyValue\" />");
        }
Exemple #2
0
        public void TestDefault()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).ButtonGroup().ToString();

            Assert.AreEqual(comparer, "<div class=\"btn-group\"></div>");
        }
Exemple #3
0
        public void TestDefault()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = new Navigation().ToHtmlString();

            Assert.AreEqual(comparer, "<ul class=\"nav\"></ul>");
        }
Exemple #4
0
        public void TestNavigationItemHeader()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = new Navigation().AddElement(new NavigationItemHeader()).ToHtmlString();

            Assert.AreEqual(comparer, "<ul class=\"nav\"><li class=\"nav-header\"></li></ul>");
        }
Exemple #5
0
        public void TestName()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Panel().SetName("Name").ToHtmlString();

            Assert.AreEqual(comparer, "<div class=\"well\" name=\"Name\"></div>");
        }
Exemple #6
0
        public void TestNavMenu()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Menu().AddNavigation(new Navigation("menu").AddLink(new Link("testlink"))).ToHtmlString();

            Assert.AreEqual(comparer, "<div class=\"navbar\"><div class=\"navbar-header\"><ul class=\"nav\" id=\"Navigation1\"><li><a href=\"\" id=\"testlink\"></a></li></ul></div></div>");
        }
Exemple #7
0
        public void TestEmptyMenu()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Menu().ToHtmlString();

            Assert.AreEqual(comparer, "<div class=\"navbar\"><div class=\"navbar-header\"></div></div>");
        }
Exemple #8
0
        public void TestAction()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Button().SetBehaviour(HtmlBehaviourType.Link).SetAction("Action").ToHtmlString();

            Assert.AreEqual(comparer, "<a class=\"btn btn-normal\" href=\"Action\" value=\"#EmptyValue\">#EmptyValue</a>");
        }
Exemple #9
0
        public void TestPositionFixedBottomNavMenu()
        {
            HtmlHelper htmlHelper     = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer       = SushiExtension.Sushi(htmlHelper).Menu().SetPosition(MenuPosition.FixedBottom).ToHtmlString();
            var        resultExpected = "<div class=\"navbar navbar-fixed-bottom\"><div class=\"navbar-header\"></div></div>";

            Assert.AreEqual(comparer, resultExpected);
        }
Exemple #10
0
        public void TestNavigationItemSeparator()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = new Navigation().AddSeparator().ToHtmlString();
            string     result     = "<ul class=\"nav\"><li class=\"divider\"></li></ul>";

            Assert.AreEqual(comparer, result);
        }
Exemple #11
0
        public void TestAddButton()
        {
            HtmlHelper htmlHelper    = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        ButtonElement = SushiExtension.Sushi(htmlHelper).Button();
            var        comparer      = SushiExtension.Sushi(htmlHelper).ButtonGroup().AddButton(ButtonElement).ToString();

            Assert.AreEqual(comparer, "<div class=\"btn-group\"><input class=\"btn btn-normal\" type=\"submit\" value=\"#EmptyValue\" /></div>");
        }
Exemple #12
0
        public void TestDefault()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());

            // var comparer = SushiExtension.Sushi(htmlHelper).DropDown().ToString();
            Assert.Inconclusive("Refactoring");
            //Assert.AreEqual(comparer, "<ul class=\"dropdown-menu\"></ul>");
        }
Exemple #13
0
        public void TestAddingHtmlInsidePanel()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Panel()
                                    .AddInnerHTML("<input class=\"btn btn-normal\" type=\"submit\" value=\"#EmptyValue\" />")
                                    .ToHtmlString();

            Assert.AreEqual(comparer, "<div class=\"well\"><input class=\"btn btn-normal\" type=\"submit\" value=\"#EmptyValue\" /></div>");
        }
Exemple #14
0
        public void TestMultipleComponentInsidePanel()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());

            using (SushiExtension.Sushi(htmlHelper).BeginBlock(LayoutType.Fixed))
            {
                htmlHelper.ViewContext.Writer.Write(SushiExtension.Sushi(htmlHelper).Button().ToString());
            }
            var comparer = FakeHtmlHelper.ResponseText;

            Assert.AreEqual(comparer, "<div class=\"fixed\"><input class=\"btn btn-normal\" type=\"submit\" value=\"#EmptyValue\" /></div>");
        }
Exemple #15
0
        public void TestDefaultWithHtmlHelper()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = new NavigationDropDown().ToString();
            var        result     = "<ul class=\"nav\">" +
                                    "<li class=\"dropdown\"><a class=\"dropdown-toggle\" data-toggle=\"dropdown\"><b class=\"caret\"></b></a>" +
                                    "<ul class=\"dropdown-menu\">" +
                                    "</ul>" +
                                    "</li>" +
                                    "</ul>";

            Assert.AreEqual(comparer, result);
        }
Exemple #16
0
        public void TestSizes()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Button().SetSize(ButtonSize.normal).ToHtmlString();

            Assert.AreEqual(comparer, "<input class=\"btn btn-normal\" type=\"submit\" value=\"#EmptyValue\" />");
            var comparer1 = SushiExtension.Sushi(htmlHelper).Button().SetSize(ButtonSize.small).ToHtmlString();

            Assert.AreEqual(comparer1, "<input class=\"btn btn-small\" type=\"submit\" value=\"#EmptyValue\" />");
            var comparer2 = SushiExtension.Sushi(htmlHelper).Button().SetSize(ButtonSize.large).ToHtmlString();

            Assert.AreEqual(comparer2, "<input class=\"btn btn-large\" type=\"submit\" value=\"#EmptyValue\" />");
        }
Exemple #17
0
        public void TestTypes()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Button().SetType(ButtonType.Primary).ToHtmlString();

            Assert.AreEqual(comparer, "<input class=\"btn btn-normal btn-primary\" type=\"submit\" value=\"#EmptyValue\" />");
            comparer = SushiExtension.Sushi(htmlHelper).Button().SetType(ButtonType.Danger).ToHtmlString();
            Assert.AreEqual(comparer, "<input class=\"btn btn-normal btn-danger\" type=\"submit\" value=\"#EmptyValue\" />");
            comparer = SushiExtension.Sushi(htmlHelper).Button().SetType(ButtonType.Default).ToHtmlString();
            Assert.AreEqual(comparer, "<input class=\"btn btn-normal\" type=\"submit\" value=\"#EmptyValue\" />");
            comparer = SushiExtension.Sushi(htmlHelper).Button().SetType(ButtonType.Info).ToHtmlString();
            Assert.AreEqual(comparer, "<input class=\"btn btn-normal btn-info\" type=\"submit\" value=\"#EmptyValue\" />");
            comparer = SushiExtension.Sushi(htmlHelper).Button().SetType(ButtonType.Success).ToHtmlString();
            Assert.AreEqual(comparer, "<input class=\"btn btn-normal btn-success\" type=\"submit\" value=\"#EmptyValue\" />");
        }
Exemple #18
0
        public void TestThreeElementsNavMenu()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Menu().AddNavigation(
                new Navigation("menu")
                .AddLink(new Link("testlink"))
                .AddLink(new Link("testlink2"))
                .AddLink(new Link("testlink3"))
                ).ToHtmlString();

            var resultExpected = "<div class=\"navbar\">" +
                                 "<div class=\"navbar-header\">" +
                                 "<ul class=\"nav\" id=\"Navigation1\">" +
                                 "<li><a href=\"\" id=\"testlink\"></a></li>" +
                                 "<li><a href=\"\" id=\"testlink2\"></a></li>" +
                                 "<li><a href=\"\" id=\"testlink3\"></a></li>" +
                                 "</ul>" +
                                 "</div></div>";

            Assert.AreEqual(comparer, resultExpected);
        }
Exemple #19
0
        public void TestAddDropDownMenu()
        {
            HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary());
            var        comparer   = SushiExtension.Sushi(htmlHelper).Menu()
                                    .AddNavigationDropDown(
                new NavigationDropDown()
                .SetCaption("File")
                .AddLink(new Link().SetCaption("New").SetAction("#"))).ToHtmlString();

            var resultExpected = "<div class=\"navbar\">" +
                                 "<div class=\"navbar-header\">" +
                                 "<ul class=\"nav\">" +
                                 "<li class=\"dropdown\">" +
                                 "<a class=\"dropdown-toggle\" data-toggle=\"dropdown\">File<b class=\"caret\"></b></a>" +
                                 "<ul class=\"dropdown-menu\">" +
                                 "<li><a href=\"#\">New</a></li>" +
                                 "</ul>" +
                                 "</li>" +
                                 "</ul>" +
                                 "</div></div>";

            Assert.AreEqual(comparer, resultExpected);
        }