OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <!-- |
| 3 @license |
| 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 8 Code distributed by Google as part of the polymer project is also |
| 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 10 --> |
| 11 <html> |
| 12 <head> |
| 13 <meta charset="UTF-8"> |
| 14 <title>paper-drawer-panel tests</title> |
| 15 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-
scale=1.0"> |
| 16 |
| 17 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 18 <script src="../../web-component-tester/browser.js"></script> |
| 19 <link rel="import" href="../paper-drawer-panel.html"> |
| 20 </head> |
| 21 <style> |
| 22 body { |
| 23 margin: 0; |
| 24 padding: 0; |
| 25 } |
| 26 </style> |
| 27 <body> |
| 28 |
| 29 <test-fixture id="left-drawer"> |
| 30 <template> |
| 31 <paper-drawer-panel> |
| 32 <div drawer></div> |
| 33 <div main></div> |
| 34 </paper-drawer-panel> |
| 35 </template> |
| 36 </test-fixture> |
| 37 |
| 38 <test-fixture id="right-drawer"> |
| 39 <template> |
| 40 <paper-drawer-panel right-drawer> |
| 41 <div drawer></div> |
| 42 <div main></div> |
| 43 </paper-drawer-panel> |
| 44 </template> |
| 45 </test-fixture> |
| 46 |
| 47 <script> |
| 48 suite('positioning', function() { |
| 49 |
| 50 test('drawer is positioned correctly', function(done) { |
| 51 var f, drawer, main; |
| 52 f = fixture('left-drawer'); |
| 53 drawer = f.$$('#drawer'); |
| 54 main = f.$$('#main'); |
| 55 |
| 56 Polymer.Base.async(function() { |
| 57 var drawerStyle = window.getComputedStyle(drawer); |
| 58 expect(drawerStyle.left).to.be.equal('0px'); |
| 59 try { |
| 60 expect(drawerStyle.right).to.be.equal('auto'); |
| 61 } catch(e) { |
| 62 // Firefox |
| 63 expect(drawerStyle.right).to.be.equal(f.offsetWidth - drawer.offsetW
idth + 'px'); |
| 64 } |
| 65 done(); |
| 66 }); |
| 67 }); |
| 68 |
| 69 test('right-drawer is positioned correctly', function(done) { |
| 70 var f, drawer, main; |
| 71 f = fixture('right-drawer'); |
| 72 drawer = f.$$('#drawer'); |
| 73 main = f.$$('#main'); |
| 74 |
| 75 Polymer.Base.async(function() { |
| 76 var drawerStyle = window.getComputedStyle(drawer); |
| 77 expect(drawerStyle.right).to.be.equal('0px'); |
| 78 |
| 79 try { |
| 80 expect(drawerStyle.left).to.be.equal('auto'); |
| 81 } catch(e) { |
| 82 // Firefox |
| 83 expect(drawerStyle.left).to.be.equal(f.offsetWidth - drawer.offsetWi
dth + 'px'); |
| 84 } |
| 85 |
| 86 done(); |
| 87 }); |
| 88 }); |
| 89 |
| 90 }); |
| 91 </script> |
| 92 </body> |
| 93 </html> |
OLD | NEW |