forked from elastic/eui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_code_block.test.js
More file actions
66 lines (52 loc) · 1.67 KB
/
_code_block.test.js
File metadata and controls
66 lines (52 loc) · 1.67 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
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
import React from 'react';
import { render } from 'enzyme';
import { requiredProps } from '../../test/required_props';
import { EuiCodeBlockImpl } from './_code_block';
const code = `var some = 'code';
console.log(some);`;
describe('EuiCodeBlockImpl', () => {
describe('inline', () => {
test('renders an inline code tag', () => {
const component = render(
<EuiCodeBlockImpl inline={true} {...requiredProps}>
{code}
</EuiCodeBlockImpl>
);
expect(component).toMatchSnapshot();
});
test('highlights javascript code, adding "js" class', () => {
const component = render(
<EuiCodeBlockImpl inline={true} language="js" />
);
expect(component).toMatchSnapshot();
});
test('renders with transparent background', () => {
const component = render(
<EuiCodeBlockImpl inline={true} transparentBackground={true} />
);
expect(component).toMatchSnapshot();
});
});
describe('block', () => {
test('renders a pre block tag', () => {
const component = render(
<EuiCodeBlockImpl inline={false} {...requiredProps}>
{code}
</EuiCodeBlockImpl>
);
expect(component).toMatchSnapshot();
});
test('highlights javascript code, adding "js" class', () => {
const component = render(
<EuiCodeBlockImpl inline={false} language="js" />
);
expect(component).toMatchSnapshot();
});
test('renders with transparent background', () => {
const component = render(
<EuiCodeBlockImpl inline={false} transparentBackground={true} />
);
expect(component).toMatchSnapshot();
});
});
});