Fix some odd spacing inconsistencies in ReactRenderDocument-test.
Ben Newman committed
Jan 6, 2014 at 21:12 UTC
4f57515f918d519bbd7894d88ea606de4ec07884
2 files changed
+11
-16
src/core/__tests__/ReactRenderDocument-test.js
+10
-15
@@ -28,6 +28,13 @@ var getTestDocument;
28
29
var testDocument;
30
31
+var UNMOUNT_INVARIANT_MESSAGE =
32
+ 'Invariant Violation: ReactFullPageComponenthtml tried to unmount. ' +
33
+ 'Because of cross-browser quirks it is impossible to unmount some ' +
34
+ 'top-level components (eg <html>, <head>, and <body>) reliably and ' +
35
+ 'efficiently. To fix this, have a single top-level component that ' +
36
+ 'never unmounts render these elements.';
37
+
38
describe('rendering React components at document', function() {
39
beforeEach(function() {
40
require('mock-modules').dumpCache();
@@ -92,13 +99,8 @@ describe('rendering React components at document', function() {
99
100
expect(function() {
101
React.unmountComponentAtNode(testDocument);
95
- }).toThrow(
96
- 'Invariant Violation: ReactFullPageComponenthtml tried to unmount. ' +
97
- 'Because of cross-browser quirks it is impossible to unmount some ' +
98
- 'top-level components (eg <html>, <head>, and <body>) reliably ' +
99
- 'and efficiently. To fix this, have a single top-level component ' +
100
- 'that never unmounts render these elements.'
101
- );
102
+ }).toThrow(UNMOUNT_INVARIANT_MESSAGE);
103
+
104
expect(testDocument.body.innerHTML).toBe(' Hello world ');
105
});
106
});
@@ -146,17 +148,10 @@ describe('rendering React components at document', function() {
148
// Reactive update
149
expect(function() {
150
React.renderComponent(<Component2 />, testDocument);
149
- }).toThrow(
150
- 'Invariant Violation: ReactFullPageComponenthtml tried to unmount. ' +
151
- 'Because of cross-browser quirks it is impossible to unmount some ' +
152
- 'top-level components (eg <html>, <head>, and <body>) reliably ' +
153
- 'and efficiently. To fix this, have a single top-level component ' +
154
- 'that never unmounts render these elements.'
155
- );
151
+ }).toThrow(UNMOUNT_INVARIANT_MESSAGE);
152
153
expect(testDocument.body.innerHTML).toBe(' Hello world ');
154
});
159
-
155
});
156
157
it('should be able to mount into document', function() {
src/dom/components/createFullPageComponent.js
+1
-1
@@ -46,7 +46,7 @@ function createFullPageComponent(componentClass) {
46
false,
47
'%s tried to unmount. Because of cross-browser quirks it is ' +
48
'impossible to unmount some top-level components (eg <html>, <head>, ' +
49
- ' and <body>) reliably and efficiently. To fix this, have a single ' +
49
+ 'and <body>) reliably and efficiently. To fix this, have a single ' +
50
'top-level component that never unmounts render these elements.',
51
this.constructor.displayName
52
);