浏览代码

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)}`')