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