Skip to content

Commit cdcd6f6

Browse files
author
Brandon Dail
committed
Run prettier on new selection events fixtures
1 parent 5e75d23 commit cdcd6f6

File tree

5 files changed

+28
-32
lines changed

5 files changed

+28
-32
lines changed

fixtures/dom/src/components/Iframe.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const ReactDOM = window.ReactDOM;
44
class IframePortal extends React.Component {
55
state = {ref: null};
66

7-
handleRef = (ref) => {
7+
handleRef = ref => {
88
if (ref !== this.state.ref) {
99
this.setState({ref});
1010
if (ref && ref.contentDocument && this.props.head) {
@@ -19,15 +19,16 @@ class IframePortal extends React.Component {
1919
if (ref && ref.contentDocument) {
2020
portal = ReactDOM.createPortal(
2121
this.props.children,
22-
ref.contentDocument.body,
22+
ref.contentDocument.body
2323
);
2424
}
2525

2626
return (
2727
<div>
2828
<iframe
29-
style={{ border: 'none', height: this.props.height }}
30-
ref={this.handleRef} />
29+
style={{border: 'none', height: this.props.height}}
30+
ref={this.handleRef}
31+
/>
3132
{portal}
3233
</div>
3334
);
@@ -38,16 +39,13 @@ class IframeSubtree extends React.Component {
3839
warned = false;
3940
render() {
4041
if (!this.warned) {
41-
console.error(`IFrame has not yet been implemented for React v${React.version}`);
42+
console.error(
43+
`IFrame has not yet been implemented for React v${React.version}`
44+
);
4245
this.warned = true;
4346
}
44-
return (
45-
<div>
46-
{this.props.children}
47-
</div>
48-
)
47+
return <div>{this.props.children}</div>;
4948
}
5049
}
5150

52-
53-
export default ReactDOM.createPortal ? IframePortal : IframeSubtree;
51+
export default (ReactDOM.createPortal ? IframePortal : IframeSubtree);

fixtures/dom/src/components/fixtures/selection-events/DraftJsEditorTestCase.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ import Iframe from '../../Iframe';
33
const React = window.React;
44
const {EditorState, Editor} = window.Draft;
55

6-
76
export default class DraftJsEditorTestCase extends React.Component {
87
constructor(props) {
98
super(props);
109
this.state = {editorState: EditorState.createEmpty()};
11-
this.onChange = (editorState) => this.setState({editorState});
10+
this.onChange = editorState => this.setState({editorState});
1211
}
1312
render() {
1413
return (
@@ -19,15 +18,20 @@ export default class DraftJsEditorTestCase extends React.Component {
1918
works in an iframe.">
2019
<TestCase.Steps>
2120
<li>Enter some text into the Draft.js editor (grey outlined box)</li>
22-
<li>Change your cursor position to somewhere in the middle of the text</li>
21+
<li>
22+
Change your cursor position to somewhere in the middle of the text
23+
</li>
2324
<li>Enter a new character</li>
2425
</TestCase.Steps>
2526
<TestCase.ExpectedResult>
2627
The cursor should not jump positions
2728
</TestCase.ExpectedResult>
2829
<Iframe height={60}>
29-
<div style={{ border: '1px solid grey' }}>
30-
<Editor editorState={this.state.editorState} onChange={this.onChange} />
30+
<div style={{border: '1px solid grey'}}>
31+
<Editor
32+
editorState={this.state.editorState}
33+
onChange={this.onChange}
34+
/>
3135
</div>
3236
</Iframe>
3337
</TestCase>

fixtures/dom/src/components/fixtures/selection-events/ReorderedInputsTestCase.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ import Iframe from '../../Iframe';
33
const React = window.React;
44

55
export default class ReorderedInputsTestCase extends React.Component {
6-
7-
state = { count: 0 };
6+
state = {count: 0};
87

98
componentDidMount() {
109
this.interval = setInterval(() => {
11-
this.setState({ count: this.state.count + 1 });
10+
this.setState({count: this.state.count + 1});
1211
}, 2000);
1312
}
1413

@@ -29,9 +28,7 @@ export default class ReorderedInputsTestCase extends React.Component {
2928

3029
render() {
3130
return (
32-
<TestCase
33-
title="Reordered input elements in iframes"
34-
description="">
31+
<TestCase title="Reordered input elements in iframes" description="">
3532
<TestCase.Steps>
3633
<li>The two inputs below swap positions every two seconds</li>
3734
<li>Select the text in either of them</li>
@@ -40,10 +37,8 @@ export default class ReorderedInputsTestCase extends React.Component {
4037
<TestCase.ExpectedResult>
4138
The selection you made should be maintained
4239
</TestCase.ExpectedResult>
43-
<Iframe height={50}>
44-
{this.renderInputs()}
45-
</Iframe>
40+
<Iframe height={50}>{this.renderInputs()}</Iframe>
4641
</TestCase>
47-
)
42+
);
4843
}
4944
}

fixtures/dom/src/components/fixtures/selection-events/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import ReorderedInputsTestCase from './ReorderedInputsTestCase';
55
import DraftJsEditorTestCase from './DraftJsEditorTestCase';
66
const React = window.React;
77

8-
98
export default function SelectionEvents() {
109
return (
1110
<FixtureSet
@@ -21,4 +20,4 @@ export default function SelectionEvents() {
2120
<DraftJsEditorTestCase />
2221
</FixtureSet>
2322
);
24-
};
23+
}

fixtures/dom/src/react-loader.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import semver from 'semver'
1+
import semver from 'semver';
22

33
/**
44
* Take a version from the window query string and load a specific
@@ -41,14 +41,14 @@ export default function loadReact() {
4141
// @TODO We're using a build of draft-js provided by @acusti in https://github.com/facebook/react/pull/12037
4242
// This is because currently draft doesn't support iframes. This should be changed back to the official
4343
// release on unpkg once the draft fixes are merged.
44-
const DRAFT_JS_PATH = 'https://cdn.rawgit.com/brandcast/draft-js-built/d6c2ffc64914b001411356c0bfab24e831bc5429/dist/Draft.js';
44+
const DRAFT_JS_PATH =
45+
'https://cdn.rawgit.com/brandcast/draft-js-built/d6c2ffc64914b001411356c0bfab24e831bc5429/dist/Draft.js';
4546
let REACT_PATH = 'react.development.js';
4647
let DOM_PATH = 'react-dom.development.js';
4748

4849
let query = parseQuery(window.location.search);
4950
let version = query.version || 'local';
5051

51-
5252
if (version !== 'local') {
5353
const {major, minor, prerelease} = semver(version);
5454
const [preReleaseStage, preReleaseVersion] = prerelease;

0 commit comments

Comments
 (0)