@neo4j-cypher/react-codemirror
Advanced tools
Comparing version 2.0.0-canary-8eea181 to 2.0.0-canary-99a839f
# @neo4j-cypher/react-codemirror | ||
## 2.0.0-next.11 | ||
### Patch Changes | ||
- Updated dependencies [05663bd] | ||
- @neo4j-cypher/language-support@2.0.0-next.8 | ||
## 2.0.0-next.10 | ||
### Patch Changes | ||
- bb7e9d3: Simplify detection and handling of value prop updates | ||
## 2.0.0-next.9 | ||
@@ -4,0 +17,0 @@ |
@@ -17,2 +17,3 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
global.IS_REACT_ACT_ENVIRONMENT = true; | ||
const DEBOUNCE_TIME_WITH_MARGIN = DEBOUNCE_TIME + 100; | ||
/** Avoids crash in test environment */ | ||
@@ -28,3 +29,3 @@ function mockEditorView(editorView) { | ||
async function debounce() { | ||
await new Promise((resolve) => setTimeout(resolve, DEBOUNCE_TIME)); | ||
await new Promise((resolve) => setTimeout(resolve, DEBOUNCE_TIME_WITH_MARGIN)); | ||
} | ||
@@ -115,3 +116,3 @@ function getEditorValue() { | ||
test('rerender should not cancel onChange', async () => { | ||
// 1. value is updated ínternally | ||
// 1. value is updated internally | ||
ref.current.setValueAndFocus('changed'); | ||
@@ -126,6 +127,6 @@ // 2. editor is rerendered while a value update is still pending | ||
test('rerender with a previous update should not cancel onChange', async () => { | ||
// 1. value is updated ínternally | ||
// 1. value is updated internally | ||
ref.current.setValueAndFocus('changed'); | ||
await debounce(); | ||
// 2. value is updated ínternally again | ||
// 2. value is updated internally again | ||
ref.current.setValueAndFocus('new change'); | ||
@@ -132,0 +133,0 @@ // 3. editor is rerendered while a value update is still pending |
@@ -6,2 +6,3 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { CypherEditorPage } from './e2eUtils'; | ||
const DEBOUNCE_TIME_WITH_MARGIN = DEBOUNCE_TIME + 100; | ||
// value updates from outside onExecute are overwritten by pending updates | ||
@@ -18,3 +19,3 @@ test.fail('external updates should override debounced updates', async ({ mount, page }) => { | ||
onChange('foo'); | ||
await page.waitForTimeout(DEBOUNCE_TIME); | ||
await page.waitForTimeout(DEBOUNCE_TIME_WITH_MARGIN); | ||
await expect(component).toContainText('foo'); | ||
@@ -35,4 +36,4 @@ }); | ||
await editorPage.getEditor().pressSequentially('RETURN 1'); | ||
await editorPage.getEditor().press('Control+Enter'); | ||
await page.waitForTimeout(DEBOUNCE_TIME); | ||
await editorPage.getEditor().press('Enter'); | ||
await page.waitForTimeout(DEBOUNCE_TIME_WITH_MARGIN); | ||
await expect(component).not.toContainText('RETURN 1'); | ||
@@ -42,4 +43,4 @@ await editorPage.getEditor().pressSequentially('RETURN 1'); | ||
await editorPage.getEditor().pressSequentially('RETURN 1'); | ||
await editorPage.getEditor().press('Control+Enter'); | ||
await page.waitForTimeout(DEBOUNCE_TIME); | ||
await editorPage.getEditor().press('Enter'); | ||
await page.waitForTimeout(DEBOUNCE_TIME_WITH_MARGIN); | ||
await expect(component).not.toContainText('RETURN 1'); | ||
@@ -61,6 +62,6 @@ }); | ||
await editorPage.getEditor().fill('RETURN 1'); | ||
await editorPage.getEditor().press('Control+Enter'); | ||
await editorPage.getEditor().press('Enter'); | ||
await editorPage.getEditor().fill('RETURN 2'); | ||
await editorPage.getEditor().press('Control+Enter'); | ||
await page.waitForTimeout(DEBOUNCE_TIME); | ||
await editorPage.getEditor().press('Enter'); | ||
await page.waitForTimeout(DEBOUNCE_TIME_WITH_MARGIN); | ||
await expect(component).toContainText('RETURN 2'); | ||
@@ -67,0 +68,0 @@ expect(executedCommand).toBe('RETURN 2'); |
@@ -24,3 +24,5 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
const textField = page.getByRole('textbox'); | ||
await textField.fill(''); | ||
await textField.fill('RETURN 12'); | ||
await expect(textField).toHaveText('RETURN 12'); | ||
// editor update is debounced, retry wait for debounced | ||
@@ -30,6 +32,2 @@ await expect(() => { | ||
}).toPass({ intervals: [300, 300, 1000] }); | ||
await page.keyboard.type('34'); | ||
await expect(() => { | ||
expect(editorValueCopy).toBe('RETURN 12'); | ||
}).toPass({ intervals: [300, 300, 1000] }); | ||
}); | ||
@@ -36,0 +34,0 @@ test('can complete RETURN', async ({ page, mount }) => { |
@@ -38,4 +38,3 @@ import { linter } from '@codemirror/lint'; | ||
const statements = parse.statementsParsing; | ||
const anySyntacticError = statements.filter((statement) => statement.diagnostics.length !== 0) | ||
.length > 0; | ||
const anySyntacticError = statements.some((statement) => statement.syntaxErrors.length !== 0); | ||
if (anySyntacticError) { | ||
@@ -42,0 +41,0 @@ return []; |
@@ -20,3 +20,3 @@ { | ||
], | ||
"version": "2.0.0-canary-8eea181", | ||
"version": "2.0.0-canary-99a839f", | ||
"main": "./dist/index.js", | ||
@@ -55,3 +55,3 @@ "types": "./dist/index.d.ts", | ||
"@lezer/highlight": "^1.1.3", | ||
"@neo4j-cypher/language-support": "2.0.0-canary-8eea181", | ||
"@neo4j-cypher/language-support": "2.0.0-canary-99a839f", | ||
"@types/prismjs": "^1.26.3", | ||
@@ -58,0 +58,0 @@ "@types/workerpool": "^6.4.7", |
@@ -57,5 +57,5 @@ import { Diagnostic, linter } from '@codemirror/lint'; | ||
const anySyntacticError = | ||
statements.filter((statement) => statement.diagnostics.length !== 0) | ||
.length > 0; | ||
const anySyntacticError = statements.some( | ||
(statement) => statement.syntaxErrors.length !== 0, | ||
); | ||
@@ -62,0 +62,0 @@ if (anySyntacticError) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
670629
8934
+ Added@neo4j-cypher/language-support@2.0.0-canary-99a839f(transitive)
- Removed@neo4j-cypher/language-support@2.0.0-canary-8eea181(transitive)