mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 15:18:58 +01:00
Fix some readonly / readOnly bugs that snuck in when textbox was converted from Lion to Shoelace
This commit is contained in:
parent
5b76c8b16d
commit
17012f6f25
@ -457,7 +457,7 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(ValidateMixin(LitFl
|
|||||||
|
|
||||||
getValue()
|
getValue()
|
||||||
{
|
{
|
||||||
if(this.readOnly || this.disabled)
|
if(this.readonly || this.disabled)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ describe("Date widget", () =>
|
|||||||
element.set_value("0");
|
element.set_value("0");
|
||||||
// wait for asychronous changes to the DOM
|
// wait for asychronous changes to the DOM
|
||||||
await elementUpdated(element);
|
await elementUpdated(element);
|
||||||
assert.equal(element.querySelector("input").value, "");
|
assert.equal(element.querySelector("et2-textbox").value, "");
|
||||||
assert.equal(element.get_value(), '');
|
assert.equal(element.get_value(), '');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -108,4 +108,4 @@ describe("Date widget", () =>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
inputBasicTests(before, "2008-09-22T00:00:00Z", "input");
|
inputBasicTests(before, "2008-09-22T00:00:00Z", "et2-textbox");
|
@ -63,7 +63,7 @@ describe("DateTime widget", () =>
|
|||||||
|
|
||||||
it('No value shows no value', () =>
|
it('No value shows no value', () =>
|
||||||
{
|
{
|
||||||
assert.equal(element.querySelector("input").textContent, "");
|
assert.equal(element.querySelector("et2-textbox").textContent, "");
|
||||||
assert.equal(element.get_value(), "");
|
assert.equal(element.get_value(), "");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ describe("DateTime widget", () =>
|
|||||||
element.set_value("0");
|
element.set_value("0");
|
||||||
// wait for asychronous changes to the DOM
|
// wait for asychronous changes to the DOM
|
||||||
await elementUpdated(element);
|
await elementUpdated(element);
|
||||||
assert.equal(element.querySelector("input").value, "");
|
assert.equal(element.querySelector("et2-textbox").value, "");
|
||||||
assert.equal(element.get_value(), "");
|
assert.equal(element.get_value(), "");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -137,6 +137,8 @@ const Et2InputWidgetMixin = <T extends Constructor<LitElement>>(superclass : T)
|
|||||||
|
|
||||||
this.validators = [];
|
this.validators = [];
|
||||||
this.defaultValidators = [];
|
this.defaultValidators = [];
|
||||||
|
|
||||||
|
this.__readonly = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback()
|
connectedCallback()
|
||||||
@ -235,18 +237,23 @@ const Et2InputWidgetMixin = <T extends Constructor<LitElement>>(superclass : T)
|
|||||||
|
|
||||||
set readOnly(new_value) {this.readonly = new_value;}
|
set readOnly(new_value) {this.readonly = new_value;}
|
||||||
|
|
||||||
get readOnly() { return this.readonly};
|
/**
|
||||||
|
* Lion mapping
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
get readOnly()
|
||||||
|
{ return this.readonly};
|
||||||
|
|
||||||
getValue()
|
getValue()
|
||||||
{
|
{
|
||||||
return this.readOnly || this.disabled ? null : this.value;
|
return this.readonly || this.disabled ? null : this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
isDirty()
|
isDirty()
|
||||||
{
|
{
|
||||||
// Readonly can't be dirty, it can't change
|
// Readonly can't be dirty, it can't change
|
||||||
if(this.readOnly)
|
if(this.readonly)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ export function inputBasicTests(before : Function, test_value : string, value_se
|
|||||||
|
|
||||||
it("does not return a value (via attribute)", async() =>
|
it("does not return a value (via attribute)", async() =>
|
||||||
{
|
{
|
||||||
element.readOnly = true;
|
element.readonly = true;
|
||||||
|
|
||||||
element.set_value(test_value);
|
element.set_value(test_value);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user