Index: polymer_0.5.0/bower_components/core-dropdown/test/basic.html |
diff --git a/polymer_0.5.0/bower_components/core-dropdown/test/basic.html b/polymer_0.5.0/bower_components/core-dropdown/test/basic.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1f9a114042a1b3ed48fdde5556df042b7df2076e |
--- /dev/null |
+++ b/polymer_0.5.0/bower_components/core-dropdown/test/basic.html |
@@ -0,0 +1,162 @@ |
+<!doctype html> |
+<!-- |
+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"> |
+ <title>core-dropdown basic tests</title> |
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> |
+ |
+ <script src="../../webcomponentsjs/webcomponents.js"></script> |
+ <script src="../../web-component-tester/browser.js"></script> |
+ |
+ <link href="../core-dropdown.html" rel="import"> |
+ |
+ <style> |
+ body { |
+ text-align: center; |
+ margin-top: 200px; |
+ } |
+ </style> |
+ |
+</head> |
+<body> |
+ |
+ <div relative id="trigger1"> |
+ tap |
+ <core-dropdown id="dropdown1">Hello World!</core-dropdown> |
+ </div> |
+ |
+ <div relative id="trigger2"> |
+ tap |
+ <core-dropdown id="dropdown2" valign="bottom">Hello World!</core-dropdown> |
+ </div> |
+ |
+ <div relative id="trigger3"> |
+ tap |
+ <core-dropdown id="dropdown3" halign="right">Hello World!</core-dropdown> |
+ </div> |
+ |
+ <div relative id="trigger4"> |
+ tap |
+ <core-dropdown id="dropdown4" layered>Hello World!</core-dropdown> |
+ </div> |
+ |
+ <div relative id="trigger5"> |
+ tap |
+ <core-dropdown id="dropdown5" layered valign="bottom">Hello World!</core-dropdown> |
+ </div> |
+ |
+ <div relative id="trigger6"> |
+ tap |
+ <core-dropdown id="dropdown6" layered halign="right">Hello World!</core-dropdown> |
+ </div> |
+ |
+ <script> |
+ |
+ function approxEqual(a, b) { |
+ return assert.equal(Math.round(a), Math.round(b)); |
+ } |
+ |
+ function assertPosition(dropdown, trigger) { |
+ var dr = dropdown.getBoundingClientRect(); |
+ var tr = trigger.getBoundingClientRect(); |
+ |
+ if (dropdown.halign === 'left') { |
+ approxEqual(dr.left, tr.left); |
+ } else { |
+ approxEqual(dr.right, tr.right); |
+ } |
+ |
+ if (dropdown.valign === 'top') { |
+ approxEqual(dr.top, tr.top); |
+ } else { |
+ approxEqual(dr.bottom, tr.bottom); |
+ } |
+ }; |
+ |
+ function flushLayoutAndRender(callback) { |
+ flush(function() { |
+ document.body.offsetTop; |
+ requestAnimationFrame(function() { |
+ callback(); |
+ }); |
+ }); |
+ } |
+ |
+ var d1 = document.getElementById('dropdown1'); |
+ var t1 = document.getElementById('trigger1'); |
+ |
+ var d2 = document.getElementById('dropdown2'); |
+ var t2 = document.getElementById('trigger2'); |
+ |
+ var d3 = document.getElementById('dropdown3'); |
+ var t3 = document.getElementById('trigger3'); |
+ |
+ var d4 = document.getElementById('dropdown4'); |
+ var t4 = document.getElementById('trigger4'); |
+ |
+ var d5 = document.getElementById('dropdown5'); |
+ var t5 = document.getElementById('trigger5'); |
+ |
+ var d6 = document.getElementById('dropdown6'); |
+ var t6 = document.getElementById('trigger6'); |
+ |
+ test('default', function(done) { |
+ d1.opened = true; |
+ flushLayoutAndRender(function() { |
+ assertPosition(d1, t1); |
+ done(); |
+ }); |
+ }); |
+ |
+ test('bottom alignment', function(done) { |
+ d2.opened = true; |
+ flushLayoutAndRender(function() { |
+ assertPosition(d2, t2); |
+ done(); |
+ }); |
+ }); |
+ |
+ test('right alignment', function(done) { |
+ d3.opened = true; |
+ flushLayoutAndRender(function() { |
+ assertPosition(d3, t3); |
+ done(); |
+ }); |
+ }); |
+ |
+ test('layered', function(done) { |
+ d4.opened = true; |
+ flushLayoutAndRender(function() { |
+ assertPosition(d4, t4); |
+ done(); |
+ }); |
+ }); |
+ |
+ test('layered, bottom alignment', function(done) { |
+ d5.opened = true; |
+ flushLayoutAndRender(function() { |
+ assertPosition(d5, t5); |
+ done(); |
+ }); |
+ }); |
+ |
+ test('layered, right alignment', function(done) { |
+ d6.opened = true; |
+ flushLayoutAndRender(function() { |
+ assertPosition(d6, t6); |
+ done(); |
+ }); |
+ }); |
+ |
+ </script> |
+ |
+</body> |
+</html> |