Browse Source

test(e2e): add more autocomplete test

Junyi Du 4 years ago
parent
commit
09120cfce2

+ 19 - 2
e2e-tests/basic.spec.ts

@@ -223,11 +223,11 @@ test('auto completion and auto pair', async ({ page }) => {
   await page.fill(':nth-match(textarea, 1)', 'Auto-completion test')
   await page.press(':nth-match(textarea, 1)', 'Enter')
 
-  // {}
+  // {{
   await page.type(':nth-match(textarea, 1)', 'type {{')
   expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('type {{}}')
 
-  // (()
+  // ((
   await newBlock(page)
 
   await page.type(':nth-match(textarea, 1)', 'type (')
@@ -235,6 +235,23 @@ test('auto completion and auto pair', async ({ page }) => {
   await page.type(':nth-match(textarea, 1)', '(')
   expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('type (())')
 
+  // 99  #3444
+  // TODO: Test under different keyboard layout when Playwright supports it
+  // await newBlock(page)
+
+  // await page.type(':nth-match(textarea, 1)', 'type 9')
+  // expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('type 9')
+  // await page.type(':nth-match(textarea, 1)', '9')
+  // expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('type 99')
+
+  // [[  #3251
+  await newBlock(page)
+
+  await page.type(':nth-match(textarea, 1)', 'type [')
+  expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('type []')
+  await page.type(':nth-match(textarea, 1)', '[')
+  expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('type [[]]')
+
   // ``
   await newBlock(page)
 

+ 0 - 3
src/main/frontend/handler/editor.cljs

@@ -2904,9 +2904,6 @@
             non-enter-processed? (and is-processed? ;; #3251
                                       (not= code keycode/enter-code))] ;; #3459
         (when-not (or (state/get-editor-show-input) non-enter-processed?)
-          (js/console.log "---")
-          (js/console.log e)
-          (js/console.log last-key-code)
           (cond
             (and (not (contains? #{"ArrowDown" "ArrowLeft" "ArrowRight" "ArrowUp"} k))
                  (not (:editor/show-page-search? @state/state))

+ 1 - 1
src/main/frontend/util/keycode.cljs

@@ -9,5 +9,5 @@
 ;; (def left-paren-code "Digit9") ;; deprecated
 (def enter-code "Enter")
 
-(def left-square-brackets-keys #{"[" "【"})
+(def left-square-brackets-keys #{"[" "【" "「"})
 (def left-paren-keys #{"(" "("})