-
-
Notifications
You must be signed in to change notification settings - Fork 604
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
0bdf9b7
commit b190e51
Showing
4 changed files
with
323 additions
and
80 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,202 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`camelCase option dashes: errors 1`] = `Array []`; | ||
|
||
exports[`camelCase option dashes: locals 1`] = ` | ||
Object { | ||
"btn--info_is-disabled_1": "jDvNwV-WRSMB9n2z9QrzR", | ||
"btn-info_is-disabled": "_1XTfjK5gKYeSzbdZhEXRpF", | ||
"btnInfo_isDisabled": "_1XTfjK5gKYeSzbdZhEXRpF", | ||
"btnInfo_isDisabled_1": "jDvNwV-WRSMB9n2z9QrzR", | ||
"foo": "bar", | ||
"my-btn-info_is-disabled": "value", | ||
"myBtnInfo_isDisabled": "value", | ||
"simple": "_1penVf9PMtov2qLxmtsMjq", | ||
} | ||
`; | ||
|
||
exports[`camelCase option dashes: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
1, | ||
"._1XTfjK5gKYeSzbdZhEXRpF { | ||
color: blue; | ||
} | ||
.jDvNwV-WRSMB9n2z9QrzR { | ||
color: blue; | ||
} | ||
._1penVf9PMtov2qLxmtsMjq { | ||
color: red; | ||
} | ||
a { | ||
color: yellow; | ||
} | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`camelCase option dashes: warnings 1`] = `Array []`; | ||
|
||
exports[`camelCase option dashesOnly: errors 1`] = `Array []`; | ||
|
||
exports[`camelCase option dashesOnly: locals 1`] = ` | ||
Object { | ||
"btnInfo_isDisabled": "_1XTfjK5gKYeSzbdZhEXRpF", | ||
"btnInfo_isDisabled_1": "jDvNwV-WRSMB9n2z9QrzR", | ||
"foo": "bar", | ||
"myBtnInfo_isDisabled": "value", | ||
"simple": "_1penVf9PMtov2qLxmtsMjq", | ||
} | ||
`; | ||
|
||
exports[`camelCase option dashesOnly: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
1, | ||
"._1XTfjK5gKYeSzbdZhEXRpF { | ||
color: blue; | ||
} | ||
.jDvNwV-WRSMB9n2z9QrzR { | ||
color: blue; | ||
} | ||
._1penVf9PMtov2qLxmtsMjq { | ||
color: red; | ||
} | ||
a { | ||
color: yellow; | ||
} | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`camelCase option dashesOnly: warnings 1`] = `Array []`; | ||
|
||
exports[`camelCase option not specified: errors 1`] = `Array []`; | ||
|
||
exports[`camelCase option not specified: locals 1`] = ` | ||
Object { | ||
"btn--info_is-disabled_1": "jDvNwV-WRSMB9n2z9QrzR", | ||
"btn-info_is-disabled": "_1XTfjK5gKYeSzbdZhEXRpF", | ||
"foo": "bar", | ||
"my-btn-info_is-disabled": "value", | ||
"simple": "_1penVf9PMtov2qLxmtsMjq", | ||
} | ||
`; | ||
|
||
exports[`camelCase option not specified: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
1, | ||
"._1XTfjK5gKYeSzbdZhEXRpF { | ||
color: blue; | ||
} | ||
.jDvNwV-WRSMB9n2z9QrzR { | ||
color: blue; | ||
} | ||
._1penVf9PMtov2qLxmtsMjq { | ||
color: red; | ||
} | ||
a { | ||
color: yellow; | ||
} | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`camelCase option not specified: warnings 1`] = `Array []`; | ||
|
||
exports[`camelCase option only: errors 1`] = `Array []`; | ||
|
||
exports[`camelCase option only: locals 1`] = ` | ||
Object { | ||
"btnInfoIsDisabled": "_1XTfjK5gKYeSzbdZhEXRpF", | ||
"btnInfoIsDisabled1": "jDvNwV-WRSMB9n2z9QrzR", | ||
"foo": "bar", | ||
"myBtnInfoIsDisabled": "value", | ||
"simple": "_1penVf9PMtov2qLxmtsMjq", | ||
} | ||
`; | ||
|
||
exports[`camelCase option only: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
1, | ||
"._1XTfjK5gKYeSzbdZhEXRpF { | ||
color: blue; | ||
} | ||
.jDvNwV-WRSMB9n2z9QrzR { | ||
color: blue; | ||
} | ||
._1penVf9PMtov2qLxmtsMjq { | ||
color: red; | ||
} | ||
a { | ||
color: yellow; | ||
} | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`camelCase option only: warnings 1`] = `Array []`; | ||
|
||
exports[`camelCase option true: errors 1`] = `Array []`; | ||
|
||
exports[`camelCase option true: locals 1`] = ` | ||
Object { | ||
"btn--info_is-disabled_1": "jDvNwV-WRSMB9n2z9QrzR", | ||
"btn-info_is-disabled": "_1XTfjK5gKYeSzbdZhEXRpF", | ||
"btnInfoIsDisabled": "_1XTfjK5gKYeSzbdZhEXRpF", | ||
"btnInfoIsDisabled1": "jDvNwV-WRSMB9n2z9QrzR", | ||
"foo": "bar", | ||
"my-btn-info_is-disabled": "value", | ||
"myBtnInfoIsDisabled": "value", | ||
"simple": "_1penVf9PMtov2qLxmtsMjq", | ||
} | ||
`; | ||
|
||
exports[`camelCase option true: module (evaluated) 1`] = ` | ||
Array [ | ||
Array [ | ||
1, | ||
"._1XTfjK5gKYeSzbdZhEXRpF { | ||
color: blue; | ||
} | ||
.jDvNwV-WRSMB9n2z9QrzR { | ||
color: blue; | ||
} | ||
._1penVf9PMtov2qLxmtsMjq { | ||
color: red; | ||
} | ||
a { | ||
color: yellow; | ||
} | ||
", | ||
"", | ||
], | ||
] | ||
`; | ||
|
||
exports[`camelCase option true: warnings 1`] = `Array []`; |
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,101 @@ | ||
const { webpack, evaluated } = require('./helpers'); | ||
|
||
describe('camelCase option', () => { | ||
it('true', async () => { | ||
const config = { | ||
loader: { | ||
options: { | ||
modules: true, | ||
camelCase: true, | ||
}, | ||
}, | ||
}; | ||
const testId = './modules/camelCase.css'; | ||
const stats = await webpack(testId, config); | ||
const { modules } = stats.toJson(); | ||
const module = modules.find((m) => m.id === testId); | ||
const evaluatedModule = evaluated(module.source); | ||
|
||
expect(evaluatedModule).toMatchSnapshot('module (evaluated)'); | ||
expect(evaluatedModule.locals).toMatchSnapshot('locals'); | ||
expect(stats.compilation.warnings).toMatchSnapshot('warnings'); | ||
expect(stats.compilation.errors).toMatchSnapshot('errors'); | ||
}); | ||
|
||
it('not specified', async () => { | ||
const config = { loader: { options: { modules: true } } }; | ||
const testId = './modules/camelCase.css'; | ||
const stats = await webpack(testId, config); | ||
const { modules } = stats.toJson(); | ||
const module = modules.find((m) => m.id === testId); | ||
const evaluatedModule = evaluated(module.source); | ||
|
||
expect(evaluatedModule).toMatchSnapshot('module (evaluated)'); | ||
expect(evaluatedModule.locals).toMatchSnapshot('locals'); | ||
expect(stats.compilation.warnings).toMatchSnapshot('warnings'); | ||
expect(stats.compilation.errors).toMatchSnapshot('errors'); | ||
}); | ||
|
||
it('dashes', async () => { | ||
const config = { | ||
loader: { | ||
options: { | ||
modules: true, | ||
camelCase: 'dashes', | ||
}, | ||
}, | ||
}; | ||
const testId = './modules/camelCase.css'; | ||
const stats = await webpack(testId, config); | ||
const { modules } = stats.toJson(); | ||
const module = modules.find((m) => m.id === testId); | ||
const evaluatedModule = evaluated(module.source); | ||
|
||
expect(evaluatedModule).toMatchSnapshot('module (evaluated)'); | ||
expect(evaluatedModule.locals).toMatchSnapshot('locals'); | ||
expect(stats.compilation.warnings).toMatchSnapshot('warnings'); | ||
expect(stats.compilation.errors).toMatchSnapshot('errors'); | ||
}); | ||
|
||
it('only', async () => { | ||
const config = { | ||
loader: { | ||
options: { | ||
modules: true, | ||
camelCase: 'only', | ||
}, | ||
}, | ||
}; | ||
const testId = './modules/camelCase.css'; | ||
const stats = await webpack(testId, config); | ||
const { modules } = stats.toJson(); | ||
const module = modules.find((m) => m.id === testId); | ||
const evaluatedModule = evaluated(module.source); | ||
|
||
expect(evaluatedModule).toMatchSnapshot('module (evaluated)'); | ||
expect(evaluatedModule.locals).toMatchSnapshot('locals'); | ||
expect(stats.compilation.warnings).toMatchSnapshot('warnings'); | ||
expect(stats.compilation.errors).toMatchSnapshot('errors'); | ||
}); | ||
|
||
it('dashesOnly', async () => { | ||
const config = { | ||
loader: { | ||
options: { | ||
modules: true, | ||
camelCase: 'dashesOnly', | ||
}, | ||
}, | ||
}; | ||
const testId = './modules/camelCase.css'; | ||
const stats = await webpack(testId, config); | ||
const { modules } = stats.toJson(); | ||
const module = modules.find((m) => m.id === testId); | ||
const evaluatedModule = evaluated(module.source); | ||
|
||
expect(evaluatedModule).toMatchSnapshot('module (evaluated)'); | ||
expect(evaluatedModule.locals).toMatchSnapshot('locals'); | ||
expect(stats.compilation.warnings).toMatchSnapshot('warnings'); | ||
expect(stats.compilation.errors).toMatchSnapshot('errors'); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.