-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix style scope issues in dynamically named slotted items
- Loading branch information
1 parent
2aa9780
commit 04db925
Showing
4 changed files
with
79 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<link rel="import" href="../../polymer/polymer-element.html"> | ||
<link rel="import" href="../../polymer/lib/utils/flattened-nodes-observer.html"> | ||
|
||
<dom-module id="observer-component"> | ||
<template> | ||
<style> | ||
.bluetext { | ||
color: rgb(0, 0, 255); | ||
} | ||
</style> | ||
</template> | ||
</dom-module> | ||
|
||
<script> | ||
class ObserverComponent extends Polymer.Element { | ||
|
||
static get is() { | ||
return 'observer-component'; | ||
} | ||
|
||
ready() { | ||
super.ready(); | ||
this._observer = new Polymer.FlattenedNodesObserver(this, info => { | ||
this._blueText = document.createElement('div'); | ||
this._blueText.classList.add('bluetext'); | ||
this._blueText.innerHTML = 'blue'; | ||
this.shadowRoot.appendChild(this._blueText); | ||
}); | ||
} | ||
|
||
getTextColor() { | ||
return getComputedStyle(this._blueText).color; | ||
} | ||
} | ||
|
||
customElements.define(ObserverComponent.is, ObserverComponent); | ||
</script> |
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,36 @@ | ||
<!doctype html> | ||
|
||
<html> | ||
<head> | ||
<title>vaadin-split-layout test</title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> | ||
<script src="../../web-component-tester/browser.js"></script> | ||
<link rel="import" href="./observer-component.html"> | ||
<link rel="import" href="../vaadin-split-layout.html"> | ||
</head> | ||
<body> | ||
|
||
<vaadin-split-layout> | ||
<observer-component> | ||
<div></div> | ||
</observer-component> | ||
<div>Bar</div> | ||
<div id="invisible">Baz</div> | ||
</vaadin-split-layout> | ||
|
||
<script> | ||
describe('style scope', () => { | ||
it('should have the right style scope', () => { | ||
const observerComponent = document.querySelector('observer-component'); | ||
expect(observerComponent.getTextColor()).to.equal('rgb(0, 0, 255)'); | ||
}); | ||
|
||
it('should only display two elements', () => { | ||
const invisible = document.querySelector('#invisible'); | ||
expect(invisible.clientHeight).to.equal(0); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
window.VaadinSplitLayoutSuites = [ | ||
'vaadin-split-layout_test.html' | ||
'vaadin-split-layout_test.html', | ||
'style-scope.html', | ||
]; |