chore: add trailingComma

This commit is contained in:
陈嘉涵
2020-01-19 11:57:09 +08:00
parent e841175fe8
commit 389d68884d
269 changed files with 2706 additions and 2702 deletions
+17 -17
View File
@@ -1,66 +1,66 @@
const group1 = [
{
text: 'Delaware',
id: 1
id: 1,
},
{
text: 'Florida',
id: 2
id: 2,
},
{
text: 'Georqia',
id: 3,
disabled: true
disabled: true,
},
{
text: 'Indiana',
id: 4
}
id: 4,
},
];
const group2 = [
{
text: 'Alabama',
id: 5
id: 5,
},
{
text: 'Kansas',
id: 6
id: 6,
},
{
text: 'Louisiana',
id: 7
id: 7,
},
{
text: 'Texas',
id: 8
}
id: 8,
},
];
const group3 = [
{
text: 'Alabama',
id: 9
id: 9,
},
{
text: 'Kansas',
id: 10
}
id: 10,
},
];
export const enUSData = [
{
text: 'Group 1',
children: group1
children: group1,
},
{
text: 'Group 2',
children: group2
children: group2,
},
{
text: 'Group 3',
disabled: true,
children: group3
}
children: group3,
},
];
+17 -17
View File
@@ -1,65 +1,65 @@
const zhejiang = [
{
text: '杭州',
id: 1
id: 1,
},
{
text: '温州',
id: 2
id: 2,
},
{
text: '宁波',
id: 3,
disabled: true
disabled: true,
},
{
text: '义乌',
id: 4
}
id: 4,
},
];
const jiangsu = [
{
text: '南京',
id: 5
id: 5,
},
{
text: '无锡',
id: 6
id: 6,
},
{
text: '徐州',
id: 7
id: 7,
},
{
text: '苏州',
id: 8
}
id: 8,
},
];
const fujian = [
{
text: '泉州',
id: 9
id: 9,
},
{
text: '厦门',
id: 10
}
id: 10,
},
];
export const zhCNData = [
{
text: '浙江',
children: zhejiang
children: zhejiang,
},
{
text: '江苏',
children: jiangsu
children: jiangsu,
},
{
text: '福建',
disabled: true,
children: fujian
}
children: fujian,
},
];
+6 -6
View File
@@ -44,7 +44,7 @@ export default {
multipleMode: '多选模式',
customContent: '自定义内容',
data: zhCNData,
dataSimple: [{ text: '分组 1' }, { text: '分组 2' }]
dataSimple: [{ text: '分组 1' }, { text: '分组 2' }],
},
'en-US': {
showInfo: 'Show Info',
@@ -52,8 +52,8 @@ export default {
multipleMode: 'Multiple Mode',
customContent: 'Custom Content',
data: enUSData,
dataSimple: [{ text: 'Group 1' }, { text: 'Group 2' }]
}
dataSimple: [{ text: 'Group 1' }, { text: 'Group 2' }],
},
},
data() {
@@ -64,7 +64,7 @@ export default {
activeIndex: 0,
activeIndex2: 0,
activeIndex3: 0,
activeIndex4: 0
activeIndex4: 0,
};
},
@@ -84,7 +84,7 @@ export default {
data[1].info = 5;
return data;
}
}
},
},
};
</script>
+8 -8
View File
@@ -79,8 +79,8 @@ function TreeSelect(
'van-ellipsis',
bem('item', {
active: isActiveItem(item.id),
disabled: item.disabled
})
disabled: item.disabled,
}),
]}
onClick={() => {
if (!item.disabled) {
@@ -134,24 +134,24 @@ function TreeSelect(
TreeSelect.props = {
max: {
type: Number,
default: Infinity
default: Infinity,
},
items: {
type: Array,
default: () => []
default: () => [],
},
height: {
type: [Number, String],
default: 300
default: 300,
},
activeId: {
type: [Number, String, Array],
default: 0
default: 0,
},
mainActiveIndex: {
type: Number,
default: 0
}
default: 0,
},
};
export default createComponent<TreeSelectProps>(TreeSelect);
+60 -60
View File
@@ -7,19 +7,19 @@ test('empty list', () => {
const mockItem = {
text: 'city1',
id: 1
id: 1,
};
const mockItem2 = {
text: 'city2',
id: 2
id: 2,
};
const mockItems = [
{
text: 'group1',
children: [mockItem]
}
children: [mockItem],
},
];
test('click-nav event', () => {
@@ -28,14 +28,14 @@ test('click-nav event', () => {
const wrapper = mount(TreeSelect, {
propsData: {
items: mockItems
items: mockItems,
},
context: {
on: {
navclick: onNavClick,
'click-nav': onClickNav
}
}
'click-nav': onClickNav,
},
},
});
const navItems = wrapper.findAll('.van-tree-select__nav-item');
@@ -51,14 +51,14 @@ test('click-item event', () => {
const wrapper = mount(TreeSelect, {
propsData: {
items: mockItems
items: mockItems,
},
context: {
on: {
itemclick: onItemClick,
'click-item': onClickItem
}
}
'click-item': onClickItem,
},
},
});
const items = wrapper.findAll('.van-tree-select__item');
@@ -76,15 +76,15 @@ test('click disabled nav', () => {
{
text: 'group1',
children: [mockItem],
disabled: true
}
]
disabled: true,
},
],
},
context: {
on: {
'click-nav': onClickNav
}
}
'click-nav': onClickNav,
},
},
});
const items = wrapper.findAll('.van-tree-select__nav-item');
@@ -102,17 +102,17 @@ test('click disabled item', () => {
children: [
{
...mockItem,
disabled: true
}
]
}
]
disabled: true,
},
],
},
],
},
context: {
on: {
'click-item': onClickItem
}
}
'click-item': onClickItem,
},
},
});
const items = wrapper.findAll('.van-tree-select__item');
@@ -125,13 +125,13 @@ test('content slot', () => {
propsData: {
items: [
{
text: 'group1'
}
]
text: 'group1',
},
],
},
scopedSlots: {
content: () => 'Custom Content'
}
content: () => 'Custom Content',
},
});
expect(wrapper).toMatchSnapshot();
@@ -140,8 +140,8 @@ test('content slot', () => {
test('height prop', () => {
const wrapper = mount(TreeSelect, {
propsData: {
height: '100vh'
}
height: '100vh',
},
});
expect(wrapper).toMatchSnapshot();
@@ -153,10 +153,10 @@ test('nav info', () => {
items: [
{
text: 'group1',
info: 3
}
]
}
info: 3,
},
],
},
});
expect(wrapper).toMatchSnapshot();
@@ -173,9 +173,9 @@ test('use sync modifier in main-active-index', () => {
data() {
return {
mainActiveIndex: -1,
items: mockItems
items: mockItems,
};
}
},
});
const navItems = wrapper.findAll('.van-tree-select__nav-item');
@@ -200,11 +200,11 @@ test('use sync modifier in active-id', () => {
items: [
{
text: 'group1',
children: [mockItem, mockItem2]
}
]
children: [mockItem, mockItem2],
},
],
};
}
},
});
const items = wrapper.findAll('.van-tree-select__item');
@@ -229,11 +229,11 @@ test('multiple select', () => {
items: [
{
text: 'group1',
children: [mockItem, mockItem2]
}
]
children: [mockItem, mockItem2],
},
],
};
}
},
});
const items = wrapper.findAll('.van-tree-select__item');
@@ -262,11 +262,11 @@ test('max prop', () => {
items: [
{
text: 'group1',
children: [mockItem, mockItem2]
}
]
children: [mockItem, mockItem2],
},
],
};
}
},
});
const items = wrapper.findAll('.van-tree-select__item');
@@ -283,10 +283,10 @@ test('className of nav', () => {
{
text: 'group1',
className: 'my-class',
children: []
}
]
}
children: [],
},
],
},
});
const items = wrapper.findAll('.van-tree-select__nav-item');
@@ -310,17 +310,17 @@ test('should sync value before trigger click-item event', done => {
items: [
{
text: 'group1',
children: [mockItem, mockItem2]
}
]
children: [mockItem, mockItem2],
},
],
};
},
methods: {
onClickItem() {
expect(wrapper.vm.activeId).toEqual(mockItem2.id);
done();
}
}
},
},
});
const items = wrapper.findAll('.van-tree-select__item');