I started to learn angular 2 and want to get things right with unit test. So I want all my directives/components to write with tests.
In angularJS (first version) to test directive You use $compile
. Here's example from doc:
it('Replaces the element with the appropriate content', function() {
var element = $compile("<a-great-eye></a-great-eye>")($rootScope);
$rootScope.$digest();
expect(element.html()).toContain("lidless, wreathed in flame, 2 times");
});
How to compile html text in angular 2 to write a test?
I want to test simpliest direcive:
import {Component} from 'angular2/core';
@Component({
selector: 'email',
template: `Hello Email`
})
export class EmailComponent {
}