-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlabel-view-test.ts
49 lines (40 loc) · 1.39 KB
/
label-view-test.ts
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
39
40
41
42
43
44
45
46
47
48
49
import { enableI18n, event } from '../test-util';
import { readit, rdfs, skos } from './../common-rdf/ns';
import { FlatLdObject } from '../common-rdf/json';
import Node from '../common-rdf/node';
import FlatItem from '../common-adapters/flat-item-model';
import LabelView from './label-view';
function getDefaultItem(): FlatItem {
return new FlatItem(new Node(getDefaultAttributes()));
}
function getDefaultAttributes(): FlatLdObject {
return {
'@id': readit('test'),
"@type": [rdfs.Class],
[skos.prefLabel]: [
{ '@value': 'Content' },
],
[skos.altLabel]: [
{ '@value': 'alternativeLabel'}
],
[skos.definition]: [
{ '@value': 'This is a test definition'}
],
};
}
describe('LabelView', function () {
beforeAll(enableI18n);
beforeEach( async function() {
this.item = getDefaultItem();
});
it('can be constructed in isolation', async function () {
let view = new LabelView({ model: this.item });
await event(this.item, 'complete');
expect(view.el.className).toContain('is-readit-content');
});
it('excludes a tooltip if told so', async function () {
let view = new LabelView({ model: this.item, toolTipSetting: false });
await event(this.item, 'complete');
expect(view.el.className).toContain('is-readit-content');
});
});