mirror of https://github.com/sveltejs/svelte
This is an attempt to fix #4313 which demonstrates that incorrect css can be produced when two components have the same style rules and the first component to be included has unused selectors.pull/4326/head
parent
efe8ab9ca5
commit
8f2e39b324
@ -0,0 +1,10 @@
|
||||
<div class="component-1 red"> Red </div>
|
||||
|
||||
<style>
|
||||
.red {
|
||||
background: red;
|
||||
}
|
||||
.yellow {
|
||||
background: yellow;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,11 @@
|
||||
<div class="component-2 red"> Red </div>
|
||||
<div class="component-2 yellow"> Yellow </div>
|
||||
|
||||
<style>
|
||||
.red {
|
||||
background: red;
|
||||
}
|
||||
.yellow {
|
||||
background: yellow;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,10 @@
|
||||
export default {
|
||||
test({ assert, component, target, window }) {
|
||||
const [component_one_red] = target.querySelectorAll('.component-1');
|
||||
const [component_two_red, component_two_yellow] = target.querySelectorAll('.component-2');
|
||||
|
||||
assert.equal(window.getComputedStyle(component_one_red).background, 'red');
|
||||
assert.equal(window.getComputedStyle(component_two_red).background, 'red');
|
||||
assert.equal(window.getComputedStyle(component_two_yellow).background, 'yellow');
|
||||
}
|
||||
};
|
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
import Component1 from './Component1.svelte'
|
||||
import Component2 from './Component2.svelte'
|
||||
</script>
|
||||
|
||||
<Component1 />
|
||||
<Component2 />
|
Loading…
Reference in new issue