fix(components): [calendar] respect table semantics (#18552)

This commit is contained in:
Jungzl
2024-11-22 22:34:19 +08:00
committed by GitHub
parent a699b21876
commit 9f0132ace8
2 changed files with 6 additions and 4 deletions

View File

@@ -117,7 +117,7 @@ describe('Calendar.vue', () => {
return <Calendar v-model={this.value} />
},
})
const head = wrapper.element.querySelector('.el-calendar-table thead')
const head = wrapper.element.querySelector('.el-calendar-table thead tr')
expect(head?.firstElementChild?.innerHTML).toBe('Sun')
expect(head?.lastElementChild?.innerHTML).toBe('Sat')
const firstRow = wrapper.element.querySelector('.el-calendar-table__row')
@@ -133,7 +133,7 @@ describe('Calendar.vue', () => {
return <Calendar v-model={this.value} />
},
})
const head = wrapper.element.querySelector('.el-calendar-table thead')
const head = wrapper.element.querySelector('.el-calendar-table thead tr')
expect(head?.firstElementChild?.innerHTML).toBe('Mon')
expect(head?.lastElementChild?.innerHTML).toBe('Sun')
const firstRow = wrapper.element.querySelector('.el-calendar-table__row')
@@ -157,7 +157,7 @@ describe('Calendar.vue', () => {
)
},
})
const head = wrapper.element.querySelector('.el-calendar-table thead')
const head = wrapper.element.querySelector('.el-calendar-table thead tr')
expect(head?.firstElementChild?.innerHTML).toBe('Sun')
expect(head?.lastElementChild?.innerHTML).toBe('Sat')
const firstRow = wrapper.element.querySelector('.el-calendar-table__row')

View File

@@ -5,7 +5,9 @@
cellpadding="0"
>
<thead v-if="!hideHeader">
<th v-for="day in weekDays" :key="day">{{ day }}</th>
<tr>
<th v-for="day in weekDays" :key="day" scope="col">{{ day }}</th>
</tr>
</thead>
<tbody>