-
Notifications
You must be signed in to change notification settings - Fork 113
/
blaze-image.spec.ts
73 lines (59 loc) · 1.81 KB
/
blaze-image.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { TestWindow } from '@stencil/core/dist/testing';
import { Image } from './blaze-image';
describe('Image', () => {
it('should build', () => {
expect(new Image()).toBeTruthy();
});
let element;
const snapIt = (name, html) => {
it(name, async () => {
const window = new TestWindow();
element = await window.load({
components: [Image],
html
});
window.flush();
expect(element).toMatchSnapshot();
});
};
snapIt(
'renders a standard image with src and alt attributes',
'<blaze-image src="https://www.blazeui.com/assets/img/blaze.png" alt="blaze logo"></blaze-image>'
);
snapIt(
'falls back to a random placeholder image',
'<blaze-image></blaze-image>'
);
snapIt(
'falls back to a random placeholder image with a filter',
'<blaze-image filter="space"></blaze-image>'
);
snapIt(
'width and height',
'<blaze-image width="1024" height="768"></blaze-image>'
);
snapIt(
'with specific photo id',
'<blaze-image photo="test-photo-id"></blaze-image>'
);
snapIt(
'with specific photo id and width and height',
'<blaze-image photo="test-photo-id" width="1024" height="768"></blaze-image>'
);
snapIt(
'from a specific user',
'<blaze-image user="test-user"></blaze-image>'
);
snapIt(
'from a specific user with width and height',
'<blaze-image user="test-user" width="1024" height="768"></blaze-image>'
);
snapIt(
'from a specific user with width and height and an additional filter',
'<blaze-image user="test-user" width="1024" height="768" filter="plane"></blaze-image>'
);
snapIt(
'from the list of a specific user\'s like photos with additional attributes',
'<blaze-image user="test-user" width="1024" height="768" filter="mountains" likes></blaze-image>'
);
});