|
1 | | -'use strict'; |
| 1 | +"use strict"; |
2 | 2 |
|
3 | | -const genericNames = require('../index'); |
4 | | -const test = require('tape'); |
5 | | -const path = require('path'); |
| 3 | +const genericNames = require("../index"); |
| 4 | +const test = require("tape"); |
| 5 | +const path = require("path"); |
6 | 6 |
|
7 | 7 | // According to the CSS spec, identifiers cannot |
8 | 8 | // start with a digit, two hyphens, or a hyphen |
9 | 9 | // followed by a digit. |
10 | 10 | // |
11 | 11 | // relates: https://github.com/webpack/css-loader/commit/da27c07d0df25a38699344c13b6614c53a469fd9 |
12 | 12 |
|
13 | | -test('identity', t => { |
14 | | - const generate = genericNames('[local]'); |
| 13 | +test("identity", t => { |
| 14 | + const generate = genericNames("[local]"); |
15 | 15 |
|
16 | | - t.equal(generate('foo', path.join(__dirname, 'test/case/source.css')), 'foo'); |
| 16 | + t.equal(generate("foo", path.join(__dirname, "test/case/source.css")), "foo"); |
17 | 17 | t.end(); |
18 | 18 | }); |
19 | 19 |
|
20 | | -test('leading digit', t => { |
21 | | - const generate = genericNames('0[local]'); |
| 20 | +test("leading digit", t => { |
| 21 | + const generate = genericNames("0[local]"); |
22 | 22 |
|
23 | | - t.equal(generate('foo', path.join(__dirname, 'test/case/source.css')), '_0foo'); |
| 23 | + t.equal( |
| 24 | + generate("foo", path.join(__dirname, "test/case/source.css")), |
| 25 | + "_0foo" |
| 26 | + ); |
24 | 27 | t.end(); |
25 | 28 | }); |
26 | 29 |
|
27 | | -test('leading digit in the token', t => { |
28 | | - const generate = genericNames('[local]'); |
| 30 | +test("leading digit in the token", t => { |
| 31 | + const generate = genericNames("[local]"); |
29 | 32 |
|
30 | | - t.equal(generate('0foo', path.join(__dirname, 'test/case/source.css')), '_0foo'); |
| 33 | + t.equal( |
| 34 | + generate("0foo", path.join(__dirname, "test/case/source.css")), |
| 35 | + "_0foo" |
| 36 | + ); |
31 | 37 | t.end(); |
32 | 38 | }); |
33 | 39 |
|
34 | | -test('leading two hyphens', t => { |
35 | | - const generate = genericNames('--[local]'); |
| 40 | +test("leading two hyphens", t => { |
| 41 | + const generate = genericNames("--[local]"); |
36 | 42 |
|
37 | | - t.equal(generate('foo', path.join(__dirname, 'test/case/source.css')), '_--foo'); |
| 43 | + t.equal( |
| 44 | + generate("foo", path.join(__dirname, "test/case/source.css")), |
| 45 | + "_--foo" |
| 46 | + ); |
38 | 47 | t.end(); |
39 | 48 | }); |
40 | 49 |
|
41 | | -test('leading hyphen and digit', t => { |
42 | | - const generate = genericNames('-0[local]'); |
| 50 | +test("leading hyphen and digit", t => { |
| 51 | + const generate = genericNames("-0[local]"); |
43 | 52 |
|
44 | | - t.equal(generate('foo', path.join(__dirname, 'test/case/source.css')), '_-0foo'); |
| 53 | + t.equal( |
| 54 | + generate("foo", path.join(__dirname, "test/case/source.css")), |
| 55 | + "_-0foo" |
| 56 | + ); |
45 | 57 | t.end(); |
46 | 58 | }); |
0 commit comments