GUI -- Reworked ButtonService unit tests (fixed logic error).
Change-Id: I793c02a327885b746ccf2345156f7a5fd1007bd2
diff --git a/web/gui/src/main/webapp/app/fw/widget/button.js b/web/gui/src/main/webapp/app/fw/widget/button.js
index 6ad0015..6b4ca28 100644
--- a/web/gui/src/main/webapp/app/fw/widget/button.js
+++ b/web/gui/src/main/webapp/app/fw/widget/button.js
@@ -203,7 +203,7 @@
} else {
idx = idxByKey[x];
if (idx === undefined) {
- $log.warn('no radio button with key "' + x + '"');
+ $log.warn('no radio button with key:', x);
} else {
selectedIndex(idx);
}
@@ -215,10 +215,14 @@
return currIdx;
} else {
if (x >= 0 && x < rads.length) {
- currIdx = x;
- invokeCurrent();
+ if (currIdx !== x) {
+ currIdx = x;
+ invokeCurrent();
+ } else {
+ $log.warn('current index already selected:', x);
+ }
} else {
- $log.warn('invalid radio button index', x);
+ $log.warn('invalid radio button index:', x);
}
}
}