Calendar: add first-day-of-week attribute (#16047)

This commit is contained in:
hetech
2019-06-24 15:07:49 +08:00
committed by Zhi Cun
parent 4069f37ef0
commit e2303b85a4
8 changed files with 65 additions and 22 deletions

View File

@@ -66,5 +66,24 @@ describe('Calendar', () => {
expect(/2019.*5/.test(titleEl.innerText)).to.be.true;
expect(cell.classList.contains('is-selected')).to.be.true;
});
it('firstDayOfWeek', async() => {
vm = createVue({
template: `
<el-calendar v-model="value" :first-day-of-week="0"></el-calendar>
`,
data() {
return {
value: new Date('2019-04-01')
};
}
}, 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('31');
expect(firstRow.lastElementChild.innerText).to.be.equal('6');
});
});