Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(grid): [grid] fix tree-grid-insert-delete-update demo #1495

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
</template>
</tiny-grid-toolbar>
</template>
<tiny-grid-column type="selection" width="100" tree-node></tiny-grid-column>
<tiny-grid-column type="selection" width="100"></tiny-grid-column>
<tiny-grid-column type="index" width="80"></tiny-grid-column>
<tiny-grid-column field="name" title="公司名称"></tiny-grid-column>
<tiny-grid-column field="name" title="公司名称" tree-node></tiny-grid-column>
<tiny-grid-column field="area" title="区域" :editor="{ component: 'input', autoselect: true }"></tiny-grid-column>
<tiny-grid-column
field="employees"
Expand Down Expand Up @@ -92,7 +92,7 @@ function copy(nodes1, nodes2) {

return res
}

const increaseId = ref(30)
const tableData = ref([
{
id: '1',
Expand Down Expand Up @@ -206,9 +206,11 @@ function insertEvent() {
const row = {
name: '新数据',
isNew: true,
id: String(increaseId.value++),
children: [
{
name: '新数据-child'
name: '新数据-child',
id: String(increaseId.value++)
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ test.describe('树表增删改功能', () => {
await page.locator('.tiny-grid-toolbar').click()
await page.getByRole('button', { name: '确定' }).click()
await expect(page.getByRole('cell', { name: 'zzcd' })).toBeVisible()
await page.getByRole('row', { name: '1 新数据' }).locator('path').nth(1).click()
await page.getByRole('row', { name: '1 新数据' }).locator('.tiny-grid-checkbox__icon').first().click()
await page.getByRole('button', { name: '移除选中' }).click()
await expect(page.getByRole('cell', { name: 'zzcd' })).not.toBeVisible()
})

test('树表修改测试', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('grid-tree-table#tree-table-tree-grid-insert-delete-update')
await page.getByRole('row', { name: '2 WWWW科技YX公司 华南区 500' }).getByRole('img').first().click()
await page
.getByRole('row', { name: '2 WWWW科技YX公司 华南区 500' })
.locator('.tiny-grid-tree-wrapper')
.first()
.click()
await page.getByRole('row', { name: '3 WWWW科技股份有限子公司 华南区 720' }).getByText('华南区').first().click()
await page.getByRole('row', { name: '3 WWWW科技股份有限子公司 720' }).getByRole('textbox').first().click()
await page.getByRole('row', { name: '3 WWWW科技股份有限子公司 720' }).getByRole('textbox').fill('华南区ee')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
</template>
</tiny-grid-toolbar>
</template>
<tiny-grid-column type="selection" width="100" tree-node></tiny-grid-column>
<tiny-grid-column type="selection" width="100"></tiny-grid-column>
<tiny-grid-column type="index" width="80"></tiny-grid-column>
<tiny-grid-column field="name" title="公司名称"></tiny-grid-column>
<tiny-grid-column field="name" title="公司名称" tree-node></tiny-grid-column>
<tiny-grid-column field="area" title="区域" :editor="{ component: 'input', autoselect: true }"></tiny-grid-column>
<tiny-grid-column
field="employees"
Expand Down Expand Up @@ -95,6 +95,7 @@ export default {
},
data() {
return {
increaseId: 30,
tableData: [
{
id: '1',
Expand Down Expand Up @@ -209,8 +210,10 @@ export default {
const row = {
name: '新数据',
isNew: true,
id: String(this.increaseId++),
children: [
{
id: String(this.increaseId++),
name: '新数据-child'
}
]
Expand Down
Loading