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>"); }
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>"); }
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\" />"); }
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>"); }
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>"); }
public void TestDefault() { HtmlHelper htmlHelper = FakeHtmlHelper.CreateFakeHtmlHelper(FakeHtmlHelper.CreateFakeViewDataDictionary()); var comparer = SushiExtension.Sushi(htmlHelper).ButtonGroup().ToString(); Assert.AreEqual(comparer, "<div class=\"btn-group\"></div>"); }
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); }
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>"); }
public void TestDefault100RecordsModel() { FakeHtmlHelper.CreateStronglyTypedFakeViewDataDictionary(ModelFactories.GetPeople100Collection()); var htmlHelper = FakeHtmlHelper.CreateStronglyTypedHtmlHelperWithCollection(); var resultObtained = SushiExtension.Sushi(htmlHelper).Grid(x => x).Bind().ToHtmlString(); var resultExpected = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestDefaultGrid20); Assert.AreEqual(resultExpected, resultObtained); }
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>"); }
public void TestDefault() { FakeHtmlHelper.CreateStronglyTypedFakeViewDataDictionary(new List <Person>()); var htmlHelper = FakeHtmlHelper.CreateStronglyTypedHtmlHelperWithCollection(); var comparer = SushiExtension.Sushi(htmlHelper).Grid(x => x).ToHtmlString(); var expected = "<table id=\"Grid1\"><thead><tr></tr></thead><tbody></tbody></table>"; Assert.AreEqual(expected, comparer); }
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>"); }
public void TestJavascriptIsLoaded() { FakeHtmlHelper.CreateStronglyTypedFakeViewDataDictionary(ModelFactories.GetPeople20Collection()); var htmlHelper = FakeHtmlHelper.CreateStronglyTypedHtmlHelperWithCollection(); var execution = SushiExtension.Sushi(htmlHelper).Grid(x => x) .Bind() .ToHtmlString(); var resultObtained = SushiExtension.Sushi(htmlHelper).ScriptManager().ToString(); var resultExpected = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestDefaultJS); Assert.AreEqual(resultExpected, resultObtained.ToString()); }
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\" />"); }
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\" />"); }
public void TestSetGridRemoteBinding() { FakeHtmlHelper.CreateStronglyTypedFakeViewDataDictionary(ModelFactories.GetPeople20Collection()); var htmlHelper = FakeHtmlHelper.CreateStronglyTypedHtmlHelperWithCollection(); var execution = SushiExtension.Sushi(htmlHelper).Grid(x => x) .Bind() .Binding(binding => binding.Setup("/StringAction")) .ToHtmlString(); var expectedtable = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestDefaultGridRemoteBinding); Assert.AreEqual(expectedtable, execution); var resultObtained = SushiExtension.Sushi(htmlHelper).ScriptManager().ToString(); var resultExpected = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestGridSettedRemoteBinding); Assert.AreEqual(resultExpected, resultObtained); }
public void TestSetGridFilteringOff() { FakeHtmlHelper.CreateStronglyTypedFakeViewDataDictionary(ModelFactories.GetPeople20Collection()); var htmlHelper = FakeHtmlHelper.CreateStronglyTypedHtmlHelperWithCollection(); var execution = SushiExtension.Sushi(htmlHelper).Grid(x => x) .Bind() .Search(search => search.SearchActive(false)) .ToHtmlString(); var expectedtable = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestDefaultGrid20); Assert.AreEqual(expectedtable, execution); var resultObtained = SushiExtension.Sushi(htmlHelper).ScriptManager().ToString(); var resultExpected = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestGridFilteringOff); Assert.AreEqual(resultExpected, resultObtained); }
public void TestSetGridDisplayPaginationOptionsTrue() { FakeHtmlHelper.CreateStronglyTypedFakeViewDataDictionary(ModelFactories.GetPeople20Collection()); var htmlHelper = FakeHtmlHelper.CreateStronglyTypedHtmlHelperWithCollection(); var execution = SushiExtension.Sushi(htmlHelper).Grid(x => x) .Bind() .Pagination(pagination => pagination.DisplayPaginationOptions(true)) .ToHtmlString(); var expectedtable = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestDefaultGrid20); Assert.AreEqual(expectedtable, execution); var resultObtained = SushiExtension.Sushi(htmlHelper).ScriptManager().ToString(); var resultExpected = HtmlStringLoader.GetHtmlStringResource(TextLoad.TestSettedGridPagingControls); Assert.AreEqual(resultExpected, resultObtained); }
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); }
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); }