diff --git a/src/index.d.ts b/src/index.d.ts index 5ccc215..fd41fc6 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -7,6 +7,7 @@ export interface Props { name?: string; id?: string; type?: string; + title?: string; defaultChecked?: number | boolean; checked?: number | boolean; disabled?: boolean; diff --git a/src/index.jsx b/src/index.jsx index 4595968..dd42cdb 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -8,6 +8,7 @@ class Checkbox extends Component { className: '', style: {}, type: 'checkbox', + title: '', defaultChecked: false, onFocus() {}, onBlur() {}, @@ -84,6 +85,7 @@ class Checkbox extends Component { name, id, type, + title, disabled, readOnly, tabIndex, @@ -119,6 +121,7 @@ class Checkbox extends Component { name={name} id={id} type={type} + title={title} required={required} readOnly={readOnly} disabled={disabled} diff --git a/tests/index.test.jsx b/tests/index.test.jsx index a318c3f..b9ac8ba 100644 --- a/tests/index.test.jsx +++ b/tests/index.test.jsx @@ -77,6 +77,12 @@ describe('rc-checkbox', () => { expect(renderedInput.attributes.value.value).toEqual('6'); }); + it('passes title prop to input', () => { + const wrapper = mount(); + 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);