コード例 #1
0
ファイル: Menu.cs プロジェクト: OsvaldoJ/Sushi
 public Menu AddNavigationDropDown(NavigationDropDown NavDropDown)
 {
     NavDropDown.ViewContext = this.ViewContext;
     NavDropDown.Component.HtmlProperties.Id = Resolvers.HtmlResolver.GenerateHtmlValidId(this.ViewContext, NavDropDown.GetType());
     this.ContainerElements.Add(NavDropDown);
     return this;
 }
コード例 #2
0
 public void TestAddLinkElement()
 {
     var comparer = new NavigationDropDown().SetCaption("Menu")
                         .AddLink(
                             new Link("testid").SetCaption("Link Option").SetAction("#")
                         ).ToString();
     var result = "<ul class=\"nav\">" +
                  "<li class=\"dropdown\"><a class=\"dropdown-toggle\" data-toggle=\"dropdown\">Menu<b class=\"caret\"></b></a>" +
                  "<ul class=\"dropdown-menu\">" +
                  "<li><a href=\"#\" id=\"testid\">Link Option</a></li>" +
                  "</ul>" +
                  "</li>" +
                  "</ul>";
     Assert.AreEqual(comparer, result);
 }
コード例 #3
0
 public void TestAddHeaderAndLinksAndSeparator()
 {
     var comparer = new NavigationDropDown().SetCaption("Menu")
                         .AddHeader("Cabecera 1")
                         .AddLink(
                             new Link("testid").SetCaption("Link Option").SetAction("#")
                         )
                         .AddLink(
                             new Link("testid2").SetCaption("Link Option 2").SetAction("#")
                         )
                         .AddSeparator()
                         .ToString();
     var result = "<ul class=\"nav\">" +
                  "<li class=\"dropdown\"><a class=\"dropdown-toggle\" data-toggle=\"dropdown\">Menu<b class=\"caret\"></b></a>" +
                  "<ul class=\"dropdown-menu\">" +
                  "<li class=\"nav-header\">Cabecera 1</li>" +
                  "<li><a href=\"#\" id=\"testid\">Link Option</a></li>" +
                  "<li><a href=\"#\" id=\"testid2\">Link Option 2</a></li>" +
                  "<li class=\"divider\"></li>" +
                  "</ul>" +
                  "</li>" +
                  "</ul>";
     Assert.AreEqual(comparer, result);
 }
コード例 #4
0
ファイル: DropDown.cs プロジェクト: OsvaldoJ/Sushi
 public DropDown AddNavigationDropDown(NavigationDropDown navDropDown)
 {
     navDropDown.ViewContext = this.ViewContext;
     navDropDown.Component.HtmlProperties.Id = Resolvers.HtmlResolver.GenerateHtmlValidId(this.ViewContext, navDropDown.GetType());
     return this;
 }
コード例 #5
0
 public void TestSetCaption()
 {
     var comparer = new NavigationDropDown().SetCaption("Caption").ToString();
     var result = "<ul class=\"nav\">" +
                  "<li class=\"dropdown\"><a class=\"dropdown-toggle\" data-toggle=\"dropdown\">Caption<b class=\"caret\"></b></a>" +
                  "<ul class=\"dropdown-menu\">" +
                  "</ul>" +
                  "</li>" +
                  "</ul>";
     Assert.AreEqual(comparer, result);
 }
コード例 #6
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);
 }
コード例 #7
0
 public Navigation AddDropDownMenu(NavigationDropDown DropDown)
 {
     DropDown.ViewContext = this.ViewContext;
     this.ContainerElements.Add(DropDown);
     return(this);
 }