From c6f8a3448dbc7e8756b9bcf7a487e19987195ee4 Mon Sep 17 00:00:00 2001 From: lixiaofeng <2368272960@qq.com> Date: Tue, 28 May 2024 19:54:46 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20app/test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug546_lixiaofeng.py | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 app/test/test_bug546_lixiaofeng.py diff --git a/app/test/test_bug546_lixiaofeng.py b/app/test/test_bug546_lixiaofeng.py new file mode 100644 index 0000000..671094b --- /dev/null +++ b/app/test/test_bug546_lixiaofeng.py @@ -0,0 +1,39 @@ +from selenium.webdriver.common.action_chains import ActionChains +from helper import signup + + +def test_highlight(driver, URL): + try: + # 打开网页 + driver.get(URL) + driver.maximize_window() + + # 注册 + signup(URL, driver) + + # 取消勾选“划词入库按钮” + highlight_checkbox = driver.find_element_by_id("chooseCheckbox") + driver.execute_script("arguments[0].click();", highlight_checkbox) + + article = driver.find_element_by_id("article") + + # 创建 ActionChains 对象 + actions = ActionChains(driver) + + # 移动鼠标到起点位置 + actions.move_to_element(article) + # actions.move_to_element_with_offset(article, 50, 100) + # 按下鼠标左键 + actions.click_and_hold() + # 拖动鼠标到结束位置 + actions.move_by_offset(400,50) + # 释放鼠标左键 + actions.release() + # 执行操作链 + actions.perform() + # time.sleep(10) + + assert driver.find_elements_by_class_name("highlighted") is not None + finally: + # 测试结束后关闭浏览器 + driver.quit() \ No newline at end of file From eed852cd6666b0afa8c7c4cf7be4e28a1a5ff409 Mon Sep 17 00:00:00 2001 From: lixiaofeng <2368272960@qq.com> Date: Tue, 28 May 2024 19:55:07 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20app/templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/userpage_get.html | 1 + 1 file changed, 1 insertion(+) diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 57461c1..e5c8d95 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -166,6 +166,7 @@ {% endif %} + {{ yml['footer'] | safe }} {% if yml['js']['bottom'] %} {% for js in yml['js']['bottom'] %} From 9f03cc49fa05687f2abb3007cee7c4482835d782 Mon Sep 17 00:00:00 2001 From: lixiaofeng <2368272960@qq.com> Date: Tue, 28 May 2024 19:55:26 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20app/static/js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/js/highlight.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/static/js/highlight.js b/app/static/js/highlight.js index 939d691..9646ff3 100644 --- a/app/static/js/highlight.js +++ b/app/static/js/highlight.js @@ -27,6 +27,8 @@ function highLight() { let pickedWords = document.getElementById("selected-words"); // words picked to the text area let dictionaryWords = document.getElementById("selected-words2"); // words appearing in the user's new words list let allWords = dictionaryWords === null ? pickedWords.value + " " : pickedWords.value + " " + dictionaryWords.value; + highlightWords = document.getElementById("selected-words3"); + allWords = highlightWords == null ? allWords : allWords + " " + highlightWords.value; const list = allWords.split(" "); // 将所有的生词放入一个list中 if(word !== null && word !== "" && word !== " "){ let articleContent_fb2 = articleContent; From e3db7c30b04335cc2fe1d345813697166ad3e4f4 Mon Sep 17 00:00:00 2001 From: lixiaofeng <2368272960@qq.com> Date: Tue, 28 May 2024 19:55:38 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20app/static/js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/js/fillword.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/static/js/fillword.js b/app/static/js/fillword.js index 421d972..111027a 100644 --- a/app/static/js/fillword.js +++ b/app/static/js/fillword.js @@ -8,7 +8,13 @@ function getWord() { function fillInWord() { let word = getWord(); if (isRead) Reader.read(word, inputSlider.value); - if (!isChoose) return; + if (!isChoose) { + if(isHighlight){ + const element = document.getElementById("selected-words3"); + element.value = element.value + " " + word; + } + return; + } const element = document.getElementById("selected-words"); localStorage.setItem('nowWords', element.value); element.value = element.value + " " + word;