Skip to content

Commit

Permalink
fix(ui): don't use tab label as prefix on tabs which have no name.
Browse files Browse the repository at this point in the history
  • Loading branch information
andershermansen committed Dec 16, 2024
1 parent 00909ec commit 0823167
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions packages/ui/src/elements/WhereBuilder/reduceClientFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ export const reduceClientFields = ({
if (typeof tab.label !== 'boolean') {
const localizedTabLabel = getTranslation(tab.label, i18n)

const labelWithPrefix = labelPrefix
? labelPrefix + ' > ' + localizedTabLabel
: localizedTabLabel
const labelWithPrefix = tabHasName(tab)
? labelPrefix
? labelPrefix + ' > ' + localizedTabLabel
: localizedTabLabel
: labelPrefix

// Make sure we handle nested tabs
const tabPathPrefix =
Expand Down
5 changes: 3 additions & 2 deletions test/admin/e2e/2/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@ describe('admin2', () => {
await page.locator('.where-builder__add-first-filter').click()
await page.locator('.condition__field .rs__control').click()
const options = page.locator('.rs__option')
await options.locator('text=Tab 1 > Title').click()
await expect(options.first()).toHaveText('Title')
await options.first().click()
await page.locator('.condition__operator .rs__control').click()
await options.locator('text=equals').click()
await page.locator('.condition__value input').fill('test')
Expand Down Expand Up @@ -780,7 +781,7 @@ describe('admin2', () => {
await page.locator('.condition__field .rs__control').click()
const options = page.locator('.rs__option')

await expect(options.locator('text=Tab 1 > Title')).toHaveText('Tab 1 > Title')
await expect(options.first()).toHaveText('Title')

// list columns
await expect(page.locator('#heading-title .sort-column__label')).toHaveText('Title')
Expand Down

0 comments on commit 0823167

Please sign in to comment.