Skip to content

Commit f8750f2

Browse files
committed
test: update test
1 parent a8dda5c commit f8750f2

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

components/_util/transition.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { defineComponent, Fragment, Transition as T, TransitionGroup as TG } from 'vue';
22

33
export const getTransitionProps = (transitionName: string, opt: object = {}) => {
4+
if (process.env.NODE_ENV === 'test') {
5+
return {};
6+
}
47
const transitionProps = transitionName
58
? {
69
appear: true,
@@ -44,7 +47,6 @@ if (process.env.NODE_ENV === 'test') {
4447
Transition = (_, { slots }) => {
4548
return slots.default?.();
4649
};
47-
Transition.inheritAttrs = false;
4850
TransitionGroup = defineComponent({
4951
inheritAttrs: false,
5052
props: ['tag', 'class'],

components/alert/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export const AlertProps = {
5858

5959
const Alert = defineComponent({
6060
name: 'AAlert',
61+
inheritAttrs: false,
6162
props: AlertProps,
6263
mixins: [BaseMixin],
6364
emits: ['close'],
@@ -96,7 +97,7 @@ const Alert = defineComponent({
9697
},
9798

9899
render() {
99-
const { prefixCls: customizePrefixCls, banner, closing, closed } = this;
100+
const { prefixCls: customizePrefixCls, banner, closing, closed, $attrs } = this;
100101
const getPrefixCls = this.configProvider.getPrefixCls;
101102
const prefixCls = getPrefixCls('alert', customizePrefixCls);
102103

@@ -148,7 +149,7 @@ const Alert = defineComponent({
148149
});
149150
return closed ? null : (
150151
<Transition {...transitionProps}>
151-
<div v-show={!closing} class={alertCls} data-show={!closing}>
152+
<div {...$attrs} v-show={!closing} class={alertCls} data-show={!closing}>
152153
{showIcon ? iconNode : null}
153154
<span class={`${prefixCls}-message`}>{message}</span>
154155
<span class={`${prefixCls}-description`}>{description}</span>

components/anchor/__tests__/Anchor.test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,26 @@ import Anchor from '..';
55

66
const { Link } = Anchor;
77

8+
let idCounter = 0;
9+
const getHashUrl = () => `Anchor-API-${idCounter++}`;
10+
811
describe('Anchor Render', () => {
912
it('Anchor render perfectly', done => {
13+
const hash = getHashUrl();
1014
const wrapper = mount(
1115
{
1216
render() {
1317
return (
1418
<Anchor ref="anchor">
15-
<Link href="#API" title="API" />
19+
<Link href={`#${hash}`} title={hash} />
1620
</Anchor>
1721
);
1822
},
1923
},
2024
{ sync: false },
2125
);
2226
Vue.nextTick(() => {
23-
wrapper.find('a[href="#API"]').trigger('click');
27+
wrapper.find(`a[href="#${hash}`).trigger('click');
2428
wrapper.vm.$refs.anchor.handleScroll();
2529
setTimeout(() => {
2630
expect(wrapper.vm.$refs.anchor.$data.activeLink).not.toBe(null);

0 commit comments

Comments
 (0)