@patternfly/react-code-editor 5.2.0-prerelease.9 → 5.2.1
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.
- package/CHANGELOG.md +180 -0
- package/README.md +20 -24
- package/dist/esm/components/CodeEditor/CodeEditor.d.ts +5 -1
- package/dist/esm/components/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/dist/esm/components/CodeEditor/CodeEditor.js +5 -5
- package/dist/esm/components/CodeEditor/CodeEditor.js.map +1 -1
- package/dist/js/components/CodeEditor/CodeEditor.d.ts +5 -1
- package/dist/js/components/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/dist/js/components/CodeEditor/CodeEditor.js +3 -3
- package/dist/js/components/CodeEditor/CodeEditor.js.map +1 -1
- package/package.json +7 -7
- package/src/components/CodeEditor/CodeEditor.tsx +11 -4
- package/src/components/CodeEditor/__test__/CodeEditor.test.tsx +72 -39
- package/src/components/CodeEditor/__test__/CodeEditorControl.test.tsx +18 -0
- package/src/components/CodeEditor/__test__/__snapshots__/CodeEditor.test.tsx.snap +7 -440
- package/src/components/CodeEditor/__test__/__snapshots__/CodeEditorControl.test.tsx.snap +22 -0
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
TooltipPosition,
|
|
18
18
|
EmptyStateHeader
|
|
19
19
|
} from '@patternfly/react-core';
|
|
20
|
-
import
|
|
20
|
+
import Editor, { EditorProps, Monaco } from '@monaco-editor/react';
|
|
21
21
|
import { editor } from 'monaco-editor/esm/vs/editor/editor.api';
|
|
22
22
|
import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
|
|
23
23
|
import UploadIcon from '@patternfly/react-icons/dist/esm/icons/upload-icon';
|
|
@@ -28,6 +28,9 @@ import Dropzone, { FileRejection } from 'react-dropzone';
|
|
|
28
28
|
import { CodeEditorContext } from './CodeEditorUtils';
|
|
29
29
|
import { CodeEditorControl } from './CodeEditorControl';
|
|
30
30
|
|
|
31
|
+
export type ChangeHandler = (value: string, event: editor.IModelContentChangedEvent) => void;
|
|
32
|
+
export type EditorDidMount = (editor: editor.IStandaloneCodeEditor, monaco: Monaco) => void;
|
|
33
|
+
|
|
31
34
|
export interface Shortcut {
|
|
32
35
|
description: string;
|
|
33
36
|
keys: string[];
|
|
@@ -134,6 +137,8 @@ export interface CodeEditorProps extends Omit<React.HTMLProps<HTMLDivElement>, '
|
|
|
134
137
|
downloadButtonToolTipText?: string;
|
|
135
138
|
/** Name of the file if user downloads code to local file. */
|
|
136
139
|
downloadFileName?: string;
|
|
140
|
+
/** Additional props to pass to the monaco editor. */
|
|
141
|
+
editorProps?: EditorProps;
|
|
137
142
|
/** Content to display in space of the code editor when there is no code to display. */
|
|
138
143
|
emptyState?: React.ReactNode;
|
|
139
144
|
/** Override default empty state body text. */
|
|
@@ -496,7 +501,8 @@ class CodeEditor extends React.Component<CodeEditorProps, CodeEditorState> {
|
|
|
496
501
|
shortcutsPopoverProps: shortcutsPopoverPropsProp,
|
|
497
502
|
showEditor,
|
|
498
503
|
options: optionsProp,
|
|
499
|
-
overrideServices
|
|
504
|
+
overrideServices,
|
|
505
|
+
editorProps
|
|
500
506
|
} = this.props;
|
|
501
507
|
const shortcutsPopoverProps: PopoverProps = {
|
|
502
508
|
...CodeEditor.defaultProps.shortcutsPopoverProps,
|
|
@@ -631,7 +637,7 @@ class CodeEditor extends React.Component<CodeEditorProps, CodeEditorState> {
|
|
|
631
637
|
|
|
632
638
|
const editor = (
|
|
633
639
|
<div className={css(styles.codeEditorCode)} ref={this.wrapperRef} tabIndex={0} dir="ltr">
|
|
634
|
-
<
|
|
640
|
+
<Editor
|
|
635
641
|
height={height}
|
|
636
642
|
width={width}
|
|
637
643
|
language={language}
|
|
@@ -639,8 +645,9 @@ class CodeEditor extends React.Component<CodeEditorProps, CodeEditorState> {
|
|
|
639
645
|
options={options}
|
|
640
646
|
overrideServices={overrideServices}
|
|
641
647
|
onChange={this.onChange}
|
|
642
|
-
|
|
648
|
+
onMount={this.editorDidMount}
|
|
643
649
|
theme={isDarkTheme ? 'vs-dark' : 'vs-light'}
|
|
650
|
+
{...editorProps}
|
|
644
651
|
/>
|
|
645
652
|
</div>
|
|
646
653
|
);
|
|
@@ -1,46 +1,79 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen, act } from '@testing-library/react';
|
|
3
3
|
import { CodeEditor, Language } from '../CodeEditor';
|
|
4
|
+
import styles from '@patternfly/react-styles/css/components/CodeEditor/code-editor';
|
|
5
|
+
import fileUploadStyles from '@patternfly/react-styles/css/components/FileUpload/file-upload';
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
writable: true,
|
|
7
|
-
value: jest.fn().mockImplementation((query) => ({
|
|
8
|
-
matches: false,
|
|
9
|
-
media: query,
|
|
10
|
-
onchange: null,
|
|
11
|
-
addListener: jest.fn(), // Deprecated
|
|
12
|
-
removeListener: jest.fn(), // Deprecated
|
|
13
|
-
addEventListener: jest.fn(),
|
|
14
|
-
removeEventListener: jest.fn(),
|
|
15
|
-
dispatchEvent: jest.fn()
|
|
16
|
-
}))
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
describe('CodeEditor', () => {
|
|
20
|
-
beforeAll(() => {
|
|
21
|
-
window.HTMLCanvasElement.prototype.getContext = () => ({}) as any;
|
|
22
|
-
});
|
|
7
|
+
jest.mock('@monaco-editor/react', () => jest.fn(() => <div data-testid="mock-editor"></div>));
|
|
23
8
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
test('Matches snapshot without props', () => {
|
|
10
|
+
const { asFragment } = render(<CodeEditor code="test" />);
|
|
11
|
+
expect(asFragment()).toMatchSnapshot();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Matches snapshot with control buttons enabled', () => {
|
|
15
|
+
const { asFragment } = render(<CodeEditor isUploadEnabled isDownloadEnabled isCopyEnabled code="test" />);
|
|
16
|
+
expect(asFragment()).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test(`Renders with default classes ${styles.codeEditor}, ${styles.codeEditorMain}, ${styles.codeEditorCode}`, () => {
|
|
20
|
+
render(<CodeEditor />);
|
|
21
|
+
expect(screen.getByTestId('mock-editor').parentElement).toHaveClass(styles.codeEditorCode);
|
|
22
|
+
expect(screen.getByTestId('mock-editor').parentElement?.parentElement).toHaveClass(styles.codeEditorMain);
|
|
23
|
+
expect(screen.getByTestId('mock-editor').parentElement?.parentElement?.parentElement).toHaveClass(styles.codeEditor);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('Renders custom class when className is passed', () => {
|
|
27
|
+
render(<CodeEditor className="custom" />);
|
|
28
|
+
expect(screen.getByTestId('mock-editor').parentElement?.parentElement?.parentElement).toHaveClass('custom');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test(`Renders with ${styles.modifiers.readOnly} when isReadOnly = true`, () => {
|
|
32
|
+
render(<CodeEditor isReadOnly />);
|
|
33
|
+
expect(screen.getByTestId('mock-editor').parentElement?.parentElement?.parentElement).toHaveClass(
|
|
34
|
+
styles.modifiers.readOnly
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test(`Renders with ${fileUploadStyles.fileUpload} when isUploadEnabled = true`, () => {
|
|
39
|
+
render(<CodeEditor isUploadEnabled code="test" />);
|
|
40
|
+
expect(screen.getByTestId('mock-editor').parentElement?.parentElement?.parentElement).toHaveClass(
|
|
41
|
+
fileUploadStyles.fileUpload
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test(`Renders with empty state when code = undefined`, () => {
|
|
46
|
+
render(<CodeEditor emptyState={<div>empty</div>} />);
|
|
47
|
+
expect(screen.getByText('empty')).toBeInTheDocument();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test(`Renders with empty state when isUploadEnabled = true and code = undefined`, () => {
|
|
51
|
+
render(<CodeEditor emptyState={<div>empty</div>} isUploadEnabled />);
|
|
52
|
+
expect(screen.getByText('empty')).toBeInTheDocument();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test(`Renders with language label when isLanguageLabelVisible`, () => {
|
|
56
|
+
render(<CodeEditor isLanguageLabelVisible language={Language.java} />);
|
|
57
|
+
expect(screen.getByText('JAVA')).toBeInTheDocument();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test(`Renders with custom controls when customControls is passed`, () => {
|
|
61
|
+
render(<CodeEditor customControls={<div>control</div>} />);
|
|
62
|
+
expect(screen.getByText('control')).toBeInTheDocument();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test(`Renders with custom header content when headerMainContent is passed`, () => {
|
|
66
|
+
render(<CodeEditor headerMainContent="header content" />);
|
|
67
|
+
expect(screen.getByText('header content')).toBeInTheDocument();
|
|
68
|
+
});
|
|
28
69
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
isLanguageLabelVisible
|
|
37
|
-
isDownloadEnabled
|
|
38
|
-
isCopyEnabled
|
|
39
|
-
height="400px"
|
|
40
|
-
code={'test'}
|
|
41
|
-
language={Language.javascript}
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
expect(asFragment()).toMatchSnapshot();
|
|
70
|
+
test(`Renders with shortcuts when shortcutsPopoverButtonText is passed`, () => {
|
|
71
|
+
render(
|
|
72
|
+
<CodeEditor shortcutsPopoverButtonText="shortcuts-button" shortcutsPopoverProps={{ bodyContent: 'shortcuts' }} />
|
|
73
|
+
);
|
|
74
|
+
expect(screen.getByText('shortcuts-button')).toBeInTheDocument();
|
|
75
|
+
act(() => {
|
|
76
|
+
screen.getByText('shortcuts-button').click();
|
|
45
77
|
});
|
|
78
|
+
expect(screen.getByText('shortcuts')).toBeInTheDocument();
|
|
46
79
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { CodeEditorControl } from '../CodeEditorControl';
|
|
4
|
+
|
|
5
|
+
test('Matches snapshot', () => {
|
|
6
|
+
const { asFragment } = render(<CodeEditorControl icon={<div>icon</div>} onClick={jest.fn()} />);
|
|
7
|
+
expect(asFragment()).toMatchSnapshot();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
test('Renders with custom class when className is passed', () => {
|
|
11
|
+
render(<CodeEditorControl className="custom" icon={<div>icon</div>} onClick={jest.fn()} />);
|
|
12
|
+
expect(screen.getByText('icon').parentElement).toHaveClass('custom');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('Renders with accessible name when aria-label is passed', () => {
|
|
16
|
+
render(<CodeEditorControl aria-label="aria-test" icon={<div>icon</div>} onClick={jest.fn()} />);
|
|
17
|
+
expect(screen.getByLabelText('aria-test'));
|
|
18
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Matches snapshot with control buttons enabled 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="pf-v5-c-code-editor
|
|
6
|
+
class="pf-v5-c-code-editor"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
9
|
class="pf-v5-c-file-upload false false"
|
|
@@ -101,32 +101,6 @@ exports[`CodeEditor matches snapshot with all props 1`] = `
|
|
|
101
101
|
<div
|
|
102
102
|
class="pf-v5-c-code-editor__header-main"
|
|
103
103
|
/>
|
|
104
|
-
<div
|
|
105
|
-
class="pf-v5-c-code-editor__tab"
|
|
106
|
-
>
|
|
107
|
-
<span
|
|
108
|
-
class="pf-v5-c-code-editor__tab-icon"
|
|
109
|
-
>
|
|
110
|
-
<svg
|
|
111
|
-
aria-hidden="true"
|
|
112
|
-
class="pf-v5-svg"
|
|
113
|
-
fill="currentColor"
|
|
114
|
-
height="1em"
|
|
115
|
-
role="img"
|
|
116
|
-
viewBox="0 0 640 512"
|
|
117
|
-
width="1em"
|
|
118
|
-
>
|
|
119
|
-
<path
|
|
120
|
-
d="M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"
|
|
121
|
-
/>
|
|
122
|
-
</svg>
|
|
123
|
-
</span>
|
|
124
|
-
<span
|
|
125
|
-
class="pf-v5-c-code-editor__tab-text"
|
|
126
|
-
>
|
|
127
|
-
JAVASCRIPT
|
|
128
|
-
</span>
|
|
129
|
-
</div>
|
|
130
104
|
</div>
|
|
131
105
|
<div
|
|
132
106
|
class="pf-v5-c-code-editor__main"
|
|
@@ -142,214 +116,8 @@ exports[`CodeEditor matches snapshot with all props 1`] = `
|
|
|
142
116
|
tabindex="0"
|
|
143
117
|
>
|
|
144
118
|
<div
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
data-mode-id="plaintext"
|
|
148
|
-
style="height: 400px;"
|
|
149
|
-
>
|
|
150
|
-
<div
|
|
151
|
-
class="monaco-editor showUnused showDeprecated vs-dark"
|
|
152
|
-
data-uri="inmemory://model/2"
|
|
153
|
-
style="width: 5px; height: 5px;"
|
|
154
|
-
>
|
|
155
|
-
<div
|
|
156
|
-
class="overflow-guard"
|
|
157
|
-
data-mprt="3"
|
|
158
|
-
style="width: 5px; height: 5px;"
|
|
159
|
-
>
|
|
160
|
-
<div
|
|
161
|
-
aria-hidden="true"
|
|
162
|
-
class="margin"
|
|
163
|
-
role="presentation"
|
|
164
|
-
style="position: absolute;"
|
|
165
|
-
>
|
|
166
|
-
<div
|
|
167
|
-
class="glyph-margin"
|
|
168
|
-
/>
|
|
169
|
-
<div
|
|
170
|
-
aria-hidden="true"
|
|
171
|
-
class="margin-view-zones"
|
|
172
|
-
role="presentation"
|
|
173
|
-
style="position: absolute;"
|
|
174
|
-
/>
|
|
175
|
-
<div
|
|
176
|
-
aria-hidden="true"
|
|
177
|
-
class="margin-view-overlays"
|
|
178
|
-
role="presentation"
|
|
179
|
-
style="position: absolute; width: 1px; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; font-feature-settings: \\"liga\\" off, \\"calt\\" off; line-height: 19px; letter-spacing: 0px;"
|
|
180
|
-
/>
|
|
181
|
-
</div>
|
|
182
|
-
<div
|
|
183
|
-
class="monaco-scrollable-element editor-scrollable vs-dark"
|
|
184
|
-
data-mprt="5"
|
|
185
|
-
role="presentation"
|
|
186
|
-
style="position: absolute; overflow: hidden; left: 26px; width: -21px; height: 5px;"
|
|
187
|
-
>
|
|
188
|
-
<div
|
|
189
|
-
class="lines-content monaco-editor-background"
|
|
190
|
-
style="position: absolute; overflow: hidden; width: 1000000px; height: 1000000px; transform: translate3d(0px, 0px, 0px); contain: strict; top: 0px; left: 0px;"
|
|
191
|
-
>
|
|
192
|
-
<div
|
|
193
|
-
aria-hidden="true"
|
|
194
|
-
class="view-overlays"
|
|
195
|
-
role="presentation"
|
|
196
|
-
style="position: absolute; height: 0px;"
|
|
197
|
-
/>
|
|
198
|
-
<div
|
|
199
|
-
aria-hidden="true"
|
|
200
|
-
class="view-rulers"
|
|
201
|
-
role="presentation"
|
|
202
|
-
/>
|
|
203
|
-
<div
|
|
204
|
-
aria-hidden="true"
|
|
205
|
-
class="blockDecorations-container"
|
|
206
|
-
role="presentation"
|
|
207
|
-
/>
|
|
208
|
-
<div
|
|
209
|
-
aria-hidden="true"
|
|
210
|
-
class="view-zones"
|
|
211
|
-
role="presentation"
|
|
212
|
-
style="position: absolute;"
|
|
213
|
-
/>
|
|
214
|
-
<div
|
|
215
|
-
aria-hidden="true"
|
|
216
|
-
class="view-lines monaco-mouse-cursor-text"
|
|
217
|
-
data-mprt="7"
|
|
218
|
-
role="presentation"
|
|
219
|
-
style="position: absolute; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; font-feature-settings: \\"liga\\" off, \\"calt\\" off; line-height: 19px; letter-spacing: 0px; width: 54px; height: 19px;"
|
|
220
|
-
>
|
|
221
|
-
<div
|
|
222
|
-
class="view-line"
|
|
223
|
-
style="top:0px;height:19px;"
|
|
224
|
-
>
|
|
225
|
-
<span>
|
|
226
|
-
<span
|
|
227
|
-
class="mtk1"
|
|
228
|
-
>
|
|
229
|
-
test
|
|
230
|
-
</span>
|
|
231
|
-
</span>
|
|
232
|
-
</div>
|
|
233
|
-
</div>
|
|
234
|
-
<div
|
|
235
|
-
class="contentWidgets"
|
|
236
|
-
data-mprt="1"
|
|
237
|
-
style="position: absolute; top: 0px;"
|
|
238
|
-
/>
|
|
239
|
-
<div
|
|
240
|
-
aria-hidden="true"
|
|
241
|
-
class="cursors-layer cursor-line-style cursor-solid"
|
|
242
|
-
role="presentation"
|
|
243
|
-
>
|
|
244
|
-
<div
|
|
245
|
-
class="cursor monaco-mouse-cursor-text"
|
|
246
|
-
style="height: 19px; top: 0px; left: 0px; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; font-feature-settings: \\"liga\\" off, \\"calt\\" off; line-height: 19px; letter-spacing: 0px; display: none; visibility: hidden;"
|
|
247
|
-
/>
|
|
248
|
-
</div>
|
|
249
|
-
</div>
|
|
250
|
-
<div
|
|
251
|
-
aria-hidden="true"
|
|
252
|
-
class="invisible scrollbar horizontal"
|
|
253
|
-
role="presentation"
|
|
254
|
-
style="position: absolute; width: 0px; height: 12px; left: 0px; bottom: 0px;"
|
|
255
|
-
>
|
|
256
|
-
<div
|
|
257
|
-
class="slider"
|
|
258
|
-
style="position: absolute; top: 0px; left: 0px; height: 12px; transform: translate3d(0px, 0px, 0px); contain: strict; width: 20px;"
|
|
259
|
-
/>
|
|
260
|
-
</div>
|
|
261
|
-
<canvas
|
|
262
|
-
aria-hidden="true"
|
|
263
|
-
class="decorationsOverviewRuler"
|
|
264
|
-
height="5"
|
|
265
|
-
style="position: absolute; transform: translate3d(0px, 0px, 0px); contain: strict; top: 0px; right: 0px; width: 14px; height: 5px; display: block;"
|
|
266
|
-
width="14"
|
|
267
|
-
/>
|
|
268
|
-
<div
|
|
269
|
-
aria-hidden="true"
|
|
270
|
-
class="invisible scrollbar vertical"
|
|
271
|
-
role="presentation"
|
|
272
|
-
style="position: absolute; width: 14px; height: 5px; right: 0px; top: 0px;"
|
|
273
|
-
>
|
|
274
|
-
<div
|
|
275
|
-
class="slider"
|
|
276
|
-
style="position: absolute; top: 0px; left: 0px; width: 14px; transform: translate3d(0px, 0px, 0px); contain: strict; height: 20px;"
|
|
277
|
-
/>
|
|
278
|
-
</div>
|
|
279
|
-
</div>
|
|
280
|
-
<div
|
|
281
|
-
aria-hidden="true"
|
|
282
|
-
role="presentation"
|
|
283
|
-
/>
|
|
284
|
-
<textarea
|
|
285
|
-
aria-autocomplete="both"
|
|
286
|
-
aria-haspopup="false"
|
|
287
|
-
aria-label="Editor content;Press Alt+F1 for Accessibility Options."
|
|
288
|
-
aria-multiline="true"
|
|
289
|
-
aria-roledescription="editor"
|
|
290
|
-
autocapitalize="off"
|
|
291
|
-
autocomplete="off"
|
|
292
|
-
autocorrect="off"
|
|
293
|
-
class="inputarea monaco-mouse-cursor-text"
|
|
294
|
-
data-mprt="6"
|
|
295
|
-
role="textbox"
|
|
296
|
-
spellcheck="false"
|
|
297
|
-
style="font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; font-feature-settings: \\"liga\\" off, \\"calt\\" off; line-height: 19px; letter-spacing: 0px; top: 0px; left: 0px; width: 1px; height: 1px;"
|
|
298
|
-
tabindex="-1"
|
|
299
|
-
wrap="off"
|
|
300
|
-
/>
|
|
301
|
-
<div
|
|
302
|
-
class="monaco-editor-background textAreaCover"
|
|
303
|
-
style="position: absolute; top: 0px; left: 0px; width: 1px; height: 1px;"
|
|
304
|
-
/>
|
|
305
|
-
<div
|
|
306
|
-
class="overlayWidgets"
|
|
307
|
-
data-mprt="4"
|
|
308
|
-
>
|
|
309
|
-
<div
|
|
310
|
-
style="position: absolute;"
|
|
311
|
-
widgetid="editor.contrib.quickInputWidget"
|
|
312
|
-
/>
|
|
313
|
-
</div>
|
|
314
|
-
<div
|
|
315
|
-
aria-hidden="true"
|
|
316
|
-
class="minimap slider-mouseover"
|
|
317
|
-
data-mprt="8"
|
|
318
|
-
role="presentation"
|
|
319
|
-
style="position: absolute; left: 0px; width: 0px; height: 5px;"
|
|
320
|
-
>
|
|
321
|
-
<div
|
|
322
|
-
class="minimap-shadow-hidden"
|
|
323
|
-
style="height: 5px;"
|
|
324
|
-
/>
|
|
325
|
-
<canvas
|
|
326
|
-
height="5"
|
|
327
|
-
style="position: absolute; left: 0px; width: 0px; height: 5px;"
|
|
328
|
-
width="0"
|
|
329
|
-
/>
|
|
330
|
-
<canvas
|
|
331
|
-
class="minimap-decorations-layer"
|
|
332
|
-
height="5"
|
|
333
|
-
style="position: absolute; left: 0px; width: 0px; height: 5px;"
|
|
334
|
-
width="0"
|
|
335
|
-
/>
|
|
336
|
-
<div
|
|
337
|
-
class="minimap-slider"
|
|
338
|
-
style="position: absolute; transform: translate3d(0px, 0px, 0px); contain: strict; width: 0px;"
|
|
339
|
-
>
|
|
340
|
-
<div
|
|
341
|
-
class="minimap-slider-horizontal"
|
|
342
|
-
style="position: absolute;"
|
|
343
|
-
/>
|
|
344
|
-
</div>
|
|
345
|
-
</div>
|
|
346
|
-
</div>
|
|
347
|
-
<div
|
|
348
|
-
class="overflowingContentWidgets"
|
|
349
|
-
data-mprt="2"
|
|
350
|
-
/>
|
|
351
|
-
</div>
|
|
352
|
-
</div>
|
|
119
|
+
data-testid="mock-editor"
|
|
120
|
+
/>
|
|
353
121
|
</div>
|
|
354
122
|
</div>
|
|
355
123
|
</div>
|
|
@@ -357,7 +125,7 @@ exports[`CodeEditor matches snapshot with all props 1`] = `
|
|
|
357
125
|
</DocumentFragment>
|
|
358
126
|
`;
|
|
359
127
|
|
|
360
|
-
exports[`
|
|
128
|
+
exports[`Matches snapshot without props 1`] = `
|
|
361
129
|
<DocumentFragment>
|
|
362
130
|
<div
|
|
363
131
|
class="pf-v5-c-code-editor"
|
|
@@ -381,209 +149,8 @@ exports[`CodeEditor matches snapshot without props 1`] = `
|
|
|
381
149
|
tabindex="0"
|
|
382
150
|
>
|
|
383
151
|
<div
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
data-mode-id="plaintext"
|
|
387
|
-
>
|
|
388
|
-
<div
|
|
389
|
-
class="monaco-editor showUnused showDeprecated vs"
|
|
390
|
-
data-uri="inmemory://model/1"
|
|
391
|
-
style="width: 5px; height: 5px;"
|
|
392
|
-
>
|
|
393
|
-
<div
|
|
394
|
-
class="overflow-guard"
|
|
395
|
-
data-mprt="3"
|
|
396
|
-
style="width: 5px; height: 5px;"
|
|
397
|
-
>
|
|
398
|
-
<div
|
|
399
|
-
aria-hidden="true"
|
|
400
|
-
class="margin"
|
|
401
|
-
role="presentation"
|
|
402
|
-
style="position: absolute;"
|
|
403
|
-
>
|
|
404
|
-
<div
|
|
405
|
-
class="glyph-margin"
|
|
406
|
-
/>
|
|
407
|
-
<div
|
|
408
|
-
aria-hidden="true"
|
|
409
|
-
class="margin-view-zones"
|
|
410
|
-
role="presentation"
|
|
411
|
-
style="position: absolute;"
|
|
412
|
-
/>
|
|
413
|
-
<div
|
|
414
|
-
aria-hidden="true"
|
|
415
|
-
class="margin-view-overlays"
|
|
416
|
-
role="presentation"
|
|
417
|
-
style="position: absolute; width: 1px; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; font-feature-settings: \\"liga\\" off, \\"calt\\" off; line-height: 19px; letter-spacing: 0px;"
|
|
418
|
-
/>
|
|
419
|
-
</div>
|
|
420
|
-
<div
|
|
421
|
-
class="monaco-scrollable-element editor-scrollable vs"
|
|
422
|
-
data-mprt="5"
|
|
423
|
-
role="presentation"
|
|
424
|
-
style="position: absolute; overflow: hidden; left: 51px; width: -46px; height: 5px;"
|
|
425
|
-
>
|
|
426
|
-
<div
|
|
427
|
-
class="lines-content monaco-editor-background"
|
|
428
|
-
style="position: absolute; overflow: hidden; width: 1000000px; height: 1000000px; transform: translate3d(0px, 0px, 0px); contain: strict; top: 0px; left: 0px;"
|
|
429
|
-
>
|
|
430
|
-
<div
|
|
431
|
-
aria-hidden="true"
|
|
432
|
-
class="view-overlays"
|
|
433
|
-
role="presentation"
|
|
434
|
-
style="position: absolute; height: 0px;"
|
|
435
|
-
/>
|
|
436
|
-
<div
|
|
437
|
-
aria-hidden="true"
|
|
438
|
-
class="view-rulers"
|
|
439
|
-
role="presentation"
|
|
440
|
-
/>
|
|
441
|
-
<div
|
|
442
|
-
aria-hidden="true"
|
|
443
|
-
class="blockDecorations-container"
|
|
444
|
-
role="presentation"
|
|
445
|
-
/>
|
|
446
|
-
<div
|
|
447
|
-
aria-hidden="true"
|
|
448
|
-
class="view-zones"
|
|
449
|
-
role="presentation"
|
|
450
|
-
style="position: absolute;"
|
|
451
|
-
/>
|
|
452
|
-
<div
|
|
453
|
-
aria-hidden="true"
|
|
454
|
-
class="view-lines monaco-mouse-cursor-text"
|
|
455
|
-
data-mprt="7"
|
|
456
|
-
role="presentation"
|
|
457
|
-
style="position: absolute; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; font-feature-settings: \\"liga\\" off, \\"calt\\" off; line-height: 19px; letter-spacing: 0px; width: 35px; height: 19px;"
|
|
458
|
-
>
|
|
459
|
-
<div
|
|
460
|
-
class="view-line"
|
|
461
|
-
style="top:0px;height:19px;"
|
|
462
|
-
>
|
|
463
|
-
<span>
|
|
464
|
-
<span />
|
|
465
|
-
</span>
|
|
466
|
-
</div>
|
|
467
|
-
</div>
|
|
468
|
-
<div
|
|
469
|
-
class="contentWidgets"
|
|
470
|
-
data-mprt="1"
|
|
471
|
-
style="position: absolute; top: 0px;"
|
|
472
|
-
/>
|
|
473
|
-
<div
|
|
474
|
-
aria-hidden="true"
|
|
475
|
-
class="cursors-layer cursor-line-style cursor-solid"
|
|
476
|
-
role="presentation"
|
|
477
|
-
>
|
|
478
|
-
<div
|
|
479
|
-
class="cursor monaco-mouse-cursor-text"
|
|
480
|
-
style="height: 19px; top: 0px; left: 0px; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; font-feature-settings: \\"liga\\" off, \\"calt\\" off; line-height: 19px; letter-spacing: 0px; display: none; visibility: hidden;"
|
|
481
|
-
/>
|
|
482
|
-
</div>
|
|
483
|
-
</div>
|
|
484
|
-
<div
|
|
485
|
-
aria-hidden="true"
|
|
486
|
-
class="invisible scrollbar horizontal"
|
|
487
|
-
role="presentation"
|
|
488
|
-
style="position: absolute; width: 0px; height: 12px; left: 0px; bottom: 0px;"
|
|
489
|
-
>
|
|
490
|
-
<div
|
|
491
|
-
class="slider"
|
|
492
|
-
style="position: absolute; top: 0px; left: 0px; height: 12px; transform: translate3d(0px, 0px, 0px); contain: strict; width: 20px;"
|
|
493
|
-
/>
|
|
494
|
-
</div>
|
|
495
|
-
<canvas
|
|
496
|
-
aria-hidden="true"
|
|
497
|
-
class="decorationsOverviewRuler"
|
|
498
|
-
height="5"
|
|
499
|
-
style="position: absolute; transform: translate3d(0px, 0px, 0px); contain: strict; top: 0px; right: 0px; width: 14px; height: 5px; display: block;"
|
|
500
|
-
width="14"
|
|
501
|
-
/>
|
|
502
|
-
<div
|
|
503
|
-
aria-hidden="true"
|
|
504
|
-
class="invisible scrollbar vertical"
|
|
505
|
-
role="presentation"
|
|
506
|
-
style="position: absolute; width: 14px; height: 5px; right: 0px; top: 0px;"
|
|
507
|
-
>
|
|
508
|
-
<div
|
|
509
|
-
class="slider"
|
|
510
|
-
style="position: absolute; top: 0px; left: 0px; width: 14px; transform: translate3d(0px, 0px, 0px); contain: strict; height: 20px;"
|
|
511
|
-
/>
|
|
512
|
-
</div>
|
|
513
|
-
</div>
|
|
514
|
-
<div
|
|
515
|
-
aria-hidden="true"
|
|
516
|
-
role="presentation"
|
|
517
|
-
/>
|
|
518
|
-
<textarea
|
|
519
|
-
aria-autocomplete="both"
|
|
520
|
-
aria-haspopup="false"
|
|
521
|
-
aria-label="Editor content;Press Alt+F1 for Accessibility Options."
|
|
522
|
-
aria-multiline="true"
|
|
523
|
-
aria-roledescription="editor"
|
|
524
|
-
autocapitalize="off"
|
|
525
|
-
autocomplete="off"
|
|
526
|
-
autocorrect="off"
|
|
527
|
-
class="inputarea monaco-mouse-cursor-text"
|
|
528
|
-
data-mprt="6"
|
|
529
|
-
role="textbox"
|
|
530
|
-
spellcheck="false"
|
|
531
|
-
style="font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; font-feature-settings: \\"liga\\" off, \\"calt\\" off; line-height: 19px; letter-spacing: 0px; top: 0px; left: 0px; width: 1px; height: 1px;"
|
|
532
|
-
tabindex="-1"
|
|
533
|
-
wrap="off"
|
|
534
|
-
/>
|
|
535
|
-
<div
|
|
536
|
-
class="monaco-editor-background textAreaCover line-numbers"
|
|
537
|
-
style="position: absolute; top: 0px; left: 0px; width: 1px; height: 1px;"
|
|
538
|
-
/>
|
|
539
|
-
<div
|
|
540
|
-
class="overlayWidgets"
|
|
541
|
-
data-mprt="4"
|
|
542
|
-
>
|
|
543
|
-
<div
|
|
544
|
-
style="position: absolute;"
|
|
545
|
-
widgetid="editor.contrib.quickInputWidget"
|
|
546
|
-
/>
|
|
547
|
-
</div>
|
|
548
|
-
<div
|
|
549
|
-
aria-hidden="true"
|
|
550
|
-
class="minimap slider-mouseover"
|
|
551
|
-
data-mprt="8"
|
|
552
|
-
role="presentation"
|
|
553
|
-
style="position: absolute; left: 0px; width: 0px; height: 5px;"
|
|
554
|
-
>
|
|
555
|
-
<div
|
|
556
|
-
class="minimap-shadow-hidden"
|
|
557
|
-
style="height: 5px;"
|
|
558
|
-
/>
|
|
559
|
-
<canvas
|
|
560
|
-
height="5"
|
|
561
|
-
style="position: absolute; left: 0px; width: 0px; height: 5px;"
|
|
562
|
-
width="0"
|
|
563
|
-
/>
|
|
564
|
-
<canvas
|
|
565
|
-
class="minimap-decorations-layer"
|
|
566
|
-
height="5"
|
|
567
|
-
style="position: absolute; left: 0px; width: 0px; height: 5px;"
|
|
568
|
-
width="0"
|
|
569
|
-
/>
|
|
570
|
-
<div
|
|
571
|
-
class="minimap-slider"
|
|
572
|
-
style="position: absolute; transform: translate3d(0px, 0px, 0px); contain: strict; width: 0px;"
|
|
573
|
-
>
|
|
574
|
-
<div
|
|
575
|
-
class="minimap-slider-horizontal"
|
|
576
|
-
style="position: absolute;"
|
|
577
|
-
/>
|
|
578
|
-
</div>
|
|
579
|
-
</div>
|
|
580
|
-
</div>
|
|
581
|
-
<div
|
|
582
|
-
class="overflowingContentWidgets"
|
|
583
|
-
data-mprt="2"
|
|
584
|
-
/>
|
|
585
|
-
</div>
|
|
586
|
-
</div>
|
|
152
|
+
data-testid="mock-editor"
|
|
153
|
+
/>
|
|
587
154
|
</div>
|
|
588
155
|
</div>
|
|
589
156
|
</div>
|