OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('downloads.layout_tests', function() { | 5 cr.define('downloads.layout_tests', function() { |
6 function registerTests() { | 6 function registerTests() { |
7 suite('LayoutTests', function() { | 7 suite('LayoutTests', function() { |
8 /** @type {!downloads.Manager} */ | 8 /** @type {!downloads.Manager} */ |
9 var manager; | 9 var manager; |
10 | 10 |
11 setup(function() { | 11 setup(function() { |
12 PolymerTest.clearBody(); | 12 PolymerTest.clearBody(); |
13 manager = document.createElement('downloads-manager'); | 13 manager = document.createElement('downloads-manager'); |
14 document.body.appendChild(manager); | 14 document.body.appendChild(manager); |
15 }); | 15 }); |
16 | 16 |
17 test('long URLs ellide', function() { | 17 test('long URLs ellide', function() { |
18 manager.updateAll_([{ | 18 manager.insertItems_(0, [{ |
dpapad
2015/11/24 18:42:33
Nit: Can you avoid referring to private method by
Dan Beam
2015/11/25 04:06:37
Done.
| |
19 file_name: 'file name', | 19 file_name: 'file name', |
20 state: downloads.States.COMPLETE, | 20 state: downloads.States.COMPLETE, |
21 url: 'a'.repeat(10000), | 21 url: 'a'.repeat(1000), |
22 }]); | 22 }]); |
23 | 23 |
24 Polymer.dom.flush(); | 24 Polymer.dom.flush(); |
25 | 25 |
26 var item = manager.$$('downloads-item'); | 26 var item = manager.$$('downloads-item'); |
27 assertLT(item.$$('#url').offsetWidth, item.offsetWidth); | 27 assertLT(item.$$('#url').offsetWidth, item.offsetWidth); |
28 }); | 28 }); |
29 }); | 29 }); |
30 } | 30 } |
31 | 31 |
32 return { | 32 return { |
33 registerTests: registerTests, | 33 registerTests: registerTests, |
34 }; | 34 }; |
35 }); | 35 }); |
OLD | NEW |