Merge branch '2.0'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / js / 3rdParty / codemirror / mode / css / test.js
CommitLineData
77b7b761 1(function() {
837afb80 2 var mode = CodeMirror.getMode({indentUnit: 2}, "css");
77b7b761
TD
3 function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
4
77b7b761
TD
5 // Error, because "foobarhello" is neither a known type or property, but
6 // property was expected (after "and"), and it should be in parenthese.
7 MT("atMediaUnknownType",
837afb80 8 "[def @media] [attribute screen] [keyword and] [error foobarhello] { }");
77b7b761
TD
9
10 // Soft error, because "foobarhello" is not a known property or type.
11 MT("atMediaUnknownProperty",
837afb80
TD
12 "[def @media] [attribute screen] [keyword and] ([error foobarhello]) { }");
13
14 // Make sure nesting works with media queries
15 MT("atMediaMaxWidthNested",
16 "[def @media] [attribute screen] [keyword and] ([property max-width]: [number 25px]) { [tag foo] { } }");
77b7b761
TD
17
18 MT("tagSelector",
19 "[tag foo] { }");
20
21 MT("classSelector",
22 "[qualifier .foo-bar_hello] { }");
23
24 MT("idSelector",
25 "[builtin #foo] { [error #foo] }");
26
27 MT("tagSelectorUnclosed",
837afb80 28 "[tag foo] { [property margin]: [number 0] } [tag bar] { }");
77b7b761
TD
29
30 MT("tagStringNoQuotes",
837afb80 31 "[tag foo] { [property font-family]: [variable hello] [variable world]; }");
77b7b761
TD
32
33 MT("tagStringDouble",
837afb80 34 "[tag foo] { [property font-family]: [string \"hello world\"]; }");
77b7b761
TD
35
36 MT("tagStringSingle",
837afb80 37 "[tag foo] { [property font-family]: [string 'hello world']; }");
77b7b761
TD
38
39 MT("tagColorKeyword",
837afb80
TD
40 "[tag foo] {",
41 " [property color]: [keyword black];",
42 " [property color]: [keyword navy];",
43 " [property color]: [keyword yellow];",
44 "}");
77b7b761
TD
45
46 MT("tagColorHex3",
837afb80 47 "[tag foo] { [property background]: [atom #fff]; }");
77b7b761
TD
48
49 MT("tagColorHex6",
837afb80 50 "[tag foo] { [property background]: [atom #ffffff]; }");
77b7b761
TD
51
52 MT("tagColorHex4",
837afb80 53 "[tag foo] { [property background]: [atom&error #ffff]; }");
77b7b761
TD
54
55 MT("tagColorHexInvalid",
837afb80 56 "[tag foo] { [property background]: [atom&error #ffg]; }");
77b7b761
TD
57
58 MT("tagNegativeNumber",
837afb80 59 "[tag foo] { [property margin]: [number -5px]; }");
77b7b761
TD
60
61 MT("tagPositiveNumber",
837afb80 62 "[tag foo] { [property padding]: [number 5px]; }");
77b7b761
TD
63
64 MT("tagVendor",
837afb80 65 "[tag foo] { [meta -foo-][property box-sizing]: [meta -foo-][atom border-box]; }");
77b7b761
TD
66
67 MT("tagBogusProperty",
837afb80 68 "[tag foo] { [property&error barhelloworld]: [number 0]; }");
77b7b761
TD
69
70 MT("tagTwoProperties",
837afb80
TD
71 "[tag foo] { [property margin]: [number 0]; [property padding]: [number 0]; }");
72
73 MT("tagTwoPropertiesURL",
74 "[tag foo] { [property background]: [atom url]([string //example.com/foo.png]); [property padding]: [number 0]; }");
77b7b761
TD
75
76 MT("commentSGML",
77 "[comment <!--comment-->]");
837afb80
TD
78
79 MT("commentSGML2",
80 "[comment <!--comment]",
81 "[comment -->] [tag div] {}");
82
83 MT("indent_tagSelector",
84 "[tag strong], [tag em] {",
85 " [property background]: [atom rgba](",
86 " [number 255], [number 255], [number 0], [number .2]",
87 " );",
88 "}");
89
90 MT("indent_atMedia",
91 "[def @media] {",
92 " [tag foo] {",
93 " [property color]:",
94 " [keyword yellow];",
95 " }",
96 "}");
97
98 MT("indent_comma",
99 "[tag foo] {",
100 " [property font-family]: [variable verdana],",
101 " [atom sans-serif];",
102 "}");
103
104 MT("indent_parentheses",
105 "[tag foo]:[variable-3 before] {",
106 " [property background]: [atom url](",
107 "[string blahblah]",
108 "[string etc]",
109 "[string ]) [keyword !important];",
110 "}");
111
112 MT("font_face",
113 "[def @font-face] {",
114 " [property font-family]: [string 'myfont'];",
115 " [error nonsense]: [string 'abc'];",
116 " [property src]: [atom url]([string http://blah]),",
117 " [atom url]([string http://foo]);",
118 "}");
77b7b761 119})();