diff --git a/src/modules/Dropdown/DropdownItem.js b/src/modules/Dropdown/DropdownItem.js
index 40c0f7eacd..67ec6cccc4 100644
--- a/src/modules/Dropdown/DropdownItem.js
+++ b/src/modules/Dropdown/DropdownItem.js
@@ -138,11 +138,18 @@ export default class DropdownItem extends Component {
const labelElement = Label.create(label)
const descriptionElement = createShorthand(
'span',
- val => ({ className: 'description', children: val }),
+ val => ({ children: val }),
description,
+ props => ({ className: 'description' })
)
if (descriptionElement) {
+ const textElement = createShorthand(
+ 'span',
+ val => ({ children: val }),
+ content || text,
+ props => ({ className: 'text' })
+ )
return (
{imageElement}
@@ -150,7 +157,7 @@ export default class DropdownItem extends Component {
{flagElement}
{labelElement}
{descriptionElement}
- {createShorthand('span', val => ({ className: 'text', children: val }), content || text)}
+ {textElement}
)
}
diff --git a/test/specs/modules/Dropdown/DropdownItem-test.js b/test/specs/modules/Dropdown/DropdownItem-test.js
index 53d78e54d8..a933545b40 100644
--- a/test/specs/modules/Dropdown/DropdownItem-test.js
+++ b/test/specs/modules/Dropdown/DropdownItem-test.js
@@ -27,9 +27,22 @@ describe('DropdownItem', () => {
propKey: 'description',
ShorthandComponent: 'span',
mapValueToProps: val => ({
+ children: val,
+ }),
+ shorthandDefaultProps: props => ({
className: 'description',
+ }),
+ })
+
+ common.implementsShorthandProp(DropdownItem, {
+ propKey: 'text',
+ ShorthandComponent: 'span',
+ mapValueToProps: val => ({
children: val,
}),
+ shorthandDefaultProps: props => ({
+ className: 'description',
+ }),
})
describe('aria', () => {
@@ -71,6 +84,13 @@ describe('DropdownItem', () => {
})
})
+ describe('description', () => {
+ it('adds className="description" to element shorthand', () => {
+ shallow(} />)
+ .should.not.have.descendants('strong.description')
+ })
+ })
+
describe('text', () => {
it('renders with wrapping span when description', () => {
const wrapper = shallow()
@@ -85,6 +105,11 @@ describe('DropdownItem', () => {
wrapper.should.not.have.descendants('span.text')
wrapper.text().should.equal('hey')
})
+
+ it('adds className="text" to element shorthand', () => {
+ shallow(} />)
+ .should.not.have.descendants('strong.text')
+ })
})
describe('content', () => {