1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-15 16:10:06 +00:00

fix(sasjs-tests): construct stylesheets

This commit is contained in:
mulahasanovic
2025-11-18 17:26:24 +01:00
parent 6f73011bc1
commit 07e4ba54f3
5 changed files with 38 additions and 23 deletions

View File

@@ -1,10 +1,16 @@
import type { TestStatus } from '../types'
import type { CompletedTest } from '../core/TestRunner'
import type { TestStatus } from '../types'
import styles from './TestCard.css?inline'
export class TestCard extends HTMLElement {
private static styleSheet = new CSSStyleSheet()
private shadow: ShadowRoot
private _testData: CompletedTest | null = null
static {
this.styleSheet.replaceSync(styles)
}
static get observedAttributes() {
return ['status', 'execution-time']
}
@@ -12,6 +18,7 @@ export class TestCard extends HTMLElement {
constructor() {
super()
this.shadow = this.attachShadow({ mode: 'open' })
this.shadow.adoptedStyleSheets = [TestCard.styleSheet]
}
connectedCallback() {
@@ -44,10 +51,6 @@ export class TestCard extends HTMLElement {
const statusIcon = this.getStatusIcon(status)
this.shadow.innerHTML = `
<link rel="stylesheet" href="${new URL(
'./TestCard.css',
import.meta.url
)}">
<div class="header">
<span class="status-icon ${status}">${statusIcon}</span>
<h3>${test.title}</h3>