@pie-lib/editable-html-tip-tap 2.1.19 → 2.1.20-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +0 -130
  2. package/lib/components/EditableHtml.js +0 -56
  3. package/lib/components/EditableHtml.js.map +1 -1
  4. package/lib/components/MenuBar.js +12 -81
  5. package/lib/components/MenuBar.js.map +1 -1
  6. package/lib/components/TiptapContainer.js +2 -2
  7. package/lib/components/TiptapContainer.js.map +1 -1
  8. package/lib/components/common/toolbar-buttons.js +5 -6
  9. package/lib/components/common/toolbar-buttons.js.map +1 -1
  10. package/lib/components/icons/TableIcons.js +1 -3
  11. package/lib/components/icons/TableIcons.js.map +1 -1
  12. package/lib/components/icons/TextAlign.js +5 -14
  13. package/lib/components/icons/TextAlign.js.map +1 -1
  14. package/lib/components/respArea/MathTemplated.js +8 -14
  15. package/lib/components/respArea/MathTemplated.js.map +1 -1
  16. package/lib/extensions/math.js +37 -19
  17. package/lib/extensions/math.js.map +1 -1
  18. package/lib/styles/editorContainerStyles.js +2 -2
  19. package/lib/styles/editorContainerStyles.js.map +1 -1
  20. package/package.json +9 -9
  21. package/src/components/EditableHtml.jsx +0 -52
  22. package/src/components/MenuBar.jsx +9 -91
  23. package/src/components/TiptapContainer.jsx +2 -2
  24. package/src/components/common/toolbar-buttons.jsx +4 -6
  25. package/src/components/icons/TableIcons.jsx +1 -9
  26. package/src/components/icons/TextAlign.jsx +5 -39
  27. package/src/components/respArea/MathTemplated.jsx +6 -13
  28. package/src/extensions/math.js +19 -11
  29. package/src/styles/editorContainerStyles.js +2 -2
  30. package/LICENSE.md +0 -5
  31. package/src/__tests__/EditableHtml.test.jsx +0 -668
  32. package/src/__tests__/constants.test.js +0 -19
  33. package/src/__tests__/div-to-paragraph-conversion.test.jsx +0 -125
  34. package/src/__tests__/editor-attributes.test.jsx +0 -77
  35. package/src/__tests__/extensions.test.js +0 -208
  36. package/src/__tests__/index.test.jsx +0 -154
  37. package/src/__tests__/size-utils.test.js +0 -64
  38. package/src/__tests__/spellcheck.test.jsx +0 -63
  39. package/src/__tests__/theme.test.js +0 -17
  40. package/src/components/__tests__/AltDialog.test.jsx +0 -147
  41. package/src/components/__tests__/CharacterPicker.test.jsx +0 -270
  42. package/src/components/__tests__/CssIcon.test.jsx +0 -46
  43. package/src/components/__tests__/DragInTheBlank.test.jsx +0 -255
  44. package/src/components/__tests__/ExplicitConstructedResponse.test.jsx +0 -209
  45. package/src/components/__tests__/ImageToolbar.test.jsx +0 -128
  46. package/src/components/__tests__/InlineDropdown.test.jsx +0 -557
  47. package/src/components/__tests__/InsertImageHandler.test.js +0 -161
  48. package/src/components/__tests__/MediaDialog.test.jsx +0 -293
  49. package/src/components/__tests__/MediaToolbar.test.jsx +0 -74
  50. package/src/components/__tests__/MediaWrapper.test.jsx +0 -81
  51. package/src/components/__tests__/MenuBar.test.jsx +0 -338
  52. package/src/components/__tests__/RespArea.test.jsx +0 -122
  53. package/src/components/__tests__/TableIcons.test.jsx +0 -149
  54. package/src/components/__tests__/TextAlign.test.jsx +0 -167
  55. package/src/components/__tests__/TiptapContainer.test.jsx +0 -138
  56. package/src/components/__tests__/characterUtils.test.js +0 -166
  57. package/src/components/__tests__/choice.test.jsx +0 -171
  58. package/src/components/__tests__/custom-popper.test.jsx +0 -82
  59. package/src/components/__tests__/done-button.test.jsx +0 -54
  60. package/src/components/__tests__/toolbar-buttons.test.jsx +0 -247
  61. package/src/components/respArea/DragInTheBlank/__tests__/choice.test.jsx +0 -72
  62. package/src/components/respArea/__tests__/MathTemplated.test.jsx +0 -210
  63. package/src/extensions/__tests__/css.test.js +0 -196
  64. package/src/extensions/__tests__/custom-toolbar-wrapper.test.jsx +0 -180
  65. package/src/extensions/__tests__/divNode.test.js +0 -87
  66. package/src/extensions/__tests__/ensure-empty-root-div.test.js +0 -57
  67. package/src/extensions/__tests__/ensure-list-item-content-is-div.test.js +0 -44
  68. package/src/extensions/__tests__/extended-list-item.test.js +0 -13
  69. package/src/extensions/__tests__/extended-table-cell.test.js +0 -22
  70. package/src/extensions/__tests__/extended-table.test.js +0 -183
  71. package/src/extensions/__tests__/image-component.test.jsx +0 -346
  72. package/src/extensions/__tests__/image.test.js +0 -237
  73. package/src/extensions/__tests__/math.test.js +0 -898
  74. package/src/extensions/__tests__/media-node-view.test.jsx +0 -298
  75. package/src/extensions/__tests__/media.test.js +0 -271
  76. package/src/extensions/__tests__/responseArea.test.js +0 -655
  77. package/src/utils/__tests__/helper.test.js +0 -126
  78. package/src/utils/__tests__/toolbar.test.js +0 -43
@@ -1,338 +0,0 @@
1
- import React from 'react';
2
- import { fireEvent, render } from '@testing-library/react';
3
- import StyledMenuBar from '../MenuBar';
4
-
5
- // flipped to false by the accessibility tests to render the toolbar in its disabled state
6
- let mockCanRunCommands = true;
7
- // node/mark types the accessibility tests want the editor state to report as active
8
- let mockActiveTypes = [];
9
-
10
- jest.mock('@tiptap/react', () => ({
11
- EditorContent: ({ editor }) => <div data-testid="editor-content" />,
12
- useEditorState: ({ selector }) => {
13
- const can = () => ({ run: jest.fn(() => mockCanRunCommands) });
14
- const mockEditor = {
15
- isActive: jest.fn((name) => mockActiveTypes.includes(name)),
16
- can: jest.fn(() => ({
17
- chain: jest.fn(() => ({
18
- toggleBold: can,
19
- insertTable: can,
20
- toggleItalic: can,
21
- toggleStrike: can,
22
- toggleCode: can,
23
- unsetAllMarks: can,
24
- undo: can,
25
- redo: can,
26
- })),
27
- })),
28
- getAttributes: jest.fn(() => ({ border: '1' })),
29
- commandManager: {},
30
- isFocused: true,
31
- state: {
32
- selection: {},
33
- },
34
- };
35
-
36
- return selector({ editor: mockEditor });
37
- },
38
- }));
39
-
40
- jest.mock('prosemirror-state', () => ({
41
- NodeSelection: jest.fn(),
42
- }));
43
-
44
- jest.mock('../CharacterPicker', () => ({
45
- CharacterIcon: ({ letter }) => <div data-testid="character-icon">{letter}</div>,
46
- CharacterPicker: ({ onClose }) => (
47
- <div data-testid="character-picker">
48
- <button onClick={onClose} data-testid="close-picker">
49
- Close
50
- </button>
51
- </div>
52
- ),
53
- }));
54
-
55
- jest.mock('../common/done-button', () => ({
56
- DoneButton: ({ onClick }) => (
57
- <button onClick={onClick} data-testid="done-button">
58
- Done
59
- </button>
60
- ),
61
- }));
62
-
63
- describe('StyledMenuBar', () => {
64
- const mockEditor = {
65
- chain: jest.fn(() => ({
66
- focus: jest.fn(() => ({
67
- insertTable: jest.fn(() => ({ run: jest.fn() })),
68
- toggleBold: jest.fn(() => ({ run: jest.fn() })),
69
- toggleItalic: jest.fn(() => ({ run: jest.fn() })),
70
- toggleStrike: jest.fn(() => ({ run: jest.fn() })),
71
- toggleCode: jest.fn(() => ({ run: jest.fn() })),
72
- toggleUnderline: jest.fn(() => ({ run: jest.fn() })),
73
- toggleSubscript: jest.fn(() => ({ run: jest.fn() })),
74
- toggleSuperscript: jest.fn(() => ({ run: jest.fn() })),
75
- setImageUploadNode: jest.fn(() => ({ run: jest.fn() })),
76
- insertMedia: jest.fn(() => ({ run: jest.fn() })),
77
- toggleHeading: jest.fn(() => ({ run: jest.fn() })),
78
- insertMath: jest.fn(() => ({ run: jest.fn() })),
79
- toggleBulletList: jest.fn(() => ({ run: jest.fn() })),
80
- toggleOrderedList: jest.fn(() => ({ run: jest.fn() })),
81
- undo: jest.fn(() => ({ run: jest.fn() })),
82
- redo: jest.fn(() => ({ run: jest.fn() })),
83
- addRowAfter: jest.fn(() => ({ run: jest.fn() })),
84
- deleteRow: jest.fn(() => ({ run: jest.fn() })),
85
- addColumnAfter: jest.fn(() => ({ run: jest.fn() })),
86
- deleteColumn: jest.fn(() => ({ run: jest.fn() })),
87
- deleteTable: jest.fn(() => ({ run: jest.fn() })),
88
- insertResponseArea: jest.fn(() => ({ run: jest.fn() })),
89
- })),
90
- })),
91
- can: jest.fn(() => ({
92
- chain: jest.fn(() => ({
93
- toggleBold: jest.fn(() => ({ run: jest.fn(() => true) })),
94
- insertTable: jest.fn(() => ({ run: jest.fn(() => true) })),
95
- undo: jest.fn(() => ({ run: jest.fn(() => true) })),
96
- redo: jest.fn(() => ({ run: jest.fn(() => true) })),
97
- })),
98
- })),
99
- isActive: jest.fn((name) => {
100
- if (name === 'bold') return true;
101
- if (name === 'italic') return false;
102
- return false;
103
- }),
104
- getAttributes: jest.fn(() => ({ border: '1' })),
105
- getHTML: jest.fn(() => '<p>Test</p>'),
106
- commands: {
107
- blur: jest.fn(),
108
- openCSSClassDialog: jest.fn(),
109
- updateAttributes: jest.fn(),
110
- },
111
- isFocused: true,
112
- state: {
113
- selection: {},
114
- },
115
- _toolbarOpened: false,
116
- };
117
-
118
- const defaultProps = {
119
- editor: mockEditor,
120
- activePlugins: ['bold', 'italic', 'underline', 'table'],
121
- toolbarOpts: {},
122
- responseAreaProps: { type: 'explicit-constructed-response' },
123
- };
124
-
125
- beforeEach(() => {
126
- jest.clearAllMocks();
127
- });
128
-
129
- it('renders without crashing', () => {
130
- const { container } = render(<StyledMenuBar {...defaultProps} />);
131
- expect(container).toBeInTheDocument();
132
- });
133
-
134
- it('renders toolbar with buttons', () => {
135
- const { container } = render(<StyledMenuBar {...defaultProps} />);
136
- const buttons = container.querySelectorAll('button');
137
- expect(buttons.length).toBeGreaterThan(0);
138
- });
139
-
140
- it('shows bold button when bold plugin is active', () => {
141
- const { container } = render(<StyledMenuBar {...defaultProps} />);
142
- expect(container).toBeInTheDocument();
143
- });
144
-
145
- it('hides buttons when isTable is true', () => {
146
- const { container } = render(<StyledMenuBar {...defaultProps} activePlugins={['table']} />);
147
- expect(container).toBeInTheDocument();
148
- });
149
-
150
- it('shows table buttons when in table context', () => {
151
- const { container } = render(<StyledMenuBar {...defaultProps} activePlugins={['table']} />);
152
- expect(container).toBeInTheDocument();
153
- });
154
-
155
- it('handles button clicks', () => {
156
- const { container } = render(<StyledMenuBar {...defaultProps} />);
157
- const button = container.querySelector('button');
158
- if (button) {
159
- fireEvent.click(button);
160
- }
161
- expect(container).toBeInTheDocument();
162
- });
163
-
164
- it('shows done button when toolbarOpts.showDone is true', () => {
165
- const { getByTestId } = render(
166
- <StyledMenuBar {...defaultProps} toolbarOpts={{ showDone: true }} onChange={jest.fn()} />,
167
- );
168
- expect(getByTestId('done-button')).toBeInTheDocument();
169
- });
170
-
171
- it('does not show done button when toolbarOpts.showDone is false', () => {
172
- const { queryByTestId } = render(<StyledMenuBar {...defaultProps} toolbarOpts={{ showDone: false }} />);
173
- expect(queryByTestId('done-button')).not.toBeInTheDocument();
174
- });
175
-
176
- it('handles done button click', () => {
177
- const onChange = jest.fn();
178
- const { getByTestId } = render(
179
- <StyledMenuBar {...defaultProps} toolbarOpts={{ showDone: true }} onChange={onChange} />,
180
- );
181
- fireEvent.click(getByTestId('done-button'));
182
- expect(onChange).toHaveBeenCalledWith('<p>Test</p>');
183
- expect(mockEditor.commands.blur).toHaveBeenCalled();
184
- });
185
-
186
- it('applies custom minWidth from toolbarOpts', () => {
187
- const { container } = render(<StyledMenuBar {...defaultProps} toolbarOpts={{ minWidth: 500 }} />);
188
- const toolbar = container.querySelector('.toolbar');
189
- expect(toolbar).toHaveStyle({ minWidth: '500px' });
190
- });
191
-
192
- it('applies hidden class when toolbarOpts.isHidden is true', () => {
193
- const { container } = render(<StyledMenuBar {...defaultProps} toolbarOpts={{ isHidden: true }} />);
194
- const toolbar = container.querySelector('.toolbar');
195
- expect(toolbar).toHaveClass('hidden');
196
- });
197
-
198
- it('shows character picker when language character button is clicked', () => {
199
- const { container, queryByTestId } = render(
200
- <StyledMenuBar {...defaultProps} activePlugins={['languageCharacters']} />,
201
- );
202
- expect(queryByTestId('character-picker')).not.toBeInTheDocument();
203
- });
204
-
205
- it('applies focused class when editor is focused', () => {
206
- const { container } = render(<StyledMenuBar {...defaultProps} toolbarOpts={{ alwaysVisible: false }} />);
207
- const toolbar = container.querySelector('.toolbar');
208
- expect(toolbar).toHaveClass('focused');
209
- });
210
-
211
- it('shows response area button when responseArea plugin is active', () => {
212
- const { container } = render(<StyledMenuBar {...defaultProps} activePlugins={['responseArea']} />);
213
- expect(container).toBeInTheDocument();
214
- });
215
-
216
- it('prevents default on mouse down', () => {
217
- const { container } = render(<StyledMenuBar {...defaultProps} />);
218
- const toolbar = container.querySelector('.toolbar');
219
- const event = new MouseEvent('mousedown', { bubbles: true, cancelable: true });
220
- const preventDefaultSpy = jest.spyOn(event, 'preventDefault');
221
- toolbar?.dispatchEvent(event);
222
- expect(preventDefaultSpy).toHaveBeenCalled();
223
- });
224
-
225
- it('calculates hasTextSelectionInTable correctly when selection is not empty in table', () => {
226
- // This test verifies the hasTextSelectionInTable state computation
227
- const { container } = render(<StyledMenuBar {...defaultProps} activePlugins={['table', 'bold', 'italic']} />);
228
- expect(container).toBeInTheDocument();
229
- });
230
-
231
- it('hides table manipulation buttons when text is selected in table', () => {
232
- // When hasTextSelectionInTable is true, table row/column buttons should be hidden
233
- const { container } = render(<StyledMenuBar {...defaultProps} activePlugins={['table']} />);
234
- // The component should render but table manipulation buttons should be conditional
235
- expect(container).toBeInTheDocument();
236
- });
237
-
238
- it('shows table manipulation buttons when no text is selected in table', () => {
239
- // When hasTextSelectionInTable is false, table row/column buttons should be visible
240
- const { container } = render(<StyledMenuBar {...defaultProps} activePlugins={['table']} />);
241
- expect(container).toBeInTheDocument();
242
- });
243
-
244
- it('shows text formatting buttons regardless of table state', () => {
245
- // Bold, italic, etc. should always be visible when their plugin is active
246
- const { container } = render(<StyledMenuBar {...defaultProps} activePlugins={['bold', 'italic', 'underline']} />);
247
- const buttons = container.querySelectorAll('button');
248
- expect(buttons.length).toBeGreaterThan(0);
249
- });
250
-
251
- it('does not hide text formatting buttons when in table', () => {
252
- // Verify that the removal of "|| state.isTable" condition works correctly
253
- const { container } = render(<StyledMenuBar {...defaultProps} activePlugins={['table', 'bold', 'italic']} />);
254
- expect(container).toBeInTheDocument();
255
- });
256
- describe('accessible names', () => {
257
- const allPlugins = [
258
- 'table',
259
- 'bold',
260
- 'italic',
261
- 'strikethrough',
262
- 'code',
263
- 'underline',
264
- 'subscript',
265
- 'superscript',
266
- 'image',
267
- 'video',
268
- 'audio',
269
- 'css',
270
- 'blockquote',
271
- 'h3',
272
- 'math',
273
- 'languageCharacters',
274
- 'bulleted-list',
275
- 'numbered-list',
276
- 'undo',
277
- 'redo',
278
- 'responseArea',
279
- ];
280
-
281
- const accessibleName = (button) => button.getAttribute('aria-label') || button.textContent.trim();
282
-
283
- afterEach(() => {
284
- mockCanRunCommands = true;
285
- mockActiveTypes = [];
286
- });
287
-
288
- it('gives every toolbar button an accessible name', () => {
289
- const { container } = render(<StyledMenuBar {...defaultProps} activePlugins={allPlugins} />);
290
- const buttons = Array.from(container.querySelectorAll('button'));
291
-
292
- expect(buttons.length).toBeGreaterThan(0);
293
- buttons.forEach((button) => expect(accessibleName(button)).not.toEqual(''));
294
- });
295
-
296
- it('keeps accessible names on disabled buttons', () => {
297
- mockCanRunCommands = false;
298
-
299
- const { container } = render(<StyledMenuBar {...defaultProps} activePlugins={allPlugins} />);
300
- const disabled = Array.from(container.querySelectorAll('button[disabled]'));
301
-
302
- expect(disabled.length).toBeGreaterThan(0);
303
- disabled.forEach((button) => expect(accessibleName(button)).not.toEqual(''));
304
- });
305
-
306
- it('labels the formatting and history buttons', () => {
307
- const { getByLabelText } = render(<StyledMenuBar {...defaultProps} activePlugins={allPlugins} />);
308
-
309
- ['Bold', 'Italic', 'Underline', 'Insert table', 'Undo', 'Redo'].forEach((label) =>
310
- expect(getByLabelText(label)).toBeInTheDocument(),
311
- );
312
- });
313
-
314
- it('labels the table buttons', () => {
315
- mockActiveTypes = ['table'];
316
-
317
- const { getByLabelText } = render(<StyledMenuBar {...defaultProps} activePlugins={allPlugins} />);
318
-
319
- ['Add table row', 'Remove table row', 'Add table column', 'Remove table column', 'Remove table'].forEach(
320
- (label) => expect(getByLabelText(label)).toBeInTheDocument(),
321
- );
322
- expect(getByLabelText('Table borders')).toHaveAttribute('aria-pressed', 'true');
323
- });
324
-
325
- it('labels the response area insert button', () => {
326
- const { getByLabelText } = render(<StyledMenuBar {...defaultProps} activePlugins={['responseArea']} />);
327
- expect(getByLabelText('Insert response area')).toBeInTheDocument();
328
- });
329
-
330
- it('exposes toggle state via aria-pressed on mark buttons', () => {
331
- const { getByLabelText } = render(<StyledMenuBar {...defaultProps} activePlugins={allPlugins} />);
332
-
333
- expect(getByLabelText('Bold')).toHaveAttribute('aria-pressed', 'false');
334
- // one-shot actions are not toggles, so they must not report a pressed state
335
- expect(getByLabelText('Undo')).not.toHaveAttribute('aria-pressed');
336
- });
337
- });
338
- });
@@ -1,122 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import { Chevron, GripIcon, ToolbarIcon } from '../icons/RespArea';
4
-
5
- describe('Chevron', () => {
6
- it('renders without crashing', () => {
7
- const { container } = render(<Chevron />);
8
- expect(container).toBeInTheDocument();
9
- });
10
-
11
- it('rotates 0 degrees for right direction (default)', () => {
12
- const { container } = render(<Chevron direction="right" />);
13
- const svg = container.querySelector('svg');
14
- expect(svg).toHaveStyle({ transform: 'rotate(0deg)' });
15
- });
16
-
17
- it('rotates 90 degrees for down direction', () => {
18
- const { container } = render(<Chevron direction="down" />);
19
- const svg = container.querySelector('svg');
20
- expect(svg).toHaveStyle({ transform: 'rotate(90deg)' });
21
- });
22
-
23
- it('rotates -90 degrees for up direction', () => {
24
- const { container } = render(<Chevron direction="up" />);
25
- const svg = container.querySelector('svg');
26
- expect(svg).toHaveStyle({ transform: 'rotate(-90deg)' });
27
- });
28
-
29
- it('rotates 180 degrees for left direction', () => {
30
- const { container } = render(<Chevron direction="left" />);
31
- const svg = container.querySelector('svg');
32
- expect(svg).toHaveStyle({ transform: 'rotate(180deg)' });
33
- });
34
-
35
- it('applies custom style prop', () => {
36
- const customStyle = { color: 'red', fontSize: '20px' };
37
- const { container } = render(<Chevron style={customStyle} />);
38
- const svg = container.querySelector('svg');
39
- expect(svg).toHaveStyle({ color: 'red', fontSize: '20px' });
40
- });
41
-
42
- it('defaults to 0 rotation when no direction specified', () => {
43
- const { container } = render(<Chevron />);
44
- const svg = container.querySelector('svg');
45
- expect(svg).toHaveStyle({ transform: 'rotate(0deg)' });
46
- });
47
- });
48
-
49
- describe('GripIcon', () => {
50
- it('renders without crashing', () => {
51
- const { container } = render(<GripIcon />);
52
- expect(container).toBeInTheDocument();
53
- });
54
-
55
- it('renders two MoreVert icons', () => {
56
- const { container } = render(<GripIcon />);
57
- const moreVertIcons = container.querySelectorAll('svg');
58
- expect(moreVertIcons.length).toBe(2);
59
- });
60
-
61
- it('applies custom style prop', () => {
62
- const customStyle = { color: 'blue' };
63
- const { container } = render(<GripIcon style={customStyle} />);
64
- const span = container.querySelector('span');
65
- expect(span).toHaveStyle({ color: 'blue' });
66
- });
67
-
68
- it('applies negative margin to first icon', () => {
69
- const { container } = render(<GripIcon />);
70
- const firstIcon = container.querySelector('svg');
71
- expect(firstIcon).toHaveStyle({ margin: '0 -16px' });
72
- });
73
- });
74
-
75
- describe('ToolbarIcon', () => {
76
- it('renders without crashing', () => {
77
- const { container } = render(<ToolbarIcon />);
78
- expect(container).toBeInTheDocument();
79
- });
80
-
81
- it('renders "+ Response Area" text', () => {
82
- const { getByText } = render(<ToolbarIcon />);
83
- expect(getByText('+ Response Area')).toBeInTheDocument();
84
- });
85
-
86
- it('applies correct font family', () => {
87
- const { getByText } = render(<ToolbarIcon />);
88
- const element = getByText('+ Response Area');
89
- // Font family is applied via styled component, just verify text renders
90
- expect(element).toBeInTheDocument();
91
- });
92
-
93
- it('applies bold font weight', () => {
94
- const { getByText } = render(<ToolbarIcon />);
95
- const element = getByText('+ Response Area');
96
- expect(element).toHaveStyle({ fontWeight: 'bold' });
97
- });
98
-
99
- it('has correct dimensions', () => {
100
- const { getByText } = render(<ToolbarIcon />);
101
- const element = getByText('+ Response Area');
102
- expect(element).toHaveStyle({ width: '110px', height: '28px' });
103
- });
104
-
105
- it('has relative positioning', () => {
106
- const { getByText } = render(<ToolbarIcon />);
107
- const element = getByText('+ Response Area');
108
- expect(element).toHaveStyle({ position: 'relative' });
109
- });
110
-
111
- it('has nowrap white space', () => {
112
- const { getByText } = render(<ToolbarIcon />);
113
- const element = getByText('+ Response Area');
114
- expect(element).toHaveStyle({ whiteSpace: 'nowrap' });
115
- });
116
-
117
- it('has top offset', () => {
118
- const { getByText } = render(<ToolbarIcon />);
119
- const element = getByText('+ Response Area');
120
- expect(element).toHaveStyle({ top: '7px' });
121
- });
122
- });
@@ -1,149 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import { AddColumn, AddRow, RemoveColumn, RemoveRow, RemoveTable } from '../icons/TableIcons';
4
-
5
- describe('AddRow', () => {
6
- it('renders without crashing', () => {
7
- const { container } = render(<AddRow />);
8
- expect(container).toBeInTheDocument();
9
- });
10
-
11
- it('renders SVG', () => {
12
- const { container } = render(<AddRow />);
13
- const svg = container.querySelector('svg');
14
- expect(svg).toBeInTheDocument();
15
- });
16
-
17
- it('has correct viewBox', () => {
18
- const { container } = render(<AddRow />);
19
- const svg = container.querySelector('svg');
20
- expect(svg).toHaveAttribute('viewBox', '0 0 24 24');
21
- });
22
-
23
- it('has correct dimensions', () => {
24
- const { container } = render(<AddRow />);
25
- const svg = container.querySelector('svg');
26
- expect(svg).toHaveAttribute('width', '24');
27
- expect(svg).toHaveAttribute('height', '24');
28
- });
29
-
30
- it('contains path element', () => {
31
- const { container } = render(<AddRow />);
32
- const path = container.querySelector('path');
33
- expect(path).toBeInTheDocument();
34
- });
35
- });
36
-
37
- describe('RemoveRow', () => {
38
- it('renders without crashing', () => {
39
- const { container } = render(<RemoveRow />);
40
- expect(container).toBeInTheDocument();
41
- });
42
-
43
- it('renders SVG', () => {
44
- const { container } = render(<RemoveRow />);
45
- const svg = container.querySelector('svg');
46
- expect(svg).toBeInTheDocument();
47
- });
48
-
49
- it('has correct viewBox', () => {
50
- const { container } = render(<RemoveRow />);
51
- const svg = container.querySelector('svg');
52
- expect(svg).toHaveAttribute('viewBox', '0 0 24 24');
53
- });
54
-
55
- it('contains path element', () => {
56
- const { container } = render(<RemoveRow />);
57
- const path = container.querySelector('path');
58
- expect(path).toBeInTheDocument();
59
- });
60
- });
61
-
62
- describe('AddColumn', () => {
63
- it('renders without crashing', () => {
64
- const { container } = render(<AddColumn />);
65
- expect(container).toBeInTheDocument();
66
- });
67
-
68
- it('renders SVG', () => {
69
- const { container } = render(<AddColumn />);
70
- const svg = container.querySelector('svg');
71
- expect(svg).toBeInTheDocument();
72
- });
73
-
74
- it('has correct viewBox', () => {
75
- const { container } = render(<AddColumn />);
76
- const svg = container.querySelector('svg');
77
- expect(svg).toHaveAttribute('viewBox', '0 0 24 24');
78
- });
79
-
80
- it('has correct dimensions', () => {
81
- const { container } = render(<AddColumn />);
82
- const svg = container.querySelector('svg');
83
- expect(svg).toHaveAttribute('width', '24');
84
- expect(svg).toHaveAttribute('height', '24');
85
- });
86
-
87
- it('contains path element', () => {
88
- const { container } = render(<AddColumn />);
89
- const path = container.querySelector('path');
90
- expect(path).toBeInTheDocument();
91
- });
92
- });
93
-
94
- describe('RemoveColumn', () => {
95
- it('renders without crashing', () => {
96
- const { container } = render(<RemoveColumn />);
97
- expect(container).toBeInTheDocument();
98
- });
99
-
100
- it('renders SVG', () => {
101
- const { container } = render(<RemoveColumn />);
102
- const svg = container.querySelector('svg');
103
- expect(svg).toBeInTheDocument();
104
- });
105
-
106
- it('has correct viewBox', () => {
107
- const { container } = render(<RemoveColumn />);
108
- const svg = container.querySelector('svg');
109
- expect(svg).toHaveAttribute('viewBox', '0 0 24 24');
110
- });
111
-
112
- it('contains path element', () => {
113
- const { container } = render(<RemoveColumn />);
114
- const path = container.querySelector('path');
115
- expect(path).toBeInTheDocument();
116
- });
117
- });
118
-
119
- describe('RemoveTable', () => {
120
- it('renders without crashing', () => {
121
- const { container } = render(<RemoveTable />);
122
- expect(container).toBeInTheDocument();
123
- });
124
-
125
- it('renders SVG', () => {
126
- const { container } = render(<RemoveTable />);
127
- const svg = container.querySelector('svg');
128
- expect(svg).toBeInTheDocument();
129
- });
130
-
131
- it('has correct viewBox', () => {
132
- const { container } = render(<RemoveTable />);
133
- const svg = container.querySelector('svg');
134
- expect(svg).toHaveAttribute('viewBox', '0 0 24 24');
135
- });
136
-
137
- it('has correct dimensions', () => {
138
- const { container } = render(<RemoveTable />);
139
- const svg = container.querySelector('svg');
140
- expect(svg).toHaveAttribute('width', '24');
141
- expect(svg).toHaveAttribute('height', '24');
142
- });
143
-
144
- it('contains path element', () => {
145
- const { container } = render(<RemoveTable />);
146
- const path = container.querySelector('path');
147
- expect(path).toBeInTheDocument();
148
- });
149
- });