From 664ff4731529683e86f57a1a997387b8d8494bd6 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 --- index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/index.d.ts b/index.d.ts index 7c929a4..3c01290 100644 --- a/index.d.ts +++ b/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 b6e898dfae5ea110415e1eeea136100f79086447 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/Checkbox.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Checkbox.jsx b/src/Checkbox.jsx index 1d22293..80ab744 100644 --- a/src/Checkbox.jsx +++ b/src/Checkbox.jsx @@ -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, @@ -92,7 +93,7 @@ class Checkbox extends Component { saveInput = (node) => { this.input = node; - } + }; render() { const { @@ -102,6 +103,7 @@ class Checkbox extends Component { name, id, type, + title, disabled, readOnly, tabIndex, @@ -132,6 +134,7 @@ class Checkbox extends Component { name={name} id={id} type={type} + title={title} readOnly={readOnly} disabled={disabled} tabIndex={tabIndex} From dd4d633e8e88fcc6a82ca96f48e42c5337da2936 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.spec.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/index.spec.jsx b/tests/index.spec.jsx index 4d07229..ae1a8a5 100644 --- a/tests/index.spec.jsx +++ b/tests/index.spec.jsx @@ -53,6 +53,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 3994f6514b8a6e6551d9bcf64d1f67b5d185b7a8 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.spec.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/index.spec.jsx b/tests/index.spec.jsx index ae1a8a5..79c07a0 100644 --- a/tests/index.spec.jsx +++ b/tests/index.spec.jsx @@ -58,7 +58,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);