summaryrefslogtreecommitdiffstats
path: root/src/test-helpers.js
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-05-19 11:31:40 +0200
committerVincent Petry <vincent@nextcloud.com>2021-05-20 11:28:50 +0200
commitb0eee4fcd29dca54823476b4b0844497328f6ab3 (patch)
treecbccb0f1aa5d89345d566ad392ee7569c085173f /src/test-helpers.js
parentdb92d48428adf09e53e23bbea115d307a11bfb6e (diff)
Add findActionButton helped globally for tests
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'src/test-helpers.js')
-rw-r--r--src/test-helpers.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test-helpers.js b/src/test-helpers.js
new file mode 100644
index 000000000..dbfafd185
--- /dev/null
+++ b/src/test-helpers.js
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
+ *
+ * @author Julius Härtl <jus@bitgrid.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
+
+// helpers
+const findActionButton = function(wrapper, text) {
+ const actionButtons = wrapper.findAllComponents(ActionButton)
+ const items = actionButtons.filter(actionButton => {
+ return actionButton.text() === text
+ })
+ if (!items.exists()) {
+ return items
+ }
+ return items.at(0)
+}
+
+export {
+ findActionButton,
+}