test(forms): added a test checking support for select

This commit is contained in:
vsavkin 2015-03-19 10:06:56 -07:00
parent f42e6337b7
commit d220b6a2a4
1 changed files with 25 additions and 0 deletions

View File

@ -193,6 +193,31 @@ export function main() {
});
}));
it("should support select", inject([AsyncTestCompleter], (async) => {
var ctx = new MyComp(new ControlGroup({"city": new Control("SF")}));
var t = `<div [control-group]="form">
<select control="city">
<option value="SF"></option>
<option value="NYC"></option>
</select>
</div>`;
compile(MyComp, t, ctx, (view) => {
var select = queryView(view, "select")
var sfOption = queryView(view, "option")
expect(select.value).toEqual('SF');
expect(sfOption.selected).toBe(true);
select.value = 'NYC';
dispatchEvent(select, "change");
expect(ctx.form.value).toEqual({"city" : 'NYC'});
expect(sfOption.selected).toBe(false);
async.done();
});
}));
it("should support custom value accessors", inject([AsyncTestCompleter], (async) => {
var ctx = new MyComp(new ControlGroup({"name": new Control("aa")}));