Example #1
0
        public void TestGetClasses()
        {
            Assert.Equal(new String[] { }, ClassAttributeExtensions.GetClasses(null));

            var element = new HElement("div");

            Assert.Equal(new String[] { }, element.GetClasses());

            var clsAttr = new HAttribute("class");

            element.Add(clsAttr);

            Assert.Equal(new String[] { }, element.GetClasses());

            clsAttr.Value = "    ";
            Assert.Equal(new String[] { }, element.GetClasses());

            clsAttr.Value = "  class1  ";
            Assert.Equal(new String[] { "class1" }, element.GetClasses());

            clsAttr.Value = "  class1 class-2 ";
            Assert.Equal(new String[] { "class1", "class-2" }, element.GetClasses());
        }