Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alaba Olatunde Albert Olanipekun
react-bootstrap
Commits
59468d72
Unverified
Commit
59468d72
authored
Mar 27, 2020
by
Max Schmitt
Committed by
GitHub
Mar 27, 2020
Browse files
fix(AccordionToggle): default button type=button (#5076)
parent
e87744eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/AccordionToggle.js
View file @
59468d72
...
...
@@ -25,7 +25,7 @@ export function useAccordionToggle(eventKey, onClick) {
const
onSelect
=
useContext
(
SelectableContext
);
return
(
e
)
=>
{
/*
/*
Compare the event key in context with the given event key.
If they are the same, then collapse the component.
*/
...
...
@@ -50,6 +50,10 @@ const AccordionToggle = React.forwardRef(
)
=>
{
const
accordionOnClick
=
useAccordionToggle
(
eventKey
,
onClick
);
if
(
Component
===
'
button
'
)
{
props
.
type
=
'
button
'
;
}
return
(
<
Component
ref
=
{
ref
}
onClick
=
{
accordionOnClick
}
{...
props
}
>
{
children
}
...
...
test/AccordionToggleSpec.js
View file @
59468d72
...
...
@@ -5,6 +5,8 @@ import AccordionToggle from '../src/AccordionToggle';
describe
(
'
<AccordionToggle>
'
,
()
=>
{
it
(
'
Should have button as default component
'
,
()
=>
{
mount
(
<
AccordionToggle
eventKey
=
""
/>
).
assertSingle
(
'
button
'
);
mount
(
<
AccordionToggle
eventKey
=
""
/>
).
assertSingle
(
'
button[type="button"]
'
,
);
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment