Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
malwaredllc
GitHub Repository: malwaredllc/byob
Path: blob/master/web-gui/buildyourownbotnet/assets/js/codemirror/mode/css/test.js
1294 views
1
(function() {
2
var mode = CodeMirror.getMode({indentUnit: 2}, "css");
3
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
4
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",
8
"[def @media] [attribute screen] [keyword and] [error foobarhello] { }");
9
10
// Soft error, because "foobarhello" is not a known property or type.
11
MT("atMediaUnknownProperty",
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] { } }");
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",
28
"[tag foo] { [property margin]: [number 0] } [tag bar] { }");
29
30
MT("tagStringNoQuotes",
31
"[tag foo] { [property font-family]: [variable hello] [variable world]; }");
32
33
MT("tagStringDouble",
34
"[tag foo] { [property font-family]: [string \"hello world\"]; }");
35
36
MT("tagStringSingle",
37
"[tag foo] { [property font-family]: [string 'hello world']; }");
38
39
MT("tagColorKeyword",
40
"[tag foo] {",
41
" [property color]: [keyword black];",
42
" [property color]: [keyword navy];",
43
" [property color]: [keyword yellow];",
44
"}");
45
46
MT("tagColorHex3",
47
"[tag foo] { [property background]: [atom #fff]; }");
48
49
MT("tagColorHex6",
50
"[tag foo] { [property background]: [atom #ffffff]; }");
51
52
MT("tagColorHex4",
53
"[tag foo] { [property background]: [atom&error #ffff]; }");
54
55
MT("tagColorHexInvalid",
56
"[tag foo] { [property background]: [atom&error #ffg]; }");
57
58
MT("tagNegativeNumber",
59
"[tag foo] { [property margin]: [number -5px]; }");
60
61
MT("tagPositiveNumber",
62
"[tag foo] { [property padding]: [number 5px]; }");
63
64
MT("tagVendor",
65
"[tag foo] { [meta -foo-][property box-sizing]: [meta -foo-][atom border-box]; }");
66
67
MT("tagBogusProperty",
68
"[tag foo] { [property&error barhelloworld]: [number 0]; }");
69
70
MT("tagTwoProperties",
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]; }");
75
76
MT("commentSGML",
77
"[comment <!--comment-->]");
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
"}");
119
})();
120
121