,
diff --git a/src/renderers/dom/client/__tests__/ReactDOMIDOperations-test.js b/src/renderers/dom/client/__tests__/ReactDOMIDOperations-test.js
index 83ebbe03956..be744c7a5fd 100644
--- a/src/renderers/dom/client/__tests__/ReactDOMIDOperations-test.js
+++ b/src/renderers/dom/client/__tests__/ReactDOMIDOperations-test.js
@@ -18,8 +18,8 @@ describe('ReactDOMIDOperations', function() {
var keyOf = require('keyOf');
it('should disallow updating special properties', function() {
- spyOn(ReactMount, "getNode");
- spyOn(DOMPropertyOperations, "setValueForProperty");
+ spyOn(ReactMount, 'getNode');
+ spyOn(DOMPropertyOperations, 'setValueForProperty');
expect(function() {
ReactDOMIDOperations.updatePropertyByID(
@@ -40,7 +40,7 @@ describe('ReactDOMIDOperations', function() {
it('should update innerHTML and preserve whitespace', function() {
var stubNode = document.createElement('div');
- spyOn(ReactMount, "getNode").andReturn(stubNode);
+ spyOn(ReactMount, 'getNode').andReturn(stubNode);
var html = '\n \t
\n testContent \t \n \t';
diff --git a/src/renderers/dom/client/__tests__/ReactMount-test.js b/src/renderers/dom/client/__tests__/ReactMount-test.js
index bba0ee9b4fa..e8c4e25d288 100644
--- a/src/renderers/dom/client/__tests__/ReactMount-test.js
+++ b/src/renderers/dom/client/__tests__/ReactMount-test.js
@@ -169,25 +169,27 @@ describe('ReactMount', function() {
);
});
- (WebComponents === undefined ? xit : it)
- ('should allow mounting/unmounting to document fragment container', function() {
- var shadowRoot;
- var proto = Object.create(HTMLElement.prototype, {
- createdCallback: {
- value: function() {
+ if (WebComponents !== undefined) {
+ it('should allow mounting/unmounting to document fragment container',
+ function() {
+ var shadowRoot;
+ var proto = Object.create(HTMLElement.prototype, {
+ createdCallback: {
+ value: function() {
shadowRoot = this.createShadowRoot();
React.render(
Hi, from within a WC!
, shadowRoot);
expect(shadowRoot.firstChild.tagName).toBe('DIV');
React.render(
Hi, from within a WC!, shadowRoot);
expect(shadowRoot.firstChild.tagName).toBe('SPAN');
+ }
}
- }
+ });
+ proto.unmount = function() {
+ React.unmountComponentAtNode(shadowRoot);
+ };
+ document.registerElement('x-foo', {prototype: proto});
+ var element = document.createElement('x-foo');
+ element.unmount();
});
- proto.unmount = function() {
- React.unmountComponentAtNode(shadowRoot);
- };
- document.registerElement('x-foo', {prototype: proto});
- var element = document.createElement('x-foo');
- element.unmount();
- });
+ }
});
diff --git a/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js b/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js
index 9b510de5d32..d13071f547f 100644
--- a/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js
+++ b/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js
@@ -14,7 +14,7 @@
var React = require('React');
describe('ReactMount', function() {
- it("should destroy a react root upon request", function() {
+ it('should destroy a react root upon request', function() {
var mainContainerDiv = document.createElement('div');
document.body.appendChild(mainContainerDiv);
diff --git a/src/renderers/dom/client/__tests__/findDOMNode-test.js b/src/renderers/dom/client/__tests__/findDOMNode-test.js
index 75e797d8834..e0ae69e0fef 100644
--- a/src/renderers/dom/client/__tests__/findDOMNode-test.js
+++ b/src/renderers/dom/client/__tests__/findDOMNode-test.js
@@ -34,14 +34,18 @@ describe('findDOMNode', function() {
});
it('findDOMNode should reject random objects', function() {
- expect(function() {React.findDOMNode({foo: 'bar'});})
+ expect(function() {
+ React.findDOMNode({foo: 'bar'});
+ })
.toThrow('Invariant Violation: Element appears to be neither ' +
'ReactComponent nor DOMNode (keys: foo)'
);
});
it('findDOMNode should reject unmounted objects with render func', function() {
- expect(function() {React.findDOMNode({render: function() {}});})
+ expect(function() {
+ React.findDOMNode({render: function() {}});
+ })
.toThrow('Invariant Violation: Component (with keys: render) ' +
'contains `render` method but is not mounted in the DOM'
);
diff --git a/src/renderers/dom/client/eventPlugins/__tests__/AnalyticsEventPlugin-test.js b/src/renderers/dom/client/eventPlugins/__tests__/AnalyticsEventPlugin-test.js
index 64c04d1e934..51c8eb1a573 100644
--- a/src/renderers/dom/client/eventPlugins/__tests__/AnalyticsEventPlugin-test.js
+++ b/src/renderers/dom/client/eventPlugins/__tests__/AnalyticsEventPlugin-test.js
@@ -18,7 +18,6 @@ describe('AnalyticsEventPlugin', function() {
var EventPluginHub;
var EventPluginRegistry;
var React;
- var ReactBrowserEventEmitter;
var ReactTestUtils;
var DefaultEventPluginOrder;
@@ -32,7 +31,6 @@ describe('AnalyticsEventPlugin', function() {
EventPluginHub = require('EventPluginHub');
EventPluginRegistry = require('EventPluginRegistry');
React = require('React');
- ReactBrowserEventEmitter = require('ReactBrowserEventEmitter');
ReactTestUtils = require('ReactTestUtils');
EventPluginRegistry._resetEventPlugins();
@@ -65,7 +63,7 @@ describe('AnalyticsEventPlugin', function() {
return (
+ data-analytics-events="click,doubleClick">
Test
);
@@ -118,8 +116,8 @@ describe('AnalyticsEventPlugin', function() {
render: function() {
return (
+ data-analytics-id="test_invalid_events"
+ data-analytics-events="click,123">
Test
);
diff --git a/src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js b/src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js
index f67d43d1b8e..b4759a07aad 100644
--- a/src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js
+++ b/src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js
@@ -56,7 +56,7 @@ describe('ReactDOMInput', function() {
it('should display "foobar" for `defaultValue` of `objToString`', function() {
var objToString = {
toString: function() {
- return "foobar";
+ return 'foobar';
}
};
@@ -86,7 +86,7 @@ describe('ReactDOMInput', function() {
expect(node.value).toEqual('true');
});
- it("should allow setting `value` to `false`", function() {
+ it('should allow setting `value` to `false`', function() {
var stub =
;
stub = ReactTestUtils.renderIntoDocument(stub);
var node = React.findDOMNode(stub);
@@ -106,7 +106,7 @@ describe('ReactDOMInput', function() {
var objToString = {
toString: function() {
- return "foobar";
+ return 'foobar';
}
};
diff --git a/src/renderers/dom/client/wrappers/__tests__/ReactDOMSelect-test.js b/src/renderers/dom/client/wrappers/__tests__/ReactDOMSelect-test.js
index 3166d913a51..72543b3bce8 100644
--- a/src/renderers/dom/client/wrappers/__tests__/ReactDOMSelect-test.js
+++ b/src/renderers/dom/client/wrappers/__tests__/ReactDOMSelect-test.js
@@ -154,7 +154,7 @@ describe('ReactDOMSelect', function() {
});
it('should reset child options selected when they are changed and `value` is set', function() {
- var stub =
;
+ var stub =
;
stub = ReactTestUtils.renderIntoDocument(stub);
stub.setProps({
@@ -174,7 +174,7 @@ describe('ReactDOMSelect', function() {
it('should allow setting `value` with `objectToString`', function() {
var objectToString = {
- animal: "giraffe",
+ animal: 'giraffe',
toString: function() {
return this.animal;
}
@@ -194,7 +194,7 @@ describe('ReactDOMSelect', function() {
expect(node.options[2].selected).toBe(false); // gorilla
// Changing the `value` prop should change the selected options.
- objectToString.animal = "monkey";
+ objectToString.animal = 'monkey';
stub.forceUpdate();
expect(node.options[0].selected).toBe(true); // monkey
diff --git a/src/renderers/dom/client/wrappers/__tests__/ReactDOMTextarea-test.js b/src/renderers/dom/client/wrappers/__tests__/ReactDOMTextarea-test.js
index 902edd5e1ba..9cd4659237c 100644
--- a/src/renderers/dom/client/wrappers/__tests__/ReactDOMTextarea-test.js
+++ b/src/renderers/dom/client/wrappers/__tests__/ReactDOMTextarea-test.js
@@ -67,7 +67,7 @@ describe('ReactDOMTextarea', function() {
it('should display "foobar" for `defaultValue` of `objToString`', function() {
var objToString = {
toString: function() {
- return "foobar";
+ return 'foobar';
}
};
@@ -136,7 +136,7 @@ describe('ReactDOMTextarea', function() {
var objToString = {
toString: function() {
- return "foo";
+ return 'foo';
}
};
stub.replaceProps({value: objToString, onChange: emptyFunction});
@@ -186,7 +186,7 @@ describe('ReactDOMTextarea', function() {
spyOn(console, 'error');
var obj = {
toString: function() {
- return "sharkswithlasers";
+ return 'sharkswithlasers';
}
};
var node = React.findDOMNode(renderTextarea(
));
diff --git a/src/renderers/dom/server/__tests__/ReactServerRendering-test.js b/src/renderers/dom/server/__tests__/ReactServerRendering-test.js
index 1a9986dac95..05db7d78822 100644
--- a/src/renderers/dom/server/__tests__/ReactServerRendering-test.js
+++ b/src/renderers/dom/server/__tests__/ReactServerRendering-test.js
@@ -14,7 +14,6 @@
require('mock-modules')
.dontMock('ExecutionEnvironment')
.dontMock('React')
- .dontMock('ReactMount')
.dontMock('ReactServerRendering')
.dontMock('ReactTestUtils')
.dontMock('ReactMarkupChecksum');
@@ -24,7 +23,6 @@ var mocks = require('mocks');
var ExecutionEnvironment;
var React;
var ReactMarkupChecksum;
-var ReactMount;
var ReactReconcileTransaction;
var ReactTestUtils;
var ReactServerRendering;
@@ -36,7 +34,6 @@ describe('ReactServerRendering', function() {
require('mock-modules').dumpCache();
React = require('React');
ReactMarkupChecksum = require('ReactMarkupChecksum');
- ReactMount = require('ReactMount');
ReactTestUtils = require('ReactTestUtils');
ReactReconcileTransaction = require('ReactReconcileTransaction');
diff --git a/src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js b/src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js
index 27b57aed6db..c9711ee77e0 100644
--- a/src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js
+++ b/src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js
@@ -212,7 +212,11 @@ describe('DOMPropertyOperations', function() {
it('should convert attribute values to string first', function() {
// Browsers default to this behavior, but some test environments do not.
// This ensures that we have consistent behavior.
- var obj = {toString: function() { return ''; }};
+ var obj = {
+ toString: function() {
+ return '';
+ }
+ };
DOMPropertyOperations.setValueForProperty(stubNode, 'role', obj);
expect(stubNode.getAttribute('role')).toBe('');
});
diff --git a/src/renderers/dom/shared/__tests__/Danger-test.js b/src/renderers/dom/shared/__tests__/Danger-test.js
index 7d7ae4e2c51..811ab51c8e0 100644
--- a/src/renderers/dom/shared/__tests__/Danger-test.js
+++ b/src/renderers/dom/shared/__tests__/Danger-test.js
@@ -99,7 +99,7 @@ describe('Danger', function() {
'Invariant Violation: dangerouslyRenderMarkup(...): Missing markup.'
);
- spyOn(console, "error");
+ spyOn(console, 'error');
var renderedMarkup = Danger.dangerouslyRenderMarkup(['
']);
var args = console.error.argsForCall[0];
diff --git a/src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js b/src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
index e45ad0b08b3..dda078a441d 100644
--- a/src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+++ b/src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
@@ -25,7 +25,7 @@ describe('ReactDOMComponent', function() {
ReactTestUtils = require('ReactTestUtils');
});
- it("should handle className", function() {
+ it('should handle className', function() {
var container = document.createElement('div');
React.render(
, container);
@@ -37,7 +37,7 @@ describe('ReactDOMComponent', function() {
expect(container.firstChild.className).toEqual('');
});
- it("should gracefully handle various style value types", function() {
+ it('should gracefully handle various style value types', function() {
var container = document.createElement('div');
React.render(
, container);
var stubStyle = container.firstChild.style;
@@ -59,7 +59,7 @@ describe('ReactDOMComponent', function() {
});
// TODO: (poshannessy) deprecate this pattern.
- it("should update styles when mutating style object", function() {
+ it('should update styles when mutating style object', function() {
// not actually used. Just to suppress the style mutation warning
spyOn(console, 'error');
@@ -138,7 +138,7 @@ describe('ReactDOMComponent', function() {
expect(console.error.argsForCall.length).toBe(2);
});
- it("should update styles if initially null", function() {
+ it('should update styles if initially null', function() {
var styles = null;
var container = document.createElement('div');
React.render(
, container);
@@ -151,7 +151,7 @@ describe('ReactDOMComponent', function() {
expect(stubStyle.display).toEqual('block');
});
- it("should update styles if updated to null multiple times", function() {
+ it('should update styles if updated to null multiple times', function() {
var styles = null;
var container = document.createElement('div');
React.render(
, container);
@@ -172,25 +172,25 @@ describe('ReactDOMComponent', function() {
expect(stubStyle.display).toEqual('');
});
- it("should remove attributes", function() {
+ it('should remove attributes', function() {
var container = document.createElement('div');
- React.render(
![]()
, container);
+ React.render(
![]()
, container);
expect(container.firstChild.hasAttribute('height')).toBe(true);
React.render(
![]()
, container);
expect(container.firstChild.hasAttribute('height')).toBe(false);
});
- it("should remove properties", function() {
+ it('should remove properties', function() {
var container = document.createElement('div');
- React.render(
, container);
+ React.render(
, container);
expect(container.firstChild.className).toEqual('monkey');
React.render(
, container);
expect(container.firstChild.className).toEqual('');
});
- it("should clear a single style prop when changing 'style'", function() {
+ it('should clear a single style prop when changing `style`', function() {
var styles = {display: 'none', color: 'red'};
var container = document.createElement('div');
React.render(
, container);
@@ -203,7 +203,7 @@ describe('ReactDOMComponent', function() {
expect(stubStyle.color).toEqual('green');
});
- it("should clear all the styles when removing 'style'", function() {
+ it('should clear all the styles when removing `style`', function() {
var styles = {display: 'none', color: 'red'};
var container = document.createElement('div');
React.render(
, container);
@@ -215,7 +215,7 @@ describe('ReactDOMComponent', function() {
expect(stubStyle.color).toEqual('');
});
- it("should update styles when 'style' changes from null to object", function() {
+ it('should update styles when `style` changes from null to object', function() {
var container = document.createElement('div');
var styles = {color: 'red'};
React.render(
, container);
@@ -226,7 +226,7 @@ describe('ReactDOMComponent', function() {
expect(stubStyle.color).toEqual('red');
});
- it("should empty element when removing innerHTML", function() {
+ it('should empty element when removing innerHTML', function() {
var container = document.createElement('div');
React.render(
, container);
@@ -235,7 +235,7 @@ describe('ReactDOMComponent', function() {
expect(container.firstChild.innerHTML).toEqual('');
});
- it("should transition from string content to innerHTML", function() {
+ it('should transition from string content to innerHTML', function() {
var container = document.createElement('div');
React.render(
hello
, container);
@@ -247,7 +247,7 @@ describe('ReactDOMComponent', function() {
expect(container.firstChild.innerHTML).toEqual('goodbye');
});
- it("should transition from innerHTML to string content", function() {
+ it('should transition from innerHTML to string content', function() {
var container = document.createElement('div');
React.render(
,
@@ -259,7 +259,7 @@ describe('ReactDOMComponent', function() {
expect(container.firstChild.innerHTML).toEqual('adieu');
});
- it("should not incur unnecessary DOM mutations", function() {
+ it('should not incur unnecessary DOM mutations', function() {
var container = document.createElement('div');
React.render(
, container);
@@ -287,7 +287,7 @@ describe('ReactDOMComponent', function() {
var genMarkup;
function quoteRegexp(str) {
- return (str + '').replace(/([.?*+\^$\[\]\\(){}|-])/g, "\\$1");
+ return (str + '').replace(/([.?*+\^$\[\]\\(){}|-])/g, '\\$1');
}
beforeEach(function() {
@@ -315,7 +315,7 @@ describe('ReactDOMComponent', function() {
this.addMatchers({
toHaveAttribute: function(attr, value) {
var expected = '(?:^|\\s)' + attr + '=[\\\'"]';
- if (typeof value != 'undefined') {
+ if (typeof value !== 'undefined') {
expected += quoteRegexp(value) + '[\\\'"]';
}
return this.actual.match(new RegExp(expected));
@@ -323,13 +323,13 @@ describe('ReactDOMComponent', function() {
});
});
- it("should generate the correct markup with className", function() {
+ it('should generate the correct markup with className', function() {
expect(genMarkup({className: 'a'})).toHaveAttribute('class', 'a');
expect(genMarkup({className: 'a b'})).toHaveAttribute('class', 'a b');
expect(genMarkup({className: ''})).toHaveAttribute('class', '');
});
- it("should escape style names and values", function() {
+ it('should escape style names and values', function() {
expect(genMarkup({
style: {'b&ckground': '<3'}
})).toHaveAttribute('style', 'b&ckground:<3;');
@@ -340,7 +340,7 @@ describe('ReactDOMComponent', function() {
var genMarkup;
function quoteRegexp(str) {
- return (str + '').replace(/([.?*+\^$\[\]\\(){}|-])/g, "\\$1");
+ return (str + '').replace(/([.?*+\^$\[\]\\(){}|-])/g, '\\$1');
}
beforeEach(function() {
@@ -368,7 +368,7 @@ describe('ReactDOMComponent', function() {
});
});
- it("should handle dangerouslySetInnerHTML", function() {
+ it('should handle dangerouslySetInnerHTML', function() {
var innerHTML = {__html: 'testContent'};
expect(
genMarkup({dangerouslySetInnerHTML: innerHTML})
@@ -399,13 +399,13 @@ describe('ReactDOMComponent', function() {
var stubComponent = new StubNativeComponent({
type: StubNativeComponent,
props: props,
- _owner: null,
+ _owner: null
});
return stubComponent.mountComponent('test', transaction, {});
};
});
- it("should warn against children for void elements", function() {
+ it('should warn against children for void elements', function() {
spyOn(console, 'error');
var container = document.createElement('div');
@@ -416,7 +416,7 @@ describe('ReactDOMComponent', function() {
expect(console.error.argsForCall[0][0]).toContain('void element');
});
- it("should warn against dangerouslySetInnerHTML for void elements", function() {
+ it('should warn against dangerouslySetInnerHTML for void elements', function() {
spyOn(console, 'error');
var container = document.createElement('div');
@@ -430,7 +430,7 @@ describe('ReactDOMComponent', function() {
expect(console.error.argsForCall[0][0]).toContain('void element');
});
- it("should treat menuitem as a void element but still create the closing tag", function() {
+ it('should treat menuitem as a void element but still create the closing tag', function() {
spyOn(console, 'error');
var container = document.createElement('div');
@@ -445,7 +445,7 @@ describe('ReactDOMComponent', function() {
expect(console.error.argsForCall[0][0]).toContain('void element');
});
- it("should validate against multiple children props", function() {
+ it('should validate against multiple children props', function() {
expect(function() {
mountComponent({children: '', dangerouslySetInnerHTML: ''});
}).toThrow(
@@ -490,14 +490,14 @@ describe('ReactDOMComponent', function() {
}).not.toThrow();
});
- it("should warn about contentEditable and children", function() {
+ it('should warn about contentEditable and children', function() {
spyOn(console, 'error');
mountComponent({contentEditable: true, children: ''});
expect(console.error.argsForCall.length).toBe(1);
expect(console.error.argsForCall[0][0]).toContain('contentEditable');
});
- it("should validate against invalid styles", function() {
+ it('should validate against invalid styles', function() {
expect(function() {
mountComponent({style: 'display: none'});
}).toThrow(
@@ -507,8 +507,7 @@ describe('ReactDOMComponent', function() {
);
});
- it("should execute custom event plugin listening behavior", function() {
- var React = require('React');
+ it('should execute custom event plugin listening behavior', function() {
var SimpleEventPlugin = require('SimpleEventPlugin');
SimpleEventPlugin.didPutListener = mocks.getMockFunction();
@@ -527,8 +526,7 @@ describe('ReactDOMComponent', function() {
expect(SimpleEventPlugin.willDeleteListener.mock.calls.length).toBe(1);
});
- it("should handle null and missing properly with event hooks", function() {
- var React = require('React');
+ it('should handle null and missing properly with event hooks', function() {
var SimpleEventPlugin = require('SimpleEventPlugin');
SimpleEventPlugin.didPutListener = mocks.getMockFunction();
@@ -570,7 +568,7 @@ describe('ReactDOMComponent', function() {
container = document.createElement('div');
});
- it("should warn against children for void elements", function() {
+ it('should warn against children for void elements', function() {
spyOn(console, 'error');
React.render(
, container);
@@ -580,7 +578,7 @@ describe('ReactDOMComponent', function() {
expect(console.error.argsForCall[0][0]).toContain('void element');
});
- it("should warn against dangerouslySetInnerHTML for void elements", function() {
+ it('should warn against dangerouslySetInnerHTML for void elements', function() {
spyOn(console, 'error');
React.render(
, container);
@@ -593,7 +591,7 @@ describe('ReactDOMComponent', function() {
expect(console.error.argsForCall[0][0]).toContain('void element');
});
- it("should validate against multiple children props", function() {
+ it('should validate against multiple children props', function() {
React.render(
, container);
expect(function() {
@@ -607,7 +605,7 @@ describe('ReactDOMComponent', function() {
);
});
- it("should warn about contentEditable and children", function() {
+ it('should warn about contentEditable and children', function() {
spyOn(console, 'error');
React.render(
,
@@ -617,7 +615,7 @@ describe('ReactDOMComponent', function() {
expect(console.error.argsForCall[0][0]).toContain('contentEditable');
});
- it("should validate against invalid styles", function() {
+ it('should validate against invalid styles', function() {
React.render(
, container);
expect(function() {
@@ -629,7 +627,7 @@ describe('ReactDOMComponent', function() {
);
});
- it("should properly escape text content and attributes values", function() {
+ it('should properly escape text content and attributes values', function() {
expect(
React.renderToStaticMarkup(
React.DOM.div({
@@ -648,7 +646,7 @@ describe('ReactDOMComponent', function() {
});
describe('unmountComponent', function() {
- it("should clean up listeners", function() {
+ it('should clean up listeners', function() {
var React = require('React');
var ReactBrowserEventEmitter = require('ReactBrowserEventEmitter');
var ReactMount = require('ReactMount');
@@ -784,10 +782,14 @@ describe('ReactDOMComponent', function() {
render: () =>
|
});
var Table = React.createClass({
- render: function() { return
; }
+ render: function() {
+ return
;
+ }
});
var FancyTable = React.createClass({
- render: function() { return
; }
+ render: function() {
+ return
;
+ }
});
var Viz1 = React.createClass({
@@ -833,7 +835,9 @@ describe('ReactDOMComponent', function() {
);
var Link = React.createClass({
- render: function() { return
{this.props.children}; }
+ render: function() {
+ return
{this.props.children};
+ }
});
ReactTestUtils.renderIntoDocument(
);
expect(console.error.calls.length).toBe(6);
diff --git a/src/renderers/shared/event/__tests__/EventPluginHub-test.js b/src/renderers/shared/event/__tests__/EventPluginHub-test.js
index 9a54b7b245d..9caf5896ad0 100644
--- a/src/renderers/shared/event/__tests__/EventPluginHub-test.js
+++ b/src/renderers/shared/event/__tests__/EventPluginHub-test.js
@@ -26,7 +26,7 @@ describe('EventPluginHub', function() {
isEventSupported.mockReturnValueOnce(false);
});
- it("should prevent non-function listeners", function() {
+ it('should prevent non-function listeners', function() {
expect(function() {
EventPluginHub.putListener(1, 'onClick', 'not a function');
}).toThrow(
diff --git a/src/renderers/shared/event/eventPlugins/__tests__/ResponderEventPlugin-test.js b/src/renderers/shared/event/eventPlugins/__tests__/ResponderEventPlugin-test.js
index 57ffd5d3233..fef18598670 100644
--- a/src/renderers/shared/event/eventPlugins/__tests__/ResponderEventPlugin-test.js
+++ b/src/renderers/shared/event/eventPlugins/__tests__/ResponderEventPlugin-test.js
@@ -13,10 +13,8 @@
var EventPluginHub;
var EventConstants;
-var EventPropagators;
var ReactInstanceHandles;
var ResponderEventPlugin;
-var SyntheticEvent;
var EventPluginUtils;
var GRANDPARENT_ID = '.0';
@@ -25,7 +23,6 @@ var CHILD_ID = '.0.0.0';
var CHILD_ID2 = '.0.0.1';
var topLevelTypes;
-var responderEventTypes;
var touch = function(nodeHandle, i) {
return {target: nodeHandle, identifier: i};
@@ -88,7 +85,7 @@ var _touchConfig =
),
topLevelType: topType,
target: targetNodeHandle,
- targetID: targetNodeHandle,
+ targetID: targetNodeHandle
};
};
@@ -180,13 +177,13 @@ var oneEventLoopTestConfig = function(readableIDToID) {
responderTerminationRequest: {},
// Non-negotiation
- responderReject: {}, // These do not bubble capture.
+ responderReject: {}, // These do not bubble capture.
responderGrant: {},
responderStart: {},
responderMove: {},
responderTerminate: {},
responderEnd: {},
- responderRelease: {},
+ responderRelease: {}
};
for (var eventName in ret) {
for (var readableNodeName in readableIDToID) {
@@ -218,23 +215,29 @@ var registerTestHandlers = function(eventTestConfig, readableIDToID) {
'\nFor event test config:\n' + JSON.stringify(eventTestConfig) + '\n'
);
};
+ /*eslint-disable no-loop-func, no-shadow */
var registerOneEventType = function(registrationName, eventTypeTestConfig) {
for (var readableID in eventTypeTestConfig) {
var nodeConfig = eventTypeTestConfig[readableID];
var id = readableIDToID[readableID];
var handler = nodeConfig.order === NA ? neverFire.bind(null, readableID, registrationName) :
- function(readableID, registrationName, nodeConfig, e) {
+ // We partially apply readableID and nodeConfig, as they change in the
+ // parent closure across iterations.
+ function(readableID, nodeConfig, e) {
expect(
readableID + '->' + registrationName + ' index:' + runs.dispatchCount++
).toBe(
readableID + '->' + registrationName + ' index:' + nodeConfig.order
);
- nodeConfig.assertEvent && nodeConfig.assertEvent(e);
+ if (nodeConfig.assertEvent) {
+ nodeConfig.assertEvent(e);
+ }
return nodeConfig.returnVal;
- }.bind(null, readableID, registrationName, nodeConfig);
+ }.bind(null, readableID, nodeConfig);
EventPluginHub.putListener(id, registrationName, handler);
}
};
+ /*eslint-enable no-loop-func, no-shadow */
for (var eventName in eventTestConfig) {
var oneEventTypeTestConfig = eventTestConfig[eventName];
var hasTwoPhase = !!oneEventTypeTestConfig.bubbled;
@@ -306,13 +309,13 @@ var run = function(config, hierarchyConfig, nativeEventConfig) {
var three = {
grandParent: GRANDPARENT_ID,
parent: PARENT_ID,
- child: CHILD_ID,
+ child: CHILD_ID
};
var siblings = {
parent: PARENT_ID,
childOne: CHILD_ID,
- childTwo: CHILD_ID2,
+ childTwo: CHILD_ID2
};
describe('ResponderEventPlugin', function() {
@@ -322,10 +325,8 @@ describe('ResponderEventPlugin', function() {
EventConstants = require('EventConstants');
EventPluginHub = require('EventPluginHub');
EventPluginUtils = require('EventPluginUtils');
- EventPropagators = require('EventPropagators');
ReactInstanceHandles = require('ReactInstanceHandles');
ResponderEventPlugin = require('ResponderEventPlugin');
- SyntheticEvent = require('SyntheticEvent');
EventPluginHub.injection.injectInstanceHandle(ReactInstanceHandles);
@@ -341,17 +342,16 @@ describe('ResponderEventPlugin', function() {
});
topLevelTypes = EventConstants.topLevelTypes;
- responderEventTypes = ResponderEventPlugin.eventTypes;
});
it('should do nothing when no one wants to respond', function() {
var config = oneEventLoopTestConfig(three);
config.startShouldSetResponder.captured.grandParent = {order: 0, returnVal: false};
- config.startShouldSetResponder.captured.parent = {order: 1, returnVal: false};
- config.startShouldSetResponder.captured.child = {order: 2, returnVal: false};
- config.startShouldSetResponder.bubbled.child = {order: 3, returnVal: false};
- config.startShouldSetResponder.bubbled.parent = {order: 4, returnVal: false};
- config.startShouldSetResponder.bubbled.grandParent = {order: 5, returnVal: false};
+ config.startShouldSetResponder.captured.parent = {order: 1, returnVal: false};
+ config.startShouldSetResponder.captured.child = {order: 2, returnVal: false};
+ config.startShouldSetResponder.bubbled.child = {order: 3, returnVal: false};
+ config.startShouldSetResponder.bubbled.parent = {order: 4, returnVal: false};
+ config.startShouldSetResponder.bubbled.grandParent = {order: 5, returnVal: false};
run(config, three, startConfig(three.child, [three.child], [0]));
expect(ResponderEventPlugin.getResponderID()).toBe(null);
diff --git a/src/renderers/shared/reconciler/__tests__/ReactComponent-test.js b/src/renderers/shared/reconciler/__tests__/ReactComponent-test.js
index 675672acb53..6b93a951d12 100644
--- a/src/renderers/shared/reconciler/__tests__/ReactComponent-test.js
+++ b/src/renderers/shared/reconciler/__tests__/ReactComponent-test.js
@@ -12,19 +12,15 @@
'use strict';
var React;
-var ReactInstanceMap;
var ReactTestUtils;
var mocks;
-var reactComponentExpect;
describe('ReactComponent', function() {
beforeEach(function() {
mocks = require('mocks');
React = require('React');
- ReactInstanceMap = require('ReactInstanceMap');
ReactTestUtils = require('ReactTestUtils');
- reactComponentExpect = require('reactComponentExpect');
});
it('should throw on invalid render targets', function() {
diff --git a/src/renderers/shared/reconciler/__tests__/ReactComponentLifeCycle-test.js b/src/renderers/shared/reconciler/__tests__/ReactComponentLifeCycle-test.js
index 7d61482da9c..9f1d426f26c 100644
--- a/src/renderers/shared/reconciler/__tests__/ReactComponentLifeCycle-test.js
+++ b/src/renderers/shared/reconciler/__tests__/ReactComponentLifeCycle-test.js
@@ -207,7 +207,7 @@ describe('ReactComponentLifeCycle', function() {
it('throws when accessing state in componentWillMount', function() {
var StatefulComponent = React.createClass({
componentWillMount: function() {
- this.state.yada;
+ void this.state.yada;
},
render: function() {
return (
@@ -271,7 +271,7 @@ describe('ReactComponentLifeCycle', function() {
expect(this.isMounted()).toBeTruthy();
},
render: function() {
- expect(this.isMounted()).toBeFalsy()
+ expect(this.isMounted()).toBeFalsy();
return
;
}
});
@@ -530,7 +530,7 @@ describe('ReactComponentLifeCycle', function() {
// Since `instance` is a root component, we can set its props. This also
// makes Tooltip rerender the tooltip component, which shouldn't throw.
- instance.setProps({text: "dos", tooltipText: "two"});
+ instance.setProps({text: 'dos', tooltipText: 'two'});
});
it('should not allow setProps() called on an unmounted element',
diff --git a/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js b/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
index 20f238fdf48..5282a5fcee5 100644
--- a/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
+++ b/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
@@ -326,7 +326,7 @@ describe('ReactCompositeComponent', function() {
expect(() => {
this.setState({value: 2}, function() {
cbCalled = true;
- })
+ });
}).not.toThrow();
},
render: function() {
@@ -515,7 +515,7 @@ describe('ReactCompositeComponent', function() {
render: function() {
return
{this.context.foo}
;
- },
+ }
});
var component = ReactTestUtils.renderIntoDocument(
);
@@ -632,7 +632,7 @@ describe('ReactCompositeComponent', function() {
expect(parentInstance.state.flag).toBe(false);
ReactUpdates.batchedUpdates(function() {
- parentInstance.setState({flag: true});
+ parentInstance.setState({flag: true});
});
expect(parentInstance.state.flag).toBe(true);
@@ -852,7 +852,7 @@ describe('ReactCompositeComponent', function() {
getChildContext: function() {
return {
- foo: "bar"
+ foo: 'bar'
};
},
diff --git a/src/renderers/shared/reconciler/__tests__/ReactCompositeComponentError-test.js b/src/renderers/shared/reconciler/__tests__/ReactCompositeComponentError-test.js
index 053399043f6..85991164229 100644
--- a/src/renderers/shared/reconciler/__tests__/ReactCompositeComponentError-test.js
+++ b/src/renderers/shared/reconciler/__tests__/ReactCompositeComponentError-test.js
@@ -12,7 +12,6 @@
'use strict';
var React = require('React');
-var ReactTestUtils = require('ReactTestUtils');
var ReactErrorUtils = require('ReactErrorUtils');
describe('ReactCompositeComponent-error', function() {
@@ -26,7 +25,7 @@ describe('ReactCompositeComponent-error', function() {
}
});
- new Component();
+ void new Component();
expect(ReactErrorUtils.guard.mostRecentCall.args[1])
.toEqual('Component.someHandler');
diff --git a/src/renderers/shared/reconciler/__tests__/ReactCompositeComponentNestedState-test.js b/src/renderers/shared/reconciler/__tests__/ReactCompositeComponentNestedState-test.js
index 0963484d461..310890b8741 100644
--- a/src/renderers/shared/reconciler/__tests__/ReactCompositeComponentNestedState-test.js
+++ b/src/renderers/shared/reconciler/__tests__/ReactCompositeComponentNestedState-test.js
@@ -58,7 +58,7 @@ describe('ReactCompositeComponentNestedState-state', function() {
this.setState(function(state, props) {
this.props.logger('setState-this', this.state.hue, this.props.color);
this.props.logger('setState-args', state.hue, props.color);
- return {hue: shade + ' ' + props.color}
+ return {hue: shade + ' ' + props.color};
}, function() {
this.props.logger('after-setState', this.state.hue, this.props.color);
});
@@ -79,7 +79,7 @@ describe('ReactCompositeComponentNestedState-state', function() {
-
+