test(matchers): add support for toHaveClass in tests

This commit is contained in:
Matias Niemelä
2015-08-07 16:45:26 -07:00
parent 574bbea747
commit 24eabb9bb1
3 changed files with 33 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import {
containsRegexp
} from 'angular2/test_lib';
import {DOM} from 'angular2/src/dom/dom_adapter';
import {MapWrapper} from 'angular2/src/facade/collection';
import {IMPLEMENTS, RegExpWrapper} from 'angular2/src/facade/lang';
@ -42,6 +43,20 @@ export function main() {
});
});
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", () => {
var el = DOM.createElement('div');
DOM.addClass(el, 'matias');
expect(el).not.toHaveCssClass('fatias');
});
});
describe('toEqual for Maps', () => {
it('should detect equality for same reference', () => {
var m1 = MapWrapper.createFromStringMap({'a': 1});