Skip to content
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

[Fiber] Don't test input value clean-up in Fiber #8948

Merged
merged 1 commit into from
Feb 8, 2017
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions scripts/fiber/tests-failing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ src/renderers/__tests__/refs-test.js
* Should increase refs with an increase in divs

src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
* should clean up input value tracking
* should clean up input textarea tracking
* gives source code refs for unknown prop warning (ssr)
* gives source code refs for unknown prop warning for exact elements (ssr)
* gives source code refs for unknown prop warning for exact elements in composition (ssr)
Expand Down
37 changes: 20 additions & 17 deletions src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ describe('ReactDOMComponent', () => {
var React;
var ReactTestUtils;
var ReactDOM;
var ReactDOMFeatureFlags;
var ReactDOMServer;
var inputValueTracking;
var ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');

function normalizeCodeLocInfo(str) {
return str && str.replace(/\(at .+?:\d+\)/g, '(at **)');
Expand Down Expand Up @@ -1206,29 +1206,32 @@ describe('ReactDOMComponent', () => {
});

describe('unmountComponent', () => {
it('should clean up input value tracking', () => {
var container = document.createElement('div');
var node = ReactDOM.render(<input type="text" defaultValue="foo"/>, container);
var tracker = inputValueTracking._getTrackerFromNode(node);
// Fiber does not have a clean-up phase for host components; relies on GC
if (!ReactDOMFeatureFlags.useFiber) {
it('should clean up input value tracking', () => {
var container = document.createElement('div');
var node = ReactDOM.render(<input type="text" defaultValue="foo"/>, container);
var tracker = inputValueTracking._getTrackerFromNode(node);

spyOn(tracker, 'stopTracking');
spyOn(tracker, 'stopTracking');

ReactDOM.unmountComponentAtNode(container);
ReactDOM.unmountComponentAtNode(container);

expect(tracker.stopTracking.calls.count()).toBe(1);
});
expect(tracker.stopTracking.calls.count()).toBe(1);
});

it('should clean up input textarea tracking', () => {
var container = document.createElement('div');
var node = ReactDOM.render(<textarea defaultValue="foo"/>, container);
var tracker = inputValueTracking._getTrackerFromNode(node);
it('should clean up input textarea tracking', () => {
var container = document.createElement('div');
var node = ReactDOM.render(<textarea defaultValue="foo"/>, container);
var tracker = inputValueTracking._getTrackerFromNode(node);

spyOn(tracker, 'stopTracking');
spyOn(tracker, 'stopTracking');

ReactDOM.unmountComponentAtNode(container);
ReactDOM.unmountComponentAtNode(container);

expect(tracker.stopTracking.calls.count()).toBe(1);
});
expect(tracker.stopTracking.calls.count()).toBe(1);
});
}

it('unmounts children before unsetting DOM node info', () => {
class Inner extends React.Component {
Expand Down