-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added changes for create client modal
Signed-off-by: chaitali-mane <cmane@progress.com>
- Loading branch information
1 parent
54b70d4
commit 6631a81
Showing
8 changed files
with
85 additions
and
50 deletions.
There are no files selected for viewing
13 changes: 0 additions & 13 deletions
13
components/automate-ui/src/app/modules/infra-proxy/clients/clients.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 43 additions & 2 deletions
45
...-ui/src/app/modules/infra-proxy/create-client-modal/create-client-modal.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,66 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { MockComponent } from 'ng2-mock-component'; | ||
import { ReactiveFormsModule } from '@angular/forms'; | ||
import { StoreModule } from '@ngrx/store'; | ||
import { ngrxReducers, runtimeChecks } from 'app/ngrx.reducers'; | ||
import { CreateClientModalComponent } from './create-client-modal.component'; | ||
import { ClientKey } from 'app/entities/clients/client.model'; | ||
import { EventEmitter } from '@angular/core'; | ||
|
||
describe('CreateClientModalComponent', () => { | ||
let component: CreateClientModalComponent; | ||
let fixture: ComponentFixture<CreateClientModalComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ CreateClientModalComponent ] | ||
declarations: [ | ||
MockComponent({ selector: 'chef-modal', inputs: ['visible'] }), | ||
MockComponent({ selector: 'chef-button', inputs: ['disabled'] }), | ||
MockComponent({ selector: 'chef-error' }), | ||
MockComponent({ selector: 'chef-form-field' }), | ||
MockComponent({ selector: 'chef-checkbox', inputs: ['checked']}), | ||
CreateClientModalComponent | ||
], | ||
imports: [ | ||
ReactiveFormsModule, | ||
StoreModule.forRoot(ngrxReducers, { runtimeChecks }) | ||
] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(CreateClientModalComponent); | ||
component = fixture.componentInstance; | ||
component.openEvent = new EventEmitter(); | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
describe('#createClientForm', () => { | ||
const clientKey: ClientKey = { | ||
name: 'test_name', | ||
public_key: 'test_public_key', | ||
expiration_date: 'test_expiration_date', | ||
private_key: 'test_private_key' | ||
}; | ||
|
||
it('should be invalid when no fields are filled out', () => { | ||
expect(component.createForm.valid).toBeFalsy(); | ||
}); | ||
|
||
it('should be valid when all fields are filled out', () => { | ||
component.createForm.controls['name'].setValue(clientKey.name); | ||
expect(component.createForm.valid).toBeTruthy(); | ||
}); | ||
|
||
it('opening create modal resets name to empty string', () => { | ||
component.visible = true; | ||
expect(component.createForm.controls['name'].value).toEqual(''); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters