Skip to content

Commit

Permalink
fix(Tabs): fix align property with value center (#3991)
Browse files Browse the repository at this point in the history
  • Loading branch information
langz authored Sep 24, 2024
1 parent 5561afb commit 8483df8
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,3 +381,41 @@ export const TabsSingleElementData = () => (
</ComponentBox>
</Wrapper>
)

export const TabsAlignProperty = () => (
<Wrapper>
<ComponentBox data-visual-test="tabs-align-property">
<Tabs
align="left"
data={[
{
title: 'Left',
key: 1,
content: <H2>Content</H2>,
},
]}
/>
<Tabs
align="center"
data={[
{
title: 'Center',
key: 1,
content: <H2>Content</H2>,
},
]}
/>

<Tabs
align="right"
data={[
{
title: 'Right',
key: 1,
content: <H2>Content</H2>,
},
]}
/>
</ComponentBox>
</Wrapper>
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
TabsExamplePrerender,
TabsSingleChildrenReactElement,
TabsSingleElementData,
TabsAlignProperty,
} from 'Docs/uilib/components/tabs/Examples'

## Demos
Expand Down Expand Up @@ -99,4 +100,5 @@ const exampleContent = {
<VisibleWhenVisualTest>
<TabsSingleChildrenReactElement />
<TabsSingleElementData />
<TabsAlignProperty />
</VisibleWhenVisualTest>
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ describe.each(['ui', 'sbanken'])('Tabs for %s', (themeName) => {
expect(screenshot).toMatchImageSnapshot()
})

it('have to match when using the align property', async () => {
const screenshot = await makeScreenshot({
selector: '[data-visual-test="tabs-align-property"]',
})
expect(screenshot).toMatchImageSnapshot()
})

it('have to match a tablist with a click handler', async () => {
const screenshot = await makeScreenshot({
selector: '[data-visual-test="tabs-clickhandler"] .dnb-tabs__tabs',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ html:not([data-visual-test]) .dnb-tabs__tabs__tablist {
justify-content: flex-end;
}
.dnb-tabs__tabs--center .dnb-tabs__tabs__tablist {
flex: 1;
justify-content: center;
}
.dnb-tabs__tabs::before {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
justify-content: flex-end;
}
&--center &__tablist {
flex: 1;
justify-content: center;
}

Expand Down

0 comments on commit 8483df8

Please sign in to comment.