diff --git a/src/.prettierrc b/.prettierrc similarity index 100% rename from src/.prettierrc rename to .prettierrc diff --git a/.travis.yml b/.travis.yml index add36de2..90647c96 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,8 @@ script: # Output useful info for debugging. - node --version - yarn --version + # Make sure prettier has ran on all files. + - yarn format-check # Make sure we can actually build the examples. - yarn run build-examples # Run tests diff --git a/examples/app.js b/examples/app.js index 86e9b895..4c86904d 100644 --- a/examples/app.js +++ b/examples/app.js @@ -30,9 +30,9 @@ class HoverMessage extends React.Component { - {getState(this.state, 'button', ':hover') - ? {' '}Hovering! - : null} + {getState(this.state, 'button', ':hover') ? ( + Hovering! + ) : null} ); } @@ -42,7 +42,8 @@ HoverMessage = Radium(HoverMessage); // // Radium with ES7 decorator // -@Radium class TwoSquares extends React.Component { +@Radium +class TwoSquares extends React.Component { render() { return (
@@ -120,20 +121,26 @@ class App extends React.Component { -

+

+ -

+

+ -

+

+ -

+

+

-

+

+ -

+

+

); } @@ -305,13 +314,14 @@ describe('Radium blackbox tests', () => { TestUtils.Simulate.click(button); spans = getElements(output, 'span'); - expect(spans).to.have - .length(1) + expect(spans) + .to.have.length(1) .and.to.have.deep.property('[0].style.color', 'blue'); }); it('resolves styles on multiple elements nested far down, Issue #307', () => { - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { return (
@@ -354,7 +364,8 @@ describe('Radium blackbox tests', () => { }); it('resolves styles if an element has element children and spreads props', () => { - @Radium class Inner extends Component { + @Radium + class Inner extends Component { static propTypes = {children: PropTypes.node}; render() { return ( @@ -365,7 +376,8 @@ describe('Radium blackbox tests', () => { } } - @Radium class Outer extends Component { + @Radium + class Outer extends Component { render() { return ( @@ -384,7 +396,8 @@ describe('Radium blackbox tests', () => { }); it('calls toString on object values', () => { - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { return (
{ }); it('adds active styles on space', () => { - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { return (
{ }); it('works with children as keyed object ala React Router', () => { - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { return (
@@ -512,14 +527,11 @@ describe('Radium blackbox tests', () => { }); it('preserves array children as arrays', () => { - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { expect(Array.isArray(this.props.children)).to.equal(true); - return ( -
- {this.props.children} -
- ); + return
{this.props.children}
; } } @@ -539,7 +551,8 @@ describe('Radium blackbox tests', () => { it('calls existing onMouseEnter handler', () => { const handleMouseEnter = sinon.spy(); - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { return (
{ it('calls existing onMouseLeave handler', () => { const handleMouseLeave = sinon.spy(); - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { return (
{ it('calls existing onMouseDown handler', () => { const handleMouseDown = sinon.spy(); - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { return (
{ it('calls existing onFocus handler', () => { const handleFocus = sinon.spy(); - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { return ( @@ -620,7 +636,8 @@ describe('Radium blackbox tests', () => { it('calls existing onBlur handler', () => { const handleBlur = sinon.spy(); - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { return ; } @@ -634,7 +651,8 @@ describe('Radium blackbox tests', () => { }); it('ignores callback refs', () => { - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { return (
@@ -661,7 +679,8 @@ describe('Radium blackbox tests', () => { it('runs a custom plugin', () => { const makeItRedPlugin = () => ({style: {color: 'red'}}); - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { return
; } @@ -943,7 +962,8 @@ describe('Radium blackbox tests', () => { it('receives config from radiumConfig prop', () => { const plugin = sinon.spy(); - @Radium class TestComponent extends Component { + @Radium + class TestComponent extends Component { render() { return
; } @@ -959,13 +979,19 @@ describe('Radium blackbox tests', () => { it('receives config from context', () => { const plugin = sinon.spy(); - @Radium class ParentComponent extends Component { + @Radium + class ParentComponent extends Component { render() { - return
; + return ( +
+ +
+ ); } } - @Radium class ChildComponent extends Component { + @Radium + class ChildComponent extends Component { render() { return
; } @@ -1020,7 +1046,8 @@ describe('Radium blackbox tests', () => { }); it('handles matching user agent', () => { - const iOSChrome47 = 'Mozilla/5.0 (iPad; CPU OS 8_0_0 like Mac OS X) AppleWebKit/600.1.4 ' + + const iOSChrome47 = + 'Mozilla/5.0 (iPad; CPU OS 8_0_0 like Mac OS X) AppleWebKit/600.1.4 ' + '(KHTML, like Gecko) CriOS/47.0.2526.107 Mobile/12H321 Safari/600.1.4'; const webkitFlex = '-webkit-flex'; diff --git a/src/__tests__/resolve-styles-test.js b/src/__tests__/resolve-styles-test.js index 15cfe6c2..b8754613 100644 --- a/src/__tests__/resolve-styles-test.js +++ b/src/__tests__/resolve-styles-test.js @@ -512,7 +512,8 @@ describe('resolveStyles', () => { ]); const createMultiPseudoTest = function(pseudoStyles, onHandlers) { - const name = 'applies pseudo styles in the defined order: ' + + const name = + 'applies pseudo styles in the defined order: ' + pseudoStyles.map(pseudo => pseudo.name).join(', ') + ' when handlers called in order: ' + onHandlers.join(', '); @@ -554,7 +555,11 @@ describe('resolveStyles', () => { } }; const component = genComponent(initialState); - const renderedElement =
; + const renderedElement = ( +
+
+
+ ); const result = resolveStyles(component, renderedElement).extraStateKeyMap; @@ -565,7 +570,11 @@ describe('resolveStyles', () => { describe('React.Children.only', () => { it("doesn't break React.Children.only", () => { const component = genComponent(); - const renderedElement =
; + const renderedElement = ( +
+ +
+ ); const result = resolveStyles(component, renderedElement).element; diff --git a/src/__tests__/style-component-test.js b/src/__tests__/style-component-test.js index 13e0f0d7..e143c82e 100644 --- a/src/__tests__/style-component-test.js +++ b/src/__tests__/style-component-test.js @@ -4,7 +4,8 @@ import {Style} from 'index'; import React from 'react'; import TestUtils from 'react-dom/test-utils'; import {expectCSS, getElement} from 'test-helpers'; -const MSIE9_USER_AGENT = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)'; +const MSIE9_USER_AGENT = + 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)'; describe('