Skip to content

Commit

Permalink
test case for #108
Browse files Browse the repository at this point in the history
  • Loading branch information
lathonez committed Jul 2, 2016
1 parent 59b2e0c commit 673622d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/components/clickerForm/clickerForm.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ion-row>
<ion-col width-80>
<ion-item>
<ion-input block [ngFormControl]="clickerNameInput" type="text" placeholder="New Clicker"></ion-input>
<ion-input block [ngFormControl]="clickerNameInput" [(ngModel)]="clickerName" type="text" placeholder="New Clicker"></ion-input>
</ion-item>
</ion-col>
<ion-col>
Expand Down
2 changes: 2 additions & 0 deletions app/components/clickerForm/clickerForm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ describe('ClickerForm', () => {

it('doesn\'t try to add a clicker with no name', () => {
let button: any = this.fixture.nativeElement.querySelectorAll('button')[1];
this.instance.clickerName = '';
this.fixture.detectChanges();
TestUtils.eventFire(button, 'click');
expect(this.instance.newClicker).toHaveBeenCalled();
expect(this.instance['clickerService'].newClicker).not.toHaveBeenCalled();
Expand Down
2 changes: 2 additions & 0 deletions app/components/clickerForm/clickerForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class ClickerForm {
private clickerService: Clickers;
private form: ControlGroup;
private clickerNameInput: AbstractControl;
private clickerName: string;

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

this.clickerNameInput = this.form.controls['clickerNameInput'];
this.clickerName = 'Clicker Issue #108';
}

public newClicker(formValue: Object): boolean {
Expand Down

0 comments on commit 673622d

Please sign in to comment.