mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-15 18:23:09 +00:00
test(browser/compile): fix calls to Jasmine fail()
The fail() function in Jasmine expects an Error object parameter. Also, there is no global alias for fail() so it must be accessed using `this.fail(new Error())`.
This commit is contained in:
parent
cb62a57d43
commit
0985a37376
2 changed files with 4 additions and 4 deletions
4
test/ng/browserSpecs.js
Normal file → Executable file
4
test/ng/browserSpecs.js
Normal file → Executable file
|
|
@ -271,8 +271,8 @@ describe('browser', function() {
|
||||||
browser.cookies('x', longVal + longVal + longVal); //should be too long for all browsers
|
browser.cookies('x', longVal + longVal + longVal); //should be too long for all browsers
|
||||||
|
|
||||||
if (document.cookie !== cookieStr) {
|
if (document.cookie !== cookieStr) {
|
||||||
fail("browser didn't drop long cookie when it was expected. make the cookie in this " +
|
this.fail(new Error("browser didn't drop long cookie when it was expected. make the " +
|
||||||
"test longer");
|
"cookie in this test longer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(browser.cookies().x).toEqual('shortVal');
|
expect(browser.cookies().x).toEqual('shortVal');
|
||||||
|
|
|
||||||
4
test/ng/compileSpec.js
Normal file → Executable file
4
test/ng/compileSpec.js
Normal file → Executable file
|
|
@ -540,8 +540,8 @@ describe('$compile', function() {
|
||||||
|
|
||||||
it('should prevent multiple templates per element', inject(function($compile) {
|
it('should prevent multiple templates per element', inject(function($compile) {
|
||||||
try {
|
try {
|
||||||
$compile('<div><span replace class="replace"></span></div>')
|
$compile('<div><span replace class="replace"></span></div>');
|
||||||
fail();
|
this.fail(new Error('should have thrown Multiple directives error'));
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
expect(e.message).toMatch(/Multiple directives .* asking for template/);
|
expect(e.message).toMatch(/Multiple directives .* asking for template/);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue