fix: corrects greater than or equal filter key (#3307)

This commit is contained in:
Jessica Chowdhury
2023-10-05 17:32:13 +01:00
committed by GitHub
parent 183414e6e8
commit 374fb99571
3 changed files with 40 additions and 1 deletions

View File

@@ -41,7 +41,7 @@ const numeric = [
},
{
label: 'isGreaterThanOrEqualTo',
value: 'greater_than_equals',
value: 'greater_than_equal',
},
]

View File

@@ -139,6 +139,8 @@ export default buildConfigWithDefaults({
await payload.create({ collection: 'rich-text-fields', data: richTextBulletsDoc })
await payload.create({ collection: 'rich-text-fields', data: richTextDocWithRelationship })
await payload.create({ collection: 'number-fields', data: { number: 2 } });
await payload.create({ collection: 'number-fields', data: { number: 3 } });
await payload.create({ collection: 'number-fields', data: numberDoc })
const blocksDocWithRichText = { ...blocksDoc }

View File

@@ -79,6 +79,43 @@ describe('fields', () => {
await expect(textCell).toHaveText(String(numberDoc.number))
})
test('should filter Number fields in the collection view - greaterThanOrEqual', async () => {
await page.goto(url.list);
// should have 3 entries
await expect(page.locator('table >> tbody >> tr')).toHaveCount(3);
// open the filter options
await page.locator('.list-controls__toggle-where').click();
await expect(page.locator('.list-controls__where.rah-static--height-auto')).toBeVisible();
await page.locator('.where-builder__add-first-filter').click();
const initialField = page.locator('.condition__field');
const operatorField = page.locator('.condition__operator');
const valueField = page.locator('.condition__value >> input');
// select Number field to filter on
await initialField.click();
const initialFieldOptions = initialField.locator('.rs__option');
await initialFieldOptions.locator('text=number').first().click();
expect(initialField.locator('.rs__single-value')).toContainText('Number');
// select >= operator
await operatorField.click();
const operatorOptions = operatorField.locator('.rs__option');
await operatorOptions.last().click();
expect(operatorField.locator('.rs__single-value')).toContainText('is greater than or equal to');
// enter value of 3
await valueField.fill('3');
await expect(valueField).toHaveValue('3');
await wait(300);
// should have 2 entries after filtering
await expect(page.locator('table >> tbody >> tr')).toHaveCount(2);
});
test('should create', async () => {
const input = 5