mirror of https://github.com/sveltejs/svelte
Merge f1e47e5faa
into cf01e0a91e
commit
75aacff703
@ -0,0 +1,7 @@
|
||||
<p>test</p>
|
||||
|
||||
<style>
|
||||
p {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
@ -1,21 +1,19 @@
|
||||
export default {
|
||||
test ( assert, component, target, window ) {
|
||||
const testStyles = ([control, test]) => {
|
||||
assert.equal( window.getComputedStyle( control ).color, 'blue' );
|
||||
assert.equal( window.getComputedStyle( test ).color, 'red' );
|
||||
};
|
||||
|
||||
const iframe = window.document.createElement('iframe');
|
||||
window.document.body.appendChild(iframe);
|
||||
|
||||
const otherTarget = iframe.contentWindow.document.body;
|
||||
|
||||
new component.constructor({
|
||||
target: otherTarget
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
window.getComputedStyle(target.querySelector('h1')).color,
|
||||
'rgb(255, 0, 0)'
|
||||
);
|
||||
assert.equal(
|
||||
window.getComputedStyle(otherTarget.querySelector('h1')).color,
|
||||
'rgb(255, 0, 0)'
|
||||
);
|
||||
testStyles(target.querySelectorAll( 'p' ));
|
||||
testStyles(otherTarget.querySelectorAll( 'p' ));
|
||||
}
|
||||
};
|
||||
|
@ -1,6 +1,18 @@
|
||||
<h1>Just some static HTML</h1>
|
||||
<p>control</p>
|
||||
<div>
|
||||
<Widget/>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
color: rgb(255, 0, 0);
|
||||
}
|
||||
p {
|
||||
color: blue;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import Widget from './Widget.html';
|
||||
|
||||
export default {
|
||||
components: { Widget }
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in new issue