Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface Props {
name?: string,
id?: string,
type?: string,
title?: string,
defaultChecked?: number | boolean,
checked?: number | boolean,
disabled?: boolean,
Expand Down
5 changes: 4 additions & 1 deletion src/Checkbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Checkbox extends Component {
name: PropTypes.string,
id: PropTypes.string,
type: PropTypes.string,
title: PropTypes.string,
defaultChecked: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
checked: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
disabled: PropTypes.bool,
Expand Down Expand Up @@ -92,7 +93,7 @@ class Checkbox extends Component {

saveInput = (node) => {
this.input = node;
}
};

render() {
const {
Expand All @@ -102,6 +103,7 @@ class Checkbox extends Component {
name,
id,
type,
title,
disabled,
readOnly,
tabIndex,
Expand Down Expand Up @@ -132,6 +134,7 @@ class Checkbox extends Component {
name={name}
id={id}
type={type}
title={title}
readOnly={readOnly}
disabled={disabled}
tabIndex={tabIndex}
Expand Down
6 changes: 6 additions & 0 deletions tests/index.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ describe('rc-checkbox', () => {
expect(renderedInput.attributes.value.value).toEqual('6');
});

it('passes title prop to input', () => {
const wrapper = mount(<Checkbox title="my-custom-title" />);
const renderedInput = wrapper.find('input').instance();
expect(renderedInput.attributes.title.value).toEqual('my-custom-title');
});

it('focus()', () => {
const container = document.createElement('div');
document.body.appendChild(container);
Expand Down