Skip to content

Commit

Permalink
Fixes : #2925 Now euiTitle renders classes of children too (#2926)
Browse files Browse the repository at this point in the history
* added child class to wraper

* added test suite

* Update src/components/title/title.test.tsx

Co-Authored-By: Greg Thompson <[email protected]>

* Update CHANGELOG.md

Co-Authored-By: Caroline Horn <[email protected]>

* Updated SnapShots

Co-authored-by: Greg Thompson <[email protected]>
Co-authored-by: Caroline Horn <[email protected]>
  • Loading branch information
3 people authored Feb 26, 2020
1 parent 2427d35 commit dc199cf
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

**Bug fixes**

- Fixed `EuiTitle` not rendering child classes ([#2926](https://github.com/elastic/eui/pull/2926))
- Fixed building dev & docs on Windows ([#2847](https://github.com/elastic/eui/pull/2847))
- Fixed screen reader discovery issues with `EuiBottomBar` and `EuiControlBar` ([#2861](https://github.com/elastic/eui/pull/2861))
- Fixed a bug in `EuiDataGrid` causing the first cell to autofocus if interactive ([#2872](https://github.com/elastic/eui/pull/2872))
Expand Down
10 changes: 10 additions & 0 deletions src/components/title/__snapshots__/title.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ exports[`EuiTitle is rendered 1`] = `
Title
</h1>
`;

exports[`EuiTitle renders children element className 1`] = `
<h1
aria-label="aria-label"
class="euiTitle euiTitle--medium testClass1 testClass2 test"
data-test-subj="test subject string"
>
Title
</h1>
`;
10 changes: 10 additions & 0 deletions src/components/title/title.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,14 @@ describe('EuiTitle', () => {

expect(component).toMatchSnapshot();
});

test('renders children element className', () => {
const component = render(
<EuiTitle {...requiredProps}>
<h1 className="test">Title</h1>
</EuiTitle>
);

expect(component).toMatchSnapshot();
});
});
3 changes: 2 additions & 1 deletion src/components/title/title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export const EuiTitle: FunctionComponent<EuiTitleProps> = ({
'euiTitle',
titleSizeToClassNameMap[size],
textTransform ? textTransformToClassNameMap[textTransform] : undefined,
className
className,
children.props.className
);

const props = {
Expand Down

0 comments on commit dc199cf

Please sign in to comment.