test: update

pull/4606/head
tangjinzhou 3 years ago
parent 3ff07fa8d4
commit bf508421cf

@ -230,7 +230,7 @@ export default defineComponent({
const vcTooltipProps = {
...attrs,
...props,
...(props as TooltipProps),
prefixCls: prefixCls.value,
getTooltipContainer: getPopupContainer || getTargetContainer.value,
builtinPlacements: tooltipPlacements.value,

@ -16,11 +16,6 @@ describe('Tooltip', () => {
mouseEnterDelay: 0,
mouseLeaveDelay: 0,
onVisibleChange,
// TODO test/util 的bug 没有使用 v-model 同样会改变
'onUpdate:visible': () => {
props.visible = this.visible;
this.$forceUpdate();
},
};
if (this.visible !== undefined) {
props.visible = this.visible;
@ -80,7 +75,7 @@ describe('Tooltip', () => {
});
await asyncExpect(() => {
expect(onVisibleChange).toHaveBeenLastCalledWith(true);
expect(wrapper.vm.$refs.tooltip.visible).toBe(true);
expect(wrapper.vm.$refs.tooltip.visible).toBe(false);
});
await asyncExpect(() => {
// always trigger onVisibleChange

@ -200,7 +200,7 @@ export default defineComponent({
fieldNames = props.replaceFields,
motion = props.openAnimation,
itemHeight = 28,
} = props;
} = props as TreeProps;
const newProps = {
...attrs,
...props,

@ -47,7 +47,7 @@ export const defaultProps = {
split: ' ',
rows: 1,
validateSearch: defaultValidateSearch,
filterOption: defaultFilterOption,
filterOption: (() => defaultFilterOption) as any,
};
export default initDefaultProps(vcMentionsProps, defaultProps);

@ -30,6 +30,8 @@ export default defineComponent({
builtinPlacements: PropTypes.object,
overlayInnerStyle: PropTypes.style,
popupVisible: PropTypes.looseBool,
onVisibleChange: PropTypes.func,
onPopupAlign: PropTypes.func,
},
slots: ['arrowContent', 'overlay'],
setup(props, { slots, attrs, expose }) {
@ -116,12 +118,12 @@ export default defineComponent({
mouseEnterDelay,
...extraProps,
...attrs,
onPopupVisibleChange: (attrs.onVisibleChange as any) || noop,
onPopupAlign: attrs.onPopupAlign || noop,
onPopupVisibleChange: props.onVisibleChange || noop,
onPopupAlign: props.onPopupAlign || noop,
ref: triggerDOM,
popup: getPopupElement(),
};
return <Trigger {...triggerProps}>{slots.default?.()}</Trigger>;
return <Trigger {...triggerProps} v-slots={{ default: slots.default }}></Trigger>;
};
},
});

@ -29,7 +29,7 @@ export default function focusTest(Component) {
expect(handleFocus).toBeCalled();
});
fit('blur() and onBlur', async () => {
it('blur() and onBlur', async () => {
const handleBlur = jest.fn();
const handleFocus = jest.fn();
const wrapper = mount(

Loading…
Cancel
Save