chore: prettier source code
This commit is contained in:
@@ -30,7 +30,7 @@ export default createComponent({
|
||||
|
||||
return (
|
||||
<div class={bem('weekdays')}>
|
||||
{weekdays.map(item => (
|
||||
{weekdays.map((item) => (
|
||||
<span class={bem('weekday')}>{item}</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -99,8 +99,8 @@ export default createComponent({
|
||||
},
|
||||
|
||||
getMultipleDayType(day) {
|
||||
const isSelected = date =>
|
||||
this.currentDate.some(item => compareDay(item, date) === 0);
|
||||
const isSelected = (date) =>
|
||||
this.currentDate.some((item) => compareDay(item, date) === 0);
|
||||
|
||||
if (isSelected(day)) {
|
||||
const prevDay = getPrevDay(day);
|
||||
|
||||
@@ -125,7 +125,7 @@ export default {
|
||||
youthDay: '青年节',
|
||||
calendar: '日历',
|
||||
maxRange: '日期区间最大范围',
|
||||
selectCount: count => `选择了 ${count} 个日期`,
|
||||
selectCount: (count) => `选择了 ${count} 个日期`,
|
||||
selectSingle: '选择单个日期',
|
||||
selectMultiple: '选择多个日期',
|
||||
selectRange: '选择日期区间',
|
||||
@@ -148,7 +148,7 @@ export default {
|
||||
youthDay: 'Youth Day',
|
||||
calendar: 'Calendar',
|
||||
maxRange: 'Max Range',
|
||||
selectCount: count => `${count} dates selected`,
|
||||
selectCount: (count) => `${count} dates selected`,
|
||||
selectSingle: 'Select Single Date',
|
||||
selectMultiple: 'Select Multiple Date',
|
||||
selectRange: 'Select Date Range',
|
||||
|
||||
@@ -219,7 +219,7 @@ export default createComponent({
|
||||
const { body, months } = this.$refs;
|
||||
const top = getScrollTop(body);
|
||||
const bottom = top + this.bodyHeight;
|
||||
const heights = months.map(item => item.height);
|
||||
const heights = months.map((item) => item.height);
|
||||
const heightSum = heights.reduce((a, b) => a + b, 0);
|
||||
|
||||
// iOS scroll bounce may exceed the range
|
||||
@@ -412,7 +412,7 @@ export default createComponent({
|
||||
|
||||
render() {
|
||||
if (this.poppable) {
|
||||
const createListener = name => () => this.$emit(name);
|
||||
const createListener = (name) => () => this.$emit(name);
|
||||
|
||||
return (
|
||||
<Popup
|
||||
|
||||
@@ -33,10 +33,7 @@ test('select event when type is single', async () => {
|
||||
|
||||
await later();
|
||||
|
||||
wrapper
|
||||
.findAll('.van-calendar__day')
|
||||
.at(15)
|
||||
.trigger('click');
|
||||
wrapper.findAll('.van-calendar__day').at(15).trigger('click');
|
||||
|
||||
expect(formatDate(wrapper.emitted('select')[0][0])).toEqual('2010/1/16');
|
||||
});
|
||||
@@ -112,10 +109,7 @@ test('should not trigger select event when click disabled day', async () => {
|
||||
|
||||
await later();
|
||||
|
||||
wrapper
|
||||
.findAll('.van-calendar__day')
|
||||
.at(1)
|
||||
.trigger('click');
|
||||
wrapper.findAll('.van-calendar__day').at(1).trigger('click');
|
||||
|
||||
expect(formatDate(wrapper.emitted('select'))).toBeFalsy();
|
||||
});
|
||||
@@ -131,10 +125,7 @@ test('confirm event when type is single', async () => {
|
||||
|
||||
await later();
|
||||
|
||||
wrapper
|
||||
.findAll('.van-calendar__day')
|
||||
.at(15)
|
||||
.trigger('click');
|
||||
wrapper.findAll('.van-calendar__day').at(15).trigger('click');
|
||||
|
||||
expect(wrapper.emitted('confirm')).toBeFalsy();
|
||||
|
||||
@@ -446,7 +437,7 @@ test('color prop when type is range', async () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should scroll to current month when show', async done => {
|
||||
test('should scroll to current month when show', async (done) => {
|
||||
const wrapper = mount(Calendar, {
|
||||
propsData: {
|
||||
type: 'range',
|
||||
@@ -456,7 +447,7 @@ test('should scroll to current month when show', async done => {
|
||||
},
|
||||
});
|
||||
|
||||
Element.prototype.scrollIntoView = function() {
|
||||
Element.prototype.scrollIntoView = function () {
|
||||
expect(this.parentNode).toEqual(
|
||||
wrapper.findAll('.van-calendar__month').at(3).element
|
||||
);
|
||||
|
||||
@@ -59,7 +59,7 @@ export function calcDateNum(date: [Date, Date]) {
|
||||
|
||||
export function copyDates(dates: Date | Date[]) {
|
||||
if (Array.isArray(dates)) {
|
||||
return dates.map(date => {
|
||||
return dates.map((date) => {
|
||||
if (date === null) {
|
||||
return date;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user