Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ describe('ReactDOMComponent', function() {
return nodeValue;
},
set: nodeValueSetter.mockImplementation(function(newValue) {
node.setAttribute('value', newValue);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Said offline but the DOM doesn't do this so while it tricks the test it's not real life.

nodeValue = newValue;
}),
});
Expand All @@ -506,17 +507,18 @@ describe('ReactDOMComponent', function() {
ReactDOM.render(<div value="foo" />, container);
expect(nodeValueSetter.mock.calls.length).toBe(1);

// Really, this _should_ remove the attribute but doesn't currently.
ReactDOM.render(<div />, container);
expect(nodeValueSetter.mock.calls.length).toBe(2);

ReactDOM.render(<div value={null} />, container);
expect(nodeValueSetter.mock.calls.length).toBe(2);

ReactDOM.render(<div value="" />, container);
expect(nodeValueSetter.mock.calls.length).toBe(3);
expect(nodeValueSetter.mock.calls.length).toBe(2);

ReactDOM.render(<div />, container);
expect(nodeValueSetter.mock.calls.length).toBe(3);
expect(nodeValueSetter.mock.calls.length).toBe(2);
});

it('should not incur unnecessary DOM mutations for boolean properties', function() {
Expand Down