You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/custom-elements/samples/new-styled/test.js

19 lines
608 B

import * as assert from 'assert';
import { tick } from 'svelte';
import './main.svelte';
export default async function (target) {
target.innerHTML = '<p>unstyled</p>';
target.appendChild(document.createElement('custom-element'));
await tick();
const unstyled = target.querySelector('p');
const styled = target.querySelector('custom-element').shadowRoot.querySelector('p');
assert.equal(unstyled.textContent, 'unstyled');
assert.equal(styled.textContent, 'styled');
assert.equal(getComputedStyle(unstyled).color, 'rgb(0, 0, 0)');
assert.equal(getComputedStyle(styled).color, 'rgb(255, 0, 0)');
}