finished client side unit test for directive id
This commit is contained in:
parent
f6c1f5f137
commit
0a8a682376
|
@ -19,7 +19,7 @@ describe('Directive vnId', () => {
|
|||
it(`should throw an error when there's no id defined`, () => {
|
||||
let html = `<form vn-id=""></form>`;
|
||||
|
||||
expect(function errorExpected() {
|
||||
expect(() => {
|
||||
compile(html);
|
||||
}).toThrow(new Error(`vnId: Attribute can't be null`));
|
||||
});
|
||||
|
@ -27,8 +27,17 @@ describe('Directive vnId', () => {
|
|||
it(`should throw an error when these's no controller defined in $element[0]`, () => {
|
||||
let html = `<div vn-id="1"></div>`;
|
||||
|
||||
expect(function errorExpected() {
|
||||
expect(() => {
|
||||
compile(html);
|
||||
}).toThrow(new Error(`vnId: Can't find controller for element '1'`));
|
||||
});
|
||||
|
||||
it(`should set the controller into the $scope as there are no errors being thrown`, () => {
|
||||
let html = `<form vn-id="1"></form>`;
|
||||
|
||||
expect($scope['1']).not.toBeDefined();
|
||||
compile(html);
|
||||
|
||||
expect($scope['1']).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue