Skip to content

Commit 673622d

Browse files
committed
test case for #108
1 parent 59b2e0c commit 673622d

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

app/components/clickerForm/clickerForm.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ion-row>
33
<ion-col width-80>
44
<ion-item>
5-
<ion-input block [ngFormControl]="clickerNameInput" type="text" placeholder="New Clicker"></ion-input>
5+
<ion-input block [ngFormControl]="clickerNameInput" [(ngModel)]="clickerName" type="text" placeholder="New Clicker"></ion-input>
66
</ion-item>
77
</ion-col>
88
<ion-col>

app/components/clickerForm/clickerForm.spec.ts

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ describe('ClickerForm', () => {
4242

4343
it('doesn\'t try to add a clicker with no name', () => {
4444
let button: any = this.fixture.nativeElement.querySelectorAll('button')[1];
45+
this.instance.clickerName = '';
46+
this.fixture.detectChanges();
4547
TestUtils.eventFire(button, 'click');
4648
expect(this.instance.newClicker).toHaveBeenCalled();
4749
expect(this.instance['clickerService'].newClicker).not.toHaveBeenCalled();

app/components/clickerForm/clickerForm.ts

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export class ClickerForm {
1616
private clickerService: Clickers;
1717
private form: ControlGroup;
1818
private clickerNameInput: AbstractControl;
19+
private clickerName: string;
1920

2021
constructor(clickerService: Clickers, fb: FormBuilder) {
2122
this.clickerService = clickerService;
@@ -25,6 +26,7 @@ export class ClickerForm {
2526
});
2627

2728
this.clickerNameInput = this.form.controls['clickerNameInput'];
29+
this.clickerName = 'Clicker Issue #108';
2830
}
2931

3032
public newClicker(formValue: Object): boolean {

0 commit comments

Comments
 (0)