-
Notifications
You must be signed in to change notification settings - Fork 51k
Fix ReactPerf.printOperations() crash #6752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c8a7988
0cd1d3b
1559111
d80723b
f0594d2
9cebc26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -174,10 +174,12 @@ describe('DOMPropertyOperations', function() { | |
|
|
||
| describe('setValueForProperty', function() { | ||
| var stubNode; | ||
| var stubInstance; | ||
|
|
||
| beforeEach(function() { | ||
| stubNode = document.createElement('div'); | ||
| ReactDOMComponentTree.precacheNode({}, stubNode); | ||
| stubInstance = {_debugID: 1}; | ||
| ReactDOMComponentTree.precacheNode(stubInstance, stubNode); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did these need to change?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The stub instances used to be plain
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, I missed the warning you added. |
||
| }); | ||
|
|
||
| it('should set values as properties by default', function() { | ||
|
|
@@ -226,7 +228,7 @@ describe('DOMPropertyOperations', function() { | |
|
|
||
| it('should not remove empty attributes for special properties', function() { | ||
| stubNode = document.createElement('input'); | ||
| ReactDOMComponentTree.precacheNode({}, stubNode); | ||
| ReactDOMComponentTree.precacheNode(stubInstance, stubNode); | ||
|
|
||
| DOMPropertyOperations.setValueForProperty(stubNode, 'value', ''); | ||
| // JSDOM does not behave correctly for attributes/properties | ||
|
|
@@ -348,10 +350,12 @@ describe('DOMPropertyOperations', function() { | |
|
|
||
| describe('deleteValueForProperty', function() { | ||
| var stubNode; | ||
| var stubInstance; | ||
|
|
||
| beforeEach(function() { | ||
| stubNode = document.createElement('div'); | ||
| ReactDOMComponentTree.precacheNode({}, stubNode); | ||
| stubInstance = {_debugID: 1}; | ||
| ReactDOMComponentTree.precacheNode(stubInstance, stubNode); | ||
| }); | ||
|
|
||
| it('should remove attributes for normal properties', function() { | ||
|
|
@@ -367,7 +371,7 @@ describe('DOMPropertyOperations', function() { | |
|
|
||
| it('should not remove attributes for special properties', function() { | ||
| stubNode = document.createElement('input'); | ||
| ReactDOMComponentTree.precacheNode({}, stubNode); | ||
| ReactDOMComponentTree.precacheNode(stubInstance, stubNode); | ||
|
|
||
| stubNode.setAttribute('value', 'foo'); | ||
|
|
||
|
|
@@ -379,7 +383,7 @@ describe('DOMPropertyOperations', function() { | |
|
|
||
| it('should not leave all options selected when deleting multiple', function() { | ||
| stubNode = document.createElement('select'); | ||
| ReactDOMComponentTree.precacheNode({}, stubNode); | ||
| ReactDOMComponentTree.precacheNode(stubInstance, stubNode); | ||
|
|
||
| stubNode.multiple = true; | ||
| stubNode.appendChild(document.createElement('option')); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These would be clearer if
elementwas a prop.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, I should’ve realized this before I wrote hundreds of tests using this pattern 😄 .