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
zkwolf 2023-02-02 18:05:58 +08:00 committed by GitHub
parent 8099391e97
commit 158cca7f8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 29 additions and 25 deletions

View File

@ -9,7 +9,7 @@ type Warning = (valid: boolean, component: string, message?: string) => void;
let warning: Warning = noop;
if (process.env.NODE_ENV !== 'production') {
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.
if (process.env.NODE_ENV === 'test') {

View File

@ -104,7 +104,7 @@ export default defineComponent({
const activeLink = ref(null);
const getContainer = computed(() => {
const { getContainer } = props;
return getContainer || getTargetContainer.value || getDefaultContainer;
return getContainer || getTargetContainer?.value || getDefaultContainer;
});
// func...
const getCurrentAnchor = (offsetTop = 0, bounds = 5) => {

View File

@ -6,10 +6,10 @@ export default (name: string, props: Record<any, any>) => {
renderEmpty: () => null,
});
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 rootPrefixCls = computed(() => configProvider.getPrefixCls());
const autoInsertSpaceInButton = computed(() => configProvider.autoInsertSpaceInButton.value);
const autoInsertSpaceInButton = computed(() => configProvider.autoInsertSpaceInButton?.value);
const renderEmpty = configProvider.renderEmpty;
const space = configProvider.space;
const pageHeader = configProvider.pageHeader;
@ -18,19 +18,19 @@ export default (name: string, props: Record<any, any>) => {
const getPopupContainer = configProvider.getPopupContainer;
const dropdownMatchSelectWidth = computed<boolean | number>(
() => props.dropdownMatchSelectWidth ?? configProvider.dropdownMatchSelectWidth.value,
() => props.dropdownMatchSelectWidth ?? configProvider.dropdownMatchSelectWidth?.value,
);
const virtual = computed(
() =>
(props.virtual === undefined
? configProvider.virtual.value !== false
? configProvider.virtual?.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(
() => 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);
return {
configProvider,

View File

@ -46,7 +46,7 @@ const Divider = defineComponent({
const prefixCls = prefixClsRef.value;
return {
[prefixCls]: true,
[hashId.value]: true,
[hashId.value]: !!hashId.value,
[`${prefixCls}-${type}`]: true,
[`${prefixCls}-dashed`]: !!dashed,
[`${prefixCls}-plain`]: !!plain,

View File

@ -62,7 +62,7 @@ export default defineComponent({
disabled,
trigger: disabled ? [] : trigger,
placement,
getPopupContainer: getPopupContainer.value,
getPopupContainer: getPopupContainer?.value,
onVisibleChange: handleVisibleChange,
mouseEnterDelay,
mouseLeaveDelay,

View File

@ -148,7 +148,7 @@ const Dropdown = defineComponent({
arrow: !!arrow,
alignPoint,
prefixCls: prefixCls.value,
getPopupContainer: getPopupContainer.value,
getPopupContainer: getPopupContainer?.value,
transitionName: transitionName.value,
trigger: triggerActions,
onVisibleChange: handleVisibleChange,

View File

@ -19,7 +19,7 @@ Child elements vertically aligned.
<template>
<div id="components-grid-demo-flex-align">
<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">
<p class="height-100">col-4</p>
</a-col>
@ -35,7 +35,7 @@ Child elements vertically aligned.
</a-row>
<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">
<p class="height-100">col-4</p>
</a-col>
@ -51,7 +51,7 @@ Child elements vertically aligned.
</a-row>
<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">
<p class="height-100">col-4</p>
</a-col>

View File

@ -18,14 +18,14 @@ To change the element sort by `order`.
<template>
<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="3">2 col-order-3</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-row>
<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 }">
1 col-order-responsive
</a-col>

View File

@ -18,17 +18,17 @@ Col provides `flex` prop to support fill rest.
<template>
<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="3">3 / 5</a-col>
</a-row>
<a-divider orientation="left">Fill rest</a-divider>
<a-row type="flex">
<a-row>
<a-col flex="100px">100px</a-col>
<a-col flex="auto">auto</a-col>
</a-row>
<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="0 1 300px">0 1 300px</a-col>
</a-row>

View File

@ -231,7 +231,7 @@ export default defineComponent({
{...attrs}
rootClassName={hashId.value}
class={classNames(hashId.value, attrs.class)}
getContainer={getContainer || getPopupContainer.value}
getContainer={getContainer || getPopupContainer?.value}
prefixCls={prefixCls.value}
wrapClassName={wrapClassNameExtended}
visible={open ?? visible}

View File

@ -137,7 +137,7 @@ const Slider = defineComponent({
transitionName={`${rootPrefixCls.value}-zoom-down`}
key={index}
overlayClassName={`${prefixCls.value}-tooltip`}
getPopupContainer={getTooltipPopupContainer || getPopupContainer.value}
getPopupContainer={getTooltipPopupContainer || getPopupContainer?.value}
>
<VcHandle
{...restProps}

View File

@ -38,7 +38,7 @@ const Space = defineComponent({
setup(props, { slots }) {
const { prefixCls, space, direction: directionConfig } = useConfigInject('space', props);
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 verticalSize = ref<number>();
watch(

View File

@ -131,7 +131,11 @@ export default defineComponent({
return tooltip.value.getPopupDomNode();
};
expose({ getPopupDomNode, open, forcePopupAlign: () => tooltip.value?.forcePopupAlign() });
expose({
getPopupDomNode,
open: innerOpen,
forcePopupAlign: () => tooltip.value?.forcePopupAlign(),
});
const tooltipPlacements = computed(() => {
const { builtinPlacements, arrowPointAtCenter, autoAdjustOverflow } = props;
@ -272,7 +276,7 @@ export default defineComponent({
...attrs,
...(props as TooltipProps),
prefixCls: prefixCls.value,
getPopupContainer: getPopupContainer.value,
getPopupContainer: getPopupContainer?.value,
builtinPlacements: tooltipPlacements.value,
visible: tempVisible,
ref: tooltip,