Skip to content

Commit

Permalink
chore: moves unneeded nesting for test file
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyloewen committed Nov 11, 2024
1 parent 60939d3 commit 4d309ee
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 33 deletions.
Empty file.
30 changes: 0 additions & 30 deletions test/unit/renderer/template-rendering.js

This file was deleted.

30 changes: 27 additions & 3 deletions test/unit/vanilla-renderer.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { assert, defineCE, fixture } from '@open-wc/testing';
import { TemplateElement, html } from '../../src/TemplateElement.js';
import { testTemplateRendering } from './renderer/template-rendering.js';

const lightTag = defineCE(
class extends TemplateElement {
Expand Down Expand Up @@ -42,8 +41,6 @@ const noHtmlTag = defineCE(
},
);

testTemplateRendering('vanilla', lightTag, shadowTag, deferTag, noHtmlTag);

class NestedShadowTag extends TemplateElement {
constructor() {
super({ shadowRender: true });
Expand Down Expand Up @@ -107,6 +104,33 @@ class NestingParentTag extends TemplateElement {
}
customElements.define('nesting-parent-tag', NestingParentTag);

describe(`template rendering`, () => {
it('renders template in light dom by default', async () => {
const el = await fixture(`<${lightTag}></${lightTag}>`);
assert.isNull(el.shadowRoot);
assert.lightDom.equal(el, '<div>light content</div>');
});

it('can render template in shadow dom by setting shadowRender: true via constructor options', async () => {
const el = await fixture(`<${shadowTag}></${shadowTag}>`);
assert.isNotNull(el.shadowRoot);
assert.shadowDom.equal(el, '<div>shadow content</div>');
});

it('can defer rendering template by setting deferUpdate: true via constructor options', async () => {
const el = await fixture(`<${deferTag}></${deferTag}>`);
assert.equal(el.innerHTML.trim(), '');
assert.lightDom.equal(el, '');
await el.requestUpdate();
assert.lightDom.equal(el, '<div>deferred content</div>');
});

it('can render standard strings as template instead of html template results', async () => {
const el = await fixture(`<${noHtmlTag}></${noHtmlTag}>`);
assert.lightDom.equal(el, '<div>no html template result content</div>');
});
});

describe(`vanilla-renderer`, () => {
it('can re-render/update slotted templates', async () => {
const el = await fixture(`<slotting-parent-tag></slotting-parent-tag>`);
Expand Down

0 comments on commit 4d309ee

Please sign in to comment.