Skip to content

Commit 8dfb602

Browse files
committed
Wrap <Predict/> and add ids needed for unit tests
1 parent 5acba48 commit 8dfb602

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/oceans/ui.jsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ const MediaControl = Object.freeze({
968968
FastForward: 'fast-forward'
969969
});
970970

971-
let Predict = class Predict extends React.Component {
971+
let UnwrappedPredict = class Predict extends React.Component {
972972
state = {
973973
displayControls: false,
974974
timeScale: defaultTimeScale
@@ -1040,14 +1040,12 @@ let Predict = class Predict extends React.Component {
10401040
this.state.timeScale !== defaultTimeScale
10411041
) {
10421042
selectedControl = MediaControl.FastForward;
1043-
} else {
1044-
selectedControl = MediaControl.Play;
10451043
}
10461044

10471045
return (
10481046
<Body>
10491047
{this.state.displayControls && (
1050-
<div style={styles.mediaControls}>
1048+
<div style={styles.mediaControls} id="uitest-media-ctrl">
10511049
<span
10521050
onClick={() => this.onScaleTime(true)}
10531051
style={[
@@ -1090,21 +1088,29 @@ let Predict = class Predict extends React.Component {
10901088
</div>
10911089
)}
10921090
{!state.isRunning && !state.isPaused && (
1093-
<Button style={styles.continueButton} onClick={this.onRun}>
1091+
<Button
1092+
style={styles.continueButton}
1093+
onClick={this.onRun}
1094+
id="uitest-run-btn"
1095+
>
10941096
<FontAwesomeIcon icon={faPlay} />
10951097
&nbsp; &nbsp; Run
10961098
</Button>
10971099
)}
10981100
{(state.isRunning || state.isPaused) && state.canSkipPredict && (
1099-
<Button style={styles.continueButton} onClick={this.onContinue}>
1101+
<Button
1102+
style={styles.continueButton}
1103+
onClick={this.onContinue}
1104+
id="uitest-continue-btn"
1105+
>
11001106
Continue
11011107
</Button>
11021108
)}
11031109
</Body>
11041110
);
11051111
}
11061112
};
1107-
Predict = Radium(Predict);
1113+
export const Predict = Radium(UnwrappedPredict); // Exported for unit tests.
11081114

11091115
class PondPanel extends React.Component {
11101116
onPondPanelClick(e) {

0 commit comments

Comments
 (0)