fix: renders presentational table columns

This commit is contained in:
Jacob Fletcher
2023-03-10 08:56:31 -05:00
parent 42fbd96040
commit 4e1748fb8a
3 changed files with 21 additions and 2 deletions

View File

@@ -9,6 +9,8 @@ import BeforeLogin from './components/BeforeLogin';
import AfterNavLinks from './components/AfterNavLinks';
import { slug, globalSlug } from './shared';
import Logout from './components/Logout';
import DemoUIFieldField from './components/DemoUIField/Field';
import DemoUIFieldCell from './components/DemoUIField/Cell';
export interface Post {
id: string;
@@ -83,7 +85,7 @@ export default buildConfig({
listSearchableFields: ['title', 'description', 'number'],
group: { en: 'One', es: 'Una' },
useAsTitle: 'title',
defaultColumns: ['id', 'number', 'title', 'description'],
defaultColumns: ['id', 'number', 'title', 'description', 'demoUIField'],
},
fields: [
{
@@ -111,6 +113,17 @@ export default buildConfig({
],
},
},
{
type: 'ui',
name: 'demoUIField',
label: 'Demo UI Field',
admin: {
components: {
Field: DemoUIFieldField,
Cell: DemoUIFieldCell,
},
},
},
],
},
{

View File

@@ -409,6 +409,12 @@ describe('admin', () => {
// ensure that the "number" column is still deselected
await expect(await page.locator('[id^=list-drawer_1_] .list-controls .column-selector .column-selector__column').first()).not.toHaveClass('column-selector__column--active');
});
test('should render custom table cell component', async () => {
await createPost();
await page.goto(url.list);
await expect(await page.locator('table >> thead >> tr >> th >> text=Demo UI Field')).toBeVisible();
});
});
describe('pagination', () => {