revert(format): Revert "chore(format): update to latest formatter"
This reverts commit 03627aa84d
.
This commit is contained in:
@ -1,4 +1,15 @@
|
||||
import {describe, it, iit, ddescribe, expect, tick, SpyObject, beforeEach, proxy, containsRegexp} from 'angular2/testing_internal';
|
||||
import {
|
||||
describe,
|
||||
it,
|
||||
iit,
|
||||
ddescribe,
|
||||
expect,
|
||||
tick,
|
||||
SpyObject,
|
||||
beforeEach,
|
||||
proxy,
|
||||
containsRegexp
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {MapWrapper} from 'angular2/src/facade/collection';
|
||||
@ -29,25 +40,25 @@ export function main() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('toHaveCssClass', () => {
|
||||
it('should assert that the CSS class is present', () => {
|
||||
describe("toHaveCssClass", () => {
|
||||
it("should assert that the CSS class is present", () => {
|
||||
var el = DOM.createElement('div');
|
||||
DOM.addClass(el, 'matias');
|
||||
expect(el).toHaveCssClass('matias');
|
||||
});
|
||||
|
||||
it('should assert that the CSS class is not present', () => {
|
||||
it("should assert that the CSS class is not present", () => {
|
||||
var el = DOM.createElement('div');
|
||||
DOM.addClass(el, 'matias');
|
||||
expect(el).not.toHaveCssClass('fatias');
|
||||
});
|
||||
});
|
||||
|
||||
describe('toMatchPAttern', () => {
|
||||
it('should assert that a string matches a given pattern', () => {
|
||||
expect('matias').toMatchPattern(/ias$/g);
|
||||
expect('tobias').toMatchPattern(/ias$/g);
|
||||
expect('joonas').not.toMatchPattern(/ias$/g);
|
||||
describe("toMatchPAttern", () => {
|
||||
it("should assert that a string matches a given pattern", () => {
|
||||
expect("matias").toMatchPattern(/ias$/g);
|
||||
expect("tobias").toMatchPattern(/ias$/g);
|
||||
expect("joonas").not.toMatchPattern(/ias$/g);
|
||||
});
|
||||
});
|
||||
|
||||
@ -58,64 +69,60 @@ export function main() {
|
||||
});
|
||||
|
||||
it('should detect equality for same content', () => {
|
||||
expect(MapWrapper.createFromStringMap({'a': 1})).toEqual(MapWrapper.createFromStringMap({
|
||||
'a': 1
|
||||
}));
|
||||
expect(MapWrapper.createFromStringMap({'a': 1}))
|
||||
.toEqual(MapWrapper.createFromStringMap({'a': 1}));
|
||||
});
|
||||
|
||||
it('should detect missing entries', () => {
|
||||
expect(MapWrapper.createFromStringMap({
|
||||
'a': 1
|
||||
})).not.toEqual(MapWrapper.createFromStringMap({}));
|
||||
expect(MapWrapper.createFromStringMap({'a': 1}))
|
||||
.not.toEqual(MapWrapper.createFromStringMap({}));
|
||||
});
|
||||
|
||||
it('should detect different values', () => {
|
||||
expect(MapWrapper.createFromStringMap({
|
||||
'a': 1
|
||||
})).not.toEqual(MapWrapper.createFromStringMap({'a': 2}));
|
||||
expect(MapWrapper.createFromStringMap({'a': 1}))
|
||||
.not.toEqual(MapWrapper.createFromStringMap({'a': 2}));
|
||||
});
|
||||
|
||||
it('should detect additional entries', () => {
|
||||
expect(MapWrapper.createFromStringMap({
|
||||
'a': 1
|
||||
})).not.toEqual(MapWrapper.createFromStringMap({'a': 1, 'b': 1}));
|
||||
expect(MapWrapper.createFromStringMap({'a': 1}))
|
||||
.not.toEqual(MapWrapper.createFromStringMap({'a': 1, 'b': 1}));
|
||||
});
|
||||
});
|
||||
|
||||
describe('spy objects', () => {
|
||||
describe("spy objects", () => {
|
||||
var spyObj;
|
||||
|
||||
beforeEach(() => { spyObj = <any>new SpyTestObj(); });
|
||||
|
||||
it('should return a new spy func with no calls',
|
||||
() => { expect(spyObj.spy('someFunc')).not.toHaveBeenCalled(); });
|
||||
it("should return a new spy func with no calls",
|
||||
() => { expect(spyObj.spy("someFunc")).not.toHaveBeenCalled(); });
|
||||
|
||||
it('should record function calls', () => {
|
||||
spyObj.spy('someFunc').andCallFake((a, b) => {return a + b});
|
||||
it("should record function calls", () => {
|
||||
spyObj.spy("someFunc").andCallFake((a, b) => {return a + b});
|
||||
|
||||
expect(spyObj.someFunc(1, 2)).toEqual(3);
|
||||
expect(spyObj.spy('someFunc')).toHaveBeenCalledWith(1, 2);
|
||||
expect(spyObj.spy("someFunc")).toHaveBeenCalledWith(1, 2);
|
||||
});
|
||||
|
||||
it('should match multiple function calls', () => {
|
||||
it("should match multiple function calls", () => {
|
||||
spyObj.someFunc(1, 2);
|
||||
spyObj.someFunc(3, 4);
|
||||
expect(spyObj.spy('someFunc')).toHaveBeenCalledWith(1, 2);
|
||||
expect(spyObj.spy('someFunc')).toHaveBeenCalledWith(3, 4);
|
||||
expect(spyObj.spy("someFunc")).toHaveBeenCalledWith(1, 2);
|
||||
expect(spyObj.spy("someFunc")).toHaveBeenCalledWith(3, 4);
|
||||
});
|
||||
|
||||
it('should match null arguments', () => {
|
||||
spyObj.someFunc(null, 'hello');
|
||||
expect(spyObj.spy('someFunc')).toHaveBeenCalledWith(null, 'hello');
|
||||
it("should match null arguments", () => {
|
||||
spyObj.someFunc(null, "hello");
|
||||
expect(spyObj.spy("someFunc")).toHaveBeenCalledWith(null, "hello");
|
||||
});
|
||||
|
||||
it('should match using deep equality', () => {
|
||||
it("should match using deep equality", () => {
|
||||
spyObj.someComplexFunc([1]);
|
||||
expect(spyObj.spy('someComplexFunc')).toHaveBeenCalledWith([1]);
|
||||
expect(spyObj.spy("someComplexFunc")).toHaveBeenCalledWith([1]);
|
||||
});
|
||||
|
||||
it('should support stubs', () => {
|
||||
var s = SpyObject.stub({'a': 1}, {'b': 2});
|
||||
it("should support stubs", () => {
|
||||
var s = SpyObject.stub({"a": 1}, {"b": 2});
|
||||
|
||||
expect(s.a()).toEqual(1);
|
||||
expect(s.b()).toEqual(2);
|
||||
|
Reference in New Issue
Block a user