Skip to content

Commit

Permalink
Merge da7e682 into 42aff16
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister authored Aug 11, 2019
2 parents 42aff16 + da7e682 commit 37ab127
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/diff/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function setStyle(style, key, value) {
style.setProperty(key, value);
}
else {
style[key] = typeof value==='number' && IS_NON_DIMENSIONAL.test(key)===false ? value+'px' : value;
style[key] = typeof value==='number' && IS_NON_DIMENSIONAL.test(key)===false ? value+'px' : value || null;
}
}

Expand Down
8 changes: 8 additions & 0 deletions test/browser/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,14 @@ describe('render()', () => {
expect(scratch.firstChild.style.backgroundColor).to.equal('blue');
});

// Issue #1850
it('should remove empty styles', () => {
render(<div style={{ visibility: 'hidden' }} />, scratch);
expect(scratch.firstChild.style.visibility).to.equal('hidden');
render(<div style={{ visibility: undefined }} />, scratch);
expect(scratch.firstChild.style.visibility).to.equal('');
});

// Skip test if the currently running browser doesn't support CSS Custom Properties
if (window.CSS && CSS.supports('color', 'var(--fake-var)')) {
it('should support css custom properties', () => {
Expand Down

0 comments on commit 37ab127

Please sign in to comment.