test: update
parent
3ff07fa8d4
commit
bf508421cf
|
@ -230,7 +230,7 @@ export default defineComponent({
|
||||||
|
|
||||||
const vcTooltipProps = {
|
const vcTooltipProps = {
|
||||||
...attrs,
|
...attrs,
|
||||||
...props,
|
...(props as TooltipProps),
|
||||||
prefixCls: prefixCls.value,
|
prefixCls: prefixCls.value,
|
||||||
getTooltipContainer: getPopupContainer || getTargetContainer.value,
|
getTooltipContainer: getPopupContainer || getTargetContainer.value,
|
||||||
builtinPlacements: tooltipPlacements.value,
|
builtinPlacements: tooltipPlacements.value,
|
||||||
|
|
|
@ -16,11 +16,6 @@ describe('Tooltip', () => {
|
||||||
mouseEnterDelay: 0,
|
mouseEnterDelay: 0,
|
||||||
mouseLeaveDelay: 0,
|
mouseLeaveDelay: 0,
|
||||||
onVisibleChange,
|
onVisibleChange,
|
||||||
// TODO test/util 的bug 没有使用 v-model 同样会改变
|
|
||||||
'onUpdate:visible': () => {
|
|
||||||
props.visible = this.visible;
|
|
||||||
this.$forceUpdate();
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
if (this.visible !== undefined) {
|
if (this.visible !== undefined) {
|
||||||
props.visible = this.visible;
|
props.visible = this.visible;
|
||||||
|
@ -80,7 +75,7 @@ describe('Tooltip', () => {
|
||||||
});
|
});
|
||||||
await asyncExpect(() => {
|
await asyncExpect(() => {
|
||||||
expect(onVisibleChange).toHaveBeenLastCalledWith(true);
|
expect(onVisibleChange).toHaveBeenLastCalledWith(true);
|
||||||
expect(wrapper.vm.$refs.tooltip.visible).toBe(true);
|
expect(wrapper.vm.$refs.tooltip.visible).toBe(false);
|
||||||
});
|
});
|
||||||
await asyncExpect(() => {
|
await asyncExpect(() => {
|
||||||
// always trigger onVisibleChange
|
// always trigger onVisibleChange
|
||||||
|
|
|
@ -200,7 +200,7 @@ export default defineComponent({
|
||||||
fieldNames = props.replaceFields,
|
fieldNames = props.replaceFields,
|
||||||
motion = props.openAnimation,
|
motion = props.openAnimation,
|
||||||
itemHeight = 28,
|
itemHeight = 28,
|
||||||
} = props;
|
} = props as TreeProps;
|
||||||
const newProps = {
|
const newProps = {
|
||||||
...attrs,
|
...attrs,
|
||||||
...props,
|
...props,
|
||||||
|
|
|
@ -47,7 +47,7 @@ export const defaultProps = {
|
||||||
split: ' ',
|
split: ' ',
|
||||||
rows: 1,
|
rows: 1,
|
||||||
validateSearch: defaultValidateSearch,
|
validateSearch: defaultValidateSearch,
|
||||||
filterOption: defaultFilterOption,
|
filterOption: (() => defaultFilterOption) as any,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default initDefaultProps(vcMentionsProps, defaultProps);
|
export default initDefaultProps(vcMentionsProps, defaultProps);
|
||||||
|
|
|
@ -30,6 +30,8 @@ export default defineComponent({
|
||||||
builtinPlacements: PropTypes.object,
|
builtinPlacements: PropTypes.object,
|
||||||
overlayInnerStyle: PropTypes.style,
|
overlayInnerStyle: PropTypes.style,
|
||||||
popupVisible: PropTypes.looseBool,
|
popupVisible: PropTypes.looseBool,
|
||||||
|
onVisibleChange: PropTypes.func,
|
||||||
|
onPopupAlign: PropTypes.func,
|
||||||
},
|
},
|
||||||
slots: ['arrowContent', 'overlay'],
|
slots: ['arrowContent', 'overlay'],
|
||||||
setup(props, { slots, attrs, expose }) {
|
setup(props, { slots, attrs, expose }) {
|
||||||
|
@ -116,12 +118,12 @@ export default defineComponent({
|
||||||
mouseEnterDelay,
|
mouseEnterDelay,
|
||||||
...extraProps,
|
...extraProps,
|
||||||
...attrs,
|
...attrs,
|
||||||
onPopupVisibleChange: (attrs.onVisibleChange as any) || noop,
|
onPopupVisibleChange: props.onVisibleChange || noop,
|
||||||
onPopupAlign: attrs.onPopupAlign || noop,
|
onPopupAlign: props.onPopupAlign || noop,
|
||||||
ref: triggerDOM,
|
ref: triggerDOM,
|
||||||
popup: getPopupElement(),
|
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();
|
expect(handleFocus).toBeCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
fit('blur() and onBlur', async () => {
|
it('blur() and onBlur', async () => {
|
||||||
const handleBlur = jest.fn();
|
const handleBlur = jest.fn();
|
||||||
const handleFocus = jest.fn();
|
const handleFocus = jest.fn();
|
||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
|
|
Loading…
Reference in New Issue