fix: prevent json data getting reset when switching tabs (#4123)

This commit is contained in:
Jessica Chowdhury
2023-11-27 17:23:20 +00:00
committed by GitHub
parent 6f59257574
commit 1dcd3a2782
3 changed files with 14 additions and 4 deletions

View File

@@ -106,6 +106,10 @@ const TabsFields: CollectionConfig = {
},
],
},
{
name: 'json',
type: 'json',
},
],
},
{

View File

@@ -805,12 +805,14 @@ describe('fields', () => {
test('should fill and retain a new value within a tab while switching tabs', async () => {
const textInRowValue = 'hello'
const numberInRowValue = '23'
const jsonValue = '{ "foo": "bar"}'
await page.goto(url.create)
await page.locator('.tabs-field__tab-button:has-text("Tab with Row")').click()
await page.locator('#field-textInRow').fill(textInRowValue)
await page.locator('#field-numberInRow').fill(numberInRowValue)
await page.locator('.json-field .inputarea').fill(jsonValue)
await wait(300)
@@ -821,16 +823,19 @@ describe('fields', () => {
await expect(page.locator('#field-textInRow')).toHaveValue(textInRowValue)
await expect(page.locator('#field-numberInRow')).toHaveValue(numberInRowValue)
await expect(page.locator('.json-field .lines-content')).toContainText(jsonValue)
})
test('should retain updated values within tabs while switching between tabs', async () => {
const textInRowValue = 'new value'
const jsonValue = '{ "new": "value"}'
await page.goto(url.list)
await page.locator('.cell-id a').click()
// Go to Row tab, update the value
await page.locator('.tabs-field__tab-button:has-text("Tab with Row")').click()
await page.locator('#field-textInRow').fill(textInRowValue)
await page.locator('.json-field .inputarea').fill(jsonValue)
await wait(250)
@@ -839,6 +844,7 @@ describe('fields', () => {
await page.locator('.tabs-field__tab-button:has-text("Tab with Row")').click()
await expect(page.locator('#field-textInRow')).toHaveValue(textInRowValue)
await expect(page.locator('.json-field .lines-content')).toContainText(jsonValue)
// Go to array tab, save the doc
await page.locator('.tabs-field__tab-button:has-text("Tab with Array")').click()