mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #3502 from spicyj/tests
Fix tests after merge of #3440
This commit is contained in:
@@ -663,28 +663,28 @@ describe('ReactDOMComponent', function() {
|
||||
});
|
||||
|
||||
it('warns on invalid nesting', () => {
|
||||
spyOn(console, 'warn');
|
||||
spyOn(console, 'error');
|
||||
ReactTestUtils.renderIntoDocument(<div><tr /></div>);
|
||||
|
||||
expect(console.warn.calls.length).toBe(1);
|
||||
expect(console.warn.calls[0].args[0]).toBe(
|
||||
expect(console.error.calls.length).toBe(1);
|
||||
expect(console.error.calls[0].args[0]).toBe(
|
||||
'Warning: validateDOMNesting(...): <div> cannot contain a <tr> node.'
|
||||
);
|
||||
});
|
||||
|
||||
it('warns on invalid nesting at root', () => {
|
||||
spyOn(console, 'warn');
|
||||
spyOn(console, 'error');
|
||||
var p = document.createElement('p');
|
||||
React.render(<tr />, p);
|
||||
|
||||
expect(console.warn.calls.length).toBe(1);
|
||||
expect(console.warn.calls[0].args[0]).toBe(
|
||||
expect(console.error.calls.length).toBe(1);
|
||||
expect(console.error.calls[0].args[0]).toBe(
|
||||
'Warning: validateDOMNesting(...): <p> cannot contain a <tr> node.'
|
||||
);
|
||||
});
|
||||
|
||||
it('warns nicely for table rows', () => {
|
||||
spyOn(console, 'warn');
|
||||
spyOn(console, 'error');
|
||||
var Foo = React.createClass({
|
||||
render: function() {
|
||||
return <table><tr /></table>;
|
||||
@@ -692,8 +692,8 @@ describe('ReactDOMComponent', function() {
|
||||
});
|
||||
ReactTestUtils.renderIntoDocument(<Foo />);
|
||||
|
||||
expect(console.warn.calls.length).toBe(1);
|
||||
expect(console.warn.calls[0].args[0]).toBe(
|
||||
expect(console.error.calls.length).toBe(1);
|
||||
expect(console.error.calls[0].args[0]).toBe(
|
||||
'Warning: validateDOMNesting(...): <table> cannot contain a <tr> ' +
|
||||
'node. Add a <tbody> to your code to match the DOM tree generated by ' +
|
||||
'the browser. Check the render method of `Foo`.'
|
||||
|
||||
@@ -390,8 +390,8 @@ describe('ReactClass-spec', function() {
|
||||
|
||||
instance.getDOMNode();
|
||||
|
||||
expect(console.warn.calls.length).toBe(1);
|
||||
expect(console.warn.calls[0].args[0]).toContain(
|
||||
expect(console.error.calls.length).toBe(1);
|
||||
expect(console.error.calls[0].args[0]).toContain(
|
||||
'MyComponent.getDOMNode(...) is deprecated. Please use ' +
|
||||
'React.findDOMNode(instance) instead.'
|
||||
);
|
||||
|
||||
@@ -266,15 +266,15 @@ describe('ReactComponent', function() {
|
||||
});
|
||||
|
||||
it('warns when calling getDOMNode', function() {
|
||||
spyOn(console, 'warn');
|
||||
spyOn(console, 'error');
|
||||
|
||||
var container = document.createElement('div');
|
||||
var instance = React.render(<div />, container);
|
||||
|
||||
instance.getDOMNode();
|
||||
|
||||
expect(console.warn.calls.length).toBe(1);
|
||||
expect(console.warn.calls[0].args[0]).toContain(
|
||||
expect(console.error.calls.length).toBe(1);
|
||||
expect(console.error.calls[0].args[0]).toContain(
|
||||
'DIV.getDOMNode(...) is deprecated. Please use ' +
|
||||
'React.findDOMNode(instance) instead.'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user