コード例 #1
0
        public void Tag()
        {
            var expected = new TagBuilder("div");
            var actual   = ExpandShorthand.Do("div").Item1;

            Assert.AreEqual(expected.ToString(), actual.Render());
        }
コード例 #2
0
        public void TagWithAttribute()
        {
            var expected = new TagBuilder("a");

            expected.MergeAttribute("href", "#foo");

            var actual = ExpandShorthand.Do("a[href='#foo']").Item1;

            Assert.AreEqual(expected.ToString(), actual.Render());
        }
コード例 #3
0
        public void TagWithHyphenatedClass()
        {
            var expected = new TagBuilder("div");

            expected.AddCssClass("bar-class");

            var actual = ExpandShorthand.Do("div.bar-class").Item1;

            Assert.AreEqual(expected.ToString(), actual.Render());
        }
コード例 #4
0
        public void TagWithId()
        {
            var expected = new TagBuilder("div");

            expected.MergeAttribute("id", "MyDiv");

            var actual = ExpandShorthand.Do("div#MyDiv").Item1;

            Assert.AreEqual(expected.ToString(), actual.Render());
        }
コード例 #5
0
        public void TagWithInnerTextWithWhtitespace()
        {
            var expected = new TagBuilder("a");

            expected.InnerHtml = "Do Stuff";

            var actual = ExpandShorthand.Do("a 'Do Stuff'").Item1;

            Assert.AreEqual(expected.ToString(), actual.Render());
        }
コード例 #6
0
        public void TagWithIdAndMultipleClass()
        {
            var expected = new TagBuilder("div");

            expected.MergeAttribute("id", "MyDiv");
            expected.AddCssClass("barClass");
            expected.AddCssClass("fooClass");

            var actual = ExpandShorthand.Do("div#MyDiv.fooClass.barClass").Item1;

            Assert.AreEqual(expected.ToString(), actual.Render());
        }
コード例 #7
0
        public void TagWithInnerTextAndAttributes()
        {
            var expected = new TagBuilder("a");

            expected.MergeAttribute("href", "#foo");
            expected.MergeAttribute("toggle", "things");
            expected.InnerHtml = "Do";

            var actual = ExpandShorthand.Do("a[href='#foo'][toggle='things'] 'Do'").Item1;

            Assert.AreEqual(expected.ToString(), actual.Render());
        }