Skip to content

Commit 7198479

Browse files
committed
test: update steps
1 parent fbfec0a commit 7198479

File tree

6 files changed

+20
-16
lines changed

6 files changed

+20
-16
lines changed

components/steps/__tests__/__snapshots__/demo.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ exports[`renders ./components/steps/demo/error.vue correctly 1`] = `
182182
</div>
183183
<div class="ant-steps-item-icon"><span class="ant-steps-icon"><span role="img" aria-label="close" class="anticon anticon-close ant-steps-error-icon"><svg focusable="false" class="" data-icon="close" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896"><path d="M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 00203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"></path></svg></span></span></div>
184184
<div class="ant-steps-item-content">
185-
<div class="ant-steps-item-title">In Progress
185+
<div class="ant-steps-item-title">In Process
186186
<!---->
187187
</div>
188188
<div class="ant-steps-item-description">This is a description.</div>
@@ -1090,7 +1090,7 @@ exports[`renders ./components/steps/demo/simple.vue correctly 1`] = `
10901090
<div class="ant-steps-item-title">Finished
10911091
<!---->
10921092
</div>
1093-
<div class="ant-steps-item-description"><span>This is a description.</span></div>
1093+
<div class="ant-steps-item-description">This is a description.</div>
10941094
</div>
10951095
</div>
10961096
</div>

components/steps/demo/customized-progress-dot.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ import { defineComponent, ref } from 'vue';
5454
5555
export default defineComponent({
5656
setup() {
57-
const current = ref<number>(0);
57+
const current = ref<number>(1);
5858
5959
return {
6060
current,
61-
description: 'This is a description.',
61+
description: 'You can hover on the dot.',
6262
};
6363
},
6464
});

components/steps/demo/error.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ By using `status` of `Steps`, you can specify the state for current step.
1616
</docs>
1717
<template>
1818
<a-steps
19-
:v-model:current="current"
19+
v-model:current="current"
2020
status="error"
2121
:items="[
2222
{
@@ -39,7 +39,7 @@ import { defineComponent, ref } from 'vue';
3939
4040
export default defineComponent({
4141
setup() {
42-
const current = ref<number>(0);
42+
const current = ref<number>(1);
4343
4444
return {
4545
current,

components/steps/demo/progress.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Steps with progress.
1818

1919
<template>
2020
<a-steps
21+
v-model:current="current"
2122
:percent="60"
22-
:v-model:current="current"
2323
:items="[
2424
{
2525
title: 'Finished',
@@ -37,8 +37,8 @@ Steps with progress.
3737
]"
3838
></a-steps>
3939
<a-steps
40+
v-model:current="current"
4041
:percent="60"
41-
:current="1"
4242
size="small"
4343
:items="[
4444
{
@@ -62,7 +62,7 @@ import { defineComponent, ref } from 'vue';
6262
6363
export default defineComponent({
6464
setup() {
65-
const current = ref<number>(0);
65+
const current = ref<number>(1);
6666
6767
return {
6868
current,

components/vc-steps/Step.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import type { EventHandler } from '../_util/EventInterface';
55
import classNames from '../_util/classNames';
66
import warning from '../_util/warning';
77
import type { VueNode } from '../_util/type';
8-
import { stringType, functionType } from '../_util/type';
8+
import { booleanType, stringType, functionType } from '../_util/type';
99
import type { StepIconRender, Status } from './interface';
10+
import omit from '../_util/omit';
1011
function isString(str: any): str is string {
1112
return typeof str === 'string';
1213
}
@@ -36,20 +37,22 @@ export const VcStepProps = () => ({
3637
onStepClick: functionType<(next: number) => void>(),
3738
stepIcon: functionType<StepIconRender>(),
3839
itemRender: functionType<(stepItem: VueNode) => VueNode>(),
40+
__legacy: booleanType(),
3941
});
4042

4143
export type VCStepProps = Partial<ExtractPropTypes<ReturnType<typeof VcStepProps>>>;
4244
export default defineComponent({
4345
compatConfig: { MODE: 3 },
4446
name: 'Step',
47+
inheritAttrs: false,
4548
props: VcStepProps(),
4649
slots: ['title', 'subTitle', 'description', 'tailContent', 'stepIcon', 'progressDot'],
4750
setup(props, { slots, emit, attrs }) {
4851
const onItemClick: EventHandler = e => {
4952
emit('click', e);
5053
emit('stepClick', props.stepIndex);
5154
};
52-
if (attrs.__legacy !== false) {
55+
if (props.__legacy !== false) {
5356
warning(
5457
false,
5558
'Steps',
@@ -140,9 +143,6 @@ export default defineComponent({
140143
[`${prefixCls}-item-active`]: active,
141144
[`${prefixCls}-item-disabled`]: disabled === true,
142145
});
143-
const stepProps = {
144-
class: classString,
145-
};
146146
const stepItemStyle: CSSProperties = {};
147147
if (itemWidth) {
148148
stepItemStyle.width = itemWidth;
@@ -165,7 +165,11 @@ export default defineComponent({
165165
accessibilityProps.onClick = onItemClick;
166166
}
167167
const stepNode = (
168-
<div {...stepProps} style={[attrs.style as CSSProperties, stepItemStyle]}>
168+
<div
169+
{...omit(attrs, ['__legacy'])}
170+
class={[classString, attrs.class]}
171+
style={[attrs.style as CSSProperties, stepItemStyle]}
172+
>
169173
<div {...accessibilityProps} class={`${prefixCls}-item-container`}>
170174
<div class={`${prefixCls}-item-tail`}>{tailContent}</div>
171175
<div class={`${prefixCls}-item-icon`}>

tests/shared/demoTest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import glob from 'glob';
22
import { mount } from '@vue/test-utils';
33
import MockDate from 'mockdate';
44
import dayjs from 'dayjs';
5-
import antd from 'ant-design-vue';
5+
import antd from '../../components';
66

77
export default function demoTest(component, options = {}) {
88
const suffix = options.suffix || 'vue';

0 commit comments

Comments
 (0)