Skip to content

Commit 53ae917

Browse files
fix(button): add class when the shape props is rectangle (#5187)
* fix(button): add class when the shape props is rectangle closed #5186 * chore: update snapshot --------- Co-authored-by: Saraph1nes <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent ae5ec91 commit 53ae917

File tree

12 files changed

+1727
-1715
lines changed

12 files changed

+1727
-1715
lines changed

internal/utils/types/src/exec.d.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { SyncOptions } from 'execa';
2-
declare const run: (
3-
command: string,
4-
options?: SyncOptions,
5-
) => Promise<{
6-
stdout: string;
7-
stderr: string;
2+
declare const run: (command: string, options?: SyncOptions) => Promise<{
3+
stdout: string;
4+
stderr: string;
85
}>;
96
export { run };

packages/components/button/__tests__/__snapshots__/index.test.jsx.snap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`Button > :props > :block 1`] = `
44
<button
5-
class="t-button t-button--variant-base t-button--theme-primary t-size-full-width"
5+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-size-full-width"
66
href=""
77
tabindex="0"
88
type="button"
@@ -20,7 +20,7 @@ exports[`Button > :props > :block 1`] = `
2020
exports[`Button > :props > :content 1`] = `
2121
<div>
2222
<button
23-
class="t-button t-button--variant-base t-button--theme-primary"
23+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
2424
href=""
2525
tabindex="0"
2626
type="button"
@@ -34,7 +34,7 @@ exports[`Button > :props > :content 1`] = `
3434
</span>
3535
</button>
3636
<button
37-
class="t-button t-button--variant-base t-button--theme-primary"
37+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
3838
href=""
3939
tabindex="0"
4040
type="button"
@@ -48,7 +48,7 @@ exports[`Button > :props > :content 1`] = `
4848
</span>
4949
</button>
5050
<button
51-
class="t-button t-button--variant-base t-button--theme-primary"
51+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
5252
href=""
5353
tabindex="0"
5454
type="button"
@@ -60,7 +60,7 @@ exports[`Button > :props > :content 1`] = `
6060
</span>
6161
</button>
6262
<button
63-
class="t-button t-button--variant-base t-button--theme-primary"
63+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
6464
href=""
6565
tabindex="0"
6666
type="button"
@@ -72,7 +72,7 @@ exports[`Button > :props > :content 1`] = `
7272
</span>
7373
</button>
7474
<button
75-
class="t-button t-button--variant-base t-button--theme-primary"
75+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
7676
href=""
7777
tabindex="0"
7878
type="button"
@@ -90,7 +90,7 @@ exports[`Button > :props > :content 1`] = `
9090

9191
exports[`Button > :props > :disabled 1`] = `
9292
<button
93-
class="t-button t-button--variant-base t-button--theme-primary t-is-disabled"
93+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-is-disabled"
9494
disabled=""
9595
href=""
9696
type="button"
@@ -107,7 +107,7 @@ exports[`Button > :props > :disabled 1`] = `
107107

108108
exports[`Button > :props > :icon function 1`] = `
109109
<button
110-
class="t-button t-button--variant-base t-button--theme-primary t-button--icon-only"
110+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-button--icon-only"
111111
href=""
112112
tabindex="0"
113113
type="button"
@@ -123,7 +123,7 @@ exports[`Button > :props > :icon function 1`] = `
123123

124124
exports[`Button > :props > :loading 1`] = `
125125
<button
126-
class="t-button t-button--variant-base t-button--theme-primary t-is-loading"
126+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-is-loading"
127127
disabled=""
128128
href=""
129129
tabindex="0"
@@ -185,7 +185,7 @@ exports[`Button > :props > :shape 1`] = `
185185

186186
exports[`Button > :props > :size 1`] = `
187187
<button
188-
class="t-button t-button--variant-base t-button--theme-primary t-size-l"
188+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-size-l"
189189
href=""
190190
tabindex="0"
191191
type="button"
@@ -202,7 +202,7 @@ exports[`Button > :props > :size 1`] = `
202202

203203
exports[`Button > :props > :variant 1`] = `
204204
<button
205-
class="t-button t-button--variant-base t-button--theme-primary"
205+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
206206
href=""
207207
tabindex="0"
208208
type="button"
@@ -219,7 +219,7 @@ exports[`Button > :props > :variant 1`] = `
219219

220220
exports[`Button > <slot> > <icon> 1`] = `
221221
<button
222-
class="t-button t-button--variant-base t-button--theme-primary t-button--icon-only"
222+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-button--icon-only"
223223
href=""
224224
tabindex="0"
225225
type="button"

packages/components/button/__tests__/__snapshots__/vitest-button.test.jsx.snap

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`Button Component > props.block works fine 1`] = `
44
<button
5-
class="t-button t-button--variant-base t-button--theme-primary t-size-full-width"
5+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-size-full-width"
66
href=""
77
tabindex="0"
88
type="button"
@@ -19,7 +19,7 @@ exports[`Button Component > props.block works fine 1`] = `
1919

2020
exports[`Button Component > props.block works fine 2`] = `
2121
<button
22-
class="t-button t-button--variant-base t-button--theme-primary"
22+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
2323
href=""
2424
tabindex="0"
2525
type="button"
@@ -36,7 +36,7 @@ exports[`Button Component > props.block works fine 2`] = `
3636

3737
exports[`Button Component > props.content works fine 1`] = `
3838
<button
39-
class="t-button t-button--variant-base t-button--theme-primary"
39+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
4040
href=""
4141
tabindex="0"
4242
type="button"
@@ -55,7 +55,7 @@ exports[`Button Component > props.content works fine 1`] = `
5555

5656
exports[`Button Component > props.default works fine 1`] = `
5757
<button
58-
class="t-button t-button--variant-base t-button--theme-primary"
58+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
5959
href=""
6060
tabindex="0"
6161
type="button"
@@ -74,7 +74,7 @@ exports[`Button Component > props.default works fine 1`] = `
7474

7575
exports[`Button Component > props.disabled works fine 1`] = `
7676
<button
77-
class="t-button t-button--variant-base t-button--theme-primary t-is-disabled"
77+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-is-disabled"
7878
disabled=""
7979
href=""
8080
type="button"
@@ -91,7 +91,7 @@ exports[`Button Component > props.disabled works fine 1`] = `
9191

9292
exports[`Button Component > props.disabled works fine 2`] = `
9393
<button
94-
class="t-button t-button--variant-base t-button--theme-primary"
94+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
9595
href=""
9696
tabindex="0"
9797
type="button"
@@ -108,7 +108,7 @@ exports[`Button Component > props.disabled works fine 2`] = `
108108

109109
exports[`Button Component > props.ghost works fine 1`] = `
110110
<button
111-
class="t-button t-button--variant-base t-button--theme-primary t-button--ghost"
111+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-button--ghost"
112112
href=""
113113
tabindex="0"
114114
type="button"
@@ -125,7 +125,7 @@ exports[`Button Component > props.ghost works fine 1`] = `
125125

126126
exports[`Button Component > props.ghost works fine 2`] = `
127127
<button
128-
class="t-button t-button--variant-base t-button--theme-primary"
128+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
129129
href=""
130130
tabindex="0"
131131
type="button"
@@ -142,7 +142,7 @@ exports[`Button Component > props.ghost works fine 2`] = `
142142

143143
exports[`Button Component > props.href works fine 1`] = `
144144
<a
145-
class="t-button t-button--variant-base t-button--theme-primary"
145+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
146146
disabled="false"
147147
href="https://tdesign.tencent.com/"
148148
tabindex="0"
@@ -160,7 +160,7 @@ exports[`Button Component > props.href works fine 1`] = `
160160

161161
exports[`Button Component > props.loading works fine 1`] = `
162162
<button
163-
class="t-button t-button--variant-base t-button--theme-primary t-is-loading"
163+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-is-loading"
164164
disabled=""
165165
href=""
166166
tabindex="0"
@@ -205,7 +205,7 @@ exports[`Button Component > props.loading works fine 1`] = `
205205

206206
exports[`Button Component > props.loading works fine 2`] = `
207207
<button
208-
class="t-button t-button--variant-base t-button--theme-primary"
208+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
209209
href=""
210210
tabindex="0"
211211
type="button"
@@ -222,7 +222,7 @@ exports[`Button Component > props.loading works fine 2`] = `
222222

223223
exports[`Button Component > props.loading: Button contains element \`.t-loading\` 1`] = `
224224
<button
225-
class="t-button t-button--variant-base t-button--theme-primary t-is-loading"
225+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-is-loading"
226226
disabled=""
227227
href=""
228228
tabindex="0"
@@ -284,7 +284,7 @@ exports[`Button Component > props.shape is equal to circle 1`] = `
284284

285285
exports[`Button Component > props.shape is equal to rectangle 1`] = `
286286
<button
287-
class="t-button t-button--variant-base t-button--theme-primary"
287+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
288288
href=""
289289
tabindex="0"
290290
type="button"
@@ -335,7 +335,7 @@ exports[`Button Component > props.shape is equal to square 1`] = `
335335

336336
exports[`Button Component > props.size is equal to large 1`] = `
337337
<button
338-
class="t-button t-button--variant-base t-button--theme-primary t-size-l"
338+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-size-l"
339339
href=""
340340
tabindex="0"
341341
type="button"
@@ -352,7 +352,7 @@ exports[`Button Component > props.size is equal to large 1`] = `
352352

353353
exports[`Button Component > props.size is equal to medium 1`] = `
354354
<button
355-
class="t-button t-button--variant-base t-button--theme-primary"
355+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
356356
href=""
357357
tabindex="0"
358358
type="button"
@@ -369,7 +369,7 @@ exports[`Button Component > props.size is equal to medium 1`] = `
369369

370370
exports[`Button Component > props.size is equal to small 1`] = `
371371
<button
372-
class="t-button t-button--variant-base t-button--theme-primary t-size-s"
372+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle t-size-s"
373373
href=""
374374
tabindex="0"
375375
type="button"
@@ -386,7 +386,7 @@ exports[`Button Component > props.size is equal to small 1`] = `
386386

387387
exports[`Button Component > props.tag is equal to a 1`] = `
388388
<a
389-
class="t-button t-button--variant-base t-button--theme-primary"
389+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
390390
disabled="false"
391391
href=""
392392
tabindex="0"
@@ -404,7 +404,7 @@ exports[`Button Component > props.tag is equal to a 1`] = `
404404

405405
exports[`Button Component > props.tag is equal to button 1`] = `
406406
<button
407-
class="t-button t-button--variant-base t-button--theme-primary"
407+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
408408
href=""
409409
tabindex="0"
410410
type="button"
@@ -421,7 +421,7 @@ exports[`Button Component > props.tag is equal to button 1`] = `
421421

422422
exports[`Button Component > props.tag is equal to div 1`] = `
423423
<div
424-
class="t-button t-button--variant-base t-button--theme-primary"
424+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
425425
disabled="false"
426426
href=""
427427
tabindex="0"
@@ -439,7 +439,7 @@ exports[`Button Component > props.tag is equal to div 1`] = `
439439

440440
exports[`Button Component > props.theme is equal to danger 1`] = `
441441
<button
442-
class="t-button t-button--variant-base t-button--theme-danger"
442+
class="t-button t-button--variant-base t-button--theme-danger t-button--shape-rectangle"
443443
href=""
444444
tabindex="0"
445445
type="button"
@@ -456,7 +456,7 @@ exports[`Button Component > props.theme is equal to danger 1`] = `
456456

457457
exports[`Button Component > props.theme is equal to default 1`] = `
458458
<button
459-
class="t-button t-button--variant-base t-button--theme-default"
459+
class="t-button t-button--variant-base t-button--theme-default t-button--shape-rectangle"
460460
href=""
461461
tabindex="0"
462462
type="button"
@@ -473,7 +473,7 @@ exports[`Button Component > props.theme is equal to default 1`] = `
473473

474474
exports[`Button Component > props.theme is equal to primary 1`] = `
475475
<button
476-
class="t-button t-button--variant-base t-button--theme-primary"
476+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
477477
href=""
478478
tabindex="0"
479479
type="button"
@@ -490,7 +490,7 @@ exports[`Button Component > props.theme is equal to primary 1`] = `
490490

491491
exports[`Button Component > props.theme is equal to success 1`] = `
492492
<button
493-
class="t-button t-button--variant-base t-button--theme-success"
493+
class="t-button t-button--variant-base t-button--theme-success t-button--shape-rectangle"
494494
href=""
495495
tabindex="0"
496496
type="button"
@@ -507,7 +507,7 @@ exports[`Button Component > props.theme is equal to success 1`] = `
507507

508508
exports[`Button Component > props.theme is equal to warning 1`] = `
509509
<button
510-
class="t-button t-button--variant-base t-button--theme-warning"
510+
class="t-button t-button--variant-base t-button--theme-warning t-button--shape-rectangle"
511511
href=""
512512
tabindex="0"
513513
type="button"
@@ -524,7 +524,7 @@ exports[`Button Component > props.theme is equal to warning 1`] = `
524524

525525
exports[`Button Component > props.variant is equal to base 1`] = `
526526
<button
527-
class="t-button t-button--variant-base t-button--theme-primary"
527+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
528528
href=""
529529
tabindex="0"
530530
type="button"
@@ -541,7 +541,7 @@ exports[`Button Component > props.variant is equal to base 1`] = `
541541

542542
exports[`Button Component > props.variant is equal to dashed 1`] = `
543543
<button
544-
class="t-button t-button--variant-dashed t-button--theme-default"
544+
class="t-button t-button--variant-dashed t-button--theme-default t-button--shape-rectangle"
545545
href=""
546546
tabindex="0"
547547
type="button"
@@ -558,7 +558,7 @@ exports[`Button Component > props.variant is equal to dashed 1`] = `
558558

559559
exports[`Button Component > props.variant is equal to outline 1`] = `
560560
<button
561-
class="t-button t-button--variant-outline t-button--theme-default"
561+
class="t-button t-button--variant-outline t-button--theme-default t-button--shape-rectangle"
562562
href=""
563563
tabindex="0"
564564
type="button"
@@ -575,7 +575,7 @@ exports[`Button Component > props.variant is equal to outline 1`] = `
575575

576576
exports[`Button Component > props.variant is equal to text 1`] = `
577577
<button
578-
class="t-button t-button--variant-text t-button--theme-default"
578+
class="t-button t-button--variant-text t-button--theme-default t-button--shape-rectangle"
579579
href=""
580580
tabindex="0"
581581
type="button"
@@ -592,7 +592,7 @@ exports[`Button Component > props.variant is equal to text 1`] = `
592592

593593
exports[`Button Component > slots.content works fine 1`] = `
594594
<button
595-
class="t-button t-button--variant-base t-button--theme-primary"
595+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
596596
href=""
597597
tabindex="0"
598598
type="button"
@@ -613,7 +613,7 @@ exports[`Button Component > slots.content works fine 1`] = `
613613

614614
exports[`Button Component > slots.default works fine 1`] = `
615615
<button
616-
class="t-button t-button--variant-base t-button--theme-primary"
616+
class="t-button t-button--variant-base t-button--theme-primary t-button--shape-rectangle"
617617
href=""
618618
tabindex="0"
619619
type="button"

packages/components/button/__tests__/vitest-button.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ describe('Button Component', () => {
118118
});
119119

120120
const shapeClassNameList = [
121-
{ 't-button--shape-rectangle': false },
121+
't-button--shape-rectangle',
122122
't-button--shape-square',
123123
't-button--shape-round',
124124
't-button--shape-circle',

0 commit comments

Comments
 (0)