mirror of
https://github.com/sasjs/adapter.git
synced 2025-12-11 01:14:36 +00:00
fix(sasjs-tests): construct stylesheets
This commit is contained in:
@@ -1,11 +1,18 @@
|
|||||||
import { appContext } from '../core/AppContext'
|
import { appContext } from '../core/AppContext'
|
||||||
|
import styles from './LoginForm.css?inline'
|
||||||
|
|
||||||
export class LoginForm extends HTMLElement {
|
export class LoginForm extends HTMLElement {
|
||||||
|
private static styleSheet = new CSSStyleSheet()
|
||||||
private shadow: ShadowRoot
|
private shadow: ShadowRoot
|
||||||
|
|
||||||
|
static {
|
||||||
|
this.styleSheet.replaceSync(styles)
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.shadow = this.attachShadow({ mode: 'open' })
|
this.shadow = this.attachShadow({ mode: 'open' })
|
||||||
|
this.shadow.adoptedStyleSheets = [LoginForm.styleSheet]
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
@@ -15,10 +22,6 @@ export class LoginForm extends HTMLElement {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
this.shadow.innerHTML = `
|
this.shadow.innerHTML = `
|
||||||
<link rel="stylesheet" href="${new URL(
|
|
||||||
'./LoginForm.css',
|
|
||||||
import.meta.url
|
|
||||||
)}">
|
|
||||||
<h1>SASjs Tests</h1>
|
<h1>SASjs Tests</h1>
|
||||||
<form id="login-form">
|
<form id="login-form">
|
||||||
<label for="username">Username</label>
|
<label for="username">Username</label>
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
import { appContext } from '../core/AppContext'
|
|
||||||
import type { SASjsRequest } from '@sasjs/adapter'
|
import type { SASjsRequest } from '@sasjs/adapter'
|
||||||
|
import { appContext } from '../core/AppContext'
|
||||||
|
import styles from './RequestsModal.css?inline'
|
||||||
|
|
||||||
export class RequestsModal extends HTMLElement {
|
export class RequestsModal extends HTMLElement {
|
||||||
|
private static styleSheet = new CSSStyleSheet()
|
||||||
private shadow: ShadowRoot
|
private shadow: ShadowRoot
|
||||||
private dialog: HTMLDialogElement | null = null
|
private dialog: HTMLDialogElement | null = null
|
||||||
|
|
||||||
|
static {
|
||||||
|
this.styleSheet.replaceSync(styles)
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.shadow = this.attachShadow({ mode: 'open' })
|
this.shadow = this.attachShadow({ mode: 'open' })
|
||||||
|
this.shadow.adoptedStyleSheets = [RequestsModal.styleSheet]
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
@@ -17,10 +24,6 @@ export class RequestsModal extends HTMLElement {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
this.shadow.innerHTML = `
|
this.shadow.innerHTML = `
|
||||||
<link rel="stylesheet" href="${new URL(
|
|
||||||
'./RequestsModal.css',
|
|
||||||
import.meta.url
|
|
||||||
)}">
|
|
||||||
<dialog id="requests-dialog">
|
<dialog id="requests-dialog">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h2 id="modal-title"></h2>
|
<h2 id="modal-title"></h2>
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
import type { TestStatus } from '../types'
|
|
||||||
import type { CompletedTest } from '../core/TestRunner'
|
import type { CompletedTest } from '../core/TestRunner'
|
||||||
|
import type { TestStatus } from '../types'
|
||||||
|
import styles from './TestCard.css?inline'
|
||||||
|
|
||||||
export class TestCard extends HTMLElement {
|
export class TestCard extends HTMLElement {
|
||||||
|
private static styleSheet = new CSSStyleSheet()
|
||||||
private shadow: ShadowRoot
|
private shadow: ShadowRoot
|
||||||
private _testData: CompletedTest | null = null
|
private _testData: CompletedTest | null = null
|
||||||
|
|
||||||
|
static {
|
||||||
|
this.styleSheet.replaceSync(styles)
|
||||||
|
}
|
||||||
|
|
||||||
static get observedAttributes() {
|
static get observedAttributes() {
|
||||||
return ['status', 'execution-time']
|
return ['status', 'execution-time']
|
||||||
}
|
}
|
||||||
@@ -12,6 +18,7 @@ export class TestCard extends HTMLElement {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.shadow = this.attachShadow({ mode: 'open' })
|
this.shadow = this.attachShadow({ mode: 'open' })
|
||||||
|
this.shadow.adoptedStyleSheets = [TestCard.styleSheet]
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
@@ -44,10 +51,6 @@ export class TestCard extends HTMLElement {
|
|||||||
const statusIcon = this.getStatusIcon(status)
|
const statusIcon = this.getStatusIcon(status)
|
||||||
|
|
||||||
this.shadow.innerHTML = `
|
this.shadow.innerHTML = `
|
||||||
<link rel="stylesheet" href="${new URL(
|
|
||||||
'./TestCard.css',
|
|
||||||
import.meta.url
|
|
||||||
)}">
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<span class="status-icon ${status}">${statusIcon}</span>
|
<span class="status-icon ${status}">${statusIcon}</span>
|
||||||
<h3>${test.title}</h3>
|
<h3>${test.title}</h3>
|
||||||
|
|||||||
@@ -1,14 +1,21 @@
|
|||||||
import type { CompletedTestSuite } from '../core/TestRunner'
|
import type { CompletedTestSuite } from '../core/TestRunner'
|
||||||
import { TestCard } from './TestCard'
|
import { TestCard } from './TestCard'
|
||||||
|
import styles from './TestSuite.css?inline'
|
||||||
|
|
||||||
export class TestSuiteElement extends HTMLElement {
|
export class TestSuiteElement extends HTMLElement {
|
||||||
|
private static styleSheet = new CSSStyleSheet()
|
||||||
private shadow: ShadowRoot
|
private shadow: ShadowRoot
|
||||||
private _suiteData: CompletedTestSuite | null = null
|
private _suiteData: CompletedTestSuite | null = null
|
||||||
private _suiteIndex: number = 0
|
private _suiteIndex: number = 0
|
||||||
|
|
||||||
|
static {
|
||||||
|
this.styleSheet.replaceSync(styles)
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.shadow = this.attachShadow({ mode: 'open' })
|
this.shadow = this.attachShadow({ mode: 'open' })
|
||||||
|
this.shadow.adoptedStyleSheets = [TestSuiteElement.styleSheet]
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
@@ -75,10 +82,6 @@ export class TestSuiteElement extends HTMLElement {
|
|||||||
const running = completedTests.filter((t) => t.status === 'running').length
|
const running = completedTests.filter((t) => t.status === 'running').length
|
||||||
|
|
||||||
this.shadow.innerHTML = `
|
this.shadow.innerHTML = `
|
||||||
<link rel="stylesheet" href="${new URL(
|
|
||||||
'./TestSuite.css',
|
|
||||||
import.meta.url
|
|
||||||
)}">
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h2>${name}</h2>
|
<h2>${name}</h2>
|
||||||
<div class="stats">Passed: ${passed} | Failed: ${failed} | Running: ${running}</div>
|
<div class="stats">Passed: ${passed} | Failed: ${failed} | Running: ${running}</div>
|
||||||
|
|||||||
@@ -1,17 +1,24 @@
|
|||||||
|
import { appContext } from '../core/AppContext'
|
||||||
import { TestRunner, type CompletedTestSuite } from '../core/TestRunner'
|
import { TestRunner, type CompletedTestSuite } from '../core/TestRunner'
|
||||||
import type { TestSuite } from '../types'
|
import type { TestSuite } from '../types'
|
||||||
import { appContext } from '../core/AppContext'
|
|
||||||
import { TestSuiteElement } from './TestSuite'
|
import { TestSuiteElement } from './TestSuite'
|
||||||
|
import styles from './TestsView.css?inline'
|
||||||
|
|
||||||
export class TestsView extends HTMLElement {
|
export class TestsView extends HTMLElement {
|
||||||
|
private static styleSheet = new CSSStyleSheet()
|
||||||
private shadow: ShadowRoot
|
private shadow: ShadowRoot
|
||||||
private testRunner: TestRunner | null = null
|
private testRunner: TestRunner | null = null
|
||||||
private _testSuites: TestSuite[] = []
|
private _testSuites: TestSuite[] = []
|
||||||
private debugMode: boolean = false
|
private debugMode: boolean = false
|
||||||
|
|
||||||
|
static {
|
||||||
|
this.styleSheet.replaceSync(styles)
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.shadow = this.attachShadow({ mode: 'open' })
|
this.shadow = this.attachShadow({ mode: 'open' })
|
||||||
|
this.shadow.adoptedStyleSheets = [TestsView.styleSheet]
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
@@ -30,10 +37,6 @@ export class TestsView extends HTMLElement {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
this.shadow.innerHTML = `
|
this.shadow.innerHTML = `
|
||||||
<link rel="stylesheet" href="${new URL(
|
|
||||||
'./TestsView.css',
|
|
||||||
import.meta.url
|
|
||||||
)}">
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>SASjs Adapter Tests</h1>
|
<h1>SASjs Adapter Tests</h1>
|
||||||
<div class="header-controls">
|
<div class="header-controls">
|
||||||
|
|||||||
Reference in New Issue
Block a user