Skip to content

Commit

Permalink
test: resolve test error (jd-opensource#1709)
Browse files Browse the repository at this point in the history
  • Loading branch information
Drjingfubo authored Sep 29, 2022
1 parent 5d41b8d commit 01faac5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`Cascader change tab 1`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2002; animation-duration: 0.3s;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -73,7 +73,7 @@ exports[`Cascader change tab 2`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2002; animation-duration: 0.3s;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -138,7 +138,7 @@ exports[`Cascader change tab 3`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2002; animation-duration: 0.3s;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item active\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -203,7 +203,7 @@ exports[`Cascader modelValue 1`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\"></view>
<view class=\\"nut-tabs__content\\" style=\\"transform: translate3d(-0%, 0, 0); transition-duration: 300ms;\\">
<view class=\\"nut-tabpane\\">
Expand Down Expand Up @@ -235,7 +235,7 @@ exports[`Cascader modelValue 2`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -300,7 +300,7 @@ exports[`Cascader modelValue 3`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item active\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -338,7 +338,7 @@ exports[`Cascader modelValue 4`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item active\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -376,7 +376,7 @@ exports[`Cascader modelValue with lazy 1`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item active\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -404,7 +404,7 @@ exports[`Cascader modelValue with lazy 2`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -472,7 +472,7 @@ exports[`Cascader options 1`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -537,7 +537,7 @@ exports[`Cascader options with convertConfig 1`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -584,7 +584,7 @@ exports[`Cascader options with valueKey/textKey/childrenKey 1`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -649,7 +649,7 @@ exports[`Cascader select 1`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item active\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -687,7 +687,7 @@ exports[`Cascader select 2`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -752,7 +752,7 @@ exports[`Cascader select 3`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -817,7 +817,7 @@ exports[`Cascader select 4`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item active\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -855,7 +855,7 @@ exports[`Cascader select with lazy 1`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\"></view>
<view class=\\"nut-tabs__content\\" style=\\"transform: translate3d(-0%, 0, 0); transition-duration: 300ms;\\">
<view class=\\"nut-tabpane\\">
Expand All @@ -877,7 +877,7 @@ exports[`Cascader select with lazy 2`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item active\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -912,7 +912,7 @@ exports[`Cascader select with lazy 3`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -962,7 +962,7 @@ exports[`Cascader select with lazy 4`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -1027,7 +1027,7 @@ exports[`Cascader select with lazy 5`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -1092,7 +1092,7 @@ exports[`Cascader select with lazy 6`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item active\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -1127,7 +1127,7 @@ exports[`Cascader select with lazy 7`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2000; animation-duration: 0.3s; display: none;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down Expand Up @@ -1177,7 +1177,7 @@ exports[`Cascader visible 1`] = `
<transition-stub>
<view class=\\"nut-popup round popup-bottom nut-cascader__popup\\" style=\\"z-index: 2001; animation-duration: 0.3s;\\">
<!--v-if-->
<view class=\\"nut-tabs horizontal nut-cascader\\">
<view class=\\"nut-tabs horizontal nut-cascader\\" id=\\"container\\">
<view class=\\"nut-tabs__titles line scrollable normal\\">
<view class=\\"nut-tabs__titles-item active\\" style=\\"margin-left: 0px; margin-right: 0px;\\">
<view class=\\"nut-tabs__titles-item__line\\"></view>
Expand Down
4 changes: 3 additions & 1 deletion src/packages/__VUE/tabs/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import Tabs from '../index.vue';
import TabPane from './../../tabpane/index.vue';
import { nextTick, reactive } from 'vue';
import NutIcon from '../../icon/index.vue';
import NutSticky from '../../sticky/index.vue';

beforeAll(() => {
config.global.components = {
NutIcon
NutIcon,
NutSticky
};
});

Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/tabs/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const component = {
};
const init = (vnodes: VNode[] = slots.default?.()) => {
titles.value = [];
vnodes = vnodes.filter((item) => typeof item.children !== 'string');
vnodes = vnodes?.filter((item) => typeof item.children !== 'string');
if (vnodes && vnodes.length) {
renderTitles(vnodes);
}
Expand Down

0 comments on commit 01faac5

Please sign in to comment.