(test) update test to account for child components

pull/366/head
Cristian Necula 9 years ago
parent 7525d6417d
commit f6591eb76b

@ -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…
Cancel
Save