diff --git a/lib/attributes-to-props.js b/lib/attributes-to-props.js index 3a604917..81fe3a2d 100644 --- a/lib/attributes-to-props.js +++ b/lib/attributes-to-props.js @@ -33,11 +33,11 @@ function attributesToProps(attributes) { // convert HTML attribute to React prop property = HTMLDOMPropertyConfig[attributeName.toLowerCase()]; if (property) { - if (property.hasBooleanValue) { - props[property.propertyName] = true; - } else { - props[property.propertyName] = attributeValue; - } + props[property.propertyName] = + property.hasBooleanValue || + (property.hasOverloadedBooleanValue && !attributeValue) + ? true + : attributeValue; continue; } diff --git a/test/attributes-to-props.js b/test/attributes-to-props.js index cf62005f..db5e7d71 100644 --- a/test/attributes-to-props.js +++ b/test/attributes-to-props.js @@ -109,6 +109,26 @@ describe('attributesToProps', () => { } ); }); + + it('converts overloaded boolean attributes', () => { + assert.deepEqual( + attributesToProps({ + download: '' + }), + { + download: true + } + ); + + assert.deepEqual( + attributesToProps({ + download: 'filename' + }), + { + download: 'filename' + } + ); + }); }); describe('SVG', () => {