From acd44a1e0eafa84bd7e4518fcefd165275b5c86f Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 4 Jan 2023 15:03:43 -0700 Subject: [PATCH] Get tests for Button passing again --- api/js/etemplate/Et2Button/ButtonMixin.ts | 2 +- api/js/etemplate/Et2Button/Et2Button.ts | 2 ++ api/js/etemplate/Et2Button/test/Et2Button.test.ts | 6 ++++-- web-test-runner.config.mjs | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/api/js/etemplate/Et2Button/ButtonMixin.ts b/api/js/etemplate/Et2Button/ButtonMixin.ts index 575bd3847e..ef6fa1486d 100644 --- a/api/js/etemplate/Et2Button/ButtonMixin.ts +++ b/api/js/etemplate/Et2Button/ButtonMixin.ts @@ -145,7 +145,7 @@ export const ButtonMixin = (superclass : T) => class exte { return { ...super.properties, - image: {type: String}, + image: {type: String, noAccessor: true}, /** * If button is set to readonly, do we want to hide it completely (old behaviour) or show it as disabled diff --git a/api/js/etemplate/Et2Button/Et2Button.ts b/api/js/etemplate/Et2Button/Et2Button.ts index b0dea154e6..9dedabb978 100644 --- a/api/js/etemplate/Et2Button/Et2Button.ts +++ b/api/js/etemplate/Et2Button/Et2Button.ts @@ -12,6 +12,8 @@ import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget"; import '../Et2Image/Et2Image'; import {SlButton} from "@shoelace-style/shoelace"; +import {ButtonMixin} from "./ButtonMixin"; +import {PropertyValues} from "@lion/core"; export class Et2Button extends ButtonMixin(Et2InputWidget(SlButton)) diff --git a/api/js/etemplate/Et2Button/test/Et2Button.test.ts b/api/js/etemplate/Et2Button/test/Et2Button.test.ts index b05726053d..ef5bc6a468 100644 --- a/api/js/etemplate/Et2Button/test/Et2Button.test.ts +++ b/api/js/etemplate/Et2Button/test/Et2Button.test.ts @@ -55,12 +55,14 @@ describe("Button widget", () => it("gets an icon", async() => { + // Wait for the render to finish + await element.updateComplete; + element.image = "check"; // Wait for the render to finish await element.updateComplete; - - let image = element.querySelectorAll("img"); + let image = element.querySelectorAll("et2-image"); assert.equal(image.length, 1); assert.equal(image[0].src, element.egw().image("check")); }) diff --git a/web-test-runner.config.mjs b/web-test-runner.config.mjs index 23108a08eb..8617271462 100644 --- a/web-test-runner.config.mjs +++ b/web-test-runner.config.mjs @@ -46,7 +46,7 @@ export default { [ { name: 'api', - files: 'api/js/etemplate/**/test/*.test.js' + files: 'api/js/etemplate/**/test/*.test.ts' } ].concat( appJS.map(app =>