Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a68bb4
commit d54216b
Showing
12 changed files
with
243 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ICSS case duplicate-export: errors 1`] = `Array []`; | ||
|
||
exports[`ICSS case duplicate-export: locals 1`] = ` | ||
Object { | ||
"_test": "_right_value", | ||
} | ||
`; | ||
|
||
exports[`ICSS case duplicate-export: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
1, | ||
" | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`ICSS case duplicate-export: warnings 1`] = `Array []`; | ||
|
||
exports[`ICSS case duplicate-export-in-multiple-export: errors 1`] = `Array []`; | ||
|
||
exports[`ICSS case duplicate-export-in-multiple-export: locals 1`] = ` | ||
Object { | ||
"_test": "_right_value", | ||
} | ||
`; | ||
|
||
exports[`ICSS case duplicate-export-in-multiple-export: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
1, | ||
" | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`ICSS case duplicate-export-in-multiple-export: warnings 1`] = `Array []`; | ||
|
||
exports[`ICSS case empty-export: errors 1`] = `Array []`; | ||
|
||
exports[`ICSS case empty-export: locals 1`] = `undefined`; | ||
|
||
exports[`ICSS case empty-export: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
1, | ||
" | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`ICSS case empty-export: warnings 1`] = `Array []`; | ||
|
||
exports[`ICSS case empty-import: errors 1`] = `Array []`; | ||
|
||
exports[`ICSS case empty-import: locals 1`] = `undefined`; | ||
|
||
exports[`ICSS case empty-import: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
1, | ||
" | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`ICSS case empty-import: warnings 1`] = `Array []`; | ||
|
||
exports[`ICSS case export: errors 1`] = `Array []`; | ||
|
||
exports[`ICSS case export: locals 1`] = ` | ||
Object { | ||
"_test": "_test", | ||
} | ||
`; | ||
|
||
exports[`ICSS case export: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
1, | ||
" | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`ICSS case export: warnings 1`] = `Array []`; | ||
|
||
exports[`ICSS case import: errors 1`] = `Array []`; | ||
|
||
exports[`ICSS case import: locals 1`] = ` | ||
Object { | ||
"primary-color": "red", | ||
} | ||
`; | ||
|
||
exports[`ICSS case import: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
2, | ||
" | ||
", | ||
"", | ||
], | ||
Array [ | ||
1, | ||
".className { | ||
color: red; | ||
} | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`ICSS case import: warnings 1`] = `Array []`; | ||
|
||
exports[`ICSS case multiple-export: errors 1`] = `Array []`; | ||
|
||
exports[`ICSS case multiple-export: locals 1`] = ` | ||
Object { | ||
"_foo": "_bar", | ||
"_test": "_test", | ||
} | ||
`; | ||
|
||
exports[`ICSS case multiple-export: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
1, | ||
" | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`ICSS case multiple-export: warnings 1`] = `Array []`; | ||
|
||
exports[`ICSS case multiple-keys-values-in-export: errors 1`] = `Array []`; | ||
|
||
exports[`ICSS case multiple-keys-values-in-export: locals 1`] = ` | ||
Object { | ||
"_test": "_test", | ||
"_test1": "1", | ||
"_test2": "'string'", | ||
"_test3": "1px 2px 3px", | ||
"_test4": "1px 2px 3px, 1px 2px 3px", | ||
} | ||
`; | ||
|
||
exports[`ICSS case multiple-keys-values-in-export: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
1, | ||
" | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`ICSS case multiple-keys-values-in-export: warnings 1`] = `Array []`; |
7 changes: 7 additions & 0 deletions
7
test/fixtures/icss/tests-cases/duplicate-export-in-multiple-export/source.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
:export { | ||
_test: _test; | ||
} | ||
|
||
:export { | ||
_test: _right_value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:export { | ||
_test: _test; | ||
_test: _right_value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
:export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
:import("./vars.css") {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:export { | ||
_test: _test | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
:import("./vars.css") { | ||
IMPORTED_NAME: primary-color; | ||
} | ||
|
||
.className { | ||
color: IMPORTED_NAME; | ||
} | ||
|
||
:export { | ||
primary-color: IMPORTED_NAME | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:export { | ||
primary-color: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
:export { | ||
_test: _test | ||
} | ||
|
||
:export { | ||
_foo: _bar | ||
} |
7 changes: 7 additions & 0 deletions
7
test/fixtures/icss/tests-cases/multiple-keys-values-in-export/source.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
:export { | ||
_test: _test; | ||
_test1: 1; | ||
_test2: 'string'; | ||
_test3: 1px 2px 3px; | ||
_test4: 1px 2px 3px, 1px 2px 3px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
const { webpack, evaluated } = require('./helpers'); | ||
|
||
const testCasesPath = path.join(__dirname, 'fixtures/icss/tests-cases'); | ||
const testCases = fs.readdirSync(testCasesPath); | ||
|
||
describe('ICSS', () => { | ||
testCases.forEach((name) => { | ||
it(`case ${name}`, async () => { | ||
const testId = `./icss/tests-cases/${name}/source.css`; | ||
const stats = await webpack(testId); | ||
const { modules } = stats.toJson(); | ||
const module = modules.find((m) => m.id === testId); | ||
const evaluatedModule = evaluated(module.source, modules); | ||
|
||
expect(evaluatedModule).toMatchSnapshot('module (evaluated)'); | ||
expect(evaluatedModule.locals).toMatchSnapshot('locals'); | ||
expect(stats.compilation.warnings).toMatchSnapshot('warnings'); | ||
expect(stats.compilation.errors).toMatchSnapshot('errors'); | ||
}); | ||
}); | ||
}); |