@@ -47,6 +47,22 @@ config file for this to work.
4747
4848#### ` ssrFixture `
4949
50+ Signature
51+
52+ ` ssrFixture<T extends HTMLElement>(template, options): T `
53+
54+ - ` template: TemplateResult ` - Lit template to be rendered. It must contain a
55+ single top level element.
56+ - ` options: object ` - Options object containing the following properties
57+ - ` modules: string[] ` - Relative paths to modules to be loaded before
58+ rendering. Usually will contain custom element definitions.
59+ - ` base?: string ` - Base location for resolving module paths provided. If not
60+ provided, the call site will be treated as the base effectively making it
61+ the same as providing ` import.meta.url ` .
62+ - ` hydrate?: boolean ` - Whether to hydrate the template after being loaded to
63+ the browser. Defaults to true if omitted.
64+ - Returns the top level element rendered in the document.
65+
5066Example
5167
5268``` js
@@ -58,9 +74,9 @@ import {assert} from '@esm-bundle/chai';
5874suite (' my-element' , () => {
5975 test (' is rendered server-side' , async () => {
6076 const el = await ssrFixture (html ` <my-element ></my-element >` , {
61- modules: [' ./my-element.js' ], // relative path to component definition
62- base: import .meta.url, // base for resolving module path (default: test file path)
63- hydrate: false , // whether to hydrate the component after loading the document (default: true)
77+ modules: [' ./my-element.js' ],
78+ base: ' http://localhost:8000/dist/components/ ' ,
79+ hydrate: false ,
6480 });
6581 assert .equal (el .shadowRoot .querySelector (' p' ).textContent , ' Hello, World!' );
6682 });
0 commit comments