UNPKG

five-bells-visualization

Version:
88 lines (72 loc) 2.76 kB
<!doctype html> <!-- @license Copyright (c) 2015 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"> <link rel="import" href="utils-elements.html"> </head> <body> <x-content id="elt1"> </x-content> <x-content id="elt2"> <div></div> <div></div> <div></div> </x-content> <x-content-multi id="elt3"> <span></span> <div></div> <span></span> <div></div> <div></div> <span></span> <span></span> </x-content-multi> <script> suite('content utils', function() { var elt1 = document.querySelector('#elt1'); var elt2 = document.querySelector('#elt2'); var elt3 = document.querySelector('#elt3'); test('getContentChildNodes (empty)', function() { var nodes = elt1.getContentChildNodes(); assert.equal(nodes.length, 1, 'should have 1 text node'); }); test('getContentChildren (empty)', function() { var nodes = elt1.getContentChildren(); assert.equal(nodes.length, 0, 'should have no children'); }); test('getContentChildNodes', function() { var nodes = elt2.getContentChildNodes(); assert.equal(nodes.length, 7, 'should have 7 nodes (text nodes + divs)'); }); test('getContentChildren', function() { var nodes = elt2.getContentChildren(); assert.equal(nodes.length, 3, 'should have 3 divs'); }); test('getContentChildNodes with selector', function() { var nodes = elt3.getContentChildNodes('[select=div]'); assert.equal(nodes.length, 3, 'should have 3 divs'); nodes = elt3.getContentChildNodes('[select=span]'); assert.equal(nodes.length, 4, 'should have 4 spans'); }); test('getContentChildren with selector', function() { var nodes = elt3.getContentChildren('[select=div]'); assert.equal(nodes.length, 3, 'should have 3 divs'); nodes = elt3.getContentChildren('[select=span]'); assert.equal(nodes.length, 4, 'should have 4 spans'); }); }); </script> </body> </html>