feat: #1001 - builds a way to allow list view to search multiple fields
* make textfields searchable * shorten namings in placeholder function * chore: finishes listSearchableFields Co-authored-by: Christian Reichart <christian.reichart@camperboys.com>
This commit is contained in:
@@ -56,6 +56,7 @@ export default buildConfig({
|
||||
{
|
||||
slug,
|
||||
admin: {
|
||||
listSearchableFields: ['title', 'description', 'number'],
|
||||
group: 'One',
|
||||
},
|
||||
fields: [
|
||||
@@ -67,6 +68,10 @@ export default buildConfig({
|
||||
name: 'description',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'number',
|
||||
type: 'number',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -184,10 +184,26 @@ describe('admin', () => {
|
||||
test('search by id', async () => {
|
||||
const { id } = await createPost();
|
||||
await page.locator('.search-filter__input').fill(id);
|
||||
await wait(250);
|
||||
const tableItems = page.locator(tableRowLocator);
|
||||
await expect(tableItems).toHaveCount(1);
|
||||
});
|
||||
|
||||
test('search by title or description', async () => {
|
||||
await createPost({
|
||||
title: 'find me',
|
||||
description: 'this is fun',
|
||||
});
|
||||
|
||||
await page.locator('.search-filter__input').fill('find me');
|
||||
await wait(250);
|
||||
await expect(page.locator(tableRowLocator)).toHaveCount(1);
|
||||
|
||||
await page.locator('.search-filter__input').fill('this is fun');
|
||||
await wait(250);
|
||||
await expect(page.locator(tableRowLocator)).toHaveCount(1);
|
||||
});
|
||||
|
||||
test('toggle columns', async () => {
|
||||
const columnCountLocator = 'table >> thead >> tr >> th';
|
||||
await createPost();
|
||||
|
||||
@@ -19,6 +19,11 @@ const init = async () => {
|
||||
},
|
||||
});
|
||||
|
||||
// Redirect root to Admin panel
|
||||
expressApp.get('/', (_, res) => {
|
||||
res.redirect('/admin');
|
||||
});
|
||||
|
||||
const externalRouter = express.Router();
|
||||
|
||||
externalRouter.use(payload.authenticate);
|
||||
|
||||
Reference in New Issue
Block a user