Skip to content

Commit

Permalink
feat(plasma-b2c/web): add stretch prop and update test
Browse files Browse the repository at this point in the history
  • Loading branch information
TitanKuzmich committed Dec 21, 2023
1 parent 1bf8622 commit 6cb3f83
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 0 deletions.
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.
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 @@ -152,6 +152,24 @@ describe('plasma-web: Segment', () => {
cy.matchImageSnapshot();
});

it('_stretch', () => {
mount(
<CypressTestDecorator>
<SegmentProvider>
<SegmentGroup view="filled" stretch filledBackground>
<SegmentItem value="segment_1" label="Segment 1" view="default" />
<SegmentItem value="segment_2" label="Segment 2" view="default" />
<SegmentItem value="segment_3" label="Segment 3" view="default" />
</SegmentGroup>
</SegmentProvider>
</CypressTestDecorator>,
);

cy.get('button').contains('Segment 1').click();

cy.matchImageSnapshot();
});

it('_size', () => {
mount(
<CypressTestDecorator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const Default: StoryObj<StorySegmentProps> = {
pilled: false,
filledBackground: false,
disabled: false,
stretch: false,
},
render: (args) => <StoryDefault {...args} />,
};
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,8 @@ export const config = {
${segmentTokens.groupFilledBackgroundColor}: var(--plasma-colors-surface-liquid01);
`,
},
stretch: {
true: css``,
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,24 @@ describe('plasma-web: Segment', () => {
cy.matchImageSnapshot();
});

it('_stretch', () => {
mount(
<CypressTestDecorator>
<SegmentProvider>
<SegmentGroup view="filled" stretch filledBackground>
<SegmentItem value="segment_1" label="Segment 1" view="default" />
<SegmentItem value="segment_2" label="Segment 2" view="default" />
<SegmentItem value="segment_3" label="Segment 3" view="default" />
</SegmentGroup>
</SegmentProvider>
</CypressTestDecorator>,
);

cy.get('button').contains('Segment 1').click();

cy.matchImageSnapshot();
});

it('_size', () => {
mount(
<CypressTestDecoratorWithTypo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const Default: StoryObj<StorySegmentProps> = {
pilled: false,
filledBackground: false,
disabled: false,
stretch: false,
},
render: (args) => <StoryDefault {...args} />,
};
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,8 @@ export const config = {
${segmentTokens.groupFilledBackgroundColor}: var(--plasma-colors-surface-liquid01);
`,
},
stretch: {
true: css``,
},
},
};

0 comments on commit 6cb3f83

Please sign in to comment.