OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:html'; | 5 import 'dart:html'; |
6 | 6 |
7 import 'package:expect/minitest.dart'; | 7 import 'package:expect/minitest.dart'; |
8 | 8 |
9 main() { | 9 main() { |
10 test('createTBody', () { | 10 test('createTBody', () { |
11 var table = new TableElement(); | 11 var table = new TableElement(); |
12 var head = table.createTHead(); | 12 var head = table.createTHead(); |
13 expect(table.tHead, head); | 13 expect(table.tHead, head); |
14 | 14 |
15 var headerRow = head.addRow(); | 15 var headerRow = head.addRow(); |
16 var headerCell = headerRow.addCell(); | 16 var headerCell = headerRow.addCell(); |
17 headerCell.text = 'Header Cell'; | 17 headerCell.text = 'Header Cell'; |
18 | 18 |
19 var caption = table.createCaption(); | 19 var caption = table.createCaption(); |
20 expect(table.caption, caption); | 20 expect(table.caption, caption); |
21 | 21 |
22 var body = table.createTBody(); | 22 var body = table.createTBody(); |
23 expect(table.tBodies.length, 1); | 23 expect(table.tBodies.length, 1); |
24 expect(table.tBodies[0], body); | 24 expect(table.tBodies[0], body); |
25 | 25 |
26 var bodyRow = body.addRow(); | 26 var bodyRow = body.addRow(); |
27 expect(body.rows.length, 1); | 27 expect(body.rows.length, 1); |
28 expect(body.rows[0], bodyRow); | 28 expect(body.rows[0], bodyRow); |
29 | 29 |
30 var bodyCell = bodyRow.addCell(); | 30 var bodyCell = bodyRow.addCell(); |
31 bodyCell.text = 'Body Cell'; | 31 bodyCell.text = 'Body Cell'; |
32 expect(bodyRow.cells.length, 1); | 32 expect(bodyRow.cells.length, 1); |
33 expect(bodyRow.cells[0], bodyCell); | 33 expect(bodyRow.cells[0], bodyCell); |
34 | 34 |
35 var foot = table.createTFoot(); | 35 var foot = table.createTFoot(); |
36 expect(table.tFoot, foot); | 36 expect(table.tFoot, foot); |
37 | 37 |
38 var footerRow = foot.addRow(); | 38 var footerRow = foot.addRow(); |
39 expect(foot.rows.length, 1); | 39 expect(foot.rows.length, 1); |
40 expect(foot.rows[0], footerRow); | 40 expect(foot.rows[0], footerRow); |
41 | 41 |
42 var footerCell = footerRow.addCell(); | 42 var footerCell = footerRow.addCell(); |
43 footerCell.text = 'Footer Cell'; | 43 footerCell.text = 'Footer Cell'; |
44 expect(footerRow.cells.length, 1); | 44 expect(footerRow.cells.length, 1); |
45 expect(footerRow.cells[0], footerCell); | 45 expect(footerRow.cells[0], footerCell); |
46 | 46 |
47 var body2 = table.createTBody(); | 47 var body2 = table.createTBody(); |
48 var bodyRow2 = body2.addRow(); | 48 var bodyRow2 = body2.addRow(); |
49 var bodyCell2 = bodyRow2.addCell(); | 49 var bodyCell2 = bodyRow2.addCell(); |
50 bodyCell2.text = 'Body Cell2'; | 50 bodyCell2.text = 'Body Cell2'; |
51 | 51 |
52 expect(body2.rows.length, 1); | 52 expect(body2.rows.length, 1); |
53 | 53 |
54 expect(table.tBodies.length, 2); | 54 expect(table.tBodies.length, 2); |
55 expect(table.tBodies[1], body2); | 55 expect(table.tBodies[1], body2); |
56 }); | 56 }); |
57 } | 57 } |
58 | |
OLD | NEW |