Skip to content

Commit 3059104

Browse files
Bertrand Laportemhevery
authored andcommitted
add compilation error test for dart
Closes angular#812
1 parent 21f24d1 commit 3059104

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

modules/angular2/test/core/compiler/integration_spec.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import {describe, xit, it, expect, beforeEach, ddescribe, iit, el} from 'angular2/test_lib';
22

33
import {DOM} from 'angular2/src/dom/dom_adapter';
4-
import {Type, isPresent, BaseException} from 'angular2/src/facade/lang';
5-
import {assertionsEnabled, isJsObject} from 'angular2/src/facade/lang';
4+
import {Type, isPresent, BaseException, assertionsEnabled, isJsObject} from 'angular2/src/facade/lang';
5+
import {PromiseWrapper} from 'angular2/src/facade/async';
66

77
import {Injector} from 'angular2/di';
8-
import {Lexer, Parser, ChangeDetector, dynamicChangeDetection,
8+
import {Lexer, Parser, dynamicChangeDetection,
99
DynamicChangeDetection, Pipe, PipeRegistry} from 'angular2/change_detection';
1010

1111
import {Compiler, CompilerCache} from 'angular2/src/core/compiler/compiler';
@@ -433,17 +433,19 @@ export function main() {
433433
});
434434
});
435435

436-
// TODO support these tests with DART e.g. with Promise.catch (JS) transpiled to Future.catchError (DART)
437-
if (assertionsEnabled() && isJsObject({})) {
436+
if (assertionsEnabled()) {
438437

439438
function expectCompileError(inlineTpl, errMessage, done) {
440439
tplResolver.setTemplate(MyComp, new Template({inline: inlineTpl}));
441-
compiler.compile(MyComp).then(() => {
442-
throw new BaseException("Test failure: should not have come here as an exception was expected");
443-
},(err) => {
444-
expect(err.message).toBe(errMessage);
445-
done();
446-
});
440+
PromiseWrapper.then(compiler.compile(MyComp),
441+
(value) => {
442+
done("Test failure: should not have come here as an exception was expected");
443+
},
444+
(err) => {
445+
expect(err.message).toEqual(errMessage);
446+
done();
447+
}
448+
);
447449
}
448450

449451
it('should raise an error if no directive is registered for an unsupported DOM property', (done) => {

0 commit comments

Comments
 (0)