kunfei 3 лет назад
Родитель
Сommit
7b54e6512b
1 измененных файлов с 11 добавлено и 0 удалено
  1. 11 0
      app/src/androidTest/java/io/legado/app/JsTest.kt

+ 11 - 0
app/src/androidTest/java/io/legado/app/JsTest.kt

@@ -2,6 +2,7 @@ package io.legado.app
 
 import com.script.SimpleBindings
 import io.legado.app.constant.SCRIPT_ENGINE
+import io.legado.app.data.entities.BookChapter
 import org.intellij.lang.annotations.Language
 import org.junit.Assert
 import org.junit.Test
@@ -134,4 +135,14 @@ class JsTest {
         Assert.assertEquals(result1, "未知错误,请联系开发者!")
     }
 
+    @Test
+    fun chapterText() {
+        val chapter = BookChapter(title = "xxxyyy")
+        val bindings = SimpleBindings()
+        bindings["chapter"] = chapter
+        val js = "chapter.title"
+        val result = SCRIPT_ENGINE.eval(js, bindings)
+        Assert.assertEquals(result, "xxxyyy")
+    }
+
 }