Unverified Commit d8db0b88 authored by Milan Klanjsek's avatar Milan Klanjsek Committed by GitHub
Browse files

Merge pull request #1232 from vmware-tanzu/issue-1102

Fix stepper component to use correct action
Showing with 16 additions and 6 deletions
+16 -6
Fix stringify on form group
Fix stepper component to send correct actions through websocket
......@@ -7,7 +7,7 @@ import {
NoopAnimationsModule,
} from '@angular/platform-browser/animations';
import { WebsocketService } from '../../../services/websocket/websocket.service';
import { anything, instance, mock, verify } from 'ts-mockito';
import { anything, deepEqual, instance, mock, verify } from 'ts-mockito';
describe('StepperComponent', () => {
let component: StepperComponent;
......@@ -72,6 +72,14 @@ describe('StepperComponent', () => {
nextButton.click();
fixture.detectChanges();
verify(mockWebsocketService.sendMessage(action, anything())).once();
verify(
mockWebsocketService.sendMessage(
'action.octant.dev/performAction',
deepEqual({
action,
formGroup: anything(),
})
)
).once();
});
});
......@@ -97,10 +97,12 @@ export class StepperComponent implements OnInit {
}
onFormSubmit() {
const form = JSON.stringify(this.formGroup.value);
this.websocketService.sendMessage(this.action, form);
this.websocketService.sendMessage('action.octant.dev/performAction', {
action: this.action,
formGroup: this.formGroup.value,
});
if (isDevMode()) {
console.log('stepper form: ' + form);
console.log('stepper form: ' + this.formGroup.value);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment