Exemplo n.º 1
0
        public void CssPropertyFactoryCalls()
        {
            var parser  = new StylesheetParser();
            var decl    = new StyleDeclaration(parser);
            var invalid = decl.CreateProperty("invalid");
            var border  = decl.CreateProperty("border");
            var color   = decl.CreateProperty("color");

            decl.SetProperty(color);
            var colorAgain = decl.CreateProperty("color");

            Assert.Null(invalid);
            Assert.NotNull(border);
            Assert.NotNull(color);
            Assert.NotNull(colorAgain);

            Assert.IsType <BorderProperty>(border);
            Assert.IsType <ColorProperty>(color);
            Assert.Equal(color, colorAgain);
        }
Exemplo n.º 2
0
        public TextPosition FillDeclarations(StyleDeclaration style)
        {
            var token = NextToken();

            _nodes.Push(style);
            ParseComments(ref token);

            while (token.IsNot(TokenType.EndOfFile, TokenType.CurlyBracketClose))
            {
                //var property = CreateDeclarationWith(Factory.Properties.Create, ref token);
                var property = CreateDeclarationWith(PropertyFactory.Instance.Create, ref token);

                if ((property != null) && property.HasValue)
                {
                    style.SetProperty(property);
                }

                ParseComments(ref token);
            }

            _nodes.Pop();
            return(token.Position);
        }