A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
test: sse-connection web-component
Christian Feicaa5814626b5
diff --git a/client/components/sse-connection.js b/client/components/sse-connection.jsindex 5f45ad4..1532935 100644--- a/client/components/sse-connection.js+++ b/client/components/sse-connection.js@@ -15,7 +15,6 @@ class SSEConnection extends HTMLElement {render (connected = false) {if (connected) this.classList.add('connected')else this.classList.remove('connected')- console.log('SSE Connection: ', window.eventSource)this.innerHTML = /* html */''}}diff --git a/client/test/sse-connection.test.js b/client/test/sse-connection.test.jsnew file mode 100644index 0000000..8c70edc--- /dev/null+++ b/client/test/sse-connection.test.js@@ -0,0 +1,23 @@+/* global describe, it */+import { fixture, html } from '@open-wc/testing'+import { expect } from '@esm-bundle/chai'++import '../components/sse-connection.js'++describe('sse-connection', () => {+ it('not connected', async () => {+ const el = await fixture(html`+ <sse-connection></sse-connection>+ `)++ expect(el.classList.contains('connected')).eq(false)+ })+ it('connected', async () => {+ window.eventSource = { readyState: 'OPEN' }+ const el = await fixture(html`+ <sse-connection></sse-connection>+ `)++ expect(el.classList.contains('connected')).eq(true)+ })+})