From 4c9b1dfd1a3c4232de2307c7319db96b24327bf1 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Mon, 2 Mar 2020 04:06:39 -0800 Subject: [PATCH] Make SeetingsSheet test deterministic Summary: The platform check is a side-effect and shouldn't be in the UI component itself. Reviewed By: mweststrate Differential Revision: D20159799 fbshipit-source-id: c5fa99e0b915a140f10056283671cf5b7368e9c9 --- src/App.tsx | 2 +- src/chrome/SettingsSheet.tsx | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index ed37a93b2..8ce041483 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -94,7 +94,7 @@ export class App extends React.Component { case ACTIVE_SHEET_SIGN_IN: return ; case ACTIVE_SHEET_SETTINGS: - return ; + return ; case ACTIVE_SHEET_DOCTOR: return ; case ACTIVE_SHEET_SELECT_PLUGINS_TO_EXPORT: diff --git a/src/chrome/SettingsSheet.tsx b/src/chrome/SettingsSheet.tsx index aa4ef5e98..d186a5922 100644 --- a/src/chrome/SettingsSheet.tsx +++ b/src/chrome/SettingsSheet.tsx @@ -27,8 +27,6 @@ import LauncherSettingsPanel from '../fb-stubs/LauncherSettingsPanel'; import {reportUsage} from '../utils/metrics'; import os from 'os'; -const platform = os.platform(); - const Container = styled(FlexColumn)({ padding: 20, width: 800, @@ -43,6 +41,7 @@ const Title = styled(Text)({ type OwnProps = { onHide: () => void; + platform: NodeJS.Platform; }; type StateFromProps = { @@ -113,21 +112,22 @@ class SettingsSheet extends Component { { this.setState({ updatedSettings: {...this.state.updatedSettings, enableIOS: v}, }); }}> {' '} - {platform === 'darwin' && ( + {this.props.platform === 'darwin' && ( )} - {platform !== 'darwin' && ( + {this.props.platform !== 'darwin' && (