Example #1
0
        public void SwitchButtonExtensions()
        {
            var hh = new FakeHtmlHelper<Foo>();
            hh.ViewData.Model = new Foo
                                    {
                                        CreatedAt = new DateTime(2011, 8, 15, 12, 30, 15)
                                    };

            var html = hh.WSwitchButtonFor(m => m.Enabled, new { @class = "testClass1 testClass2" });
            Assert.AreEqual("<input class=\"testClass1 testClass2 wswitchbutton\" id=\"Enabled\" name=\"Enabled\" no=\"Não!\" type=\"checkbox\" value=\"true\" yes=\"Sim!\" /><input name=\"Enabled\" type=\"hidden\" value=\"false\" />", html.ToHtmlString());

            html = hh.WSwitchButtonFor(m => m.Enabled);
            Assert.AreEqual("<input class=\"wswitchbutton\" id=\"Enabled\" name=\"Enabled\" no=\"Não!\" type=\"checkbox\" value=\"true\" yes=\"Sim!\" /><input name=\"Enabled\" type=\"hidden\" value=\"false\" />", html.ToHtmlString());

            html = hh.WSwitchButton("teste");
            Assert.AreEqual("<input class=\"wswitchbutton\" id=\"teste\" name=\"teste\" type=\"checkbox\" value=\"true\" /><input name=\"teste\" type=\"hidden\" value=\"false\" />", html.ToHtmlString());

        }