-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(builder): remove extra quote from generated CSS module types (#4639)
- Loading branch information
1 parent
9f90277
commit de9cdee
Showing
6 changed files
with
44 additions
and
7 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,7 @@ | ||
--- | ||
'@modern-js/builder-shared': patch | ||
--- | ||
|
||
fix(builder): remove extra quote from generated CSS module types | ||
|
||
fix(builder): 移除生成的 CSS module 类型中多余的引号 |
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
20 changes: 20 additions & 0 deletions
20
packages/builder/builder-shared/tests/loaders/wrapQuotes.test.ts
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,20 @@ | ||
import { expect, it } from 'vitest'; | ||
import { wrapQuotes } from '../../src/loaders/css-modules-typescript-loader'; | ||
|
||
it('should wrap key correctly', () => { | ||
// do not need wrap | ||
expect(wrapQuotes('foo')).toBe(`foo`); | ||
expect(wrapQuotes('f1o')).toBe(`f1o`); | ||
expect(wrapQuotes('Foo')).toBe(`Foo`); | ||
expect(wrapQuotes('$foo')).toBe(`$foo`); | ||
expect(wrapQuotes('_foo')).toBe(`_foo`); | ||
expect(wrapQuotes('foo1')).toBe(`foo1`); | ||
expect(wrapQuotes('fooBar')).toBe(`fooBar`); | ||
|
||
// need wrap | ||
expect(wrapQuotes('#foo')).toBe(`'#foo'`); | ||
expect(wrapQuotes('1foo')).toBe(`'1foo'`); | ||
expect(wrapQuotes('-bar')).toBe(`'-bar'`); | ||
expect(wrapQuotes('foo-bar')).toBe(`'foo-bar'`); | ||
expect(wrapQuotes('foo~bar')).toBe(`'foo~bar'`); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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