示例#1
0
        public void AttributeSelectorsWithQuotedContentShouldNotBeIdentifiedAsPropertyValues()
        {
            var content  = "input[type=\"text\"] { color: blue; }";
            var expected = new CategorisedCharacterString[]
            {
                CSS.SelectorOrStyleProperty("input[type=\"text\"]", 0),
                CSS.Whitespace(" ", 18),
                CSS.OpenBrace(19),
                CSS.Whitespace(" ", 20),
                CSS.SelectorOrStyleProperty("color", 21),
                CSS.StylePropertyColon(26),
                CSS.Whitespace(" ", 27),
                CSS.Value("blue", 28),
                CSS.SemiColon(32),
                CSS.Whitespace(" ", 33),
                CSS.CloseBrace(34)
            };

            Assert.Equal(
                expected,
                Parser.ParseLESS(content),
                new CategorisedCharacterStringComparer()
                );
        }
示例#2
0
        public void WhitespaceInQuotedValueIsCategorisedAsValueAndNotAsWhitespace()
        {
            var content  = "body { font-family: \"Segoe UI\"; }";
            var expected = new CategorisedCharacterString[]
            {
                CSS.SelectorOrStyleProperty("body", 0),
                CSS.Whitespace(" ", 4),
                CSS.OpenBrace(5),
                CSS.Whitespace(" ", 6),
                CSS.SelectorOrStyleProperty("font-family", 7),
                CSS.StylePropertyColon(18),
                CSS.Whitespace(" ", 19),
                CSS.Value("\"Segoe UI\"", 20),
                CSS.SemiColon(30),
                CSS.Whitespace(" ", 31),
                CSS.CloseBrace(32)
            };

            Assert.Equal(
                expected,
                Parser.ParseLESS(content),
                new CategorisedCharacterStringComparer()
                );
        }
示例#3
0
        public void PseudoClassesShouldNotBeIdentifiedAsPropertyValues()
        {
            var content  = "a:hover { color: blue; }";
            var expected = new CategorisedCharacterString[]
            {
                CSS.SelectorOrStyleProperty("a:hover", 0),
                CSS.Whitespace(" ", 7),
                CSS.OpenBrace(8),
                CSS.Whitespace(" ", 9),
                CSS.SelectorOrStyleProperty("color", 10),
                CSS.StylePropertyColon(15),
                CSS.Whitespace(" ", 16),
                CSS.Value("blue", 17),
                CSS.SemiColon(21),
                CSS.Whitespace(" ", 22),
                CSS.CloseBrace(23)
            };

            Assert.Equal(
                expected,
                Parser.ParseLESS(content),
                new CategorisedCharacterStringComparer()
                );
        }