Skip to content

Commit 201f039

Browse files
committed
add screenshot test
1 parent a3991a1 commit 201f039

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed

packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Value/SummaryList/Examples.tsx

+30
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,36 @@ export const HorizontalLayoutWithoutLabel = () => (
335335
</ComponentBox>
336336
)
337337

338+
export const WithHelpInInfoOverlay = () => (
339+
<ComponentBox data-visual-test="forms-value-summary-with-help-in-info-overlay">
340+
<Form.Handler
341+
data={{
342+
firstName: 'John',
343+
lastName: 'Doe',
344+
}}
345+
>
346+
<Form.InfoOverlay>
347+
<Value.SummaryList>
348+
<Value.Name.First
349+
path="/firstName"
350+
help={{
351+
title: 'Help title',
352+
content: 'Help content.',
353+
}}
354+
/>
355+
<Value.Name.Last
356+
path="/lastName"
357+
help={{
358+
title: 'Help title',
359+
content: 'Help content.',
360+
}}
361+
/>
362+
</Value.SummaryList>
363+
</Form.InfoOverlay>
364+
</Form.Handler>
365+
</ComponentBox>
366+
)
367+
338368
export function AnimatedVisibility() {
339369
return (
340370
<ComponentBox>

packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Value/SummaryList/demos.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ To maintain the semantic structure of the `dl` element, the `Form.Visibility` co
4545
<Examples.DefaultLayoutWithHelp />
4646
<Examples.HorizontalLayoutWithHelp />
4747
<Examples.GridLayoutWithHelp />
48+
<Examples.WithHelpInInfoOverlay />
4849
</VisibleWhenVisualTest>

packages/dnb-eufemia/src/extensions/forms/Value/SummaryList/__tests__/SummaryList.screenshot.test.ts

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ describe('Value.SummaryList', () => {
4444
expect(screenshot).toMatchImageSnapshot()
4545
})
4646

47+
it('have to match with help wrapped in info overlay', async () => {
48+
const screenshot = await makeScreenshot({
49+
selector:
50+
'[data-visual-test="forms-value-summary-with-help-in-info-overlay"]',
51+
})
52+
expect(screenshot).toMatchImageSnapshot()
53+
})
54+
4755
it('have to match default layout with help', async () => {
4856
const screenshot = await makeScreenshot({
4957
selector:

packages/dnb-eufemia/src/extensions/forms/ValueBlock/style/dnb-value-block.scss

+7
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949
&__content:has(+ .dnb-help-button) {
5050
margin-right: 0.5rem;
5151
}
52+
div {
53+
// To support when wrapped in a Form.InfoOverlay
54+
& > strong:has(+ .dnb-help-button),// To support dt > strong
55+
&__content:has(+ .dnb-help-button) {
56+
margin-right: 0.5rem;
57+
}
58+
}
5259
}
5360

5461
&__help {

0 commit comments

Comments
 (0)