-
Notifications
You must be signed in to change notification settings - Fork 113
/
blaze-breadcrumbs.spec.ts
54 lines (46 loc) · 1.31 KB
/
blaze-breadcrumbs.spec.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
50
51
52
53
54
import { TestWindow } from '@stencil/core/dist/testing';
import { Breadcrumbs } from './blaze-breadcrumbs';
import { Breadcrumb } from './blaze-breadcrumb';
describe('Breadcrumbs', () => {
it('should build', () => {
expect(new Breadcrumbs()).toBeTruthy();
expect(new Breadcrumb()).toBeTruthy();
});
let element;
const snapIt = (name, html) => {
it(name, async () => {
const window = new TestWindow();
element = await window.load({
components: [Breadcrumbs, Breadcrumb],
html
});
window.flush();
expect(element).toMatchSnapshot();
});
};
snapIt(
'nothing is rendered with no crumbs',
'<blaze-breadcrumbs></blaze-breadcrumbs>'
);
snapIt(
'one crumb',
`<blaze-breadcrumbs>
<blaze-breadcrumb>Home</blaze-breadcrumb>
</blaze-breadcrumbs>`
);
snapIt(
'two crumbs with a separator',
`<blaze-breadcrumbs>
<blaze-breadcrumb>Home</blaze-breadcrumb>
<blaze-breadcrumb>Sub-section</blaze-breadcrumb>
</blaze-breadcrumbs>`
);
snapIt(
'linked crumb',
`<blaze-breadcrumbs>
<blaze-breadcrumb href="home.html">Home</blaze-breadcrumb>
<blaze-breadcrumb href="another-page.html">Another page</blaze-breadcrumb>
<blaze-breadcrumb>Sub-section</blaze-breadcrumb>
</blaze-breadcrumbs>`
);
});