summaryrefslogtreecommitdiff
path: root/packages/integrations/lit/test
diff options
context:
space:
mode:
authorGravatar Elliott Marquez <5981958+e111077@users.noreply.github.com> 2023-03-29 09:43:40 -0700
committerGravatar GitHub <noreply@github.com> 2023-03-29 12:43:40 -0400
commit4b077318fbc21c4350cc21c380d96b54d302759c (patch)
tree445c8da37d52782bea038581aed4cbf14cd50e46 /packages/integrations/lit/test
parentf0b732d326c609208f30485b9805a84a321a870e (diff)
downloadastro-4b077318fbc21c4350cc21c380d96b54d302759c.tar.gz
astro-4b077318fbc21c4350cc21c380d96b54d302759c.tar.zst
astro-4b077318fbc21c4350cc21c380d96b54d302759c.zip
Update lit-ssr dependency (#6681)
* update lit-ssr dependency * delete unnecessary lit shim checks * delete another unused lit shim feature * fix sass build * bump lit and polyfill versions to match ssr req * shim HTMLElement in test * remove lit global shim workarounds * re-shim Astro's ce.define * remove fix window test and shim HTML Element * Update .changeset/gold-windows-fly.md Co-authored-by: Augustine Kim <ajk830@gmail.com> * fix window check test * implement suggestoins --------- Co-authored-by: Augustine Kim <ajk830@gmail.com>
Diffstat (limited to 'packages/integrations/lit/test')
-rw-r--r--packages/integrations/lit/test/server.test.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/integrations/lit/test/server.test.js b/packages/integrations/lit/test/server.test.js
index 315937401..51e083241 100644
--- a/packages/integrations/lit/test/server.test.js
+++ b/packages/integrations/lit/test/server.test.js
@@ -1,6 +1,8 @@
import { expect } from 'chai';
-import server from '../server.js';
import { LitElement, html } from 'lit';
+// Must come after lit import because @lit/reactive-element defines
+// globalThis.customElements which the server shim expects to be defined.
+import server from '../server.js';
import * as cheerio from 'cheerio';
const { check, renderToStaticMarkup } = server;
@@ -12,6 +14,10 @@ describe('check', () => {
it('should be false with a registered non-lit component', async () => {
const tagName = 'non-lit-component';
+ // Lit no longer shims HTMLElement globally, so we need to do it ourselves.
+ if (!globalThis.HTMLElement) {
+ globalThis.HTMLElement = class {};
+ }
customElements.define(tagName, class TestComponent extends HTMLElement {});
expect(await check(tagName)).to.equal(false);
});
@@ -85,7 +91,7 @@ describe('renderToStaticMarkup', () => {
});
it('should render DSD attributes based on shadowRootOptions', async () => {
- const tagName = 'lit-component';
+ const tagName = 'shadow-root-options-component';
customElements.define(
tagName,
class extends LitElement {