Skip to content

Commit 158cca7

Browse files
authored
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"
1 parent 8099391 commit 158cca7

File tree

13 files changed

+29
-25
lines changed

13 files changed

+29
-25
lines changed

components/_util/warning.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type Warning = (valid: boolean, component: string, message?: string) => void;
99
let warning: Warning = noop;
1010
if (process.env.NODE_ENV !== 'production') {
1111
warning = (valid, component, message) => {
12-
vcWarning(valid, `[antd: ${component}] ${message}`);
12+
vcWarning(valid, `[antdv: ${component}] ${message}`);
1313

1414
// StrictMode will inject console which will not throw warning in React 17.
1515
if (process.env.NODE_ENV === 'test') {

components/anchor/Anchor.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export default defineComponent({
104104
const activeLink = ref(null);
105105
const getContainer = computed(() => {
106106
const { getContainer } = props;
107-
return getContainer || getTargetContainer.value || getDefaultContainer;
107+
return getContainer || getTargetContainer?.value || getDefaultContainer;
108108
});
109109
// func...
110110
const getCurrentAnchor = (offsetTop = 0, bounds = 5) => {

components/config-provider/hooks/useConfigInject.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ export default (name: string, props: Record<any, any>) => {
66
renderEmpty: () => null,
77
});
88
const prefixCls = computed(() => configProvider.getPrefixCls(name, props.prefixCls));
9-
const direction = computed(() => props.direction ?? configProvider.direction.value);
9+
const direction = computed(() => props.direction ?? configProvider.direction?.value);
1010
const iconPrefixCls = computed(() => props.iconPrefixCls ?? configProvider.iconPrefixCls.value);
1111
const rootPrefixCls = computed(() => configProvider.getPrefixCls());
12-
const autoInsertSpaceInButton = computed(() => configProvider.autoInsertSpaceInButton.value);
12+
const autoInsertSpaceInButton = computed(() => configProvider.autoInsertSpaceInButton?.value);
1313
const renderEmpty = configProvider.renderEmpty;
1414
const space = configProvider.space;
1515
const pageHeader = configProvider.pageHeader;
@@ -18,19 +18,19 @@ export default (name: string, props: Record<any, any>) => {
1818
const getPopupContainer = configProvider.getPopupContainer;
1919

2020
const dropdownMatchSelectWidth = computed<boolean | number>(
21-
() => props.dropdownMatchSelectWidth ?? configProvider.dropdownMatchSelectWidth.value,
21+
() => props.dropdownMatchSelectWidth ?? configProvider.dropdownMatchSelectWidth?.value,
2222
);
2323
const virtual = computed(
2424
() =>
2525
(props.virtual === undefined
26-
? configProvider.virtual.value !== false
26+
? configProvider.virtual?.value !== false
2727
: props.virtual !== false) && dropdownMatchSelectWidth.value !== false,
2828
);
29-
const size = computed(() => props.size || configProvider.componentSize.value);
29+
const size = computed(() => props.size || configProvider.componentSize?.value);
3030
const autocomplete = computed(
31-
() => props.autocomplete ?? configProvider.input.value?.autocomplete,
31+
() => props.autocomplete ?? configProvider.input?.value?.autocomplete,
3232
);
33-
const disabled = computed(() => props.disabled || configProvider.componentDisabled.value);
33+
const disabled = computed(() => props.disabled || configProvider.componentDisabled?.value);
3434
const csp = computed(() => props.csp ?? configProvider.csp);
3535
return {
3636
configProvider,

components/divider/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const Divider = defineComponent({
4646
const prefixCls = prefixClsRef.value;
4747
return {
4848
[prefixCls]: true,
49-
[hashId.value]: true,
49+
[hashId.value]: !!hashId.value,
5050
[`${prefixCls}-${type}`]: true,
5151
[`${prefixCls}-dashed`]: !!dashed,
5252
[`${prefixCls}-plain`]: !!plain,

components/dropdown/dropdown-button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default defineComponent({
6262
disabled,
6363
trigger: disabled ? [] : trigger,
6464
placement,
65-
getPopupContainer: getPopupContainer.value,
65+
getPopupContainer: getPopupContainer?.value,
6666
onVisibleChange: handleVisibleChange,
6767
mouseEnterDelay,
6868
mouseLeaveDelay,

components/dropdown/dropdown.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ const Dropdown = defineComponent({
148148
arrow: !!arrow,
149149
alignPoint,
150150
prefixCls: prefixCls.value,
151-
getPopupContainer: getPopupContainer.value,
151+
getPopupContainer: getPopupContainer?.value,
152152
transitionName: transitionName.value,
153153
trigger: triggerActions,
154154
onVisibleChange: handleVisibleChange,

components/grid/demo/flex-align.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Child elements vertically aligned.
1919
<template>
2020
<div id="components-grid-demo-flex-align">
2121
<a-divider orientation="left">Align Top</a-divider>
22-
<a-row type="flex" justify="center" align="top">
22+
<a-row justify="center" align="top">
2323
<a-col :span="4">
2424
<p class="height-100">col-4</p>
2525
</a-col>
@@ -35,7 +35,7 @@ Child elements vertically aligned.
3535
</a-row>
3636

3737
<a-divider orientation="left">Align Middle</a-divider>
38-
<a-row type="flex" justify="space-around" align="middle">
38+
<a-row justify="space-around" align="middle">
3939
<a-col :span="4">
4040
<p class="height-100">col-4</p>
4141
</a-col>
@@ -51,7 +51,7 @@ Child elements vertically aligned.
5151
</a-row>
5252

5353
<a-divider orientation="left">Align Bottom</a-divider>
54-
<a-row type="flex" justify="space-between" align="bottom">
54+
<a-row justify="space-between" align="bottom">
5555
<a-col :span="4">
5656
<p class="height-100">col-4</p>
5757
</a-col>

components/grid/demo/flex-order.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ To change the element sort by `order`.
1818

1919
<template>
2020
<a-divider orientation="left">Normal</a-divider>
21-
<a-row type="flex">
21+
<a-row>
2222
<a-col :span="6" :order="4">1 col-order-4</a-col>
2323
<a-col :span="6" :order="3">2 col-order-3</a-col>
2424
<a-col :span="6" :order="2">3 col-order-2</a-col>
2525
<a-col :span="6" :order="1">4 col-order-1</a-col>
2626
</a-row>
2727
<a-divider orientation="left">Responsive</a-divider>
28-
<a-row type="flex">
28+
<a-row>
2929
<a-col :span="6" :xs="{ order: 1 }" :sm="{ order: 2 }" :md="{ order: 3 }" :lg="{ order: 4 }">
3030
1 col-order-responsive
3131
</a-col>

components/grid/demo/flex-stretch.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ Col provides `flex` prop to support fill rest.
1818

1919
<template>
2020
<a-divider orientation="left">Percentage columns</a-divider>
21-
<a-row type="flex">
21+
<a-row>
2222
<a-col :flex="2">2 / 5</a-col>
2323
<a-col :flex="3">3 / 5</a-col>
2424
</a-row>
2525
<a-divider orientation="left">Fill rest</a-divider>
26-
<a-row type="flex">
26+
<a-row>
2727
<a-col flex="100px">100px</a-col>
2828
<a-col flex="auto">auto</a-col>
2929
</a-row>
3030
<a-divider orientation="left">Raw flex style</a-divider>
31-
<a-row type="flex">
31+
<a-row>
3232
<a-col flex="1 1 200px">1 1 200px</a-col>
3333
<a-col flex="0 1 300px">0 1 300px</a-col>
3434
</a-row>

components/modal/Modal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export default defineComponent({
231231
{...attrs}
232232
rootClassName={hashId.value}
233233
class={classNames(hashId.value, attrs.class)}
234-
getContainer={getContainer || getPopupContainer.value}
234+
getContainer={getContainer || getPopupContainer?.value}
235235
prefixCls={prefixCls.value}
236236
wrapClassName={wrapClassNameExtended}
237237
visible={open ?? visible}

components/slider/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const Slider = defineComponent({
137137
transitionName={`${rootPrefixCls.value}-zoom-down`}
138138
key={index}
139139
overlayClassName={`${prefixCls.value}-tooltip`}
140-
getPopupContainer={getTooltipPopupContainer || getPopupContainer.value}
140+
getPopupContainer={getTooltipPopupContainer || getPopupContainer?.value}
141141
>
142142
<VcHandle
143143
{...restProps}

components/space/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const Space = defineComponent({
3838
setup(props, { slots }) {
3939
const { prefixCls, space, direction: directionConfig } = useConfigInject('space', props);
4040
const supportFlexGap = useFlexGapSupport();
41-
const size = computed(() => props.size ?? space.value?.size ?? 'small');
41+
const size = computed(() => props.size ?? space?.value?.size ?? 'small');
4242
const horizontalSize = ref<number>();
4343
const verticalSize = ref<number>();
4444
watch(

components/tooltip/Tooltip.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ export default defineComponent({
131131
return tooltip.value.getPopupDomNode();
132132
};
133133

134-
expose({ getPopupDomNode, open, forcePopupAlign: () => tooltip.value?.forcePopupAlign() });
134+
expose({
135+
getPopupDomNode,
136+
open: innerOpen,
137+
forcePopupAlign: () => tooltip.value?.forcePopupAlign(),
138+
});
135139

136140
const tooltipPlacements = computed(() => {
137141
const { builtinPlacements, arrowPointAtCenter, autoAdjustOverflow } = props;
@@ -272,7 +276,7 @@ export default defineComponent({
272276
...attrs,
273277
...(props as TooltipProps),
274278
prefixCls: prefixCls.value,
275-
getPopupContainer: getPopupContainer.value,
279+
getPopupContainer: getPopupContainer?.value,
276280
builtinPlacements: tooltipPlacements.value,
277281
visible: tempVisible,
278282
ref: tooltip,

0 commit comments

Comments
 (0)