add handleExecutionFlagChange spec

This commit is contained in:
Shelley Vohr
2020-01-04 21:13:52 -05:00
parent 7e90679706
commit 55bfb0241b
2 changed files with 24 additions and 1 deletions
@@ -58,7 +58,7 @@ export class ExecutionSettings extends React.Component<ExecutionSettingsProps, {
event: React.FormEvent<HTMLInputElement>
) {
const { value } = event.currentTarget;
const flags = value.split(',');
const flags = value.split('|');
this.props.appState.executionFlags = flags;
}
@@ -56,4 +56,27 @@ describe('ExecutionSettings component', () => {
expect(store.isEnablingElectronLogging).toBe(true);
});
});
describe('handleElectronLoggingChange()', () => {
it('handles a new selection', async () => {
const wrapper = shallow(
<ExecutionSettings appState={store} />
);
const instance = wrapper.instance() as any;
await instance.handleExecutionFlagChange({
currentTarget: { value: '--lang=es' }
});
expect(store.executionFlags).toBe(['--lang=es']);
await instance.handleExecutionFlagChange({
currentTarget: { value: '--lang=es|--js-flags=--expose-gc' }
});
expect(store.executionFlags).toBe([
'--lang=es',
'--js-flags=--expose-gc'
]);
});
});
});