forked from opentiny/tiny-vue
test(e2e): fix grid e2e test error (#1458)
This commit is contained in:
parent
91bce03056
commit
19acdd953e
|
@ -92,37 +92,37 @@ const tableData = ref([
|
||||||
])
|
])
|
||||||
const theGridRef = ref('theGridRef')
|
const theGridRef = ref('theGridRef')
|
||||||
|
|
||||||
function editRowEvent(row) {
|
const getActiveRow = () => {
|
||||||
|
const activedRowIndex = theGridRef.value.getActiveRow()
|
||||||
|
|
||||||
|
activedRow.value = activedRowIndex ? activedRowIndex.rowIndex : ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const editRowEvent = (row) => {
|
||||||
if (row.name === 'RFV有限责任公司') {
|
if (row.name === 'RFV有限责任公司') {
|
||||||
// 只激活区域单元格编辑
|
// 只激活区域单元格编辑
|
||||||
theGridRef.value.setActiveCell(row, 'area').then(() => {
|
theGridRef.value.setActiveCell(row, 'area').then(() => {
|
||||||
this.getActiveRow()
|
getActiveRow()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// mode: 'cell' 时默认激活第一个单元格
|
// mode: 'cell' 时默认激活第一个单元格
|
||||||
theGridRef.value.setActiveRow(row).then(() => {
|
theGridRef.value.setActiveRow(row).then(() => {
|
||||||
this.getActiveRow()
|
getActiveRow()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveRowEvent() {
|
const saveRowEvent = () => {
|
||||||
theGridRef.value.clearActived().then(() => {
|
theGridRef.value.clearActived().then(() => {
|
||||||
getActiveRow()
|
getActiveRow()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelRowEvent() {
|
const cancelRowEvent = () => {
|
||||||
theGridRef.value.clearActived().then(() => {
|
theGridRef.value.clearActived().then(() => {
|
||||||
getActiveRow()
|
getActiveRow()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getActiveRow() {
|
|
||||||
const activedRowIndex = theGridRef.value.getActiveRow()
|
|
||||||
|
|
||||||
activedRow.value = activedRowIndex ? activedRowIndex.rowIndex : ''
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -4,7 +4,7 @@ test('Grid-编辑器-下拉多选', async ({ page }) => {
|
||||||
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
||||||
await page.goto('grid-editor#editor-mutil-render')
|
await page.goto('grid-editor#editor-mutil-render')
|
||||||
await page.getByText('华中区;华南区').click()
|
await page.getByText('华中区;华南区').click()
|
||||||
await page.locator('.tiny-input__suffix-inner > .tiny-svg > .st0').click()
|
await page.locator('.tiny-input__suffix-inner > .tiny-svg').click()
|
||||||
await page.locator('li').filter({ hasText: '华东区' }).locator('span').nth(2).click()
|
await page.locator('li').filter({ hasText: '华东区' }).locator('span').nth(2).click()
|
||||||
await page.getByRole('cell', { name: '创建时间' }).click()
|
await page.getByRole('cell', { name: '创建时间' }).click()
|
||||||
await expect(page.locator('.tiny-grid-body__row').first()).toContainText('华中区;华东区;华南区')
|
await expect(page.locator('.tiny-grid-body__row').first()).toContainText('华中区;华东区;华南区')
|
||||||
|
|
Loading…
Reference in New Issue