|
1 | 1 | import { renderWithAppContext } from '../../__helpers__/test-utils'; |
| 2 | +import { mockSettings } from '../../__mocks__/state-mocks'; |
2 | 3 |
|
3 | 4 | import { NotificationTitle } from './NotificationTitle'; |
4 | 5 |
|
5 | 6 | describe('renderer/components/notifications/NotificationTitle.tsx', () => { |
6 | 7 | it('should render plain text without code blocks', () => { |
7 | 8 | const tree = renderWithAppContext( |
8 | | - <NotificationTitle title="Simple notification title" wrapTitle={false} />, |
| 9 | + <NotificationTitle title="Simple notification title" />, |
9 | 10 | ); |
10 | 11 |
|
11 | 12 | expect(tree).toMatchSnapshot(); |
12 | 13 | }); |
13 | 14 |
|
14 | 15 | it('should render text with single inline code block', () => { |
15 | 16 | const tree = renderWithAppContext( |
16 | | - <NotificationTitle |
17 | | - title="refactor: migrate deprecated atlaskit `xcss`" |
18 | | - wrapTitle={false} |
19 | | - />, |
| 17 | + <NotificationTitle title="refactor: migrate deprecated atlaskit `xcss`" />, |
20 | 18 | ); |
21 | 19 |
|
22 | 20 | expect(tree).toMatchSnapshot(); |
23 | 21 | }); |
24 | 22 |
|
25 | 23 | it('should render text with multiple inline code blocks', () => { |
26 | 24 | const tree = renderWithAppContext( |
27 | | - <NotificationTitle |
28 | | - title="Replace `foo` with `bar` in config" |
29 | | - wrapTitle={false} |
30 | | - />, |
| 25 | + <NotificationTitle title="Replace `foo` with `bar` in config" />, |
31 | 26 | ); |
32 | 27 |
|
33 | 28 | expect(tree).toMatchSnapshot(); |
34 | 29 | }); |
35 | 30 |
|
36 | 31 | it('should render text with code block at the start', () => { |
37 | 32 | const tree = renderWithAppContext( |
38 | | - <NotificationTitle |
39 | | - title="`useState` hook implementation" |
40 | | - wrapTitle={false} |
41 | | - />, |
| 33 | + <NotificationTitle title="`useState` hook implementation" />, |
42 | 34 | ); |
43 | 35 |
|
44 | 36 | expect(tree).toMatchSnapshot(); |
45 | 37 | }); |
46 | 38 |
|
47 | 39 | it('should render text with code block at the end', () => { |
48 | 40 | const tree = renderWithAppContext( |
49 | | - <NotificationTitle title="Fix issue with `render`" wrapTitle={false} />, |
| 41 | + <NotificationTitle title="Fix issue with `render`" />, |
50 | 42 | ); |
51 | 43 |
|
52 | 44 | expect(tree).toMatchSnapshot(); |
53 | 45 | }); |
54 | 46 |
|
55 | | - it('should apply truncate className when wrapTitle is false', () => { |
| 47 | + it('should apply truncate className when wrapNotificationTitle is false', () => { |
56 | 48 | const tree = renderWithAppContext( |
57 | | - <NotificationTitle |
58 | | - title="refactor: migrate deprecated atlaskit `xcss`" |
59 | | - wrapTitle={false} |
60 | | - />, |
| 49 | + <NotificationTitle title="refactor: migrate deprecated atlaskit `xcss`" />, |
| 50 | + { |
| 51 | + settings: { |
| 52 | + ...mockSettings, |
| 53 | + wrapNotificationTitle: false, |
| 54 | + }, |
| 55 | + }, |
61 | 56 | ); |
62 | 57 |
|
63 | 58 | expect(tree).toMatchSnapshot(); |
64 | 59 | }); |
65 | 60 |
|
66 | | - it('should not apply truncate className when wrapTitle is true', () => { |
| 61 | + it('should not apply truncate className when wrapNotificationTitle is true', () => { |
67 | 62 | const tree = renderWithAppContext( |
68 | | - <NotificationTitle |
69 | | - title="refactor: migrate deprecated atlaskit `xcss`" |
70 | | - wrapTitle={true} |
71 | | - />, |
| 63 | + <NotificationTitle title="refactor: migrate deprecated atlaskit `xcss`" />, |
| 64 | + { |
| 65 | + settings: { |
| 66 | + ...mockSettings, |
| 67 | + wrapNotificationTitle: true, |
| 68 | + }, |
| 69 | + }, |
72 | 70 | ); |
73 | 71 |
|
74 | 72 | expect(tree).toMatchSnapshot(); |
|
0 commit comments