mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-02 03:19:56 +01:00
Fix some Et2InputWidgets would not get a label
This commit is contained in:
parent
2a939299ff
commit
6396516bad
@ -563,7 +563,8 @@ const Et2InputWidgetMixin = <T extends Constructor<LitElement>>(superclass : T)
|
||||
{
|
||||
if(!new_label || !new_label.includes("%s"))
|
||||
{
|
||||
return super.label = new_label;
|
||||
super.set_label(new_label);
|
||||
return;
|
||||
}
|
||||
this.__label = new_label;
|
||||
const [pre, post] = et2_csvSplit(new_label, 2, "%s");
|
||||
|
@ -34,16 +34,30 @@ describe("Textbox widget", () =>
|
||||
|
||||
// Setup run before each test
|
||||
beforeEach(before);
|
||||
|
||||
const checkLabel = function(labelValue)
|
||||
{
|
||||
const label = element.querySelector(".et2_label");
|
||||
assert.isNotNull(label);
|
||||
assert.isTrue(label.checkVisibility(), "Label is not visible");
|
||||
assert.equal(element.querySelector('.et2_label')?.textContent.trim(), labelValue);
|
||||
}
|
||||
it('is defined', () =>
|
||||
{
|
||||
assert.instanceOf(element, Et2Textbox);
|
||||
});
|
||||
|
||||
it('has a label', () =>
|
||||
it('gets a label via set_label()', async() =>
|
||||
{
|
||||
// Old set_label()
|
||||
element.set_label("Yay label");
|
||||
assert.isEmpty(element.shadowRoot.querySelectorAll('.et2_label'));
|
||||
await element.updateComplete;
|
||||
checkLabel("Yay label")
|
||||
});
|
||||
it('gets a label via property', async() =>
|
||||
{
|
||||
element.label = "Assign via property";
|
||||
await element.updateComplete;
|
||||
checkLabel("Assign via property");
|
||||
})
|
||||
});
|
||||
inputBasicTests(before, "I'm a good test value", "input");
|
Loading…
Reference in New Issue
Block a user