Skip to content

Commit 93f34f3

Browse files
authored
Merge pull request #129 from rovercode/beta
Push to Production
2 parents 79d0f6a + 63b49de commit 93f34f3

5 files changed

Lines changed: 30 additions & 7 deletions

File tree

src/components/Credential.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import fileDownload from 'js-file-download';
1212

1313
const defaultState = {
1414
downloadOpen: false,
15-
apName: null,
16-
apPassword: null,
15+
apName: '',
16+
apPassword: '',
1717
};
1818

1919
class Credential extends Component {
@@ -95,8 +95,8 @@ class Credential extends Component {
9595
/>
9696
</p>
9797
<Form id="apForm" onSubmit={this.downloadCredentials}>
98-
<Form.Input inline label={networkNameLabel} onChange={this.handleNameChange} required />
99-
<Form.Input inline label={networkPasswordLabel} type="password" onChange={this.handlePasswordChange} required />
98+
<Form.Input inline label={networkNameLabel} onChange={this.handleNameChange} />
99+
<Form.Input inline label={networkPasswordLabel} type="password" onChange={this.handlePasswordChange} />
100100
</Form>
101101
</Modal.Content>
102102
<Modal.Actions>

src/components/Workspace.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ class Workspace extends Component {
344344
stepCode = () => {
345345
const { interpreter, workspace } = this.state;
346346

347+
if (this.sleeping) {
348+
return true;
349+
}
350+
347351
const ok = interpreter.step();
348352
if (!ok) {
349353
// Program complete, no more code to execute.

src/components/__tests__/Workspace.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,28 @@ describe('The Workspace component', () => {
398398
expect(workspace.instance().highlightPause).toBe(false);
399399
});
400400

401+
test('stops stepping when sleeping', () => {
402+
const wrapper = shallowWithIntl(
403+
<Workspace store={store}>
404+
<div />
405+
</Workspace>, { context },
406+
).dive();
407+
408+
const mockInterpreter = {
409+
step: jest.fn(() => true),
410+
};
411+
const workspace = wrapper.dive().dive();
412+
workspace.setState({
413+
interpreter: mockInterpreter,
414+
});
415+
workspace.update();
416+
workspace.instance().sleeping = true;
417+
const result = workspace.instance().stepCode();
418+
419+
expect(result).toBe(true);
420+
expect(mockInterpreter.step).not.toHaveBeenCalled();
421+
});
422+
401423
test('continues stepping when not at the end', () => {
402424
const mockStep = jest.fn();
403425
mockStep.mockReturnValueOnce(true).mockReturnValueOnce(false);

src/components/__tests__/__snapshots__/Credential.test.js.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,13 @@ exports[`The Credential component renders on the page with no errors 1`] = `
5252
inline={true}
5353
label="Network Name:"
5454
onChange={[Function]}
55-
required={true}
5655
/>
5756
<FormInput
5857
as={[Function]}
5958
control={[Function]}
6059
inline={true}
6160
label="Network Password:"
6261
onChange={[Function]}
63-
required={true}
6462
type="password"
6563
/>
6664
</Form>

src/utils/blockly-api.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ class BlocklyApi {
7878
interpreter.createNativeFunction(wrapper));
7979

8080
// Add continue API function
81-
/* TODO: Make the highlighting stay on continue block while sleeping */
8281
wrapper = (lengthInMs) => {
8382
this.beginSleep(lengthInMs);
8483
this.writeToConsole(`Sleeping for ${lengthInMs}ms.`);

0 commit comments

Comments
 (0)