UNPKG

five-bells-visualization

Version:
94 lines (73 loc) 2.39 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="behaviors-elements.html"> <body> <script> suite('single behavior element', function() { var el; setup(function() { el = document.createElement('single-behavior'); document.body.appendChild(el); }); teardown(function() { document.body.removeChild(el); }); test('ready from behavior', function() { assert.equal(el.__readyA, true); }); test('properties from behavior', function() { el.label = 'foo'; assert.equal(el.__label, 'foo'); }); test('listener from behavior', function() { el.fire('change', {value: 'bar'}); assert.equal(el.__change, 'bar'); }); }); suite('multi-behaviors element', function() { var el; setup(function() { el = document.createElement('multi-behaviors'); document.body.appendChild(el); }); teardown(function() { document.body.removeChild(el); }); test('ready from behaviors', function() { assert.equal(el.__readyA, true); assert.equal(el.__readyB, true); }); test('properties from behaviors', function() { el.label = 'foo'; assert.equal(el.__label, 'foo'); el.disabled = true; assert.equal(el.__disabled, true); }); test('properties from itself', function() { assert.isDefined(el._setFoo, 'readOnly setter not available'); el._setFoo('bar'); assert.equal(el.__foo, 'bar', 'observer not getting called'); assert.equal(el.getAttribute('foo'), 'bar', 'not getting reflected'); }); test('listener from behaviors', function() { el.fire('change', {value: 'bar'}); assert.equal(el.__change, 'bar'); }); }); </script> </body> </html>