Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
added jest test, example
Browse files Browse the repository at this point in the history
  • Loading branch information
Sugan G authored and Sugan G committed Feb 21, 2024
1 parent 3313eb9 commit 79ad103
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* eslint-disable react/forbid-dom-props */
import React from 'react';
import SectionHeader from 'terra-section-header';

export default () => (
<div style={{
width: '400px', height: '200px', background: 'gray', margin: '10px', overflow: 'scroll',
}}
>
<div style={{ width: '600px', height: '400px' }}>
<SectionHeader
text="Closed Section Header 1"
isTitleSticky
onClick={() => {}}
/>
<br />
<SectionHeader
text="Closed Section Header 2"
isTitleSticky
onClick={() => {}}
/>
<br />
<SectionHeader
text="Section Header 3"
isTitleSticky
/>
</div>
</div>
);
13 changes: 13 additions & 0 deletions packages/terra-section-header/tests/jest/SectionHeader.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,17 @@ describe('SectionHeader', () => {
const sectionHeader = wrapper.find('.arrange-wrapper.title-fixed').at(0);
expect(sectionHeader).toHaveLength(1);
});

it('verifies that section header with a sticky title has appropriate classes', () => {
const wrapper = enzyme.shallow(
<SectionHeader
text="foo"
level={2}
isTitleSticky
/>,
);

const sectionHeader = wrapper.find('.arrange-wrapper.title-sticky').at(0);
expect(sectionHeader).toHaveLength(1);
});
});

0 comments on commit 79ad103

Please sign in to comment.