Skip to content

Commit

Permalink
Renamed 'submit' button to 'save' in endpoint & service editors.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyanziano committed Feb 4, 2019
1 parent 7c05e44 commit ff3ee8e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- [main] Fixed issue [(#1257)](https://github.com/Microsoft/BotFramework-Emulator/issues/1257) where opening transcripts via the command line was crashing the app, in PR [#1269](https://github.com/Microsoft/BotFramework-Emulator/pull/1269).
- [main] display correct selected theme in file menu on mac, in PR [#1280](https://github.com/Microsoft/BotFramework-Emulator/pull/1280).
- [client] Renamed 'submit' button to 'save' in endpoint & service editors, in PR[#1296](https://github.com/Microsoft/BotFramework-Emulator/pull/1296)
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ describe('The EndpointExplorer component should', () => {
expect(instance.absContent.style.height).toEqual('135px');
});

it('should update the endpoint service when onSubmitClick is called', () => {
it('should update the endpoint service when onSaveClick is called', () => {
const instance = node.instance();
instance.state.botService = {
tenantId: '1234',
Expand All @@ -203,7 +203,7 @@ describe('The EndpointExplorer component should', () => {
serviceName: '321',
};
const hideDialogSpy = jest.spyOn(DialogService, 'hideDialog');
instance.onSubmitClick();
instance.onSaveClick();

expect(hideDialogSpy).toHaveBeenCalledWith([
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export class EndpointEditor extends Component<EndpointEditorProps, EndpointEdito
</div>
<DialogFooter>
<DefaultButton text="Cancel" onClick={this.onCancelClick} />
<PrimaryButton disabled={!this.isDirty || !valid} text="Submit" onClick={this.onSubmitClick} />
<PrimaryButton disabled={!this.isDirty || !valid} text="Save" onClick={this.onSaveClick} />
</DialogFooter>
</Dialog>
);
Expand All @@ -239,7 +239,7 @@ export class EndpointEditor extends Component<EndpointEditorProps, EndpointEdito
this.props.cancel();
};

private onSubmitClick = (): void => {
private onSaveClick = (): void => {
const { endpointService, botService } = this.state;
const servicesToUpdate: UpdatedServicesPayload = [endpointService];
if (botService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ describe('The ConnectedServiceEditor component ', () => {
expect(instance.state.nameError).not.toBeNull();
});

it('should exit with the newly edited model when clicking submit', () => {
it('should exit with the newly edited model when clicking save', () => {
const spy = jest.spyOn(DialogService, 'hideDialog');
const instance = node.instance();
const mockEvent = {
target: { value: 'renamed model', dataset: { prop: 'name' } },
};
instance.onInputChange(mockEvent as any);
instance.onSubmitClick();
instance.onSaveClick();
const mockMock = { ...mockService };
mockMock.name = 'renamed model';
expect(spy).toHaveBeenCalledWith([new LuisService(mockMock)]);
});

it('should enable the submit button when all required fields have non-null values', () => {
it('should enable the save button when all required fields have non-null values', () => {
const instance = node.instance();
const mockEvent = {
target: { value: 'renamed model', dataset: { prop: 'name' } },
Expand All @@ -139,8 +139,8 @@ describe('The ConnectedServiceEditor component ', () => {
mockEvent.target.value = '';
instance.onInputChange(mockEvent as any); // non-required field
instance.render();
const submitBtn = node.find(PrimaryButton);
expect(submitBtn.props.disabled).toBeFalsy();
const saveBtn = node.find(PrimaryButton);
expect(saveBtn.props.disabled).toBeFalsy();
});

it('should update the connectedServiceCopy.configuration when the "onKvPairChange()" handler is called', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class ConnectedServiceEditor extends Component<ConnectedServiceEditorProp
}

public render(): JSX.Element {
const { state, onInputChange, props, onSubmitClick } = this;
const { state, onInputChange, props, onSaveClick } = this;
const { connectedServiceCopy } = state;
const { type } = connectedServiceCopy;
const fields = this.editableFields;
Expand Down Expand Up @@ -154,7 +154,7 @@ export class ConnectedServiceEditor extends Component<ConnectedServiceEditorProp
{this.supplementalContent}
<DialogFooter>
<DefaultButton text="Cancel" onClick={props.cancel} />
<PrimaryButton disabled={!isDirty || !valid} text="Submit" onClick={onSubmitClick} />
<PrimaryButton disabled={!isDirty || !valid} text="Save" onClick={onSaveClick} />
</DialogFooter>
</Dialog>
);
Expand Down Expand Up @@ -331,7 +331,7 @@ export class ConnectedServiceEditor extends Component<ConnectedServiceEditorProp
}
}

private onSubmitClick = (): void => {
private onSaveClick = (): void => {
this.props.updateConnectedService(this.state.connectedServiceCopy);
};

Expand Down

0 comments on commit ff3ee8e

Please sign in to comment.