Support button title change
Change-Id: Ie0f225071edeb2547f841632951715a104477ff7
diff --git a/Changes b/Changes
index 59f97fc..2ad0086 100644
--- a/Changes
+++ b/Changes
@@ -3,6 +3,7 @@
- Authorization service with POST (support API version 1.1) (hebasta)
- Enhance handling of improper json files (diewald)
- Support API version 1.1 (diewald)
+ - Support title change in button groups (diewald)
0.64 2026-02-14
- Improve 'Plugins' mounting (diewald)
diff --git a/dev/js/spec/buttongroupSpec.js b/dev/js/spec/buttongroupSpec.js
index 9f20042..189fb24 100644
--- a/dev/js/spec/buttongroupSpec.js
+++ b/dev/js/spec/buttongroupSpec.js
@@ -74,7 +74,7 @@
var count = 0;
- group.add('Meta', undefined, function () {
+ let btn = group.add('Meta', undefined, function () {
count++;
});
@@ -84,6 +84,10 @@
group.element().firstChild.click();
expect(count).toEqual(1);
+
+ expect(btn.textContent).toEqual("Meta");
+ btn.changeTitle("Cool");
+ expect(btn.textContent).toEqual("Cool");
});
it('should respect binds', function () {
diff --git a/dev/js/src/buttongroup.js b/dev/js/src/buttongroup.js
index da12078..40eb61f 100644
--- a/dev/js/src/buttongroup.js
+++ b/dev/js/src/buttongroup.js
@@ -115,7 +115,12 @@
};
b.setAttribute('title', desc);
- b.addE('span').addT(title);
+ let innerSpan = b.addE('span');
+ innerSpan.addT(title);
+
+ b["changeTitle"] = function (title) {
+ innerSpan.textContent = title;
+ };
let that = this;
b.addEventListener('click', function (e) {