UNPKG

five-bells-visualization

Version:
90 lines (71 loc) 2.1 kB
<!doctype html> <!-- @license Copyright (c) 2014 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <html> <head> <meta charset="utf-8"> <script src="../../../webcomponentsjs/webcomponents-lite.js"></script> <script src="../../../web-component-tester/browser.js"></script> <link rel="import" href="../../polymer.html"> <style is="x-style"> x-bar { border: 1px solid red; display: block; } x-foo::shadow #bar2 { border: 2px solid orange; display: block; } </style> </head> <body> <x-bar></x-bar> <x-foo></x-foo> <dom-module id="x-foo"> <template> <div>x-foo</div> <x-bar id="bar1"></x-bar> <x-bar id="bar2"></x-bar> </template> </dom-module> <dom-module id="x-bar"> <template> <div>x-bar</div> </template> </dom-module> <script> suite('x-style', function() { suiteSetup(function() { Polymer({ is: 'x-bar' }); Polymer({ is: 'x-foo' }); xBar = document.querySelector('x-bar'); xFoo = document.querySelector('x-foo'); }); test('root styles applied', function() { assertComputed(xBar, '1px'); }); test('root styles have lower bound encapsulation', function() { assertComputed(xFoo.$.bar1, '0px'); }); test('::shadow styles applied', function() { assertComputed(xFoo.$.bar2, '2px'); }); }); function assertComputed(element, value) { var computed = getComputedStyle(element); assert.equal(computed['border-top-width'], value, 'computed style incorrect'); } </script> </body> </html>