NgMatchers

export interface NgMatchers

exported from angular2/testing defined in angular2/src/testing/matchers.ts (line 3)

Jasmine matchers that check Angular specific conditions.

Members

toBePromise() : boolean

Expect the value to be a Promise.

expect(value).toBePromise();

toBeAnInstanceOf(expected: any) : boolean

Expect the value to be an instance of a class.

expect(value).toBeAnInstanceOf(SomeClass);

toHaveText(expected: any) : boolean

Expect the element to have exactly the given text.

expect(element).toHaveText('Hello world!');

toHaveCssClass(expected: any) : boolean

Expect the element to have the given CSS class.

expect(element).toHaveCssClass('current');

toHaveCssStyle(expected: any) : boolean

Expect the element to have the given CSS styles.

expect(element).toHaveCssStyle({width: '100px', height: 'auto'});

toImplement(expected: any) : boolean

Expect a class to implement the interface of the given class.

expect(SomeClass).toImplement(OtherClass);

toContainError(expected: any) : boolean

Expect an exception to contain the given error text.

expect(exception).toContainError('Failed to load');

toThrowErrorWith(expectedMessage: any) : boolean

Expect a function to throw an error with the given error text when executed.

expect(() => { throw 'Failed to load'; }).toThrowErrorWith('Failed to load');

not : NgMatchers

Invert the matchers.