~/talk

Testing native js web components

Talkat dotJS 2019 · 2019-12-05..12-06· [testing, web-platform]
slides:none on file

Shows how to test native JavaScript web components without a browser by mocking the DOM: jsdom lacks web components support so the solution treats window as an injected third‑party, supplying it via webpack externals, rollup globals or a window.mjs shim. Builds a minimal mock: attachShadow sets shadowRoot to a div and a tiny customElements registry that gets defined then frozen so tests cannot mutate it. Includes runnable examples for Jasmine, Mocha, and Jest with webpack, Rollup and ESM.

AI-written summary · about

  1. 0:00Introduction
  2. 0:28Web Components
  3. 0:52Custom Elements
  4. 1:14JSM
  5. 1:31Window
  6. 1:46Webpack
  7. 2:16Window MJS
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.