From 6a989f50b21f1669c1f1661d11574f2bc2e73106 Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 1 Dec 2021 14:54:11 +0100 Subject: [PATCH] fixed errors --- .../sebserver/gui/widget/WidgetFactory.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java b/src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java index 540e3cb3..7206ddbc 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java @@ -399,7 +399,11 @@ public class WidgetFactory { final Button button = new Button(parent, type); setARIARole(button, AriaRole.button); - setTestId(button, locTextKey.name); + if (locTextKey != null) { + setTestId(button, locTextKey.name); + } else if (toolTipKey != null) { + setTestId(button, toolTipKey.name); + } this.polyglotPageService.injectI18n(button, locTextKey, toolTipKey); return button; } @@ -781,7 +785,13 @@ public class WidgetFactory { final Supplier>> itemsSupplier, final LocTextKey toolTipTextKey) { - return this.selectionLocalized(type, parent, itemsSupplier, toolTipTextKey, null, toolTipTextKey.name); + return this.selectionLocalized( + type, + parent, + itemsSupplier, + toolTipTextKey, + null, + (toolTipTextKey != null) ? toolTipTextKey.name : null); } public Selection selectionLocalized( @@ -791,8 +801,13 @@ public class WidgetFactory { final LocTextKey toolTipTextKey, final Supplier>> itemsToolTipSupplier) { - return selectionLocalized(type, parent, itemsSupplier, toolTipTextKey, itemsToolTipSupplier, - toolTipTextKey.name); + return selectionLocalized( + type, + parent, + itemsSupplier, + toolTipTextKey, + itemsToolTipSupplier, + (toolTipTextKey != null) ? toolTipTextKey.name : null); } public Selection selectionLocalized(