2 var mode
= CodeMirror
.getMode({tabSize
: 4}, "css");
3 function MT(name
) { test
.mode(name
, mode
, Array
.prototype.slice
.call(arguments
, 1)); }
5 // Requires at least one media query
7 "[def @media] [error {] }");
10 "[def @media] [keyword not] [attribute screen] [operator and] ([property color]), [keyword not] [attribute print] [operator and] ([property color]) { }");
12 MT("atMediaCheckStack",
13 "[def @media] [attribute screen] { } [tag foo] { }");
15 MT("atMediaCheckStack",
16 "[def @media] [attribute screen] ([property color]) { } [tag foo] { }");
18 MT("atMediaCheckStackInvalidAttribute",
19 "[def @media] [attribute&error foobarhello] { } [tag foo] { }");
21 // Error, because "and" is only allowed immediately preceding a media expression
22 MT("atMediaInvalidAttribute",
23 "[def @media] [attribute&error foobarhello] { }");
25 // Error, because "and" is only allowed immediately preceding a media expression
26 MT("atMediaInvalidAnd",
27 "[def @media] [error and] [attribute screen] { }");
29 // Error, because "not" is only allowed as the first item in each media query
30 MT("atMediaInvalidNot",
31 "[def @media] [attribute screen] [error not] ([error not]) { }");
33 // Error, because "only" is only allowed as the first item in each media query
34 MT("atMediaInvalidOnly",
35 "[def @media] [attribute screen] [error only] ([error only]) { }");
37 // Error, because "foobarhello" is neither a known type or property, but
38 // property was expected (after "and"), and it should be in parenthese.
39 MT("atMediaUnknownType",
40 "[def @media] [attribute screen] [operator and] [error foobarhello] { }");
42 // Error, because "color" is not a known type, but is a known property, and
43 // should be in parentheses.
44 MT("atMediaInvalidType",
45 "[def @media] [attribute screen] [operator and] [error color] { }");
47 // Error, because "print" is not a known property, but is a known type,
48 // and should not be in parenthese.
49 MT("atMediaInvalidProperty",
50 "[def @media] [attribute screen] [operator and] ([error print]) { }");
52 // Soft error, because "foobarhello" is not a known property or type.
53 MT("atMediaUnknownProperty",
54 "[def @media] [attribute screen] [operator and] ([property&error foobarhello]) { }");
60 "[qualifier .foo-bar_hello] { }");
63 "[builtin #foo] { [error #foo] }");
65 MT("tagSelectorUnclosed",
66 "[tag foo] { [property margin][operator :] [number 0] } [tag bar] { }");
68 MT("tagStringNoQuotes",
69 "[tag foo] { [property font-family][operator :] [variable-2 hello] [variable-2 world]; }");
72 "[tag foo] { [property font-family][operator :] [string \"hello world\"]; }");
75 "[tag foo] { [property font-family][operator :] [string 'hello world']; }");
79 "[property color][operator :] [keyword black];" +
80 "[property color][operator :] [keyword navy];" +
81 "[property color][operator :] [keyword yellow];" +
85 "[tag foo] { [property background][operator :] [atom #fff]; }");
88 "[tag foo] { [property background][operator :] [atom #ffffff]; }");
91 "[tag foo] { [property background][operator :] [atom&error #ffff]; }");
93 MT("tagColorHexInvalid",
94 "[tag foo] { [property background][operator :] [atom&error #ffg]; }");
96 MT("tagNegativeNumber",
97 "[tag foo] { [property margin][operator :] [number -5px]; }");
99 MT("tagPositiveNumber",
100 "[tag foo] { [property padding][operator :] [number 5px]; }");
103 "[tag foo] { [meta -foo-][property box-sizing][operator :] [meta -foo-][string-2 border-box]; }");
105 MT("tagBogusProperty",
106 "[tag foo] { [property&error barhelloworld][operator :] [number 0]; }");
108 MT("tagTwoProperties",
109 "[tag foo] { [property margin][operator :] [number 0]; [property padding][operator :] [number 0]; }");
112 "[comment <!--comment-->]");