mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-20 04:48:49 +01:00
Et2Email: Fix placeholder not allowed
This commit is contained in:
parent
97be3be97a
commit
57c76e9840
@ -253,6 +253,15 @@ export class Et2Email extends Et2InputWidget(LitElement) implements SearchMixinI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
firstUpdated(changedProperties : PropertyValues)
|
||||||
|
{
|
||||||
|
super.firstUpdated(changedProperties);
|
||||||
|
|
||||||
|
// Make sure validators reflect allowPlaceholder, in case it's not caught by willUpdate()
|
||||||
|
this.defaultValidators = (<Array<Validator>>this.defaultValidators).filter(v => !(v instanceof IsEmail));
|
||||||
|
this.defaultValidators.push(new IsEmail(this.allowPlaceholder));
|
||||||
|
}
|
||||||
|
|
||||||
updated(changedProperties : PropertyValues)
|
updated(changedProperties : PropertyValues)
|
||||||
{
|
{
|
||||||
super.updated(changedProperties);
|
super.updated(changedProperties);
|
||||||
|
@ -117,6 +117,34 @@ describe("Email widget basics", () =>
|
|||||||
assert.sameMembers(element.value, [value], "Valid email was not accepted on blur");
|
assert.sameMembers(element.value, [value], "Valid email was not accepted on blur");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe("Properties", async() =>
|
||||||
|
{
|
||||||
|
// Setup run before each test
|
||||||
|
beforeEach(before);
|
||||||
|
|
||||||
|
it("Allows placeholder", async() =>
|
||||||
|
{
|
||||||
|
|
||||||
|
const value = "{{placeholder}}";
|
||||||
|
element.allowPlaceholder = false;
|
||||||
|
await elementUpdated(element);
|
||||||
|
|
||||||
|
|
||||||
|
element.addAddress(value);
|
||||||
|
|
||||||
|
await elementUpdated(element);
|
||||||
|
assert.sameMembers(element.value, [], "Placeholder was accepted when not allowed");
|
||||||
|
|
||||||
|
element.allowPlaceholder = true;
|
||||||
|
await elementUpdated(element);
|
||||||
|
|
||||||
|
element.addAddress(value);
|
||||||
|
|
||||||
|
await elementUpdated(element);
|
||||||
|
assert.sameMembers(element.value, [value], "Placeholder was not accepted when allowed");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("Suggestions", () =>
|
describe("Suggestions", () =>
|
||||||
{ // Setup run before each test
|
{ // Setup run before each test
|
||||||
beforeEach(before);
|
beforeEach(before);
|
||||||
@ -127,7 +155,6 @@ describe("Suggestions", () =>
|
|||||||
// Start the search
|
// Start the search
|
||||||
element.focus();
|
element.focus();
|
||||||
element.startSearch();
|
element.startSearch();
|
||||||
debugger;
|
|
||||||
await waitForEvent(element, "sl-after-show");
|
await waitForEvent(element, "sl-after-show");
|
||||||
|
|
||||||
// Click the first one
|
// Click the first one
|
||||||
@ -199,7 +226,6 @@ describe("Tags", () =>
|
|||||||
assert.sameMembers(element.value, ["two@example.com"], "Removing tag did not remove value");
|
assert.sameMembers(element.value, ["two@example.com"], "Removing tag did not remove value");
|
||||||
assert.equal(element._tags.length, 1, "Removed tag is still there");
|
assert.equal(element._tags.length, 1, "Removed tag is still there");
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
inputBasicTests(async() =>
|
inputBasicTests(async() =>
|
||||||
|
Loading…
Reference in New Issue
Block a user