Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2b825a2

Browse filesBrowse files
committed
fix(CFormLabel): CFormLabelProps doesn't accept htmlFor
1 parent d109bc3 commit 2b825a2
Copy full SHA for 2b825a2

File tree

Expand file treeCollapse file tree

3 files changed

+21
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+21
-2
lines changed

‎packages/coreui-react/src/components/form/CFormLabel.tsx

Copy file name to clipboardExpand all lines: packages/coreui-react/src/components/form/CFormLabel.tsx
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React, { forwardRef, HTMLAttributes } from 'react'
1+
import React, { forwardRef, AllHTMLAttributes } from 'react'
22
import PropTypes from 'prop-types'
33
import classNames from 'classnames'
44

5-
export interface CFormLabelProps extends HTMLAttributes<HTMLLabelElement> {
5+
export interface CFormLabelProps extends AllHTMLAttributes<HTMLLabelElement> {
66
/**
77
* A string of all className you want applied to the component.
88
*/

‎packages/coreui-react/src/components/form/__tests__/CFormLabel.spec.tsx

Copy file name to clipboardExpand all lines: packages/coreui-react/src/components/form/__tests__/CFormLabel.spec.tsx
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ test('CFormLabel customize className', async () => {
1515
expect(container.firstChild).toHaveClass('form-label')
1616
expect(container.firstChild).toHaveTextContent('Test')
1717
})
18+
19+
test('CFormLabel customize htmlFor', async () => {
20+
const { container } = render(<CFormLabel htmlFor="bazinga">Test</CFormLabel>)
21+
expect(container).toMatchSnapshot()
22+
expect(container.firstChild).toHaveAttribute('for', 'bazinga')
23+
expect(container.firstChild).toHaveClass('form-label')
24+
expect(container.firstChild).toHaveTextContent('Test')
25+
})

‎packages/coreui-react/src/components/form/__tests__/__snapshots__/CFormLabel.spec.tsx.snap

Copy file name to clipboardExpand all lines: packages/coreui-react/src/components/form/__tests__/__snapshots__/CFormLabel.spec.tsx.snap
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ exports[`CFormLabel customize className 1`] = `
1010
</div>
1111
`;
1212

13+
exports[`CFormLabel customize htmlFor 1`] = `
14+
<div>
15+
<label
16+
class="form-label"
17+
for="bazinga"
18+
>
19+
Test
20+
</label>
21+
</div>
22+
`;
23+
1324
exports[`loads and displays CFormLabel component 1`] = `
1425
<div>
1526
<label

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.