Skip to content

Commit 65c1e76

Browse files
committed
#RI-3784 - fix tests, add enum for monaco theme
1 parent 7b23aac commit 65c1e76

File tree

5 files changed

+23
-7
lines changed

5 files changed

+23
-7
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react'
2+
import { render } from 'uiSrc/utils/test-utils'
3+
4+
import MonacoJson from './MonacoJson'
5+
6+
describe('', () => {
7+
it('should render', () => {
8+
expect(render(<MonacoJson value="val" onChange={jest.fn()} />)).toBeTruthy()
9+
})
10+
})

redisinsight/ui/src/components/monaco-json/MonacoJson.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useContext, useEffect, useRef, useState } from 'react'
22
import * as monacoEditor from 'monaco-editor/esm/vs/editor/editor.api'
33
import MonacoEditor, { monaco } from 'react-monaco-editor'
44
import cx from 'classnames'
5-
import { darkTheme, lightTheme } from 'uiSrc/constants/monaco/cypher'
5+
import { darkTheme, lightTheme, MonacoThemes } from 'uiSrc/constants/monaco/cypher'
66

77
import { Nullable } from 'uiSrc/utils'
88
import { IEditorMount } from 'uiSrc/pages/workbench/interfaces'
@@ -13,7 +13,7 @@ import styles from './styles.modules.scss'
1313
export interface Props {
1414
value: string
1515
onChange: (value: string) => void
16-
disabled: boolean
16+
disabled?: boolean
1717
wrapperClassName?: string
1818
'data-testid'?: string
1919
}
@@ -53,8 +53,8 @@ const MonacoJson = (props: Props) => {
5353
}
5454

5555
if (monaco?.editor) {
56-
monaco.editor.defineTheme('dark', darkTheme)
57-
monaco.editor.defineTheme('light', lightTheme)
56+
monaco.editor.defineTheme(MonacoThemes.Dark, darkTheme)
57+
monaco.editor.defineTheme(MonacoThemes.Light, lightTheme)
5858
}
5959

6060
const options: monacoEditor.editor.IStandaloneEditorConstructionOptions = {

redisinsight/ui/src/components/query/Query/Query.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import { ThemeContext } from 'uiSrc/contexts/themeContext'
3636
import { appRedisCommandsSelector } from 'uiSrc/slices/app/redis-commands'
3737
import { IEditorMount, ISnippetController } from 'uiSrc/pages/workbench/interfaces'
3838
import { CommandExecutionUI } from 'uiSrc/slices/interfaces'
39-
import { darkTheme, lightTheme } from 'uiSrc/constants/monaco/cypher'
39+
import { darkTheme, lightTheme, MonacoThemes } from 'uiSrc/constants/monaco/cypher'
4040
import { RunQueryMode, ResultsMode } from 'uiSrc/slices/interfaces/workbench'
4141
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
4242
import { stopProcessing, workbenchResultsSelector } from 'uiSrc/slices/workbench/wb-results'
@@ -466,8 +466,8 @@ const Query = (props: Props) => {
466466
}
467467

468468
if (monaco?.editor) {
469-
monaco.editor.defineTheme('dark', darkTheme)
470-
monaco.editor.defineTheme('light', lightTheme)
469+
monaco.editor.defineTheme(MonacoThemes.Dark, darkTheme)
470+
monaco.editor.defineTheme(MonacoThemes.Light, lightTheme)
471471
}
472472

473473
const isLoading = loading || processing

redisinsight/ui/src/constants/monaco/cypher/theme.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ export const lightThemeRules = [
88
{ token: 'function', foreground: '795E26' }
99
]
1010

11+
export enum MonacoThemes {
12+
Dark = 'dark',
13+
Light = 'light'
14+
}
15+
1116
export const darkTheme: monaco.editor.IStandaloneThemeData = {
1217
base: 'vs-dark',
1318
inherit: true,

redisinsight/ui/src/pages/browser/components/add-key/AddKeyReJSON/AddKeyReJSON.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const AddKeyReJSON = (props: Props) => {
7575
value={ReJSONValue}
7676
onChange={setReJSONValue}
7777
disabled={loading}
78+
data-testid="json-value"
7879
/>
7980
</EuiFormRow>
8081

0 commit comments

Comments
 (0)