raw-html.component.spec.ts
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {TestComponentBuilder} from 'ng-forward/cjs/testing/test-component-builder';
import {Component} from 'ng-forward';
import {RawHTMLBlock} from './raw-html.component';
const tcb = new TestComponentBuilder();
const htmlTemplate: string = '<noosfero-raw-html-block [block]="ctrl.block" [owner]="ctrl.owner"></noosfero-raw-html-block>';
describe("Components", () => {
describe("Raw Html Block Component", () => {
beforeEach(angular.mock.module("templates"));
beforeEach(angular.mock.module("noosferoApp", ($translateProvider: angular.translate.ITranslateProvider) => {
$translateProvider.translations('en', {});
}));
it("display html stored in block settings", done => {
@Component({
selector: 'test-container-component',
template: htmlTemplate,
directives: [RawHTMLBlock],
})
class CustomBlockType {
block: any = { settings: { html: '<em>block content</em>' } };
owner: any = { name: 'profile-name' };
}
tcb.createAsync(CustomBlockType).then(fixture => {
expect(fixture.debugElement.query(".raw-html-block em").text().trim()).toEqual('block content');
done();
});
});
});
});