Skip to content

Commit 4150091

Browse files
authored
fix: add class name and data test id on some components (#5581)
1 parent 647bf54 commit 4150091

File tree

7 files changed

+35
-5
lines changed

7 files changed

+35
-5
lines changed

.changeset/silver-apes-strive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ultraviolet/plus": patch
3+
---
4+
5+
Add missing `className` and `data-testid` on some components

packages/plus/src/components/InfoTable/InfoTable.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,23 @@ const StyledDl = styled('dl', {
2424
type InfoTableProps = {
2525
children: ReactNode
2626
width?: string
27+
className?: string
28+
'data-testid'?: string
2729
}
2830

2931
/**
3032
* Use this component to display offers.
3133
* Create rows with `InfoTable.Row` and place cells within each row using `InfoTable.Cell`.
3234
*/
33-
export const InfoTable = ({ children, width }: InfoTableProps) => (
34-
<StyledDl width={width}>{children}</StyledDl>
35+
export const InfoTable = ({
36+
children,
37+
width,
38+
className,
39+
'data-testid': dataTestId,
40+
}: InfoTableProps) => (
41+
<StyledDl className={className} data-testid={dataTestId} width={width}>
42+
{children}
43+
</StyledDl>
3544
)
3645

3746
InfoTable.Row = InfoTableRow

packages/plus/src/components/Navigation/NavigationContent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const NavigationContent = ({
9696
logo,
9797
onWidthResize,
9898
className,
99+
'data-testid': dataTestId,
99100
id,
100101
onToggleExpand,
101102
}: NavigationProps) => {
@@ -202,7 +203,7 @@ export const NavigationContent = ({
202203
])
203204

204205
return (
205-
<StyledNav className={className} id={id}>
206+
<StyledNav className={className} data-testid={dataTestId} id={id}>
206207
<Container
207208
data-animation={shouldAnimate ? animation : undefined}
208209
data-expanded={expanded}

packages/plus/src/components/Navigation/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ export type NavigationProps = {
3939
* This function will be called when the user toggle the expand/collapse button or with the slider.
4040
*/
4141
onToggleExpand?: (expanded: boolean) => void
42+
'data-testid'?: string
4243
}

packages/plus/src/components/OfferList/OfferList.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const StyledList = styled(List)`
1414
width: ${({ theme }) => theme.sizing[700]};
1515
min-width: ${({ theme }) => theme.sizing[700]};
1616
max-width: ${({ theme }) => theme.sizing[700]};
17-
}
17+
}
1818
`
1919

2020
type OfferListProps = Omit<
@@ -30,6 +30,8 @@ type OfferListProps = Omit<
3030
* Pre-selected rows (using their offerName). Must be an array when `type = "checkbox"`.
3131
*/
3232
selected?: string | string[]
33+
['data-testid']?: string
34+
className?: string
3335
}
3436

3537
export const OfferList = ({
@@ -41,6 +43,8 @@ export const OfferList = ({
4143
autoCollapse,
4244
selected,
4345
onChangeSelect,
46+
className,
47+
'data-testid': dataTestId,
4448
}: OfferListProps) => {
4549
const [radioSelectedRow, setRadioSelectedRow] = useState<string | undefined>(
4650
typeof selected === 'string' ? selected : undefined,
@@ -82,7 +86,9 @@ export const OfferList = ({
8286
>
8387
<StyledList
8488
autoCollapse={autoCollapse}
89+
className={className}
8590
columns={computedColumns}
91+
data-testid={dataTestId}
8692
expandable={false}
8793
selectable={false}
8894
>

packages/plus/src/components/OrderSummary/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ export const OrderSummary = ({
5252
onChangeUnitInput,
5353
totalPriceDescription,
5454
additionalInfo,
55+
className,
56+
'data-testid': dataTestId,
5557
}: OrderSummaryProps) => {
5658
const [timePeriodUnit, setTimePeriodUnit] = useState<TimeUnit>(unitUnitInput)
5759
const [timePeriodAmount, setTimePeriodAmount] = useState(valueUnitInput)
@@ -152,7 +154,11 @@ export const OrderSummary = ({
152154

153155
return (
154156
<OrderSummaryContext.Provider value={valueContext}>
155-
<Container justifyContent={hideDetails ? 'flex-start' : 'space-between'}>
157+
<Container
158+
className={className}
159+
data-testId={dataTestId}
160+
justifyContent={hideDetails ? 'flex-start' : 'space-between'}
161+
>
156162
{header ? (
157163
<HeaderContainer
158164
data-hidedetails={hideDetails}

packages/plus/src/components/OrderSummary/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,6 @@ export type OrderSummaryProps = {
119119
*/
120120
onChange?: (price: PriceType, totalPrice: PriceTypeSingle) => void
121121
hideDetails?: boolean
122+
className?: string
123+
['data-testid']?: string
122124
} & PeriodProps

0 commit comments

Comments
 (0)