Skip to content

Commit d220b6a

Browse files
committed
test(forms): added a test checking support for select
1 parent f42e633 commit d220b6a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

modules/angular2/test/forms/integration_spec.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,31 @@ export function main() {
193193
});
194194
}));
195195

196+
it("should support select", inject([AsyncTestCompleter], (async) => {
197+
var ctx = new MyComp(new ControlGroup({"city": new Control("SF")}));
198+
199+
var t = `<div [control-group]="form">
200+
<select control="city">
201+
<option value="SF"></option>
202+
<option value="NYC"></option>
203+
</select>
204+
</div>`;
205+
206+
compile(MyComp, t, ctx, (view) => {
207+
var select = queryView(view, "select")
208+
var sfOption = queryView(view, "option")
209+
expect(select.value).toEqual('SF');
210+
expect(sfOption.selected).toBe(true);
211+
212+
select.value = 'NYC';
213+
dispatchEvent(select, "change");
214+
215+
expect(ctx.form.value).toEqual({"city" : 'NYC'});
216+
expect(sfOption.selected).toBe(false);
217+
async.done();
218+
});
219+
}));
220+
196221
it("should support custom value accessors", inject([AsyncTestCompleter], (async) => {
197222
var ctx = new MyComp(new ControlGroup({"name": new Control("aa")}));
198223

0 commit comments

Comments
 (0)