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

20 lines
548 B

import * as assert from 'assert';
import CustomElement from './main.svelte';
export default function (target) {
target.innerHTML = '<p>unstyled</p>';
new CustomElement({
target
});
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)');
}