mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Get tests for Colorpicker passing again
This commit is contained in:
parent
acd44a1e0e
commit
37dd18894f
@ -3,22 +3,36 @@
|
|||||||
*/
|
*/
|
||||||
import {assert, fixture, html} from '@open-wc/testing';
|
import {assert, fixture, html} from '@open-wc/testing';
|
||||||
import {Et2Colorpicker} from "../Et2Colorpicker";
|
import {Et2Colorpicker} from "../Et2Colorpicker";
|
||||||
|
import * as sinon from 'sinon';
|
||||||
|
|
||||||
|
|
||||||
describe("Colorpicker widget", () =>
|
describe("Colorpicker widget", () =>
|
||||||
{
|
{
|
||||||
// Reference to component under test
|
// Reference to component under test
|
||||||
let element : Et2Colorpicker;
|
let element : Et2Colorpicker;
|
||||||
|
let egw_stub;
|
||||||
|
|
||||||
// Setup run before each test
|
// Setup run before each test
|
||||||
beforeEach(async() =>
|
beforeEach(async() =>
|
||||||
{
|
{
|
||||||
|
// Stub egw
|
||||||
|
// @ts-ignore
|
||||||
|
egw_stub = sinon.stub(Et2Colorpicker.prototype, "egw").returns({
|
||||||
|
lang: i => i,
|
||||||
|
tooltipUnbind: () => {}
|
||||||
|
});
|
||||||
|
|
||||||
// Create an element to test with, and wait until it's ready
|
// Create an element to test with, and wait until it's ready
|
||||||
element = await fixture<Et2Colorpicker>(html`
|
element = await fixture<Et2Colorpicker>(html`
|
||||||
<et2-colorpicker></et2-colorpicker>
|
<et2-colorpicker></et2-colorpicker>
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterEach(() =>
|
||||||
|
{
|
||||||
|
egw_stub.restore();
|
||||||
|
});
|
||||||
|
|
||||||
it('is defined', () =>
|
it('is defined', () =>
|
||||||
{
|
{
|
||||||
assert.instanceOf(element, Et2Colorpicker);
|
assert.instanceOf(element, Et2Colorpicker);
|
||||||
@ -29,7 +43,7 @@ describe("Colorpicker widget", () =>
|
|||||||
// set a value
|
// set a value
|
||||||
element.set_value("11111");
|
element.set_value("11111");
|
||||||
// trigger the clear button
|
// trigger the clear button
|
||||||
element.__getClearButtonNode().dispatchEvent(new MouseEvent('click'));
|
element.shadowRoot.querySelector(".input__clear").dispatchEvent(new MouseEvent('click'));
|
||||||
|
|
||||||
assert.equal(element.getValue(), "");
|
assert.equal(element.getValue(), "");
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user