|
1 | 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
|
2 | 2 |
|
| 3 | +exports[`loader basic (css endpoint): errors 1`] = `Array []`; |
| 4 | + |
| 5 | +exports[`loader basic (css endpoint): module 1`] = ` |
| 6 | +Array [ |
| 7 | + Array [ |
| 8 | + 1, |
| 9 | + "@charset \\"UTF-8\\"; |
| 10 | +
|
| 11 | +.class { |
| 12 | + color: red; |
| 13 | + background: url({./url/img.png}); |
| 14 | +} |
| 15 | +
|
| 16 | +.u-m\\\\+ { |
| 17 | + a: b c d; |
| 18 | +} |
| 19 | +
|
| 20 | +.grid.\\\\-top { |
| 21 | + a: b c d; |
| 22 | +} |
| 23 | +
|
| 24 | +.u-m\\\\00002b { |
| 25 | + a: b c d; |
| 26 | +} |
| 27 | +
|
| 28 | +.class { |
| 29 | + content: '\\"\\\\\\\\f10c\\"'; |
| 30 | +} |
| 31 | +
|
| 32 | +.class { |
| 33 | + font-family: '微软雅黑'; |
| 34 | +} |
| 35 | +
|
| 36 | +.class { |
| 37 | + content: '\\\\e901'; |
| 38 | +} |
| 39 | +
|
| 40 | +.class { |
| 41 | + content: \\"\\\\F10C\\" |
| 42 | +} |
| 43 | +
|
| 44 | +.class { |
| 45 | + content: \\"\\\\f10C\\" |
| 46 | +} |
| 47 | +
|
| 48 | +.class { |
| 49 | + content: \\"\\\\F10C \\\\F10D\\" |
| 50 | +} |
| 51 | +
|
| 52 | +:root { |
| 53 | + --foo: 1px; |
| 54 | + --bar: 2px; |
| 55 | +} |
| 56 | +
|
| 57 | +:root { |
| 58 | + --title-align: center; |
| 59 | + --sr-only: { |
| 60 | + position: absolute; |
| 61 | + width: 1px; |
| 62 | + height: 1px; |
| 63 | + padding: 0; |
| 64 | + overflow: hidden; |
| 65 | + clip: rect(0,0,0,0); |
| 66 | + white-space: nowrap; |
| 67 | + clip-path: inset(50%); |
| 68 | + border: 0; |
| 69 | + }; |
| 70 | +} |
| 71 | +", |
| 72 | + "", |
| 73 | + ], |
| 74 | +] |
| 75 | +`; |
| 76 | + |
| 77 | +exports[`loader basic (css endpoint): runtime 1`] = ` |
| 78 | +"'use strict'; |
| 79 | +
|
| 80 | +/* eslint-disable */ |
| 81 | +
|
| 82 | +// CSS Loader (Runtime) |
| 83 | +module.exports = function (useSourceMap) { |
| 84 | + const list = []; |
| 85 | +
|
| 86 | + // Return the list of modules as css string |
| 87 | + list.toString = function toString() { |
| 88 | + return this.map(function (item) { |
| 89 | + const content = cssWithMappingToString(item, useSourceMap); |
| 90 | +
|
| 91 | + if (item[2]) { |
| 92 | + return '@media ' + item[2] + '{' + content + '}'; |
| 93 | + } |
| 94 | +
|
| 95 | + return content; |
| 96 | + }).join(''); |
| 97 | + }; |
| 98 | +
|
| 99 | + // Import a list of modules into the list |
| 100 | + list.i = function (modules, mediaQuery) { |
| 101 | + if (typeof modules === 'string') { |
| 102 | + modules = [[null, modules, '']]; |
| 103 | + } |
| 104 | +
|
| 105 | + const isImported = {}; |
| 106 | +
|
| 107 | + for (let i = 0; i < this.length; i++) { |
| 108 | + const id = this[i][0]; |
| 109 | +
|
| 110 | + if (typeof id === 'number') { |
| 111 | + isImported[id] = true; |
| 112 | + } |
| 113 | + } |
| 114 | +
|
| 115 | + for (let i = 0; i < modules.length; i++) { |
| 116 | + const item = modules[i]; |
| 117 | +
|
| 118 | + // Skip already imported module. |
| 119 | + // This implementation is not 100% perfect for weird media query combinations |
| 120 | + // when a module is imported multiple times with different media queries. |
| 121 | + // I hope this will never occur (Hey this way we have smaller bundles). |
| 122 | + if (typeof item[0] !== 'number' || !isImported[item[0]]) { |
| 123 | + if (mediaQuery && !item[2]) { |
| 124 | + item[2] = mediaQuery; |
| 125 | + } else if (mediaQuery) { |
| 126 | + item[2] = '(' + item[2] + ') and (' + mediaQuery + ')'; |
| 127 | + } |
| 128 | +
|
| 129 | + list.push(item); |
| 130 | + } |
| 131 | + } |
| 132 | + }; |
| 133 | +
|
| 134 | + return list; |
| 135 | +}; |
| 136 | +
|
| 137 | +function cssWithMappingToString(item, useSourceMap) { |
| 138 | + const content = item[1] || ''; |
| 139 | + const sourceMap = item[3]; |
| 140 | +
|
| 141 | + if (!sourceMap) { |
| 142 | + return content; |
| 143 | + } |
| 144 | +
|
| 145 | + if (useSourceMap && typeof btoa === 'function') { |
| 146 | + const sourceMapping = toComment(sourceMap); |
| 147 | + const sourceURLs = sourceMap.sources.map(function (source) { |
| 148 | + return '/*# sourceURL=' + sourceMap.sourceRoot + source + ' */'; |
| 149 | + }); |
| 150 | +
|
| 151 | + return [content].concat(sourceURLs).concat([sourceMapping]).join('\\\\n'); |
| 152 | + } |
| 153 | +
|
| 154 | + return [content].join('\\\\n'); |
| 155 | +} |
| 156 | +
|
| 157 | +// Adapted from convert-source-map (MIT) |
| 158 | +function toComment(sourceMap) { |
| 159 | + // eslint-disable-next-line no-undef |
| 160 | + const base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); |
| 161 | + const data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; |
| 162 | +
|
| 163 | + return '/*# ' + data + ' */'; |
| 164 | +}" |
| 165 | +`; |
| 166 | + |
| 167 | +exports[`loader basic (css endpoint): runtimeEscape 1`] = ` |
| 168 | +"'use strict'; |
| 169 | +
|
| 170 | +/* eslint-disable */ |
| 171 | +
|
| 172 | +module.exports = function escape(url) { |
| 173 | + if (typeof url !== 'string') { |
| 174 | + return url; |
| 175 | + } |
| 176 | +
|
| 177 | + // If url is already wrapped in quotes, remove them |
| 178 | + if (/^['\\"].*['\\"]$/.test(url)) { |
| 179 | + url = url.slice(1, -1); |
| 180 | + } |
| 181 | +
|
| 182 | + // Should url be wrapped? |
| 183 | + // See https://drafts.csswg.org/css-values-3/#urls |
| 184 | + if (/[\\"'() \\\\t\\\\n]/.test(url)) { |
| 185 | + return '\\"' + url.replace(/\\"/g, '\\\\\\\\\\"').replace(/\\\\n/g, '\\\\\\\\n') + '\\"'; |
| 186 | + } |
| 187 | +
|
| 188 | + return url; |
| 189 | +};" |
| 190 | +`; |
| 191 | + |
| 192 | +exports[`loader basic (css endpoint): warnings 1`] = `Array []`; |
| 193 | + |
3 | 194 | exports[`loader basic: errors 1`] = `Array []`;
|
4 | 195 |
|
5 | 196 | exports[`loader basic: module 1`] = `
|
|
0 commit comments