mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Removed redundant gCC test
This commit is contained in:
@@ -159,7 +159,6 @@ src/isomorphic/classic/__tests__/ReactContextValidator-test.js
|
||||
* should check child context types
|
||||
* should warn (but not error) if getChildContext method is missing
|
||||
* should pass parent context if getChildContext method is missing
|
||||
* should only warn about missing getChildContext once per component type
|
||||
|
||||
src/isomorphic/classic/class/__tests__/ReactBind-test.js
|
||||
* Holds reference to instance
|
||||
|
||||
@@ -294,20 +294,36 @@ describe('ReactContextValidator', () => {
|
||||
it('should warn (but not error) if getChildContext method is missing', () => {
|
||||
spyOn(console, 'error');
|
||||
|
||||
var MyComponent = React.createClass({
|
||||
childContextTypes: {
|
||||
class ComponentA extends React.Component {
|
||||
static childContextTypes = {
|
||||
foo: React.PropTypes.string.isRequired,
|
||||
},
|
||||
|
||||
render: function() {
|
||||
};
|
||||
render() {
|
||||
return <div />;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
class ComponentB extends React.Component {
|
||||
static childContextTypes = {
|
||||
foo: React.PropTypes.string.isRequired,
|
||||
};
|
||||
render() {
|
||||
return <div />;
|
||||
}
|
||||
}
|
||||
|
||||
ReactTestUtils.renderIntoDocument(<MyComponent/>);
|
||||
ReactTestUtils.renderIntoDocument(<ComponentA/>);
|
||||
expectDev(console.error.calls.count()).toBe(1);
|
||||
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
|
||||
'Warning: getChildContext() is not defined for MyComponent'
|
||||
'Warning: getChildContext() is not defined for ComponentA'
|
||||
);
|
||||
|
||||
// Warnings should be deduped by component type
|
||||
ReactTestUtils.renderIntoDocument(<ComponentA/>);
|
||||
expectDev(console.error.calls.count()).toBe(1);
|
||||
ReactTestUtils.renderIntoDocument(<ComponentB/>);
|
||||
expectDev(console.error.calls.count()).toBe(2);
|
||||
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
|
||||
'Warning: getChildContext() is not defined for ComponentB'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -356,38 +372,4 @@ describe('ReactContextValidator', () => {
|
||||
expect(childContext.foo).toBe('FOO');
|
||||
});
|
||||
|
||||
it('should only warn about missing getChildContext once per component type', () => {
|
||||
spyOn(console, 'error');
|
||||
|
||||
class ComponentA extends React.Component {
|
||||
static childContextTypes = {
|
||||
foo: React.PropTypes.string.isRequired,
|
||||
};
|
||||
render() {
|
||||
return <div />;
|
||||
}
|
||||
}
|
||||
class ComponentB extends React.Component {
|
||||
static childContextTypes = {
|
||||
foo: React.PropTypes.string.isRequired,
|
||||
};
|
||||
render() {
|
||||
return <div />;
|
||||
}
|
||||
}
|
||||
|
||||
ReactTestUtils.renderIntoDocument(<ComponentA/>);
|
||||
expectDev(console.error.calls.count()).toBe(1);
|
||||
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
|
||||
'Warning: getChildContext() is not defined for ComponentA'
|
||||
);
|
||||
ReactTestUtils.renderIntoDocument(<ComponentA/>);
|
||||
expectDev(console.error.calls.count()).toBe(1);
|
||||
ReactTestUtils.renderIntoDocument(<ComponentB/>);
|
||||
expectDev(console.error.calls.count()).toBe(2);
|
||||
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
|
||||
'Warning: getChildContext() is not defined for ComponentB'
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user