fix(forms): improve error message when ngFormModel is missing a form

Closes #8136

Closes #8143
This commit is contained in:
Kara Erickson
2016-04-20 12:52:35 -07:00
committed by Kara
parent 9092ac79d4
commit 12837e1c17
2 changed files with 23 additions and 1 deletions

View File

@ -62,6 +62,19 @@ export function main() {
});
}));
it("should throw if a form isn't passed into ngFormModel",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
var t = `<div [ngFormModel]="form">
<input type="text" ngControl="login">
</div>`;
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
expect(() => fixture.detectChanges())
.toThrowError(new RegExp(`ngFormModel expects a form. Please pass one in.`));
async.done();
});
}));
it("should update the control group values on DOM change",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
var form = new ControlGroup({"login": new Control("oldValue")});