|
| 1 | +"use strict"; |
| 2 | + |
| 3 | +function singleValue(nodes) { |
| 4 | + return { |
| 5 | + type: "values", |
| 6 | + nodes: [ |
| 7 | + { |
| 8 | + type: "value", |
| 9 | + nodes: nodes |
| 10 | + } |
| 11 | + ] |
| 12 | + }; |
| 13 | +} |
| 14 | + |
| 15 | +module.exports = { |
| 16 | + "item": [ |
| 17 | + "item", |
| 18 | + singleValue([ |
| 19 | + { type: "item", name: "item" } |
| 20 | + ]) |
| 21 | + ], |
| 22 | + "items": [ |
| 23 | + "item other-item", |
| 24 | + singleValue([ |
| 25 | + { type: "item", name: "item", after: " " }, |
| 26 | + { type: "item", name: "other-item" } |
| 27 | + ]) |
| 28 | + ], |
| 29 | + "multiple values": [ |
| 30 | + "item other-item, second-value 3rd-value ,item", |
| 31 | + { |
| 32 | + type: "values", |
| 33 | + nodes: [ |
| 34 | + { type: "value", nodes: [ |
| 35 | + { type: "item", name: "item", after: " " }, |
| 36 | + { type: "item", name: "other-item" } |
| 37 | + ] }, |
| 38 | + { type: "value", nodes: [ |
| 39 | + { type: "item", name: "second-value", after: " " }, |
| 40 | + { type: "item", name: "3rd-value", after: " " } |
| 41 | + ], before: " " }, |
| 42 | + { type: "value", nodes: [ |
| 43 | + { type: "item", name: "item" } |
| 44 | + ] } |
| 45 | + ] |
| 46 | + } |
| 47 | + ], |
| 48 | + "strings": [ |
| 49 | + "'ab\\'\"c d' \"e\\\" f\"", |
| 50 | + singleValue([ |
| 51 | + { type: "string", value: "ab'\"c d", stringType: "'", after: " " }, |
| 52 | + { type: "string", value: "e\" f", stringType: "\"" } |
| 53 | + ]) |
| 54 | + ], |
| 55 | + "comment": [ |
| 56 | + "item /* hello world */ item", |
| 57 | + singleValue([ |
| 58 | + { type: "item", name: "item", after: " " }, |
| 59 | + { type: "comment", content: " hello world ", after: " " }, |
| 60 | + { type: "item", name: "item" } |
| 61 | + ]) |
| 62 | + ], |
| 63 | + "urls": [ |
| 64 | + "url('ab\\'\"c d') url( \"e\\\" f\" ) url( ghi\\)j\\\"k)", |
| 65 | + singleValue([ |
| 66 | + { type: "url", url: "ab'\"c d", stringType: "'", after: " " }, |
| 67 | + { type: "url", url: "e\" f", stringType: "\"", innerSpacingBefore: " ", innerSpacingAfter: " ", after: " " }, |
| 68 | + { type: "url", url: "ghi)j\"k", innerSpacingBefore: " " } |
| 69 | + ]) |
| 70 | + ], |
| 71 | + "spacing": [ |
| 72 | + " hello\n\t world\t", |
| 73 | + { |
| 74 | + type: "values", |
| 75 | + nodes: [ |
| 76 | + { type: "value", nodes: [ |
| 77 | + { type: "item", name: "hello", after: "\n\t " }, |
| 78 | + { type: "item", name: "world" } |
| 79 | + ], before: " ", after: "\t" } |
| 80 | + ] |
| 81 | + } |
| 82 | + ] |
| 83 | +}; |
0 commit comments