Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests UGN-272 add column matching tests #73

Merged
merged 2 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"jest": "27.5.1",
"jest-watch-typeahead": "1.0.0",
"prettier": "2.5.1",
"react-select-event": "5.3.0",
"rollup": "2.67.3",
"rollup-plugin-typescript2": "0.31.2",
"ts-essentials": "9.1.2",
Expand Down
4 changes: 3 additions & 1 deletion src/components/Selects/MatchColumnSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ interface Props {
value?: SelectOption
options: readonly SelectOption[]
placeholder?: string
name?: string
}

export const MatchColumnSelect = ({ onChange, value, options, placeholder }: Props) => {
export const MatchColumnSelect = ({ onChange, value, options, placeholder, name }: Props) => {
const styles = useStyleConfig("MatchColumnsStep") as Styles
return (
<Select
Expand All @@ -23,6 +24,7 @@ export const MatchColumnSelect = ({ onChange, value, options, placeholder }: Pro
chakraStyles={styles.select}
menuPosition="fixed"
components={customComponents}
aria-label={name}
/>
)
}
5 changes: 3 additions & 2 deletions src/steps/MatchColumnsStep/components/MatchIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ export const MatchIcon = (props: MatchIconProps) => {
minH={6}
w={6}
h={6}
data-highlighted={dataAttr(props.isChecked)}
ml="0.875rem"
mr={3}
data-highlighted={dataAttr(props.isChecked)}
data-testid="column-checkmark"
>
{props.isChecked && (
<MotionFlex {...animationConfig}>
<CgCheck size="1.5rem"/>
<CgCheck size="1.5rem" />
</MotionFlex>
)}
</chakra.div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const SubMatchingSelect = <T extends string>({ option, column, onSubChang
placeholder={translations.matchColumnsStep.subSelectPlaceholder}
onChange={(value) => onSubChange(value?.value as T, column.index, option.entry!)}
options={options}
name={option.entry}
/>
</Box>
)
Expand Down
11 changes: 9 additions & 2 deletions src/steps/MatchColumnsStep/components/TemplateColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const TemplateColumn = <T extends string>({ column, onChange, onSubChange
value={selectValue}
onChange={(value) => onChange(value?.value as T, column.index)}
options={selectOptions}
name={column.header}
/>
</Box>
<MatchIcon isChecked={isChecked} />
Expand All @@ -65,7 +66,13 @@ export const TemplateColumn = <T extends string>({ column, onChange, onSubChange
<Flex width="100%">
<Accordion allowMultiple width="100%">
<AccordionItem border="none" py={1}>
<AccordionButton _hover={{ bg: "transparent" }} _focus={{ boxShadow: "none" }} px={0} py={4}>
<AccordionButton
_hover={{ bg: "transparent" }}
_focus={{ boxShadow: "none" }}
px={0}
py={4}
data-testid="accordion-button"
>
<AccordionIcon />
<Box textAlign="left">
<Text sx={styles.selectColumn.accordionLabel}>
Expand All @@ -75,7 +82,7 @@ export const TemplateColumn = <T extends string>({ column, onChange, onSubChange
</AccordionButton>
<AccordionPanel pb={4} pr={3} display="flex" flexDir="column">
{column.matchedOptions.map((option) => (
<SubMatchingSelect option={option} column={column} onSubChange={onSubChange} />
<SubMatchingSelect option={option} column={column} onSubChange={onSubChange} key={option.entry} />
))}
</AccordionPanel>
</AccordionItem>
Expand Down
Loading