Skip to content

Commit

Permalink
fix(RulesTable): RHICOMPL-914 - Placeholders should be sentence case
Browse files Browse the repository at this point in the history
  • Loading branch information
bastilian committed Dec 17, 2020
1 parent 0e485c1 commit 2a094ab
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const stringToId = (string) => (
string.split(' ').join('').toLowerCase()
);

const defaultPlaceholder = (label) => (`Filter by ${ label.toLowerCase() }`);

class FilterConfigBuilder {
chipBuilder = null;
filterBuilder = null;
Expand All @@ -31,6 +33,7 @@ class FilterConfigBuilder {
toTextFilterConfig = (item, handler, value) => ({
type: conditionalFilterType.text,
label: item.label,
placeholder: defaultPlaceholder(item.label),
id: stringToId(item.label),
filterValues: {
value,
Expand All @@ -43,6 +46,7 @@ class FilterConfigBuilder {
toCheckboxFilterConfig = (item, handler, value) => ({
type: conditionalFilterType.checkbox,
label: item.label,
placeholder: defaultPlaceholder(item.label),
id: stringToId(item.label),
filterValues: {
value,
Expand All @@ -56,6 +60,7 @@ class FilterConfigBuilder {
toRadioFilterConfig = (item, handler, value) => ({
type: conditionalFilterType.radio,
label: item.label,
placeholder: defaultPlaceholder(item.label),
id: stringToId(item.label),
filterValues: {
value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Object {
},
"id": "filterwithmultiplespaces",
"label": "Filter with multiple spaces",
"placeholder": "Filter by filter with multiple spaces",
"type": "checkbox",
},
Object {
Expand All @@ -49,6 +50,7 @@ Object {
},
"id": "name",
"label": "Name",
"placeholder": "Filter by name",
"type": "text",
},
Object {
Expand Down Expand Up @@ -119,6 +121,7 @@ Object {
},
"id": "severity",
"label": "Severity",
"placeholder": "Filter by severity",
"type": "checkbox",
},
Object {
Expand All @@ -138,6 +141,7 @@ Object {
},
"id": "passed",
"label": "Passed",
"placeholder": "Filter by passed",
"type": "radio",
},
Object {
Expand All @@ -153,6 +157,7 @@ Object {
},
"id": "selected",
"label": "Selected",
"placeholder": "Filter by selected",
"type": "checkbox",
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ exports[`SystemRulesTable component should render 1`] = `
},
"id": "name",
"label": "Name",
"placeholder": "Filter by name",
"type": "text",
},
Object {
Expand Down Expand Up @@ -90,6 +91,7 @@ exports[`SystemRulesTable component should render 1`] = `
},
"id": "severity",
"label": "Severity",
"placeholder": "Filter by severity",
"type": "checkbox",
},
Object {
Expand All @@ -109,6 +111,7 @@ exports[`SystemRulesTable component should render 1`] = `
},
"id": "passed",
"label": "Passed",
"placeholder": "Filter by passed",
"type": "radio",
},
],
Expand Down Expand Up @@ -1200,6 +1203,7 @@ exports[`SystemRulesTable component should render filtered and search mixed resu
},
"id": "name",
"label": "Name",
"placeholder": "Filter by name",
"type": "text",
},
Object {
Expand Down Expand Up @@ -1272,6 +1276,7 @@ exports[`SystemRulesTable component should render filtered and search mixed resu
},
"id": "severity",
"label": "Severity",
"placeholder": "Filter by severity",
"type": "checkbox",
},
Object {
Expand All @@ -1291,6 +1296,7 @@ exports[`SystemRulesTable component should render filtered and search mixed resu
},
"id": "passed",
"label": "Passed",
"placeholder": "Filter by passed",
"type": "radio",
},
],
Expand Down Expand Up @@ -1569,6 +1575,7 @@ exports[`SystemRulesTable component should render search results by rule name 1`
},
"id": "name",
"label": "Name",
"placeholder": "Filter by name",
"type": "text",
},
Object {
Expand Down Expand Up @@ -1639,6 +1646,7 @@ exports[`SystemRulesTable component should render search results by rule name 1`
},
"id": "severity",
"label": "Severity",
"placeholder": "Filter by severity",
"type": "checkbox",
},
Object {
Expand All @@ -1658,6 +1666,7 @@ exports[`SystemRulesTable component should render search results by rule name 1`
},
"id": "passed",
"label": "Passed",
"placeholder": "Filter by passed",
"type": "radio",
},
],
Expand Down Expand Up @@ -1990,6 +1999,7 @@ exports[`SystemRulesTable component should render search results on any page, re
},
"id": "name",
"label": "Name",
"placeholder": "Filter by name",
"type": "text",
},
Object {
Expand Down Expand Up @@ -2060,6 +2070,7 @@ exports[`SystemRulesTable component should render search results on any page, re
},
"id": "severity",
"label": "Severity",
"placeholder": "Filter by severity",
"type": "checkbox",
},
Object {
Expand All @@ -2079,6 +2090,7 @@ exports[`SystemRulesTable component should render search results on any page, re
},
"id": "passed",
"label": "Passed",
"placeholder": "Filter by passed",
"type": "radio",
},
],
Expand Down Expand Up @@ -2402,6 +2414,7 @@ exports[`SystemRulesTable component should render sorted rows 1`] = `
},
"id": "name",
"label": "Name",
"placeholder": "Filter by name",
"type": "text",
},
Object {
Expand Down Expand Up @@ -2472,6 +2485,7 @@ exports[`SystemRulesTable component should render sorted rows 1`] = `
},
"id": "severity",
"label": "Severity",
"placeholder": "Filter by severity",
"type": "checkbox",
},
Object {
Expand All @@ -2491,6 +2505,7 @@ exports[`SystemRulesTable component should render sorted rows 1`] = `
},
"id": "passed",
"label": "Passed",
"placeholder": "Filter by passed",
"type": "radio",
},
],
Expand Down Expand Up @@ -3492,6 +3507,7 @@ exports[`SystemRulesTable component should render sorted rows 2`] = `
},
"id": "name",
"label": "Name",
"placeholder": "Filter by name",
"type": "text",
},
Object {
Expand Down Expand Up @@ -3562,6 +3578,7 @@ exports[`SystemRulesTable component should render sorted rows 2`] = `
},
"id": "severity",
"label": "Severity",
"placeholder": "Filter by severity",
"type": "checkbox",
},
Object {
Expand All @@ -3581,6 +3598,7 @@ exports[`SystemRulesTable component should render sorted rows 2`] = `
},
"id": "passed",
"label": "Passed",
"placeholder": "Filter by passed",
"type": "radio",
},
],
Expand Down Expand Up @@ -4569,6 +4587,7 @@ exports[`SystemRulesTable component should render without remediations if prop p
},
"id": "name",
"label": "Name",
"placeholder": "Filter by name",
"type": "text",
},
Object {
Expand Down Expand Up @@ -4639,6 +4658,7 @@ exports[`SystemRulesTable component should render without remediations if prop p
},
"id": "severity",
"label": "Severity",
"placeholder": "Filter by severity",
"type": "checkbox",
},
Object {
Expand All @@ -4658,6 +4678,7 @@ exports[`SystemRulesTable component should render without remediations if prop p
},
"id": "passed",
"label": "Passed",
"placeholder": "Filter by passed",
"type": "radio",
},
],
Expand Down Expand Up @@ -5612,6 +5633,7 @@ exports[`SystemRulesTable component tailoring rules should be able to filter by
},
"id": "name",
"label": "Name",
"placeholder": "Filter by name",
"type": "text",
},
Object {
Expand Down Expand Up @@ -5682,6 +5704,7 @@ exports[`SystemRulesTable component tailoring rules should be able to filter by
},
"id": "severity",
"label": "Severity",
"placeholder": "Filter by severity",
"type": "checkbox",
},
Object {
Expand All @@ -5699,6 +5722,7 @@ exports[`SystemRulesTable component tailoring rules should be able to filter by
},
"id": "selected",
"label": "Selected",
"placeholder": "Filter by selected",
"type": "checkbox",
},
],
Expand Down Expand Up @@ -5933,6 +5957,7 @@ exports[`SystemRulesTable component tailoring rules should be able to filter by
},
"id": "name",
"label": "Name",
"placeholder": "Filter by name",
"type": "text",
},
Object {
Expand Down Expand Up @@ -6003,6 +6028,7 @@ exports[`SystemRulesTable component tailoring rules should be able to filter by
},
"id": "severity",
"label": "Severity",
"placeholder": "Filter by severity",
"type": "checkbox",
},
Object {
Expand All @@ -6018,6 +6044,7 @@ exports[`SystemRulesTable component tailoring rules should be able to filter by
},
"id": "selected",
"label": "Selected",
"placeholder": "Filter by selected",
"type": "checkbox",
},
],
Expand Down Expand Up @@ -6883,6 +6910,7 @@ exports[`SystemRulesTable component tailoring rules should be able to show all s
},
"id": "name",
"label": "Name",
"placeholder": "Filter by name",
"type": "text",
},
Object {
Expand Down Expand Up @@ -6953,6 +6981,7 @@ exports[`SystemRulesTable component tailoring rules should be able to show all s
},
"id": "severity",
"label": "Severity",
"placeholder": "Filter by severity",
"type": "checkbox",
},
Object {
Expand All @@ -6970,6 +6999,7 @@ exports[`SystemRulesTable component tailoring rules should be able to show all s
},
"id": "selected",
"label": "Selected",
"placeholder": "Filter by selected",
"type": "checkbox",
},
],
Expand Down

0 comments on commit 2a094ab

Please sign in to comment.