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