diff --git a/modules/angular2/test/forms/directives_spec.js b/modules/angular2/test/forms/directives_spec.ts similarity index 59% rename from modules/angular2/test/forms/directives_spec.js rename to modules/angular2/test/forms/directives_spec.ts index 5e1dcf723b..3c9bb02c39 100644 --- a/modules/angular2/test/forms/directives_spec.js +++ b/modules/angular2/test/forms/directives_spec.ts @@ -1,5 +1,16 @@ -import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, el, - AsyncTestCompleter, inject} from 'angular2/test_lib'; +import { + ddescribe, + describe, + it, + iit, + xit, + expect, + beforeEach, + afterEach, + el, + AsyncTestCompleter, + inject +} from 'angular2/test_lib'; import {ControlGroup, ControlDirective, ControlGroupDirective} from 'angular2/forms'; export function main() { @@ -7,9 +18,8 @@ export function main() { describe("Control", () => { it("should throw when the group is not found and the control is not set", () => { var c = new ControlDirective(null); - expect(() => { - c.controlOrName = 'login'; - }).toThrowError(new RegExp('No control group found for "login"')); + expect(() => { c.controlOrName = 'login'; }) + .toThrowError(new RegExp('No control group found for "login"')); }); it("should throw when cannot find the control in the group", () => { @@ -17,9 +27,8 @@ export function main() { emptyGroup.controlOrName = new ControlGroup({}); var c = new ControlDirective(emptyGroup); - expect(() => { - c.controlOrName = 'login'; - }).toThrowError(new RegExp('Cannot find control "login"')); + expect(() => { c.controlOrName = 'login'; }) + .toThrowError(new RegExp('Cannot find control "login"')); }); }); }); diff --git a/modules/angular2/test/forms/form_builder_spec.js b/modules/angular2/test/forms/form_builder_spec.ts similarity index 61% rename from modules/angular2/test/forms/form_builder_spec.js rename to modules/angular2/test/forms/form_builder_spec.ts index 538dc9eefb..02e33fbce8 100644 --- a/modules/angular2/test/forms/form_builder_spec.js +++ b/modules/angular2/test/forms/form_builder_spec.ts @@ -1,27 +1,30 @@ -import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach, el} from 'angular2/test_lib'; +import { + ddescribe, + describe, + it, + iit, + xit, + expect, + beforeEach, + afterEach, + el +} from 'angular2/test_lib'; import {Control, FormBuilder, Validators} from 'angular2/forms'; export function main() { describe("Form Builder", () => { var b; - beforeEach(() => { - b = new FormBuilder(); - }); + beforeEach(() => { b = new FormBuilder(); }); it("should create controls from a value", () => { - var g = b.group({ - "login": "some value" - }); + var g = b.group({"login": "some value"}); expect(g.controls["login"].value).toEqual("some value"); }); it("should create controls from an array", () => { - var g = b.group({ - "login": ["some value"], - "password": ["some value", Validators.required] - }); + var g = b.group({"login": ["some value"], "password": ["some value", Validators.required]}); expect(g.controls["login"].value).toEqual("some value"); expect(g.controls["password"].value).toEqual("some value"); @@ -29,49 +32,35 @@ export function main() { }); it("should use controls", () => { - var g = b.group({ - "login": b.control("some value", Validators.required) - }); + var g = b.group({"login": b.control("some value", Validators.required)}); expect(g.controls["login"].value).toEqual("some value"); expect(g.controls["login"].validator).toBe(Validators.required); }); it("should create groups with optional controls", () => { - var g = b.group({ - "login": "some value" - }, {"optionals": {"login" : false}}); + var g = b.group({"login": "some value"}, {"optionals": {"login": false}}); expect(g.contains("login")).toEqual(false); }); it("should create groups with a custom validator", () => { - var g = b.group({ - "login": "some value" - }, {"validator": Validators.nullValidator}); + var g = b.group({"login": "some value"}, {"validator": Validators.nullValidator}); expect(g.validator).toBe(Validators.nullValidator); }); it("should use default validators when no validators are provided", () => { - var g = b.group({ - "login": "some value" - }); + var g = b.group({"login": "some value"}); expect(g.controls["login"].validator).toBe(Validators.nullValidator); expect(g.validator).toBe(Validators.group); }); it("should create control arrays", () => { var c = b.control("three"); - var a = b.array([ - "one", - ["two", Validators.required], - c, - b.array(['four']) - ]); + var a = b.array(["one", ["two", Validators.required], c, b.array(['four'])]); expect(a.value).toEqual(['one', 'two', 'three', ['four']]); }); }); } - diff --git a/modules/angular2/test/forms/integration_spec.js b/modules/angular2/test/forms/integration_spec.js deleted file mode 100644 index bfb7176b47..0000000000 --- a/modules/angular2/test/forms/integration_spec.js +++ /dev/null @@ -1,429 +0,0 @@ -import { - afterEach, - AsyncTestCompleter, - beforeEach, - ddescribe, - describe, - dispatchEvent, - el, - expect, - iit, - inject, - it, - xit -} from 'angular2/test_lib'; -import {DOM} from 'angular2/src/dom/dom_adapter'; - -import {Inject} from 'angular2/src/di/annotations_impl'; - -import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations'; -import {View} from 'angular2/src/core/annotations_impl/view'; - -import {TestBed} from 'angular2/src/test_lib/test_bed'; - -import {ControlGroupDirective, ControlDirective, Control, ControlGroup, RequiredValidatorDirective, CheckboxControlValueAccessor, DefaultValueAccessor, SelectControlValueAccessor, Validators} from 'angular2/forms'; - -export function main() { - describe("integration tests", () => { - - it("should initialize DOM elements with the given form object", - inject([TestBed, AsyncTestCompleter], (tb, async) => { - var ctx = new MyComp(new ControlGroup({ - "login": new Control("loginValue") - })); - - var t = `