Browse Source

test(e2e): add test for block with code and multi properties

Andelf 3 years ago
parent
commit
585e7ba1f5
1 changed files with 38 additions and 0 deletions
  1. 38 0
      e2e-tests/code-editing.spec.ts

+ 38 - 0
e2e-tests/code-editing.spec.ts

@@ -196,6 +196,9 @@ test('click outside to exit', async ({ page }) => {
 test('click lanuage label to exit #3463', async ({ page }) => {
   await createRandomPage(page)
 
+  await page.press('.block-editor textarea', 'Enter')
+  await page.waitForTimeout(200)
+
   await page.fill('.block-editor textarea', '```cpp\n```')
   await page.waitForTimeout(500)
   await escapeToCodeEditor(page)
@@ -206,3 +209,38 @@ test('click lanuage label to exit #3463', async ({ page }) => {
   await page.waitForTimeout(500)
   expect(await page.inputValue('.block-editor textarea')).toBe('```cpp\n#include<iostream>\n```')
 })
+
+test('multi properties with code', async ({ page }) => {
+  await createRandomPage(page)
+
+  await page.fill('.block-editor textarea',
+    'type:: code\n' +
+    '类型:: 代码\n' +
+    '```go\n' +
+    'if err != nil {\n' +
+    '\treturn err\n' +
+    '}\n' +
+    '```'
+  )
+  await page.waitForTimeout(500)
+  await escapeToCodeEditor(page)
+
+  // first character of code
+  await page.click('.CodeMirror pre', { position: { x: 1, y: 5 } })
+  await page.waitForTimeout(500)
+  await page.type('.CodeMirror textarea', '// Returns nil\n')
+
+  await page.waitForTimeout(500)
+  await page.press('.CodeMirror textarea', 'Escape')
+  await page.waitForTimeout(500)
+  expect(await page.inputValue('.block-editor textarea')).toBe(
+    'type:: code\n' +
+    '类型:: 代码\n' +
+    '```go\n' +
+    '// Returns nil\n' +
+    'if err != nil {\n' +
+    '\treturn err\n' +
+    '}\n' +
+    '```'
+  )
+})