test(e2e): fix grid e2e test error (#1458)

This commit is contained in:
ajaxzheng 2024-03-04 17:56:45 +08:00 committed by GitHub
parent 91bce03056
commit 19acdd953e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 12 deletions

View File

@ -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>

View File

@ -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('华中区;华东区;华南区')