move a few things away in to-be-integrated/
[myslice.git] / to-be-integrated / third-party / codemirror-3.15 / mode / css / test.js
1 (function() {
2   var mode = CodeMirror.getMode({tabSize: 4}, "css");
3   function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
4
5   // Requires at least one media query
6   MT("atMediaEmpty",
7      "[def @media] [error {] }");
8
9   MT("atMediaMultiple",
10      "[def @media] [keyword not] [attribute screen] [operator and] ([property color]), [keyword not] [attribute print] [operator and] ([property color]) { }");
11
12   MT("atMediaCheckStack",
13      "[def @media] [attribute screen] { } [tag foo] { }");
14
15   MT("atMediaCheckStack",
16      "[def @media] [attribute screen] ([property color]) { } [tag foo] { }");
17
18   MT("atMediaPropertyOnly",
19      "[def @media] ([property color]) { } [tag foo] { }");
20
21   MT("atMediaCheckStackInvalidAttribute",
22      "[def @media] [attribute&error foobarhello] { [tag foo] { } }");
23
24   MT("atMediaCheckStackInvalidAttribute",
25      "[def @media] [attribute&error foobarhello] { } [tag foo] { }");
26
27   // Error, because "and" is only allowed immediately preceding a media expression
28   MT("atMediaInvalidAttribute",
29      "[def @media] [attribute&error foobarhello] { }");
30
31   // Error, because "and" is only allowed immediately preceding a media expression
32   MT("atMediaInvalidAnd",
33      "[def @media] [error and] [attribute screen] { }");
34
35   // Error, because "not" is only allowed as the first item in each media query
36   MT("atMediaInvalidNot",
37      "[def @media] [attribute screen] [error not] ([error not]) { }");
38
39   // Error, because "only" is only allowed as the first item in each media query
40   MT("atMediaInvalidOnly",
41      "[def @media] [attribute screen] [error only] ([error only]) { }");
42
43   // Error, because "foobarhello" is neither a known type or property, but
44   // property was expected (after "and"), and it should be in parenthese.
45   MT("atMediaUnknownType",
46      "[def @media] [attribute screen] [operator and] [error foobarhello] { }");
47
48   // Error, because "color" is not a known type, but is a known property, and
49   // should be in parentheses.
50   MT("atMediaInvalidType",
51      "[def @media] [attribute screen] [operator and] [error color] { }");
52
53   // Error, because "print" is not a known property, but is a known type,
54   // and should not be in parenthese.
55   MT("atMediaInvalidProperty",
56      "[def @media] [attribute screen] [operator and] ([error print]) { }");
57
58   // Soft error, because "foobarhello" is not a known property or type.
59   MT("atMediaUnknownProperty",
60      "[def @media] [attribute screen] [operator and] ([property&error foobarhello]) { }");
61
62   // Make sure nesting works with media queries
63   MT("atMediaMaxWidthNested",
64      "[def @media] [attribute screen] [operator and] ([property max-width][operator :] [number 25px]) { [tag foo] { } }");
65
66   MT("tagSelector",
67      "[tag foo] { }");
68
69   MT("classSelector",
70      "[qualifier .foo-bar_hello] { }");
71
72   MT("idSelector",
73      "[builtin #foo] { [error #foo] }");
74
75   MT("tagSelectorUnclosed",
76      "[tag foo] { [property margin][operator :] [number 0] } [tag bar] { }");
77
78   MT("tagStringNoQuotes",
79      "[tag foo] { [property font-family][operator :] [variable-2 hello] [variable-2 world]; }");
80
81   MT("tagStringDouble",
82      "[tag foo] { [property font-family][operator :] [string \"hello world\"]; }");
83
84   MT("tagStringSingle",
85      "[tag foo] { [property font-family][operator :] [string 'hello world']; }");
86
87   MT("tagColorKeyword",
88      "[tag foo] {" +
89        "[property color][operator :] [keyword black];" +
90        "[property color][operator :] [keyword navy];" +
91        "[property color][operator :] [keyword yellow];" +
92        "}");
93
94   MT("tagColorHex3",
95      "[tag foo] { [property background][operator :] [atom #fff]; }");
96
97   MT("tagColorHex6",
98      "[tag foo] { [property background][operator :] [atom #ffffff]; }");
99
100   MT("tagColorHex4",
101      "[tag foo] { [property background][operator :] [atom&error #ffff]; }");
102
103   MT("tagColorHexInvalid",
104      "[tag foo] { [property background][operator :] [atom&error #ffg]; }");
105
106   MT("tagNegativeNumber",
107      "[tag foo] { [property margin][operator :] [number -5px]; }");
108
109   MT("tagPositiveNumber",
110      "[tag foo] { [property padding][operator :] [number 5px]; }");
111
112   MT("tagVendor",
113      "[tag foo] { [meta -foo-][property box-sizing][operator :] [meta -foo-][string-2 border-box]; }");
114
115   MT("tagBogusProperty",
116      "[tag foo] { [property&error barhelloworld][operator :] [number 0]; }");
117
118   MT("tagTwoProperties",
119      "[tag foo] { [property margin][operator :] [number 0]; [property padding][operator :] [number 0]; }");
120
121   MT("tagTwoPropertiesURL",
122      "[tag foo] { [property background][operator :] [string-2 url]([string //example.com/foo.png]); [property padding][operator :] [number 0]; }");
123
124   MT("commentSGML",
125      "[comment <!--comment-->]");
126 })();