Skip to content

Commit

Permalink
Set datatestid for filters (#4302)
Browse files Browse the repository at this point in the history
* Set datatestid for filters

* Changeset
  • Loading branch information
andrzejewsky authored Oct 6, 2023
1 parent 795b208 commit bd3290b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tall-kangaroos-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Set data-test-id for filters
14 changes: 13 additions & 1 deletion src/components/ConditionalFilter/UI/RightOperator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const RightOperator = ({
if (isTextInput(selected)) {
return (
<Input
data-test-id={`right-${index}`}
value={selected.value}
onChange={e => {
emitter.changeRightOperator(index, e.target.value);
Expand All @@ -63,6 +64,7 @@ export const RightOperator = ({
if (isNumberInput(selected)) {
return (
<Input
data-test-id={`right-${index}`}
type="number"
value={selected.value}
onChange={e => {
Expand All @@ -84,6 +86,7 @@ export const RightOperator = ({
if (isMultiselect(selected)) {
return (
<DynamicMultiselect
data-test-id={`right-${index}`}
value={selected.value}
options={selected.options ?? []}
loading={selected.loading}
Expand All @@ -107,6 +110,7 @@ export const RightOperator = ({
if (isCombobox(selected)) {
return (
<DynamicCombobox
data-test-id={`right-${index}`}
value={selected.value}
options={selected.options ?? []}
loading={selected.loading}
Expand All @@ -133,6 +137,7 @@ export const RightOperator = ({
if (isSelect(selected)) {
return (
<Select
data-test-id={`right-${index}`}
value={selected.value}
options={selected.options ?? []}
onChange={value => emitter.changeRightOperator(index, value)}
Expand All @@ -153,6 +158,7 @@ export const RightOperator = ({
return (
<RangeInputWrapper>
<RangeInput
data-test-id={`right-${index}`}
value={selected.value}
onChange={value => {
emitter.changeRightOperator(index, value);
Expand All @@ -170,6 +176,7 @@ export const RightOperator = ({
if (isDate(selected)) {
return (
<Input
data-test-id={`right-${index}`}
type="date"
value={selected.value}
onChange={e => {
Expand All @@ -185,6 +192,7 @@ export const RightOperator = ({
if (isDateTime(selected)) {
return (
<Input
data-test-id={`right-${index}`}
type="datetime-local"
value={selected.value}
onChange={e => {
Expand All @@ -201,6 +209,7 @@ export const RightOperator = ({
return (
<RangeInputWrapper>
<RangeInput
data-test-id={`right-${index}`}
value={selected.value}
onChange={value => {
emitter.changeRightOperator(index, value);
Expand All @@ -219,6 +228,7 @@ export const RightOperator = ({
return (
<RangeInputWrapper>
<RangeInput
data-test-id={`right-${index}`}
value={selected.value}
onChange={value => {
emitter.changeRightOperator(index, value);
Expand All @@ -233,5 +243,7 @@ export const RightOperator = ({
);
}

return <Input disabled value={selected.value} />;
return (
<Input disabled value={selected.value} data-test-id={`right-${index}`} />
);
};
2 changes: 2 additions & 0 deletions src/components/ConditionalFilter/UI/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const RowComponent = ({
alignItems="start"
>
<DynamicCombobox
data-test-id={`left-${index}`}
value={item.value}
options={leftOptions}
loading={item.loading}
Expand Down Expand Up @@ -67,6 +68,7 @@ export const RowComponent = ({
/>

<Select
data-test-id={`condition-${index}`}
value={item.condition.selected.conditionValue}
options={item.condition.options}
disabled={constrain.disableCondition}
Expand Down

0 comments on commit bd3290b

Please sign in to comment.