test: test case error (#6225)
* fix: inject value maybe undefined * fix: tootip emit correct value * fix: rollback warning suffix avoid test break * doc(grid): remove unused type="flex"pull/6227/head
parent
8099391e97
commit
158cca7f8a
|
@ -9,7 +9,7 @@ type Warning = (valid: boolean, component: string, message?: string) => void;
|
||||||
let warning: Warning = noop;
|
let warning: Warning = noop;
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
warning = (valid, component, message) => {
|
warning = (valid, component, message) => {
|
||||||
vcWarning(valid, `[antd: ${component}] ${message}`);
|
vcWarning(valid, `[antdv: ${component}] ${message}`);
|
||||||
|
|
||||||
// StrictMode will inject console which will not throw warning in React 17.
|
// StrictMode will inject console which will not throw warning in React 17.
|
||||||
if (process.env.NODE_ENV === 'test') {
|
if (process.env.NODE_ENV === 'test') {
|
||||||
|
|
|
@ -104,7 +104,7 @@ export default defineComponent({
|
||||||
const activeLink = ref(null);
|
const activeLink = ref(null);
|
||||||
const getContainer = computed(() => {
|
const getContainer = computed(() => {
|
||||||
const { getContainer } = props;
|
const { getContainer } = props;
|
||||||
return getContainer || getTargetContainer.value || getDefaultContainer;
|
return getContainer || getTargetContainer?.value || getDefaultContainer;
|
||||||
});
|
});
|
||||||
// func...
|
// func...
|
||||||
const getCurrentAnchor = (offsetTop = 0, bounds = 5) => {
|
const getCurrentAnchor = (offsetTop = 0, bounds = 5) => {
|
||||||
|
|
|
@ -6,10 +6,10 @@ export default (name: string, props: Record<any, any>) => {
|
||||||
renderEmpty: () => null,
|
renderEmpty: () => null,
|
||||||
});
|
});
|
||||||
const prefixCls = computed(() => configProvider.getPrefixCls(name, props.prefixCls));
|
const prefixCls = computed(() => configProvider.getPrefixCls(name, props.prefixCls));
|
||||||
const direction = computed(() => props.direction ?? configProvider.direction.value);
|
const direction = computed(() => props.direction ?? configProvider.direction?.value);
|
||||||
const iconPrefixCls = computed(() => props.iconPrefixCls ?? configProvider.iconPrefixCls.value);
|
const iconPrefixCls = computed(() => props.iconPrefixCls ?? configProvider.iconPrefixCls.value);
|
||||||
const rootPrefixCls = computed(() => configProvider.getPrefixCls());
|
const rootPrefixCls = computed(() => configProvider.getPrefixCls());
|
||||||
const autoInsertSpaceInButton = computed(() => configProvider.autoInsertSpaceInButton.value);
|
const autoInsertSpaceInButton = computed(() => configProvider.autoInsertSpaceInButton?.value);
|
||||||
const renderEmpty = configProvider.renderEmpty;
|
const renderEmpty = configProvider.renderEmpty;
|
||||||
const space = configProvider.space;
|
const space = configProvider.space;
|
||||||
const pageHeader = configProvider.pageHeader;
|
const pageHeader = configProvider.pageHeader;
|
||||||
|
@ -18,19 +18,19 @@ export default (name: string, props: Record<any, any>) => {
|
||||||
const getPopupContainer = configProvider.getPopupContainer;
|
const getPopupContainer = configProvider.getPopupContainer;
|
||||||
|
|
||||||
const dropdownMatchSelectWidth = computed<boolean | number>(
|
const dropdownMatchSelectWidth = computed<boolean | number>(
|
||||||
() => props.dropdownMatchSelectWidth ?? configProvider.dropdownMatchSelectWidth.value,
|
() => props.dropdownMatchSelectWidth ?? configProvider.dropdownMatchSelectWidth?.value,
|
||||||
);
|
);
|
||||||
const virtual = computed(
|
const virtual = computed(
|
||||||
() =>
|
() =>
|
||||||
(props.virtual === undefined
|
(props.virtual === undefined
|
||||||
? configProvider.virtual.value !== false
|
? configProvider.virtual?.value !== false
|
||||||
: props.virtual !== false) && dropdownMatchSelectWidth.value !== false,
|
: props.virtual !== false) && dropdownMatchSelectWidth.value !== false,
|
||||||
);
|
);
|
||||||
const size = computed(() => props.size || configProvider.componentSize.value);
|
const size = computed(() => props.size || configProvider.componentSize?.value);
|
||||||
const autocomplete = computed(
|
const autocomplete = computed(
|
||||||
() => props.autocomplete ?? configProvider.input.value?.autocomplete,
|
() => props.autocomplete ?? configProvider.input?.value?.autocomplete,
|
||||||
);
|
);
|
||||||
const disabled = computed(() => props.disabled || configProvider.componentDisabled.value);
|
const disabled = computed(() => props.disabled || configProvider.componentDisabled?.value);
|
||||||
const csp = computed(() => props.csp ?? configProvider.csp);
|
const csp = computed(() => props.csp ?? configProvider.csp);
|
||||||
return {
|
return {
|
||||||
configProvider,
|
configProvider,
|
||||||
|
|
|
@ -46,7 +46,7 @@ const Divider = defineComponent({
|
||||||
const prefixCls = prefixClsRef.value;
|
const prefixCls = prefixClsRef.value;
|
||||||
return {
|
return {
|
||||||
[prefixCls]: true,
|
[prefixCls]: true,
|
||||||
[hashId.value]: true,
|
[hashId.value]: !!hashId.value,
|
||||||
[`${prefixCls}-${type}`]: true,
|
[`${prefixCls}-${type}`]: true,
|
||||||
[`${prefixCls}-dashed`]: !!dashed,
|
[`${prefixCls}-dashed`]: !!dashed,
|
||||||
[`${prefixCls}-plain`]: !!plain,
|
[`${prefixCls}-plain`]: !!plain,
|
||||||
|
|
|
@ -62,7 +62,7 @@ export default defineComponent({
|
||||||
disabled,
|
disabled,
|
||||||
trigger: disabled ? [] : trigger,
|
trigger: disabled ? [] : trigger,
|
||||||
placement,
|
placement,
|
||||||
getPopupContainer: getPopupContainer.value,
|
getPopupContainer: getPopupContainer?.value,
|
||||||
onVisibleChange: handleVisibleChange,
|
onVisibleChange: handleVisibleChange,
|
||||||
mouseEnterDelay,
|
mouseEnterDelay,
|
||||||
mouseLeaveDelay,
|
mouseLeaveDelay,
|
||||||
|
|
|
@ -148,7 +148,7 @@ const Dropdown = defineComponent({
|
||||||
arrow: !!arrow,
|
arrow: !!arrow,
|
||||||
alignPoint,
|
alignPoint,
|
||||||
prefixCls: prefixCls.value,
|
prefixCls: prefixCls.value,
|
||||||
getPopupContainer: getPopupContainer.value,
|
getPopupContainer: getPopupContainer?.value,
|
||||||
transitionName: transitionName.value,
|
transitionName: transitionName.value,
|
||||||
trigger: triggerActions,
|
trigger: triggerActions,
|
||||||
onVisibleChange: handleVisibleChange,
|
onVisibleChange: handleVisibleChange,
|
||||||
|
|
|
@ -19,7 +19,7 @@ Child elements vertically aligned.
|
||||||
<template>
|
<template>
|
||||||
<div id="components-grid-demo-flex-align">
|
<div id="components-grid-demo-flex-align">
|
||||||
<a-divider orientation="left">Align Top</a-divider>
|
<a-divider orientation="left">Align Top</a-divider>
|
||||||
<a-row type="flex" justify="center" align="top">
|
<a-row justify="center" align="top">
|
||||||
<a-col :span="4">
|
<a-col :span="4">
|
||||||
<p class="height-100">col-4</p>
|
<p class="height-100">col-4</p>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -35,7 +35,7 @@ Child elements vertically aligned.
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<a-divider orientation="left">Align Middle</a-divider>
|
<a-divider orientation="left">Align Middle</a-divider>
|
||||||
<a-row type="flex" justify="space-around" align="middle">
|
<a-row justify="space-around" align="middle">
|
||||||
<a-col :span="4">
|
<a-col :span="4">
|
||||||
<p class="height-100">col-4</p>
|
<p class="height-100">col-4</p>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -51,7 +51,7 @@ Child elements vertically aligned.
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<a-divider orientation="left">Align Bottom</a-divider>
|
<a-divider orientation="left">Align Bottom</a-divider>
|
||||||
<a-row type="flex" justify="space-between" align="bottom">
|
<a-row justify="space-between" align="bottom">
|
||||||
<a-col :span="4">
|
<a-col :span="4">
|
||||||
<p class="height-100">col-4</p>
|
<p class="height-100">col-4</p>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
|
@ -18,14 +18,14 @@ To change the element sort by `order`.
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-divider orientation="left">Normal</a-divider>
|
<a-divider orientation="left">Normal</a-divider>
|
||||||
<a-row type="flex">
|
<a-row>
|
||||||
<a-col :span="6" :order="4">1 col-order-4</a-col>
|
<a-col :span="6" :order="4">1 col-order-4</a-col>
|
||||||
<a-col :span="6" :order="3">2 col-order-3</a-col>
|
<a-col :span="6" :order="3">2 col-order-3</a-col>
|
||||||
<a-col :span="6" :order="2">3 col-order-2</a-col>
|
<a-col :span="6" :order="2">3 col-order-2</a-col>
|
||||||
<a-col :span="6" :order="1">4 col-order-1</a-col>
|
<a-col :span="6" :order="1">4 col-order-1</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-divider orientation="left">Responsive</a-divider>
|
<a-divider orientation="left">Responsive</a-divider>
|
||||||
<a-row type="flex">
|
<a-row>
|
||||||
<a-col :span="6" :xs="{ order: 1 }" :sm="{ order: 2 }" :md="{ order: 3 }" :lg="{ order: 4 }">
|
<a-col :span="6" :xs="{ order: 1 }" :sm="{ order: 2 }" :md="{ order: 3 }" :lg="{ order: 4 }">
|
||||||
1 col-order-responsive
|
1 col-order-responsive
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
|
@ -18,17 +18,17 @@ Col provides `flex` prop to support fill rest.
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-divider orientation="left">Percentage columns</a-divider>
|
<a-divider orientation="left">Percentage columns</a-divider>
|
||||||
<a-row type="flex">
|
<a-row>
|
||||||
<a-col :flex="2">2 / 5</a-col>
|
<a-col :flex="2">2 / 5</a-col>
|
||||||
<a-col :flex="3">3 / 5</a-col>
|
<a-col :flex="3">3 / 5</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-divider orientation="left">Fill rest</a-divider>
|
<a-divider orientation="left">Fill rest</a-divider>
|
||||||
<a-row type="flex">
|
<a-row>
|
||||||
<a-col flex="100px">100px</a-col>
|
<a-col flex="100px">100px</a-col>
|
||||||
<a-col flex="auto">auto</a-col>
|
<a-col flex="auto">auto</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-divider orientation="left">Raw flex style</a-divider>
|
<a-divider orientation="left">Raw flex style</a-divider>
|
||||||
<a-row type="flex">
|
<a-row>
|
||||||
<a-col flex="1 1 200px">1 1 200px</a-col>
|
<a-col flex="1 1 200px">1 1 200px</a-col>
|
||||||
<a-col flex="0 1 300px">0 1 300px</a-col>
|
<a-col flex="0 1 300px">0 1 300px</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
|
@ -231,7 +231,7 @@ export default defineComponent({
|
||||||
{...attrs}
|
{...attrs}
|
||||||
rootClassName={hashId.value}
|
rootClassName={hashId.value}
|
||||||
class={classNames(hashId.value, attrs.class)}
|
class={classNames(hashId.value, attrs.class)}
|
||||||
getContainer={getContainer || getPopupContainer.value}
|
getContainer={getContainer || getPopupContainer?.value}
|
||||||
prefixCls={prefixCls.value}
|
prefixCls={prefixCls.value}
|
||||||
wrapClassName={wrapClassNameExtended}
|
wrapClassName={wrapClassNameExtended}
|
||||||
visible={open ?? visible}
|
visible={open ?? visible}
|
||||||
|
|
|
@ -137,7 +137,7 @@ const Slider = defineComponent({
|
||||||
transitionName={`${rootPrefixCls.value}-zoom-down`}
|
transitionName={`${rootPrefixCls.value}-zoom-down`}
|
||||||
key={index}
|
key={index}
|
||||||
overlayClassName={`${prefixCls.value}-tooltip`}
|
overlayClassName={`${prefixCls.value}-tooltip`}
|
||||||
getPopupContainer={getTooltipPopupContainer || getPopupContainer.value}
|
getPopupContainer={getTooltipPopupContainer || getPopupContainer?.value}
|
||||||
>
|
>
|
||||||
<VcHandle
|
<VcHandle
|
||||||
{...restProps}
|
{...restProps}
|
||||||
|
|
|
@ -38,7 +38,7 @@ const Space = defineComponent({
|
||||||
setup(props, { slots }) {
|
setup(props, { slots }) {
|
||||||
const { prefixCls, space, direction: directionConfig } = useConfigInject('space', props);
|
const { prefixCls, space, direction: directionConfig } = useConfigInject('space', props);
|
||||||
const supportFlexGap = useFlexGapSupport();
|
const supportFlexGap = useFlexGapSupport();
|
||||||
const size = computed(() => props.size ?? space.value?.size ?? 'small');
|
const size = computed(() => props.size ?? space?.value?.size ?? 'small');
|
||||||
const horizontalSize = ref<number>();
|
const horizontalSize = ref<number>();
|
||||||
const verticalSize = ref<number>();
|
const verticalSize = ref<number>();
|
||||||
watch(
|
watch(
|
||||||
|
|
|
@ -131,7 +131,11 @@ export default defineComponent({
|
||||||
return tooltip.value.getPopupDomNode();
|
return tooltip.value.getPopupDomNode();
|
||||||
};
|
};
|
||||||
|
|
||||||
expose({ getPopupDomNode, open, forcePopupAlign: () => tooltip.value?.forcePopupAlign() });
|
expose({
|
||||||
|
getPopupDomNode,
|
||||||
|
open: innerOpen,
|
||||||
|
forcePopupAlign: () => tooltip.value?.forcePopupAlign(),
|
||||||
|
});
|
||||||
|
|
||||||
const tooltipPlacements = computed(() => {
|
const tooltipPlacements = computed(() => {
|
||||||
const { builtinPlacements, arrowPointAtCenter, autoAdjustOverflow } = props;
|
const { builtinPlacements, arrowPointAtCenter, autoAdjustOverflow } = props;
|
||||||
|
@ -272,7 +276,7 @@ export default defineComponent({
|
||||||
...attrs,
|
...attrs,
|
||||||
...(props as TooltipProps),
|
...(props as TooltipProps),
|
||||||
prefixCls: prefixCls.value,
|
prefixCls: prefixCls.value,
|
||||||
getPopupContainer: getPopupContainer.value,
|
getPopupContainer: getPopupContainer?.value,
|
||||||
builtinPlacements: tooltipPlacements.value,
|
builtinPlacements: tooltipPlacements.value,
|
||||||
visible: tempVisible,
|
visible: tempVisible,
|
||||||
ref: tooltip,
|
ref: tooltip,
|
||||||
|
|
Loading…
Reference in New Issue