Skip to content

Commit

Permalink
Insensitive by default for text field filter (#1963)
Browse files Browse the repository at this point in the history
  • Loading branch information
gemscng authored and timleslie committed Nov 17, 2019
1 parent dcf2558 commit af1e9e4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-owls-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystonejs/fields': minor
---

Insensitive by default for text field filter
16 changes: 8 additions & 8 deletions packages/fields/src/types/Text/views/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,42 @@ export default class TextController extends FieldController {
};
getFilterTypes = () => [
{
type: 'contains',
type: 'contains_i',
label: 'Contains',
getInitialValue: () => '',
},
{
type: 'not_contains',
type: 'not_contains_i',
label: 'Does not contain',
getInitialValue: () => '',
},
{
type: 'is',
type: 'is_i',
label: 'Is exactly',
getInitialValue: () => '',
},
{
type: 'not',
type: 'not_i',
label: 'Is not exactly',
getInitialValue: () => '',
},
{
type: 'starts_with',
type: 'starts_with_i',
label: 'Starts with',
getInitialValue: () => '',
},
{
type: 'not_starts_with',
type: 'not_starts_with_i',
label: 'Does not start with',
getInitialValue: () => '',
},
{
type: 'ends_with',
type: 'ends_with_i',
label: 'Ends with',
getInitialValue: () => '',
},
{
type: 'not_ends_with',
type: 'not_ends_with_i',
label: 'Does not end with',
getInitialValue: () => '',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('List view URL state', () => {
});
it('Stores filter state in the url', () => {
// Filter defined in the url
cy.visit('/admin/posts?!name_contains="Hello"');
cy.visit('/admin/posts?!name_contains_i="Hello"');
cy.get('#ks-list-active-filters button:nth-of-type(1)').should(
'contain',
'Name contains: "Hello"'
Expand All @@ -143,7 +143,7 @@ describe('List view URL state', () => {
.find('input[placeholder="Name contains"]')
.clear()
.type(`keystone{enter}`, { force: true });
cy.location('search').should('eq', '?!name_contains=%22keystone%22');
cy.location('search').should('eq', '?!name_contains_i=%22keystone%22');
cy.get('#ks-list-active-filters button:nth-of-type(1)').should(
'contain',
'Name contains: "keystone"'
Expand Down

0 comments on commit af1e9e4

Please sign in to comment.