all repos — NoPaste @ 29b774f090102303e43cf939b38ac2083e62d9f1

Resurrected - The PussTheCat.org fork of NoPaste

scripts/CodeMirror/mode/css/less_test.js (view raw)

 1// CodeMirror, copyright (c) by Marijn Haverbeke and others
 2// Distributed under an MIT license: https://codemirror.net/LICENSE
 3
 4(function() {
 5  "use strict";
 6
 7  var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-less");
 8  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "less"); }
 9
10  MT("variable",
11     "[variable-2 @base]: [atom #f04615];",
12     "[qualifier .class] {",
13     "  [property width]: [variable&callee percentage]([number 0.5]); [comment // returns `50%`]",
14     "  [property color]: [variable&callee saturate]([variable-2 @base], [number 5%]);",
15     "}");
16
17  MT("amp",
18     "[qualifier .child], [qualifier .sibling] {",
19     "  [qualifier .parent] [atom &] {",
20     "    [property color]: [keyword black];",
21     "  }",
22     "  [atom &] + [atom &] {",
23     "    [property color]: [keyword red];",
24     "  }",
25     "}");
26
27  MT("mixin",
28     "[qualifier .mixin] ([variable dark]; [variable-2 @color]) {",
29     "  [property color]: [variable&callee darken]([variable-2 @color], [number 10%]);",
30     "}",
31     "[qualifier .mixin] ([variable light]; [variable-2 @color]) {",
32     "  [property color]: [variable&callee lighten]([variable-2 @color], [number 10%]);",
33     "}",
34     "[qualifier .mixin] ([variable-2 @_]; [variable-2 @color]) {",
35     "  [property display]: [atom block];",
36     "}",
37     "[variable-2 @switch]: [variable light];",
38     "[qualifier .class] {",
39     "  [qualifier .mixin]([variable-2 @switch]; [atom #888]);",
40     "}");
41
42  MT("nest",
43     "[qualifier .one] {",
44     "  [def @media] ([property width]: [number 400px]) {",
45     "    [property font-size]: [number 1.2em];",
46     "    [def @media] [attribute print] [keyword and] [property color] {",
47     "      [property color]: [keyword blue];",
48     "    }",
49     "  }",
50     "}");
51
52
53  MT("interpolation", ".@{[variable foo]} { [property font-weight]: [atom bold]; }");
54})();