You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2021/10/20 18:32:39 UTC
[myfaces-tobago] 02/04: fix: tobago-test-tool
This is an automated email from the ASF dual-hosted git repository.
hnoeth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit a79c280754acf21516c6dc90ed71265392c371dc
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Wed Oct 20 18:26:38 2021 +0200
fix: tobago-test-tool
* use click() for links
---
.../META-INF/resources/tobago/test/tobago-test-tool.js | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tobago-tool/tobago-tool-test/src/main/resources/META-INF/resources/tobago/test/tobago-test-tool.js b/tobago-tool/tobago-tool-test/src/main/resources/META-INF/resources/tobago/test/tobago-test-tool.js
index 0c7a56c..c550dfc 100644
--- a/tobago-tool/tobago-tool-test/src/main/resources/META-INF/resources/tobago/test/tobago-test-tool.js
+++ b/tobago-tool/tobago-tool-test/src/main/resources/META-INF/resources/tobago/test/tobago-test-tool.js
@@ -85,6 +85,14 @@ class JasmineTestTool {
let eventFn;
if (typeof eventElement !== "function") {
eventFn = () => fail("'eventElement' must be a function but was: " + eventElement);
+ } else if (eventType === "click") {
+ eventFn = () => {
+ if (eventElement().getAttribute("href")) {
+ eventElement().click(); //links are only executed with 'click()'
+ } else {
+ eventElement().dispatchEvent(new Event(eventType, {bubbles: true}))
+ }
+ }
} else {
eventFn = () => eventElement().dispatchEvent(new Event(eventType, {bubbles: true}));
}
@@ -109,6 +117,14 @@ class JasmineTestTool {
let eventFn;
if (typeof element !== "function") {
eventFn = () => fail("'element' must be a function but was: " + element);
+ } else if (type === "click") {
+ eventFn = () => {
+ if (element().getAttribute("href")) {
+ element().click(); //links are only executed with 'click()'
+ } else {
+ element().dispatchEvent(new Event(type, {bubbles: true}))
+ }
+ }
} else {
eventFn = () => element().dispatchEvent(new Event(type, {bubbles: true}));
}