소스 검색

test: add `eval_js()` func test

wangweimin 5 년 전
부모
커밋
659f01c1e8
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      test/template.py

+ 8 - 0
test/template.py

@@ -274,6 +274,14 @@ def test_output(browser: Chrome, enable_percy=False):
 
 
 def basic_input():
+    js_res = yield eval_js('''(function(){
+        var a = 0;
+        for(var i=0;i<=100;i++)
+            a += i;
+        return a;
+    })()''')
+    assert js_res == 5050
+
     age = yield input("How old are you?", type=NUMBER)
     put_markdown(f'`{repr(age)}`')