Skip to content

Commit bdf6623

Browse files
committed
feat(PopoverTitle): add component
1 parent ba7570b commit bdf6623

3 files changed

Lines changed: 52 additions & 0 deletions

File tree

lib/PopoverTitle.jsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React, { PropTypes } from 'react';
2+
import classNames from 'classnames';
3+
4+
const propTypes = {};
5+
6+
const defaultProps = {};
7+
8+
class PopoverTitle extends React.Component {
9+
constructor(props) {
10+
super(props);
11+
}
12+
13+
render() {
14+
const {
15+
children,
16+
className,
17+
...attributes
18+
} = this.props;
19+
20+
const classes = classNames(
21+
className,
22+
'popover-title'
23+
);
24+
25+
return (
26+
<h3 {...attributes}
27+
className={classes}>
28+
{children}
29+
</h3>
30+
);
31+
}
32+
}
33+
34+
PopoverTitle.propTypes = propTypes;
35+
PopoverTitle.defaultProps = defaultProps;
36+
37+
export default PopoverTitle;

lib/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import DropdownItem from './DropdownItem';
77
import DropdownMenu from './DropdownMenu';
88
import DropdownToggle from './DropdownToggle';
99
import Label from './Label';
10+
import PopoverTitle from './PopoverTitle';
1011
import TetherContent from './TetherContent';
1112
import Tooltip from './Tooltip';
1213

@@ -20,6 +21,7 @@ export {
2021
DropdownMenu,
2122
DropdownToggle,
2223
Label,
24+
PopoverTitle,
2325
TetherContent,
2426
Tooltip
2527
};

test/PopoverTitle.spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* eslint react/no-multi-comp: 0, react/prop-types: 0 */
2+
import React from 'react';
3+
import { shallow, mount } from 'enzyme';
4+
import { PopoverTitle } from '../lib';
5+
6+
describe('PopoverTitle', () => {
7+
it('should render children', () => {
8+
const wrapper = shallow(<PopoverTitle>Ello world</PopoverTitle>);
9+
10+
expect(wrapper.text()).toBe('Ello world');
11+
expect(wrapper.hasClass('popover-title')).toBe(true);
12+
});
13+
});

0 commit comments

Comments
 (0)