Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50665 views
1
// CodeMirror, copyright (c) by Marijn Haverbeke and others
2
// Distributed under an MIT license: http://codemirror.net/LICENSE
3
4
(function() {
5
var mode = CodeMirror.getMode({indentUnit: 2}, "css");
6
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
7
8
// Error, because "foobarhello" is neither a known type or property, but
9
// property was expected (after "and"), and it should be in parenthese.
10
MT("atMediaUnknownType",
11
"[def @media] [attribute screen] [keyword and] [error foobarhello] { }");
12
13
// Soft error, because "foobarhello" is not a known property or type.
14
MT("atMediaUnknownProperty",
15
"[def @media] [attribute screen] [keyword and] ([error foobarhello]) { }");
16
17
// Make sure nesting works with media queries
18
MT("atMediaMaxWidthNested",
19
"[def @media] [attribute screen] [keyword and] ([property max-width]: [number 25px]) { [tag foo] { } }");
20
21
MT("tagSelector",
22
"[tag foo] { }");
23
24
MT("classSelector",
25
"[qualifier .foo-bar_hello] { }");
26
27
MT("idSelector",
28
"[builtin #foo] { [error #foo] }");
29
30
MT("tagSelectorUnclosed",
31
"[tag foo] { [property margin]: [number 0] } [tag bar] { }");
32
33
MT("tagStringNoQuotes",
34
"[tag foo] { [property font-family]: [variable hello] [variable world]; }");
35
36
MT("tagStringDouble",
37
"[tag foo] { [property font-family]: [string \"hello world\"]; }");
38
39
MT("tagStringSingle",
40
"[tag foo] { [property font-family]: [string 'hello world']; }");
41
42
MT("tagColorKeyword",
43
"[tag foo] {",
44
" [property color]: [keyword black];",
45
" [property color]: [keyword navy];",
46
" [property color]: [keyword yellow];",
47
"}");
48
49
MT("tagColorHex3",
50
"[tag foo] { [property background]: [atom #fff]; }");
51
52
MT("tagColorHex6",
53
"[tag foo] { [property background]: [atom #ffffff]; }");
54
55
MT("tagColorHex4",
56
"[tag foo] { [property background]: [atom&error #ffff]; }");
57
58
MT("tagColorHexInvalid",
59
"[tag foo] { [property background]: [atom&error #ffg]; }");
60
61
MT("tagNegativeNumber",
62
"[tag foo] { [property margin]: [number -5px]; }");
63
64
MT("tagPositiveNumber",
65
"[tag foo] { [property padding]: [number 5px]; }");
66
67
MT("tagVendor",
68
"[tag foo] { [meta -foo-][property box-sizing]: [meta -foo-][atom border-box]; }");
69
70
MT("tagBogusProperty",
71
"[tag foo] { [property&error barhelloworld]: [number 0]; }");
72
73
MT("tagTwoProperties",
74
"[tag foo] { [property margin]: [number 0]; [property padding]: [number 0]; }");
75
76
MT("tagTwoPropertiesURL",
77
"[tag foo] { [property background]: [atom url]([string //example.com/foo.png]); [property padding]: [number 0]; }");
78
79
MT("commentSGML",
80
"[comment <!--comment-->]");
81
82
MT("commentSGML2",
83
"[comment <!--comment]",
84
"[comment -->] [tag div] {}");
85
86
MT("indent_tagSelector",
87
"[tag strong], [tag em] {",
88
" [property background]: [atom rgba](",
89
" [number 255], [number 255], [number 0], [number .2]",
90
" );",
91
"}");
92
93
MT("indent_atMedia",
94
"[def @media] {",
95
" [tag foo] {",
96
" [property color]:",
97
" [keyword yellow];",
98
" }",
99
"}");
100
101
MT("indent_comma",
102
"[tag foo] {",
103
" [property font-family]: [variable verdana],",
104
" [atom sans-serif];",
105
"}");
106
107
MT("indent_parentheses",
108
"[tag foo]:[variable-3 before] {",
109
" [property background]: [atom url](",
110
"[string blahblah]",
111
"[string etc]",
112
"[string ]) [keyword !important];",
113
"}");
114
115
MT("font_face",
116
"[def @font-face] {",
117
" [property font-family]: [string 'myfont'];",
118
" [error nonsense]: [string 'abc'];",
119
" [property src]: [atom url]([string http://blah]),",
120
" [atom url]([string http://foo]);",
121
"}");
122
123
MT("empty_url",
124
"[def @import] [tag url]() [tag screen];");
125
126
MT("parens",
127
"[qualifier .foo] {",
128
" [property background-image]: [variable fade]([atom #000], [number 20%]);",
129
" [property border-image]: [variable linear-gradient](",
130
" [atom to] [atom bottom],",
131
" [variable fade]([atom #000], [number 20%]) [number 0%],",
132
" [variable fade]([atom #000], [number 20%]) [number 100%]",
133
" );",
134
"}");
135
})();
136
137