Calendar: Display correct header when range is specified (#16354)

* Calendar: display correct header when range is specified

* firstOfWeek is supported

* update docs

* update test

* update

* fix typo
This commit is contained in:
hetech
2019-07-22 13:36:32 +08:00
committed by Zhi Cun
parent e13de1688b
commit adabeff9ed
6 changed files with 50 additions and 19 deletions

View File

@@ -85,5 +85,24 @@ describe('Calendar', () => {
expect(firstRow.firstElementChild.innerText).to.be.equal('31');
expect(firstRow.lastElementChild.innerText).to.be.equal('6');
});
it('firstDayOfWeek in range mode', async() => {
vm = createVue({
template: `
<el-calendar v-model="value" :first-day-of-week="7" :range="['2019-02-03', '2019-03-23']"></el-calendar>
`,
data() {
return {
value: new Date('2019-03-04')
};
}
}, true);
const head = vm.$el.querySelector('.el-calendar-table thead');
expect(head.firstElementChild.innerText).to.be.equal('日');
expect(head.lastElementChild.innerText).to.be.equal('六');
const firstRow = vm.$el.querySelector('.el-calendar-table__row');
expect(firstRow.firstElementChild.innerText).to.be.equal('3');
expect(firstRow.lastElementChild.innerText).to.be.equal('9');
});
});