Просмотр исходного кода

test(editor): page-search-hashtag at handle-last-input

Andelf 3 лет назад
Родитель
Сommit
674022d4fb
1 измененных файлов с 21 добавлено и 1 удалено
  1. 21 1
      src/test/frontend/handler/editor_test.cljs

+ 21 - 1
src/test/frontend/handler/editor_test.cljs

@@ -96,4 +96,24 @@
     (handle-last-input-handler {:value "first \nfoo::bar"
     (handle-last-input-handler {:value "first \nfoo::bar"
                                 :cursor-pos (dec (count "first "))})
                                 :cursor-pos (dec (count "first "))})
     (is (= nil (state/get-editor-action))
     (is (= nil (state/get-editor-action))
-        "Don't autocomplete properties if typing in a block where properties already exist")))
+        "Don't autocomplete properties if typing in a block where properties already exist")
+
+    (handle-last-input-handler {:value "#"
+                                :cursor-pos 1})
+    (is (= :page-search-hashtag (state/get-editor-action))
+        "Page search if only hashtags has been typed")
+
+    (handle-last-input-handler {:value "foo bar#"
+                                :cursor-pos 8})
+    (is (= :page-search-hashtag (state/get-editor-action))
+        "Page search if hashtags has been typed as EOL")
+
+    (handle-last-input-handler {:value "foo #"
+                                :cursor-pos 5})
+    (is (= :page-search-hashtag (state/get-editor-action))
+        "Page search if hashtags has been typed after a space")
+
+    (handle-last-input-handler {:value "foo#bar"
+                                :cursor-pos 4})
+    (is (= :page-search-hashtag (state/get-editor-action))
+        "Page search if hashtags has been typed in the middle of a line")))