aboutsummaryrefslogtreecommitdiff
path: root/contexts/data/lib/closure-library/closure/goog/ui/drilldownrow_test.html
blob: 0de92a1faba7b40b31c18671ce18d9315c59145b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html>
<!--
Copyright 2011 The Closure Library Authors. All Rights Reserved.

Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.

Author: nicksantos@google.com (Nick Santos)
-->
<head>
<title>DrilldownRow Tests</title>
<script type="text/javascript" src="../base.js"></script>
<script>
goog.require('goog.dom');
goog.require('goog.ui.DrilldownRow');
goog.require('goog.testing.jsunit');
</script>

<style type="text/css">

.toggle {
  cursor: pointer;
  cursor: hand;
  background-repeat: none;
  background-position: right;
}

tr.goog-drilldown-expanded .toggle {
  background-image: url('../images/minus.png');
}

tr.goog-drilldown-collapsed .toggle {
  background-image: url('../images/plus.png');
}

tr.goog-drilldown-hover td {
  background-color: #CCCCFF;
}

td {
  background-color: white;
}

</style>
</head>

<body>
<table id=table style="background-color: silver">
 <tr>
  <th>Column Head</th>
  <th>Second Head</th>
 </tr>
 <tr id=firstRow>
  <td>First row</td>
  <td>Second column</td>
 </tr>
</table>
</body>

<script type="text/javascript">

function testMakeRows() {
  var ff = goog.dom.getElement('firstRow');
  var d = new goog.ui.DrilldownRow({});
  var d1 = new goog.ui.DrilldownRow(
      {html: '<tr><td>Second row</td><td>Second column</td></tr>'}
      );
  var d2 = new goog.ui.DrilldownRow(
      {html: '<tr><td>Third row</td><td>Second column</td></tr>'}
      );
  var d21 = new goog.ui.DrilldownRow(
      {html: '<tr><td>Fourth row</td><td>Second column</td></tr>'}
      );
  var d22 = new goog.ui.DrilldownRow(goog.ui.DrilldownRow.sampleProperties);
  d.decorate(ff);
  d.addChild(d1, true);
  d.addChild(d2, true);
  d2.addChild(d21, true);
  d2.addChild(d22, true);

  assertThrows(function() {
    d.findIndex();
  });

  assertEquals(0, d1.findIndex());
  assertEquals(1, d2.findIndex());
}


</script>
</html>