From 4d0bd91b84e1e26fdcc4d42b5009df93ce9bb205 Mon Sep 17 00:00:00 2001 From: kilya11 Date: Wed, 23 Oct 2019 09:45:45 +0200 Subject: [PATCH 1/4] Type for the title prop https://github.com/react-component/checkbox/issues/104 --- src/index.d.ts | 1 + 1 file changed, 1 insertion(+) 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; From e78c9034d00082d6d06c0b0ab2423da2b415e03f Mon Sep 17 00:00:00 2001 From: kilya11 Date: Wed, 23 Oct 2019 09:48:37 +0200 Subject: [PATCH 2/4] Pass title prop https://github.com/react-component/checkbox/issues/104 --- src/index.jsx | 3 +++ 1 file changed, 3 insertions(+) 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} From e2e6178c18fe0c23a7fbe7b03c567cf1406cae65 Mon Sep 17 00:00:00 2001 From: kilya11 Date: Wed, 23 Oct 2019 09:49:43 +0200 Subject: [PATCH 3/4] Test title prop https://github.com/react-component/checkbox/issues/104 --- tests/index.test.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/index.test.jsx b/tests/index.test.jsx index a318c3f..61befd2 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); From cbe238c9c40b9fdaf9f5ef55af79a49195eb4e34 Mon Sep 17 00:00:00 2001 From: kilya11 Date: Wed, 23 Oct 2019 09:56:01 +0200 Subject: [PATCH 4/4] Remove trailing spaces --- tests/index.test.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/index.test.jsx b/tests/index.test.jsx index 61befd2..b9ac8ba 100644 --- a/tests/index.test.jsx +++ b/tests/index.test.jsx @@ -82,7 +82,7 @@ describe('rc-checkbox', () => { 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);