forked from ionic-team/stencil
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(runtime): add root scope id to the nested child as classname
sass compiler adds root scope id to the nested child elements too, therefore nested element selectors are not working from the root component since the root scope id is not adding as classname to the nested children elements ionic-team#5702
- Loading branch information
Showing
8 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
:host { | ||
cmp-level-2 { | ||
cmp-level-3 { | ||
padding: 32px; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Component, h } from '@stencil/core'; | ||
|
||
@Component({ | ||
tag: 'cmp-level-1', | ||
styleUrl: 'cmp-level-1.scss', | ||
shadow: false, | ||
scoped: true, | ||
}) | ||
export class CmpLevel1 { | ||
render() { | ||
return <cmp-level-2></cmp-level-2>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Component, h } from '@stencil/core'; | ||
|
||
@Component({ | ||
tag: 'cmp-level-2', | ||
shadow: false, | ||
scoped: true, | ||
}) | ||
export class CmpLevel2 { | ||
render() { | ||
return ( | ||
<cmp-level-3> | ||
<slot /> | ||
</cmp-level-3> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:host { | ||
padding: 8px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Component, h } from '@stencil/core'; | ||
|
||
@Component({ | ||
tag: 'cmp-level-3', | ||
styleUrl: 'cmp-level-3.scss', | ||
shadow: false, | ||
scoped: true, | ||
}) | ||
export class CmpLevel3 { | ||
render() { | ||
return ( | ||
<div> | ||
<slot>DEFAULT</slot> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { h } from '@stencil/core'; | ||
import { render } from '@wdio/browser-runner/stencil'; | ||
|
||
describe('scope-id-in-nested-classname', function () { | ||
beforeEach(() => { | ||
render({ | ||
template: () => <cmp-level-1></cmp-level-1>, | ||
}); | ||
}); | ||
|
||
it('should have root scope id in the nested element as classname', async () => { | ||
await expect($('cmp-level-3')).toHaveElementClass('sc-cmp-level-1'); | ||
}); | ||
}); |