Do not announce robot account token before account ID is available
[chromium-blink-merge.git] / chrome / test / data / webui / list_single_selection_model_test.html
blobaf006d5fc20f307b5b92fabf23262f1e5b033c36
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="list_selection_model_test_util.js"></script>
5 </head>
6 <body>
8 <script>
10 function createSelectionModel(len, opt_dependentLeadItem) {
11 var sm = new cr.ui.ListSingleSelectionModel(len);
12 sm.independentLeadItem_ = !opt_dependentLeadItem;
13 return sm;
16 function testAdjust1() {
17 var sm = createSelectionModel(200);
19 sm.leadIndex = sm.anchorIndex = sm.selectedIndex = 100;
20 adjust(sm, 0, 10, 0);
22 assertEquals(90, sm.leadIndex);
23 assertEquals(90, sm.anchorIndex);
24 assertEquals(90, sm.selectedIndex);
27 function testAdjust2() {
28 var sm = createSelectionModel(200);
30 sm.leadIndex = sm.anchorIndex = sm.selectedIndex = 50;
31 adjust(sm, 60, 10, 0);
33 assertEquals(50, sm.leadIndex);
34 assertEquals(50, sm.anchorIndex);
35 assertEquals(50, sm.selectedIndex);
38 function testAdjust3() {
39 var sm = createSelectionModel(200);
41 sm.leadIndex = sm.anchorIndex = sm.selectedIndex = 100;
42 adjust(sm, 0, 0, 10);
44 assertEquals(110, sm.leadIndex);
45 assertEquals(110, sm.anchorIndex);
46 assertEquals(110, sm.selectedIndex);
49 function testAdjust4() {
50 var sm = createSelectionModel(100);
52 sm.leadIndex = sm.anchorIndex = sm.selectedIndex = 99;
54 adjust(sm, 99, 1, 0);
56 assertEquals(-1, sm.leadIndex, 'lead');
57 assertEquals(-1, sm.anchorIndex, 'anchor');
58 assertArrayEquals([], sm.selectedIndexes);
61 function testAdjust5() {
62 var sm = createSelectionModel(1);
64 sm.leadIndex = sm.anchorIndex = sm.selectedIndex = 0;
66 adjust(sm, 0, 0, 10);
68 assertEquals(10, sm.leadIndex,'lead');
69 assertEquals(10, sm.anchorIndex, 'anchor');
70 assertArrayEquals([10], sm.selectedIndexes);
73 function testSelectedIndex1() {
74 var sm = createSelectionModel(100, true);
76 sm.selectedIndex = 99;
78 assertEquals(99, sm.leadIndex, 'lead');
79 assertEquals(99, sm.anchorIndex, 'anchor');
80 assertArrayEquals([99], sm.selectedIndexes);
83 function testLeadIndex1() {
84 var sm = createSelectionModel(100);
86 sm.leadIndex = 99;
88 assertEquals(99, sm.leadIndex, 'lead');
89 assertEquals(99, sm.anchorIndex, 'anchor');
90 assertArrayEquals([], sm.selectedIndexes);
93 function testLeadIndex2() {
94 var sm = createSelectionModel(100, true);
96 sm.leadIndex = 99;
98 assertEquals(-1, sm.leadIndex, 'lead');
99 assertEquals(-1, sm.anchorIndex, 'anchor');
100 assertArrayEquals([], sm.selectedIndexes);
103 </script>
105 </body>
106 </html>