-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from ebidel/resetStyleInheritance-feature
Fixes issue #199 - adds support for resetStyleInheritance on prototype
- Loading branch information
Showing
3 changed files
with
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright 2013 The Polymer Authors. All rights reserved. | ||
Use of this source code is governed by a BSD-style | ||
license that can be found in the LICENSE file. | ||
--> | ||
<html> | ||
<head> | ||
<title>applyAuthorStyles / resetStyleInheirtance</title> | ||
<script src="../../../polymer.js"></script> | ||
<script src="../../../tools/test/htmltest.js"></script> | ||
<script src="../../../node_modules/chai/chai.js"></script> | ||
<style> | ||
body { | ||
color: rgb(255, 0, 0); | ||
font-size: 100px; | ||
} | ||
div { | ||
color: rgb(0, 255, 0); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<x-test></x-test> | ||
|
||
<polymer-element name="x-test"> | ||
<template><div id="div">I should be small and green</div></template> | ||
<script> | ||
Polymer('x-test', { | ||
applyAuthorStyles: true, | ||
resetStyleInheritance: true, | ||
ready: function() { | ||
this.appliedAuthorStyles = this.shadowRoot.applyAuthorStyles; | ||
this.appliedResetStyles = this.shadowRoot.resetStyleInheritance; | ||
} | ||
}); | ||
</script> | ||
</polymer-element> | ||
|
||
<script> | ||
document.addEventListener('WebComponentsReady', function() { | ||
var test = document.querySelector('x-test'); | ||
chai.assert.isTrue(test.appliedAuthorStyles, 'applyAuthorStyles applied'); | ||
chai.assert.isTrue(test.appliedResetStyles, 'resetStyleInheritance applied'); | ||
chai.assert.equal(getComputedStyle(test).color, 'rgb(255, 0, 0)', | ||
'author styles applied correctly'); | ||
chai.assert.equal(getComputedStyle(test.$.div).color, 'rgb(0, 255, 0)', | ||
'styles reset correctly'); | ||
chai.assert.notEqual(parseInt(getComputedStyle(test.$.div).fontSize), 100, | ||
'styles reset correctly'); | ||
done(); | ||
}); | ||
</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