From d18958943f59d0047b558fdada3b53bebd158e08 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Thu, 3 Mar 2022 09:15:38 -0500 Subject: [PATCH] Remove the lit-element test --- packages/astro/package.json | 2 +- packages/astro/test/lit-element.test.js | 82 ------------------------- 2 files changed, 1 insertion(+), 83 deletions(-) delete mode 100644 packages/astro/test/lit-element.test.js diff --git a/packages/astro/package.json b/packages/astro/package.json index dde380791..9d47cbb75 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -52,7 +52,7 @@ "dev": "astro-scripts dev \"src/**/*.ts\"", "postbuild": "astro-scripts copy \"src/**/*.astro\"", "benchmark": "node test/benchmark/dev.bench.js && node test/benchmark/build.bench.js", - "test": "mocha --parallel --timeout 15000 --ignore **/lit-element.test.js && mocha **/lit-element.test.js", + "test": "mocha --parallel --timeout 15000", "test:match": "mocha --timeout 15000 -g" }, "dependencies": { diff --git a/packages/astro/test/lit-element.test.js b/packages/astro/test/lit-element.test.js deleted file mode 100644 index 395eaf2e5..000000000 --- a/packages/astro/test/lit-element.test.js +++ /dev/null @@ -1,82 +0,0 @@ -import { expect } from 'chai'; -import cheerio from 'cheerio'; -import { loadFixture } from './test-utils.js'; - -describe('LitElement test', function () { - this.timeout(30000); - - let fixture; - - const NODE_VERSION = parseFloat(process.versions.node); - const stripExpressionMarkers = (html) => html.replace(//g, ''); - - before(async () => { - // @lit-labs/ssr/ requires Node 13.9 or higher - if (NODE_VERSION < 13.9) { - return; - } - fixture = await loadFixture({ - projectRoot: './fixtures/lit-element/', - renderers: ['@astrojs/renderer-lit'], - }); - await fixture.build(); - }); - - it('Renders a custom element by tag name', async () => { - // @lit-labs/ssr/ requires Node 13.9 or higher - if (NODE_VERSION < 13.9) { - return; - } - const html = await fixture.readFile('/index.html'); - const $ = cheerio.load(html); - - // test 1: attributes rendered – non reactive properties - expect($('my-element').attr('foo')).to.equal('bar'); - - // test 2: shadow rendered - expect($('my-element').html()).to.include(`
Testing...
`); - - // test 3: string reactive property set - expect(stripExpressionMarkers($('my-element').html())).to.include(`
initialized
`); - - // test 4: boolean reactive property correctly set - // Lit will equate to true because it uses - // this.hasAttribute to determine its value - expect(stripExpressionMarkers($('my-element').html())).to.include(`
B
`); - - // test 5: object reactive property set - // by default objects will be stringifed to [object Object] - expect(stripExpressionMarkers($('my-element').html())).to.include(`
data: 1
`); - - // test 6: reactive properties are not rendered as attributes - expect($('my-element').attr('obj')).to.equal(undefined); - expect($('my-element').attr('bool')).to.equal(undefined); - expect($('my-element').attr('str')).to.equal(undefined); - - // test 7: reflected reactive props are rendered as attributes - expect($('my-element').attr('reflectedbool')).to.equal(''); - expect($('my-element').attr('reflected-str')).to.equal('default reflected string'); - expect($('my-element').attr('reflected-str-prop')).to.equal('initialized reflected'); - }); - - // Skipped because not supported by Lit - it.skip('Renders a custom element by the constructor', async () => { - const html = await fixture.fetch('/ctr/index.html'); - const $ = cheerio.load(html); - - // test 1: attributes rendered - expect($('my-element').attr('foo')).to.equal('bar'); - - // test 2: shadow rendered - expect($('my-element').html()).to.include(`
Testing...
`); - }); -}); - -after(async () => { - // The Lit renderer adds browser globals that interfere with other tests, so remove them now. - const globals = Object.keys(globalThis.window || {}); - globals.splice(globals.indexOf('global'), 1); - for (let name of globals) { - delete globalThis[name]; - } -});