Re-enable index-basics-workers test to see if still times
[chromium-blink-merge.git] / tools / cc-frame-viewer / src / ui / list_view_test.html
blob2ecc6fc76e18f6844c13b8617cff56413a8fe6f9
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 Copyright (c) 2012 The Chromium Authors. All rights reserved.
5 Use of this source code is governed by a BSD-style license that can be
6 found in the LICENSE file.
7 -->
8 <head>
9 <script src="../base.js"></script>
10 <script>
11 base.require('base.unittest');
12 base.require('ui.list_view');
13 </script>
14 </head>
15 <body>
16 <script>
17 'use strict';
19 var ListView = ui.ListView;
21 function testInstantiate() {
22 var view = new ListView();
23 var i1 = view.addItem('item 1');
24 var i2 = view.addItem('item 2');
25 var i3 = view.addItem('item 3');
26 this.addHTMLOutput('basic-list-view', view);
27 i1.click();
30 function testProgrammaticSelection() {
31 var view = new ListView();
32 var i1 = view.addItem('item 1');
33 var i2 = view.addItem('item 2');
34 var i3 = view.addItem('item 3');
35 this.addHTMLOutput('programmatic selection', view);
36 i2.selected = true;
37 assertTrue(i2.hasAttribute('selected'));
38 i3.selected = true;
39 assertFalse(i2.hasAttribute('selected'));
40 assertTrue(i3.hasAttribute('selected'));
43 function testSelectionEvents() {
44 var view = new ListView();
45 var didSelectionChange = 0;
46 view.addEventListener('selection-changed', function() {
47 didSelectionChange = true;
48 });
49 var i1 = view.addItem('item 1');
50 var i2 = view.addItem('item 2');
51 var i3 = view.addItem('item 3');
53 didSelectionChange = false;
54 i2.selected = true;
55 assertTrue(didSelectionChange);
57 didSelectionChange = false;
58 view.removeChild(i2);
59 assertTrue(didSelectionChange);
62 </script>
63 </body>
64 </html>