mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 06:27:16 +08:00
fix: revert changes when the value is the same as old (#44196)
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Revert changes when the value is the same as the old value --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
This commit is contained in:
@@ -786,6 +786,53 @@ test.describe('Queue Table Operations', () => {
|
||||
await expect(page.getByRole('gridcell', { name: 'only in table 2' })).not.toBeVisible()
|
||||
})
|
||||
|
||||
test('reverted cell edit clears the pending change', async ({ page, ref }) => {
|
||||
const tableName = `${tableNamePrefix}_revert_edit`
|
||||
const columnName = 'name'
|
||||
|
||||
await using _ = await withSetupCleanup(
|
||||
async () => {
|
||||
await createTable(tableName, columnName, [{ name: 'original value' }])
|
||||
},
|
||||
async () => {
|
||||
await dropTable(tableName)
|
||||
}
|
||||
)
|
||||
|
||||
await page.goto(toUrl(`/project/${ref}/editor?schema=public`))
|
||||
await enableQueueOperations(page)
|
||||
await page.reload()
|
||||
await waitForTableToLoad(page, ref)
|
||||
|
||||
await page.getByRole('button', { name: `View ${tableName}`, exact: true }).click()
|
||||
await page.waitForURL(/\/editor\/\d+\?schema=public$/)
|
||||
|
||||
await expect(page.getByRole('gridcell', { name: 'original value' })).toBeVisible()
|
||||
|
||||
// Edit the cell to a different value
|
||||
const cell = page.getByRole('gridcell', { name: 'original value' })
|
||||
await cell.dblclick()
|
||||
|
||||
const editor = page.getByRole('textbox', { name: /Editor content/ })
|
||||
await expect(editor).toBeVisible()
|
||||
await editor.fill('changed value')
|
||||
await page.keyboard.press('Enter')
|
||||
|
||||
await expect(page.getByText('1 pending change')).toBeVisible()
|
||||
|
||||
// Edit the cell back to the original value
|
||||
const changedCell = page.getByRole('gridcell', { name: 'changed value' })
|
||||
await changedCell.dblclick()
|
||||
|
||||
const editor2 = page.getByRole('textbox', { name: /Editor content/ })
|
||||
await expect(editor2).toBeVisible()
|
||||
await editor2.fill('original value')
|
||||
await page.keyboard.press('Enter')
|
||||
|
||||
// The pending change should be cleared since the value was reverted
|
||||
await expect(page.getByText('pending change')).not.toBeVisible()
|
||||
})
|
||||
|
||||
test('editing multiple columns via side panel queues all changes', async ({ page, ref }) => {
|
||||
const tableName = `${tableNamePrefix}_multi_col`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user