@neo4j-cypher/react-codemirror 2.0.0-next.3 → 2.0.0-next.30
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 +257 -0
- package/README.md +3 -2
- package/dist/{types → src}/CypherEditor.d.ts +81 -3
- package/dist/src/CypherEditor.js +336 -0
- package/dist/src/CypherEditor.js.map +1 -0
- package/dist/src/CypherEditor.test.js +154 -0
- package/dist/src/CypherEditor.test.js.map +1 -0
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/constants.js +2 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/e2e_tests/autoCompletion.spec.js +332 -0
- package/dist/src/e2e_tests/autoCompletion.spec.js.map +1 -0
- package/dist/src/e2e_tests/configuration.spec.js +83 -0
- package/dist/src/e2e_tests/configuration.spec.js.map +1 -0
- package/dist/src/e2e_tests/debounce.spec.js +66 -0
- package/dist/src/e2e_tests/debounce.spec.js.map +1 -0
- package/dist/{types/e2e_tests/e2e-utils.d.ts → src/e2e_tests/e2eUtils.d.ts} +2 -0
- package/dist/src/e2e_tests/e2eUtils.js +79 -0
- package/dist/src/e2e_tests/e2eUtils.js.map +1 -0
- package/dist/src/e2e_tests/extraKeybindings.spec.js +43 -0
- package/dist/src/e2e_tests/extraKeybindings.spec.js.map +1 -0
- package/dist/src/e2e_tests/historyNavigation.spec.js +227 -0
- package/dist/src/e2e_tests/historyNavigation.spec.js.map +1 -0
- package/dist/src/e2e_tests/performanceTest.spec.d.ts +6 -0
- package/dist/src/e2e_tests/performanceTest.spec.js +97 -0
- package/dist/src/e2e_tests/performanceTest.spec.js.map +1 -0
- package/dist/src/e2e_tests/sanityChecks.spec.js +53 -0
- package/dist/src/e2e_tests/sanityChecks.spec.js.map +1 -0
- package/dist/src/e2e_tests/signatureHelp.spec.js +228 -0
- package/dist/src/e2e_tests/signatureHelp.spec.js.map +1 -0
- package/dist/src/e2e_tests/snippets.spec.js +62 -0
- package/dist/src/e2e_tests/snippets.spec.js.map +1 -0
- package/dist/src/e2e_tests/syntaxHighlighting.spec.d.ts +1 -0
- package/dist/src/e2e_tests/syntaxHighlighting.spec.js +90 -0
- package/dist/src/e2e_tests/syntaxHighlighting.spec.js.map +1 -0
- package/dist/src/e2e_tests/syntaxValidation.spec.d.ts +1 -0
- package/dist/src/e2e_tests/syntaxValidation.spec.js +126 -0
- package/dist/src/e2e_tests/syntaxValidation.spec.js.map +1 -0
- package/dist/src/historyNavigation.js +163 -0
- package/dist/src/historyNavigation.js.map +1 -0
- package/dist/{types → src}/icons.d.ts +1 -1
- package/dist/src/icons.js +62 -0
- package/dist/src/icons.js.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lang-cypher/autocomplete.d.ts +6 -0
- package/dist/src/lang-cypher/autocomplete.js +113 -0
- package/dist/src/lang-cypher/autocomplete.js.map +1 -0
- package/dist/{types → src}/lang-cypher/constants.d.ts +11 -0
- package/dist/src/lang-cypher/constants.js +69 -0
- package/dist/src/lang-cypher/constants.js.map +1 -0
- package/dist/src/lang-cypher/contants.test.d.ts +1 -0
- package/dist/src/lang-cypher/contants.test.js +103 -0
- package/dist/src/lang-cypher/contants.test.js.map +1 -0
- package/dist/src/lang-cypher/createCypherTheme.js +183 -0
- package/dist/src/lang-cypher/createCypherTheme.js.map +1 -0
- package/dist/src/lang-cypher/langCypher.d.ts +13 -0
- package/dist/src/lang-cypher/langCypher.js +23 -0
- package/dist/src/lang-cypher/langCypher.js.map +1 -0
- package/dist/src/lang-cypher/lintWorker.mjs +2022 -0
- package/dist/src/lang-cypher/parser-adapter.d.ts +19 -0
- package/dist/src/lang-cypher/parser-adapter.js +113 -0
- package/dist/src/lang-cypher/parser-adapter.js.map +1 -0
- package/dist/src/lang-cypher/signatureHelp.d.ts +4 -0
- package/dist/src/lang-cypher/signatureHelp.js +109 -0
- package/dist/src/lang-cypher/signatureHelp.js.map +1 -0
- package/dist/{types/lang-cypher/syntax-validation.d.ts → src/lang-cypher/syntaxValidation.d.ts} +2 -1
- package/dist/src/lang-cypher/syntaxValidation.js +57 -0
- package/dist/src/lang-cypher/syntaxValidation.js.map +1 -0
- package/dist/src/lang-cypher/themeIcons.js +22 -0
- package/dist/src/lang-cypher/themeIcons.js.map +1 -0
- package/dist/src/lang-cypher/utils.d.ts +2 -0
- package/dist/src/lang-cypher/utils.js +10 -0
- package/dist/src/lang-cypher/utils.js.map +1 -0
- package/dist/src/ndlTokensCopy.d.ts +570 -0
- package/dist/src/ndlTokensCopy.js +571 -0
- package/dist/src/ndlTokensCopy.js.map +1 -0
- package/dist/src/ndlTokensCopy.test.d.ts +1 -0
- package/dist/src/ndlTokensCopy.test.js +12 -0
- package/dist/src/ndlTokensCopy.test.js.map +1 -0
- package/dist/src/neo4jSetup.d.ts +6 -0
- package/dist/src/neo4jSetup.js +120 -0
- package/dist/src/neo4jSetup.js.map +1 -0
- package/dist/src/richClipboardCopier.d.ts +4 -0
- package/dist/src/richClipboardCopier.js +78 -0
- package/dist/src/richClipboardCopier.js.map +1 -0
- package/dist/src/richClipboardCopier.test.d.ts +1 -0
- package/dist/src/richClipboardCopier.test.js +53 -0
- package/dist/src/richClipboardCopier.test.js.map +1 -0
- package/dist/{types → src}/themes.d.ts +1 -1
- package/dist/src/themes.js +93 -0
- package/dist/src/themes.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +43 -41
- package/src/CypherEditor.test.tsx +204 -0
- package/src/CypherEditor.tsx +316 -42
- package/src/constants.ts +1 -0
- package/src/e2e_tests/autoCompletion.spec.tsx +571 -0
- package/src/e2e_tests/configuration.spec.tsx +111 -0
- package/src/e2e_tests/debounce.spec.tsx +106 -0
- package/src/e2e_tests/{e2e-utils.ts → e2eUtils.ts} +41 -3
- package/src/e2e_tests/{extra-keybindings.spec.tsx → extraKeybindings.spec.tsx} +1 -3
- package/src/e2e_tests/{history-navigation.spec.tsx → historyNavigation.spec.tsx} +137 -18
- package/src/e2e_tests/performanceTest.spec.tsx +163 -0
- package/src/e2e_tests/{sanity-checks.spec.tsx → sanityChecks.spec.tsx} +7 -22
- package/src/e2e_tests/signatureHelp.spec.tsx +444 -0
- package/src/e2e_tests/snippets.spec.tsx +92 -0
- package/src/e2e_tests/{syntax-highlighting.spec.tsx → syntaxHighlighting.spec.tsx} +26 -24
- package/src/e2e_tests/syntaxValidation.spec.tsx +259 -0
- package/src/{history-navigation.ts → historyNavigation.ts} +1 -1
- package/src/icons.ts +3 -0
- package/src/index.ts +2 -2
- package/src/lang-cypher/autocomplete.ts +99 -18
- package/src/lang-cypher/constants.ts +27 -0
- package/src/lang-cypher/contants.test.ts +6 -2
- package/src/lang-cypher/{create-cypher-theme.ts → createCypherTheme.ts} +45 -2
- package/src/lang-cypher/langCypher.ts +42 -0
- package/src/lang-cypher/lintWorker.mjs +2022 -0
- package/src/lang-cypher/parser-adapter.ts +145 -0
- package/src/lang-cypher/signatureHelp.ts +151 -0
- package/src/lang-cypher/syntaxValidation.ts +72 -0
- package/src/lang-cypher/utils.ts +9 -0
- package/src/{ndl-tokens-copy.test.ts → ndlTokensCopy.test.ts} +2 -1
- package/src/ndlTokensCopy.ts +570 -0
- package/src/{neo4j-setup.tsx → neo4jSetup.tsx} +78 -17
- package/src/richClipboardCopier.test.ts +65 -0
- package/src/richClipboardCopier.ts +99 -0
- package/src/themes.ts +45 -70
- package/src/viteEnv.d.ts +1 -0
- package/dist/cjs/index.cjs +0 -1440
- package/dist/cjs/index.cjs.map +0 -7
- package/dist/esm/index.mjs +0 -1463
- package/dist/esm/index.mjs.map +0 -7
- package/dist/types/e2e_tests/mock-data.d.ts +0 -3779
- package/dist/types/index.d.ts +0 -4
- package/dist/types/lang-cypher/ParserAdapter.d.ts +0 -14
- package/dist/types/lang-cypher/autocomplete.d.ts +0 -3
- package/dist/types/lang-cypher/lang-cypher.d.ts +0 -7
- package/dist/types/ndl-tokens-copy.d.ts +0 -379
- package/dist/types/neo4j-setup.d.ts +0 -2
- package/dist/types/tsconfig.tsbuildinfo +0 -1
- package/src/e2e_tests/auto-completion.spec.tsx +0 -232
- package/src/e2e_tests/mock-data.ts +0 -4310
- package/src/e2e_tests/performance-test.spec.tsx +0 -71
- package/src/e2e_tests/syntax-validation.spec.tsx +0 -156
- package/src/lang-cypher/ParserAdapter.ts +0 -92
- package/src/lang-cypher/lang-cypher.ts +0 -32
- package/src/lang-cypher/syntax-validation.ts +0 -24
- package/src/ndl-tokens-copy.ts +0 -379
- /package/dist/{types/e2e_tests/auto-completion.spec.d.ts → src/CypherEditor.test.d.ts} +0 -0
- /package/dist/{types/e2e_tests/extra-keybindings.spec.d.ts → src/e2e_tests/autoCompletion.spec.d.ts} +0 -0
- /package/dist/{types/e2e_tests/history-navigation.spec.d.ts → src/e2e_tests/configuration.spec.d.ts} +0 -0
- /package/dist/{types/e2e_tests/performance-test.spec.d.ts → src/e2e_tests/debounce.spec.d.ts} +0 -0
- /package/dist/{types/e2e_tests/sanity-checks.spec.d.ts → src/e2e_tests/extraKeybindings.spec.d.ts} +0 -0
- /package/dist/{types/e2e_tests/syntax-highlighting.spec.d.ts → src/e2e_tests/historyNavigation.spec.d.ts} +0 -0
- /package/dist/{types/e2e_tests/syntax-validation.spec.d.ts → src/e2e_tests/sanityChecks.spec.d.ts} +0 -0
- /package/dist/{types/lang-cypher/contants.test.d.ts → src/e2e_tests/signatureHelp.spec.d.ts} +0 -0
- /package/dist/{types/ndl-tokens-copy.test.d.ts → src/e2e_tests/snippets.spec.d.ts} +0 -0
- /package/dist/{types/history-navigation.d.ts → src/historyNavigation.d.ts} +0 -0
- /package/dist/{types/lang-cypher/create-cypher-theme.d.ts → src/lang-cypher/createCypherTheme.d.ts} +0 -0
- /package/dist/{types/lang-cypher/theme-icons.d.ts → src/lang-cypher/themeIcons.d.ts} +0 -0
- /package/src/lang-cypher/{theme-icons.ts → themeIcons.ts} +0 -0
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { expect, test } from '@playwright/experimental-ct-react';
|
|
2
|
-
import { CypherEditor } from '../CypherEditor';
|
|
3
|
-
|
|
4
|
-
test.use({ viewport: { width: 500, height: 500 } });
|
|
5
|
-
|
|
6
|
-
test('hello world end 2 end test', async ({ mount }) => {
|
|
7
|
-
const component = await mount(<CypherEditor value="hello world" />);
|
|
8
|
-
await expect(component).toContainText('hello world');
|
|
9
|
-
await component.update(<CypherEditor value="RETURN 123" />);
|
|
10
|
-
await expect(component).toContainText('RETURN 123');
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test('can complete in the middle of statement', async ({ mount, page }) => {
|
|
14
|
-
const component = await mount(
|
|
15
|
-
<CypherEditor
|
|
16
|
-
value={`MATCH ()
|
|
17
|
-
WHER true
|
|
18
|
-
RETURN n;`}
|
|
19
|
-
/>,
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
// Move into the statement and trigger autocompletion
|
|
23
|
-
const textField = page.getByRole('textbox');
|
|
24
|
-
|
|
25
|
-
await textField.focus();
|
|
26
|
-
await textField.press('ArrowDown');
|
|
27
|
-
await textField.press('ArrowRight');
|
|
28
|
-
await textField.press('ArrowRight');
|
|
29
|
-
await textField.press('ArrowRight');
|
|
30
|
-
await textField.press('ArrowRight');
|
|
31
|
-
|
|
32
|
-
await textField.press('Control+ ');
|
|
33
|
-
|
|
34
|
-
await expect(page.locator('.cm-tooltip-autocomplete')).toBeVisible();
|
|
35
|
-
await page.locator('.cm-tooltip-autocomplete').getByText('WHERE').click();
|
|
36
|
-
|
|
37
|
-
await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
|
|
38
|
-
|
|
39
|
-
await expect(component).toContainText('WHERE true');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('get completions when typing and can accept completions with tab', async ({
|
|
43
|
-
mount,
|
|
44
|
-
page,
|
|
45
|
-
}) => {
|
|
46
|
-
const component = await mount(<CypherEditor />);
|
|
47
|
-
const textField = page.getByRole('textbox');
|
|
48
|
-
|
|
49
|
-
await textField.fill('RETU');
|
|
50
|
-
|
|
51
|
-
await expect(
|
|
52
|
-
page.locator('.cm-tooltip-autocomplete').getByText('RETURN'),
|
|
53
|
-
).toBeVisible();
|
|
54
|
-
|
|
55
|
-
// We need to wait for the editor to realise there is a completion open
|
|
56
|
-
// so that it does not just indent with tab key
|
|
57
|
-
await page.waitForTimeout(500);
|
|
58
|
-
await textField.press('Tab');
|
|
59
|
-
|
|
60
|
-
await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
|
|
61
|
-
|
|
62
|
-
await expect(component).toContainText('RETURN');
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test('can complete labels', async ({ mount, page }) => {
|
|
66
|
-
const component = await mount(
|
|
67
|
-
<CypherEditor
|
|
68
|
-
schema={{
|
|
69
|
-
labels: ['Pokemon'],
|
|
70
|
-
}}
|
|
71
|
-
/>,
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
const textField = page.getByRole('textbox');
|
|
75
|
-
|
|
76
|
-
await textField.fill('MATCH (n :P');
|
|
77
|
-
|
|
78
|
-
await page.locator('.cm-tooltip-autocomplete').getByText('Pokemon').click();
|
|
79
|
-
await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
|
|
80
|
-
|
|
81
|
-
await expect(component).toContainText('MATCH (n :Pokemon');
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
test('can update dbschema', async ({ mount, page }) => {
|
|
85
|
-
const component = await mount(
|
|
86
|
-
<CypherEditor
|
|
87
|
-
schema={{
|
|
88
|
-
labels: ['Pokemon'],
|
|
89
|
-
}}
|
|
90
|
-
/>,
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
const textField = page.getByRole('textbox');
|
|
94
|
-
|
|
95
|
-
await textField.fill('MATCH (n :');
|
|
96
|
-
|
|
97
|
-
await expect(
|
|
98
|
-
page.locator('.cm-tooltip-autocomplete').getByText('Pokemon'),
|
|
99
|
-
).toBeVisible();
|
|
100
|
-
|
|
101
|
-
await textField.press('Escape');
|
|
102
|
-
|
|
103
|
-
await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
|
|
104
|
-
|
|
105
|
-
await component.update(
|
|
106
|
-
<CypherEditor
|
|
107
|
-
schema={{
|
|
108
|
-
labels: ['Pokemon', 'Digimon'],
|
|
109
|
-
}}
|
|
110
|
-
/>,
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
await textField.press('Control+ ');
|
|
114
|
-
|
|
115
|
-
await expect(
|
|
116
|
-
page.locator('.cm-tooltip-autocomplete').getByText('Pokemon'),
|
|
117
|
-
).toBeVisible();
|
|
118
|
-
|
|
119
|
-
await expect(
|
|
120
|
-
page.locator('.cm-tooltip-autocomplete').getByText('Digimon'),
|
|
121
|
-
).toBeVisible();
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
test('can complete rel types', async ({ page, mount }) => {
|
|
125
|
-
const component = await mount(
|
|
126
|
-
<CypherEditor
|
|
127
|
-
schema={{
|
|
128
|
-
relationshipTypes: ['KNOWS'],
|
|
129
|
-
}}
|
|
130
|
-
/>,
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
const textField = page.getByRole('textbox');
|
|
134
|
-
|
|
135
|
-
await textField.fill('MATCH (n)-[:');
|
|
136
|
-
|
|
137
|
-
await page.locator('.cm-tooltip-autocomplete').getByText('KNOWS').click();
|
|
138
|
-
await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
|
|
139
|
-
|
|
140
|
-
await expect(component).toContainText('MATCH (n)-[:KNOWS');
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
test('can complete functions', async ({ page, mount }) => {
|
|
144
|
-
const component = await mount(
|
|
145
|
-
<CypherEditor
|
|
146
|
-
schema={{
|
|
147
|
-
functionSignatures: {
|
|
148
|
-
function123: { label: 'function123', documentation: 'no docs' },
|
|
149
|
-
},
|
|
150
|
-
}}
|
|
151
|
-
/>,
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
const textField = page.getByRole('textbox');
|
|
155
|
-
|
|
156
|
-
await textField.fill('RETURN func');
|
|
157
|
-
|
|
158
|
-
await page
|
|
159
|
-
.locator('.cm-tooltip-autocomplete')
|
|
160
|
-
.getByText('function123')
|
|
161
|
-
.click();
|
|
162
|
-
|
|
163
|
-
await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
|
|
164
|
-
|
|
165
|
-
await expect(component).toContainText('RETURN function123');
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
test('can complete procedures', async ({ page, mount }) => {
|
|
169
|
-
const component = await mount(
|
|
170
|
-
<CypherEditor
|
|
171
|
-
schema={{
|
|
172
|
-
procedureSignatures: {
|
|
173
|
-
'db.ping': { label: 'db.ping', documentation: 'no docs' },
|
|
174
|
-
},
|
|
175
|
-
}}
|
|
176
|
-
/>,
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
const textField = page.getByRole('textbox');
|
|
180
|
-
|
|
181
|
-
await textField.fill('CALL d');
|
|
182
|
-
|
|
183
|
-
await page.locator('.cm-tooltip-autocomplete').getByText('db.ping').click();
|
|
184
|
-
await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
|
|
185
|
-
|
|
186
|
-
await expect(component).toContainText('CALL db.ping');
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
test('can complete parameters', async ({ page, mount }) => {
|
|
190
|
-
const component = await mount(
|
|
191
|
-
<CypherEditor
|
|
192
|
-
schema={{
|
|
193
|
-
parameters: { parameter: { type: 'string' } },
|
|
194
|
-
}}
|
|
195
|
-
/>,
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
const textField = page.getByRole('textbox');
|
|
199
|
-
|
|
200
|
-
await textField.fill('RETURN $p');
|
|
201
|
-
|
|
202
|
-
await page.locator('.cm-tooltip-autocomplete').getByText('parameter').click();
|
|
203
|
-
await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
|
|
204
|
-
|
|
205
|
-
await expect(component).toContainText('RETURN $parameter');
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
test('completes allShortestPaths correctly', async ({ page, mount }) => {
|
|
209
|
-
await mount(
|
|
210
|
-
<CypherEditor
|
|
211
|
-
schema={{
|
|
212
|
-
parameters: { parameter: { type: 'string' } },
|
|
213
|
-
}}
|
|
214
|
-
/>,
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
const textField = page.getByRole('textbox');
|
|
218
|
-
|
|
219
|
-
// The first query contains errors on purpose so the
|
|
220
|
-
// syntax errors get triggered before the auto-completion
|
|
221
|
-
await textField.fill('MATCH (n) REURN n; MATCH a');
|
|
222
|
-
|
|
223
|
-
await page
|
|
224
|
-
.locator('.cm-tooltip-autocomplete')
|
|
225
|
-
.getByText('allShortestPaths')
|
|
226
|
-
.click();
|
|
227
|
-
await expect(page.locator('.cm-tooltip-autocomplete')).not.toBeVisible();
|
|
228
|
-
|
|
229
|
-
expect(await textField.textContent()).toEqual(
|
|
230
|
-
'MATCH (n) REURN n; MATCH allShortestPaths',
|
|
231
|
-
);
|
|
232
|
-
});
|