Skip to content

Commit

Permalink
fix: Select style without hash
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Jan 29, 2024
1 parent 4ecc0d7 commit 3d5b4e2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .dumi/theme/layouts/GlobalLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ const GlobalLayout: React.FC = () => {
motion: !theme.includes('motion-off'),
},
cssVar: true,
hashed: false,
}}
>
<HappyProvider disabled={!theme.includes('happy-work')}>{content}</HappyProvider>
Expand Down
1 change: 1 addition & 0 deletions components/select/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const genBaseStyle: GenerateStyle<SelectToken> = (token) => {
[iconCls]: {
verticalAlign: 'top',
transition: `transform ${token.motionDurationSlow}`,
fontSize: token.fontSizeIcon,

'> svg': {
verticalAlign: 'top',
Expand Down
4 changes: 2 additions & 2 deletions scripts/visual-regression/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ async function boot() {
// compare cssinjs and css-var png from pr
// to the same cssinjs png in `master` branch
const cssInJsImgNames = baseImgFileList
.filter((i) => !i.endsWith('.css-var.png'))
.filter((i) => !i.endsWith('.css-var.png') && !i.endsWith('.css-var-without-hash.png'))
.map((n) => path.basename(n, path.extname(n)));

for (const basename of cssInJsImgNames) {
for (const extname of ['.png', '.css-var.png']) {
for (const extname of ['.png', '.css-var.png', '.css-var-without-hash.png']) {
// baseImg always use cssinjs png
const baseImgName = `${basename}.png`;
const baseImgPath = path.join(baseImgSourceDir, baseImgName);
Expand Down
9 changes: 9 additions & 0 deletions tests/shared/imageTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ export default function imageTest(
<ConfigProvider theme={{ algorithm, cssVar: true }}>{component}</ConfigProvider>
</div>,
);
test(
`[CSS Var without Hash] component image screenshot should correct ${key}`,
`.${key}.css-var-without-hash`,
<div style={{ background: key === 'dark' ? '#000' : '', padding: `24px 12px` }} key={key}>
<ConfigProvider theme={{ algorithm, cssVar: true, hashed: false }}>
{component}
</ConfigProvider>
</div>,
);
});
}

Expand Down

0 comments on commit 3d5b4e2

Please sign in to comment.