Skip to content

Commit 838a63d

Browse files
committed
Update tests to reflect superclass allowance (#455)
1 parent 77ec7f4 commit 838a63d

File tree

2 files changed

+37
-26
lines changed

2 files changed

+37
-26
lines changed

frontend/src/semantic-search/chain-view-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('semantic search ChainView', function() {
3535
expect(view.items.length).toBe(1);
3636
await event(view.items[0], 'ready');
3737
expect(view.items[0]['typeGroup']).toBeDefined();
38-
expect(view.items[0]['typeGroup'].collection.length).toBe(3);
38+
expect(view.items[0]['typeGroup'].collection.length).toBe(4);
3939
});
4040

4141
it('can be constructed with a preselection', async function() {

frontend/src/semantic-search/dropdown-view-test.ts

+36-25
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,43 @@ describe('semantic search DropdownView', function() {
3737
expect(view.$('optgroup:nth-child(2)').prop('label')).toBe('apply logic');
3838
expect(view.$('optgroup:nth-child(2) option').length).toBe(3);
3939
expect(view.$('optgroup:nth-child(3)').prop('label')).toBe('expect type');
40-
expect(view.$('optgroup:nth-child(3) option').length).toBe(3);
40+
expect(view.$('optgroup:nth-child(3) option').length).toBe(4);
4141
expect(view.$('optgroup:nth-child(3)').text()).toContain('Reader');
42-
expect(view.$('optgroup:nth-child(3)').text()).not.toContain('Person');
42+
expect(view.$('optgroup:nth-child(3)').text()).toContain('Person');
4343
});
4444

45-
each({
46-
'single class': 'Reader',
47-
'property': 'descriptionOf',
48-
}, (term, label) =>
49-
it(`can be constructed with a ${label}`, async function() {
50-
const model = new Model({
51-
precedent: ldChannel.request('obtain', readit(term)),
52-
});
53-
const view = new Dropdown({ model });
54-
await event(view, 'ready');
55-
await event(view.predicateGroup.collection.at(0), 'change:classLabel');
56-
expect(view.$('select optgroup').length).toBe(3);
57-
expect(view.$('optgroup:nth-child(2)').prop('label')).toBe('apply logic');
58-
expect(view.$('optgroup:nth-child(2) option').length).toBe(3);
59-
expect(view.$('optgroup:nth-child(3)').prop('label')).toBe('apply filter');
60-
expect(view.$('optgroup:nth-child(3) option').length).toBe(2);
61-
expect(view.$('optgroup:nth-child(3)').text()).toContain('Is exactly');
62-
expect(view.$('optgroup:nth-child(3)').text()).not.toContain('Is less than');
63-
expect(view.$('optgroup:nth-child(4)').prop('label')).toBe('traverse predicate');
64-
expect(view.$('optgroup:nth-child(4) option').length).toBe(2);
65-
expect(view.$('optgroup:nth-child(4)').text()).toContain('description of');
66-
})
67-
);
45+
it('can be constructed with a property', async function() {
46+
const model = new Model({
47+
precedent: ldChannel.request('obtain', readit('descriptionOf')),
48+
});
49+
const view = new Dropdown({ model });
50+
await event(view, 'ready');
51+
await event(view.typeGroup.collection, 'complete:all');
52+
expect(view.$('select optgroup').length).toBe(2);
53+
expect(view.$('optgroup:nth-child(2)').prop('label')).toBe('apply logic');
54+
expect(view.$('optgroup:nth-child(2) option').length).toBe(3);
55+
expect(view.$('optgroup:nth-child(3)').prop('label')).toBe('expect type');
56+
expect(view.$('optgroup:nth-child(3) option').length).toBe(2);
57+
expect(view.$('optgroup:nth-child(3)').text()).toContain('Reader');
58+
expect(view.$('optgroup:nth-child(3)').text()).toContain('Person');
59+
});
60+
61+
it(`can be constructed with a single class`, async function() {
62+
const model = new Model({
63+
precedent: ldChannel.request('obtain', readit('Reader')),
64+
});
65+
const view = new Dropdown({ model });
66+
await event(view, 'ready');
67+
await event(view.predicateGroup.collection.at(0), 'change:classLabel');
68+
expect(view.$('select optgroup').length).toBe(3);
69+
expect(view.$('optgroup:nth-child(2)').prop('label')).toBe('apply logic');
70+
expect(view.$('optgroup:nth-child(2) option').length).toBe(3);
71+
expect(view.$('optgroup:nth-child(3)').prop('label')).toBe('apply filter');
72+
expect(view.$('optgroup:nth-child(3) option').length).toBe(2);
73+
expect(view.$('optgroup:nth-child(3)').text()).toContain('Is exactly');
74+
expect(view.$('optgroup:nth-child(3)').text()).not.toContain('Is less than');
75+
expect(view.$('optgroup:nth-child(4)').prop('label')).toBe('traverse predicate');
76+
expect(view.$('optgroup:nth-child(4) option').length).toBe(2);
77+
expect(view.$('optgroup:nth-child(4)').text()).toContain('description of');
78+
});
6879
});

0 commit comments

Comments
 (0)