Beispiel #1
0
        public void Zero_Values_Before_Decimals_Are_Parsed()
        {
            var parser = new StylesheetParser();
            var style = parser.Parse("*{ background-position: 0 1.1em; }");

            Assert.AreEqual(1, style.RuleSets[0].Declarations.Count);
        }
        protected bool LoadCss3Document(string fileName)
        {
            Terminal.WriteLine(string.Format("Validating the file ~{0}:", fileName), ConsoleColor.DarkBlue);
            Terminal.Indent();

            OpenTest("Loading the file... ");
            Stylesheet stylesheet = null;
            string     cssDoc     = LoadCssFile(fileName);

            //one point if the CSS name is OK
            if (!string.IsNullOrEmpty(cssDoc))
            {
                CloseTest(string.Empty);
            }
            else
            {
                cssDoc = LoadCssFile("*.css");

                if (string.IsNullOrEmpty(cssDoc))
                {
                    CloseTest("Unable to read the CSS file.");
                }
                else
                {
                    CloseTest("Incorrect file name");
                }
            }

            if (!string.IsNullOrEmpty(cssDoc))
            {
                OpenTest("Validating against the W3C official validation tool... ");

                if (!W3CSchemaValidationForCss3(cssDoc))
                {
                    CloseTest("Unable to validate.", 0);
                    stylesheet = null;
                }
                else
                {
                    CloseTest(string.Empty, 0);

                    OpenTest("Parsing the CSS file... ");
                    StylesheetParser parser = new StylesheetParser();
                    stylesheet = parser.Parse(cssDoc);

                    if (stylesheet == null)
                    {
                        CloseTest("Unable to parse the CSS file.", 0);
                    }
                    else
                    {
                        CloseTest(string.Empty, 0);
                    }
                }
            }

            Terminal.UnIndent();
            this.CssDoc = stylesheet;
            return(stylesheet != null);
        }
        public ExCSSFixture()
        {
            _parser = new StylesheetParser();

            //new StylesheetParser().Parse(".big{color: red;}");
            //new StylesheetParser().Parse("@import \"mystyle.css\";");
        }
        public static SelectorType GetSelectorType(string selector)
        {
            SelectorType sel = SelectorType.Unspecified;

            try
            {
                XPathExpression.Compile(selector);
                sel = SelectorType.Xpath;
            }
            catch (XPathException) { }

            try
            {
                var parser     = new StylesheetParser();
                var stylesheet = parser.ParseSelector(selector);
                if (stylesheet == null)
                {
                    throw new ArgumentException();
                }
                sel = SelectorType.Css;
            }
            catch (ArgumentException) { }

            return(sel);
        }
Beispiel #5
0
        public UnityUGUIContext(RectTransform hostElement, Jint.Engine engine, StringObjectDictionary assets, ReactScript script, bool isDevServer)
        {
            Engine      = engine;
            Globals     = assets;
            Script      = script;
            IsDevServer = isDevServer;

            Parser    = new StylesheetParser(true, true, true, true, true);
            StyleTree = new StyleTree(Parser);

            Host           = new HostComponent(hostElement, this);
            Host.Tag       = "_root";
            RootLayoutNode = Host.Layout;

            InsertStyle(ResourcesHelper.UseragentStylesheet?.text, -1);
            Host.ResolveStyle(true);

            MainThreadDispatcher.AddCallOnLateUpdate(() =>
            {
                if (Scheduled)
                {
                    RootLayoutNode.CalculateLayout();
                    Scheduled = false;

                    for (int i = 0; i < ScheduledCallbacks.Count; i++)
                    {
                        ScheduledCallbacks[i]?.Invoke();
                    }
                }
            });
        }
Beispiel #6
0
        public void Empty_Terms_Are_Ignored()
        {
            var parser = new StylesheetParser();
            var style  = parser.Parse("*{ font-size: 10px; ; }");

            Assert.AreEqual(1, style.RuleSets[0].Declarations.Count);
        }
Beispiel #7
0
        static StyleRule Parse(string source)
        {
            var parser = new StylesheetParser();
            var rule   = parser.Parse(source).Rules[0];

            return(rule as StyleRule);
        }
Beispiel #8
0
        public void Debug_stuff_here()
        {
            var sheet = new StylesheetParser().Parse("foo > bar {color: red; }");
            var _     = sheet.ToCss();

            Console.WriteLine(sheet.StyleRules.First().SelectorText);
        }
Beispiel #9
0
        public void ParseCss_WithStandardString_ExpectReadableProperties()
        {
            // Could read in a file here...
            // Arrange
            string css = "html{ background-color: #5a5eed; color: #FFFFFF; margin: 5px; } h2{ background-color: red }";

            // Act
            var stylesheet = new StylesheetParser().Parse(css);

            // Get the info out - long hand
            // var info = stylesheet.Children.First(c => ((ExCSS.StyleRule)c).SelectorText == "html") as ExCSS.StyleRule;
            // var selector = info.SelectorText;
            // var firstCssProperty = info.Style.BackgroundColor;

            // Get the info out - New way
            var info            = stylesheet.StyleRules.First() as ExCSS.StyleRule;
            var selector        = info.SelectorText;
            var backgroundColor = info.Style.BackgroundColor;
            var foregroundColor = info.Style.Color;
            var margin          = info.Style.Margin;

            // Assert
            Assert.Equal(@"html", selector);
            Assert.Equal(@"rgb(90, 94, 237)", backgroundColor);
            Assert.Equal(@"rgb(255, 255, 255)", foregroundColor);
            Assert.Equal(@"5px", margin);
        }
Beispiel #10
0
        public void Empty_Terms_Are_Ignored()
        {
            var parser = new StylesheetParser();
            var style = parser.Parse("*{ font-size: 10px; ; }");

            Assert.AreEqual(1, style.RuleSets[0].Declarations.Count);
        }
Beispiel #11
0
        public void Zero_Values_Before_Decimals_Are_Parsed()
        {
            var parser = new StylesheetParser();
            var style  = parser.Parse("*{ background-position: 0 1.1em; }");

            Assert.AreEqual(1, style.RuleSets[0].Declarations.Count);
        }
Beispiel #12
0
        public void Terms_With_Vendor_Functions_Are_Parsed()
        {
            var parser = new StylesheetParser();
            var style = parser.Parse("*{background-image: -moz-linear-gradient(top,#CCC,#ddd) }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual("-moz-linear-gradient(top, #CCC, #DDD)", expression.Terms[0].ToString());
        }
Beispiel #13
0
        public void Terms_With_Size_And_Height_Shorthand_Are_Parsed()
        {
            var parser = new StylesheetParser();
            var style = parser.Parse("*{font-size: 12px/20px }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual("12px/20px", expression.Terms[0].ToString());
        }
Beispiel #14
0
        public void Content_With_Empty_Single_Quote_Strings_Is_Parsed()
        {
            var parser = new StylesheetParser();
            var style = parser.Parse("*{content: '  ' }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual("'  '", expression.Terms[0].ToString());
        }
Beispiel #15
0
        public void Content_With_Empty_Single_Quote_Strings_Is_Parsed()
        {
            var parser     = new StylesheetParser();
            var style      = parser.Parse("*{content: '  ' }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual("'  '", expression.Terms[0].ToString());
        }
        internal static StyleDeclaration ParseDeclarations(string declarations)
        {
            var parser = new StylesheetParser();
            var style  = new StyleDeclaration(parser);

            style.Update(declarations);
            return(style);
        }
Beispiel #17
0
 public static void Main(string[] args)
 {
     using (var file = File.OpenRead(args[0]))
     {
         var parser = new StylesheetParser();
         parser.Parse(file);
     }
 }
Beispiel #18
0
        public void Terms_With_Vendor_Functions_Are_Parsed()
        {
            var parser     = new StylesheetParser();
            var style      = parser.Parse("*{background-image: -moz-linear-gradient(top,#CCC,#ddd) }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual("-moz-linear-gradient(top, #CCC, #DDD)", expression.Terms[0].ToString());
        }
Beispiel #19
0
        public void Terms_With_Size_And_Height_Shorthand_Are_Parsed()
        {
            var parser     = new StylesheetParser();
            var style      = parser.Parse("*{font-size: 12px/20px }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual("12px/20px", expression.Terms[0].ToString());
        }
Beispiel #20
0
        public void ParseJustifyContent()
        {
            var parser = new StylesheetParser();
            var sheet  = parser.Parse("a {justify-content: space-evenly; }");
            var style  = ((StyleRule)sheet.StyleRules.First()).Style;

            Assert.Equal("space-evenly", style.JustifyContent);
        }
Beispiel #21
0
        public void StyleSheetInsertShouldSetParentStyleSheetCorrectly()
        {
            var parser = new StylesheetParser();
            var s      = new Stylesheet(parser);

            s.Insert("a {color: blue}", 0);
            Assert.Equal(s, s.Rules[0].Owner);
        }
Beispiel #22
0
        public void StyleSheetWithInitialCommentShouldWorkWithTriviaActive()
        {
            var parser   = new StylesheetParser(preserveComments: true);
            var document = parser.Parse(@"/* Comment at the start */ body { font-size: 10pt; }");
            var comment  = document.Children.First();

            Assert.IsType <Comment>(comment);
            Assert.Equal(" Comment at the start ", ((Comment)comment).Data);
        }
Beispiel #23
0
        public void StyleSheetWithoutCommentsButStoringTrivia()
        {
            var          parser   = new StylesheetParser();
            const string source   = ".foo { color: red; } @media print { #myid { color: green; } }";
            var          sheet    = parser.Parse(source);
            var          comments = sheet.GetComments();

            Assert.Empty(comments);
        }
Beispiel #24
0
        public void StyleSheetSimpleRoundtrip()
        {
            var          parser    = new StylesheetParser(preserveComments: true);
            const string source    = ".foo { color: red; } @media all /*test*/ and /*test*/ (min-width: 701px) /*test*/ { #myid { color: green; } }";
            var          sheet     = parser.Parse(source);
            var          roundtrip = sheet.StylesheetText.Text;

            Assert.Equal(source, roundtrip);
        }
Beispiel #25
0
        public void Terms_With_Functions_Are_Parsed()
        {
            var parser = new StylesheetParser();
            var style = parser.Parse("*{clip: rect(0px,60px,200px,0px) }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(1, expression.Terms.Count);
            Assert.AreEqual("rect(0px, 60px, 200px, 0px)", expression.Terms[0].ToString());
        }
Beispiel #26
0
        public void Terms_With_Functions_Are_Parsed()
        {
            var parser     = new StylesheetParser();
            var style      = parser.Parse("*{clip: rect(0px,60px,200px,0px) }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(1, expression.Terms.Count);
            Assert.AreEqual("rect(0px, 60px, 200px, 0px)", expression.Terms[0].ToString());
        }
        public void accelerator_true()
        {
            var termParts = new[]{"true"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{accelerator: true }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("true", expression.Terms[0].ToString());
        }
Beispiel #28
0
        public Stylesheet ParseSheet(string cssBody)
        {
            var parser = new StylesheetParser();

            parser.SetContext(cssBody);
            var ret = parser.DoParse();

            Errors = parser.Errors;
            return(ret);
        }
        public void azimuth_left_side()
        {
            var termParts = new[]{"left-side"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{azimuth: left-side }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("left-side", expression.Terms[0].ToString());
        }
        public void background_attachment_scroll()
        {
            var termParts = new[]{"scroll"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{background-attachment: scroll }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("scroll", expression.Terms[0].ToString());
        }
Beispiel #31
0
        static ImportRule NewImportRule(string cssText)
        {
            var parser = new StylesheetParser();
            var rule   = new ImportRule(parser)
            {
                Text = cssText
            };

            return(rule);
        }
Beispiel #32
0
        public void ColorFunctionsMixAllShouldWork()
        {
            var          parser = new StylesheetParser();
            const string source = @"
.rgbNumber { color: rgb(255, 128, 0); }
.rgbPercent { color: rgb(100%, 50%, 0%); }
.rgbaNumber { color: rgba(255, 128, 0, 0.0); }
.rgbaPercent { color: rgba(100%, 50%, 0%, 0.0); }
.hsl { color: hsl(120, 100%, 50%); }
.hslAngle { color: hsl(120deg, 100%, 50%); }
.hsla { color: hsla(120, 100%, 50%, 0.25); }
.hslaAngle { color: hsla(120deg, 100%, 50%, 0.25); }
.grayNumber { color: gray(128); }
.grayPercent { color: gray(50%); }
.grayPercentAlpha { color: gray(50%, 0.5); }
.hwb { color: hwb(120, 60%, 20%); }
.hwbAngle { color: hwb(120deg, 60%, 20%); }
.hwbAlpha { color: hwb(120, 10%, 50%, 0.5); }
.hwbAngleAlpha { color: hwb(120deg, 10%, 50%, 0.5); }";
            var          sheet  = parser.Parse(source);

            Assert.Equal(15, sheet.Rules.Length);

            var rgbNumber        = (sheet.Rules[0] as StyleRule).Style.Color;
            var rgbPercent       = (sheet.Rules[1] as StyleRule).Style.Color;
            var rgbaNumber       = (sheet.Rules[2] as StyleRule).Style.Color;
            var rgbaPercent      = (sheet.Rules[3] as StyleRule).Style.Color;
            var hsl              = (sheet.Rules[4] as StyleRule).Style.Color;
            var hslAngle         = (sheet.Rules[5] as StyleRule).Style.Color;
            var hsla             = (sheet.Rules[6] as StyleRule).Style.Color;
            var hslaAngle        = (sheet.Rules[7] as StyleRule).Style.Color;
            var grayNumber       = (sheet.Rules[8] as StyleRule).Style.Color;
            var grayPercent      = (sheet.Rules[9] as StyleRule).Style.Color;
            var grayPercentAlpha = (sheet.Rules[10] as StyleRule).Style.Color;
            var hwb              = (sheet.Rules[11] as StyleRule).Style.Color;
            var hwbAngle         = (sheet.Rules[12] as StyleRule).Style.Color;
            var hwbAlpha         = (sheet.Rules[13] as StyleRule).Style.Color;
            var hwbAngleAlpha    = (sheet.Rules[14] as StyleRule).Style.Color;

            Assert.NotNull(rgbNumber);
            Assert.NotNull(rgbPercent);
            Assert.NotNull(rgbaNumber);
            Assert.NotNull(rgbaPercent);
            Assert.NotNull(hsl);
            Assert.NotNull(hslAngle);
            Assert.NotNull(hsla);
            Assert.NotNull(hslaAngle);
            Assert.NotNull(grayNumber);
            Assert.NotNull(grayPercent);
            Assert.NotNull(grayPercentAlpha);
            Assert.NotNull(hwb);
            Assert.NotNull(hwbAngle);
            Assert.NotNull(hwbAlpha);
            Assert.NotNull(hwbAngleAlpha);
        }
Beispiel #33
0
        public void SpaceIssue1()
        {
            var input  = ".class{outline:5px auto -webkit-focus-ring-color;}";
            var parser = new StylesheetParser();

            parser.SetContext(input);
            var p = parser.DoParse();

            Assert.IsTrue(parser.End);
            Assert.IsTrue(p.IsValid, "must be valid css");
            Assert.AreEqual(".class{outline:5px auto -webkit-focus-ring-color;}", p.ToString());
        }
Beispiel #34
0
        public void GumbyComment()
        {
            var input  = "@charset \"UTF-8\";\n/*  */\n@import url(url);";
            var parser = new StylesheetParser();

            parser.SetContext(input);
            var p = parser.DoParse();

            Assert.IsTrue(parser.End);
            Assert.AreEqual(0, parser.Errors.Count);
            Assert.IsTrue(p.IsValid, "invalid css");
        }
Beispiel #35
0
        public void InvalidOscaro()
        {
            var input  = ".lvml{behavior:url(#default#VML);display:inline-block;position:absolute;}";
            var parser = new StylesheetParser();

            parser.SetContext(input);
            var p = parser.DoParse();

            Assert.IsTrue(parser.End);
            Assert.AreEqual(0, parser.Errors.Count);
            Assert.IsTrue(p.IsValid, "invalid css");
        }
Beispiel #36
0
        public void SeemsToBeAnOperation()
        {
            var input  = ".class{background-position: 9px -20px;}";
            var parser = new StylesheetParser();

            parser.SetContext(input);
            var p = parser.DoParse();

            Assert.IsTrue(parser.End);
            Assert.IsTrue(p.IsValid, "must be valid css");
            Assert.AreEqual(".class{background-position:9px -20px;}", p.ToString());
        }
Beispiel #37
0
        public void SpaceIssue2()
        {
            var input  = ".class{-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);}";
            var parser = new StylesheetParser();

            parser.SetContext(input);
            var p = parser.DoParse();

            Assert.IsTrue(parser.End);
            Assert.IsTrue(p.IsValid, "must be valid css");
            Assert.AreEqual(".class{-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);}", p.ToString());
        }
Beispiel #38
0
 public static void Main(string[] args)
 {
     Fuzzer.OutOfProcess.Run(stream =>
     {
         try
         {
             var parser = new StylesheetParser();
             parser.Parse(stream);
         }
         catch (ArgumentOutOfRangeException) { }
         catch (ParseException) { }
     });
 }
Beispiel #39
0
        public void StringsInProperty()
        {
            // from materialize.css
            var input  = "a[href]:after {content: \" (\" attr(href) \")\"}";
            var parser = new StylesheetParser();

            parser.SetContext(input);
            var p = parser.DoParse();

            Assert.IsTrue(parser.End);
            Assert.AreEqual(0, parser.Errors.Count);
            Assert.IsTrue(p.IsValid, "invalid css");
        }
Beispiel #40
0
        public void TwoBracesAtOnce()
        {
            var input  = "@media print{.table-bordered th{border:1px solid #ddd !important;}}@font-face{font-family:'Glyphicons Halflings';}";
            var parser = new StylesheetParser();

            parser.SetContext(input);
            var p = parser.DoParse();

            Assert.IsTrue(parser.End);
            Assert.AreEqual(0, parser.Errors.Count);
            Assert.IsTrue(p.IsValid, "invalid css");
            Assert.AreEqual(input, p.ToString());
        }
        public void background_CCC_transparent_urlimagesimgpng_fixed_repeat_x_repeat_y_no_repeat_top_left_center_right_bottom_1px_2px()
        {
            var termParts = new[]{"#CCC","transparent","url(images/img.png)","fixed","repeat-x","repeat-y","no-repeat","top","left","center","right","bottom","1px","2px"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{background: #CCC transparent url(images/img.png) fixed repeat-x repeat-y no-repeat top left center right bottom 1px 2px }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("#CCC", expression.Terms[0].ToString());
            Assert.AreEqual("transparent", expression.Terms[1].ToString());
            Assert.AreEqual("url(images/img.png)", expression.Terms[2].ToString());
            Assert.AreEqual("fixed", expression.Terms[3].ToString());
            Assert.AreEqual("repeat-x", expression.Terms[4].ToString());
            Assert.AreEqual("repeat-y", expression.Terms[5].ToString());
            Assert.AreEqual("no-repeat", expression.Terms[6].ToString());
            Assert.AreEqual("top", expression.Terms[7].ToString());
            Assert.AreEqual("left", expression.Terms[8].ToString());
            Assert.AreEqual("center", expression.Terms[9].ToString());
            Assert.AreEqual("right", expression.Terms[10].ToString());
            Assert.AreEqual("bottom", expression.Terms[11].ToString());
            Assert.AreEqual("1px", expression.Terms[12].ToString());
            Assert.AreEqual("2px", expression.Terms[13].ToString());
        }
        public void z_index__1()
        {
            var termParts = new[]{"-1"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{z-index: -1 }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("-1", expression.Terms[0].ToString());
        }
        public void _moz_border_radius_5Percent()
        {
            var termParts = new[]{"5%"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{-moz-border-radius: 5% }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("5%", expression.Terms[0].ToString());
        }
        public void background_position_1px_2em_0_3px()
        {
            var termParts = new[]{"1px","2em","0","3px"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{background-position: 1px 2em 0 3px }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("1px", expression.Terms[0].ToString());
            Assert.AreEqual("2em", expression.Terms[1].ToString());
            Assert.AreEqual("0", expression.Terms[2].ToString());
            Assert.AreEqual("3px", expression.Terms[3].ToString());
        }
        public void background_transparent_0_0()
        {
            var termParts = new[]{"transparent","0","0"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{background: transparent 0 0 }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("transparent", expression.Terms[0].ToString());
            Assert.AreEqual("0", expression.Terms[1].ToString());
            Assert.AreEqual("0", expression.Terms[2].ToString());
        }
        public void border_radius_5px_10px()
        {
            var termParts = new[]{"5px","10px"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{border-radius: 5px 10px }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("5px", expression.Terms[0].ToString());
            Assert.AreEqual("10px", expression.Terms[1].ToString());
        }
        public void text_transform_capitalize()
        {
            var termParts = new[]{"capitalize"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{text-transform: capitalize }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("capitalize", expression.Terms[0].ToString());
        }
        public void vertical_align_text_top()
        {
            var termParts = new[]{"text-top"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{vertical-align: text-top }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("text-top", expression.Terms[0].ToString());
        }
        public void border_left_1px_none()
        {
            var termParts = new[]{"1px","none"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{border-left: 1px none }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("1px", expression.Terms[0].ToString());
            Assert.AreEqual("none", expression.Terms[1].ToString());
        }
        public void background_position_5px_10Percent()
        {
            var termParts = new[]{"5px","10%"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{background-position: 5px 10% }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("5px", expression.Terms[0].ToString());
            Assert.AreEqual("10%", expression.Terms[1].ToString());
        }
        public void border_left_style_dashed()
        {
            var termParts = new[]{"dashed"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{border-left-style: dashed }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("dashed", expression.Terms[0].ToString());
        }
        public void border_solid_1px_CCC()
        {
            var termParts = new[]{"solid","1px","#CCC"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{border: solid 1px #CCC }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("solid", expression.Terms[0].ToString());
            Assert.AreEqual("1px", expression.Terms[1].ToString());
            Assert.AreEqual("#CCC", expression.Terms[2].ToString());
        }
        public void border_ridge()
        {
            var termParts = new[]{"ridge"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{border: ridge }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("ridge", expression.Terms[0].ToString());
        }
        public void white_space_pre_line()
        {
            var termParts = new[]{"pre-line"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{white-space: pre-line }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("pre-line", expression.Terms[0].ToString());
        }
        public void visibility_hidden()
        {
            var termParts = new[]{"hidden"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{visibility: hidden }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("hidden", expression.Terms[0].ToString());
        }
        public void border_bottom_solid()
        {
            var termParts = new[]{"solid"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{border-bottom: solid }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("solid", expression.Terms[0].ToString());
        }
        public void background_repeat_repeat_y()
        {
            var termParts = new[]{"repeat-y"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{background-repeat: repeat-y }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("repeat-y", expression.Terms[0].ToString());
        }
 public ExCSSFixture()
 {
     _parser = new StylesheetParser();
     _parsed = _parser.Parse(_stylesheets.Css3);
 }
        public void background_position_x_inherit()
        {
            var termParts = new[]{"inherit"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{background-position-x: inherit }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("inherit", expression.Terms[0].ToString());
        }
        public void border_left_width_2px()
        {
            var termParts = new[]{"2px"};
            var parser = new StylesheetParser();
            var style = parser.Parse("*{border-left-width: 2px }");
            var expression = style.RuleSets[0].Declarations[0].Expression;

            Assert.AreEqual(termParts.Length, expression.Terms.Count);
            Assert.AreEqual("2px", expression.Terms[0].ToString());
        }