| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/tracing/base/task.html"> | 8 <link rel="import" href="/tracing/base/task.html"> |
| 9 <link rel="import" href="/tracing/ui/base/resize_sensor.html"> | 9 <link rel="import" href="/tracing/ui/base/resize_sensor.html"> |
| 10 | 10 |
| 11 <script> | 11 <script> |
| 12 'use strict'; | 12 'use strict'; |
| 13 | 13 |
| 14 tr.b.unittest.testSuite(function() { | 14 tr.b.unittest.testSuite(function() { |
| 15 function forceLayout(element) { | 15 function forceLayout(element) { |
| 16 element.offsetHeight; | 16 element.offsetHeight; |
| 17 } | 17 } |
| 18 | 18 |
| 19 test('instantiate', function() { | 19 test('instantiate', function() { |
| 20 var sensor = document.createElement('tr-ui-b-resize-sensor'); | 20 var sensor = document.createElement('tr-ui-b-resize-sensor'); |
| 21 sensor.appendChild(document.createTextNode('hello')); | 21 Polymer.dom(sensor).appendChild(document.createTextNode('hello')); |
| 22 | 22 |
| 23 var resizeCount = 0; | 23 var resizeCount = 0; |
| 24 function onResize(event) { | 24 function onResize(event) { |
| 25 resizeCount += 1; | 25 resizeCount += 1; |
| 26 } | 26 } |
| 27 | 27 |
| 28 this.addHTMLOutput(sensor); | 28 this.addHTMLOutput(sensor); |
| 29 forceLayout(sensor); | 29 forceLayout(sensor); |
| 30 sensor.addEventListener('resize', onResize); | 30 sensor.addEventListener('resize', onResize); |
| 31 | 31 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 47 forceLayout(sensor); | 47 forceLayout(sensor); |
| 48 window.requestAnimationFrame(function() { | 48 window.requestAnimationFrame(function() { |
| 49 assert.equal(1, resizeCount); | 49 assert.equal(1, resizeCount); |
| 50 resolve(); | 50 resolve(); |
| 51 }); | 51 }); |
| 52 }); | 52 }); |
| 53 }); | 53 }); |
| 54 }); | 54 }); |
| 55 }); | 55 }); |
| 56 </script> | 56 </script> |
| OLD | NEW |