mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
Et2Select: Unit test update
- Added check to see if it actually shows the options - Fix "Selected multiple remote results in value" failed
This commit is contained in:
parent
6c06a5311f
commit
795160301b
@ -111,6 +111,39 @@ describe("Select widget", () =>
|
||||
assert.includeMembers(option_keys, ["1", "2", "option"], "Option mis-match");
|
||||
assert.equal(option_keys.length, 3);
|
||||
});
|
||||
|
||||
it("actually shows the options", async() =>
|
||||
{
|
||||
// Create an element to test with, and wait until it's ready
|
||||
// @ts-ignore
|
||||
element = await fixture<Et2Select>(html`
|
||||
<et2-select label="I'm a select"></et2-select>
|
||||
`);
|
||||
// Stub egw()
|
||||
sinon.stub(element, "egw").returns(window.egw);
|
||||
element.select_options = [
|
||||
{value: "one", label: "one"},
|
||||
{value: "two", label: "two"},
|
||||
{value: "three", label: "three"},
|
||||
{value: "four", label: "four"},
|
||||
{value: "five", label: "five"}
|
||||
];
|
||||
|
||||
await element.updateComplete;
|
||||
await elementUpdated(element);
|
||||
|
||||
await element.show();
|
||||
|
||||
// Not actually testing if the browser renders, just if they show where expected
|
||||
const options = element.select.querySelectorAll("sl-option");
|
||||
assert.equal(options.length, 5, "Wrong number of options");
|
||||
|
||||
// Still not checking if they're _really_ visible, just that they have the correct display
|
||||
options.forEach(o =>
|
||||
{
|
||||
assert.equal(getComputedStyle(o).display, "block", "Wrong style.display");
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe("Value tests", () =>
|
||||
|
@ -313,6 +313,9 @@ describe("Search results", () =>
|
||||
// Enable multiple
|
||||
element.multiple = true;
|
||||
|
||||
// Clear auto-selected value
|
||||
element.value = "";
|
||||
|
||||
// Enable searching
|
||||
element.searchUrl = "test";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user