| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 for details. All rights reserved. Use of this source code is governed by a | 4 for details. All rights reserved. Use of this source code is governed by a |
| 5 BSD-style license that can be found in the LICENSE file. | 5 BSD-style license that can be found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 <html lang="en"> | 7 <html lang="en"> |
| 8 <head> | 8 <head> |
| 9 <meta charset="utf-8"> | 9 <meta charset="utf-8"> |
| 10 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 10 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 11 <script src="packages/web_ui/testing/testing.js"></script> | 11 <script src="packages/web_ui/testing/testing.js"></script> |
| 12 </head> | 12 </head> |
| 13 <body> | 13 <body> |
| 14 <!-- Tests that tables are rendered correctly when using iterate attributes | 14 <!-- Tests that tables are rendered correctly when using iterate attributes |
| 15 on td and tr elements. --> | 15 on td and tr elements. --> |
| 16 <table> | 16 <table> |
| 17 <tbody id='test' template iterate="row in table"> | 17 <tbody id='test' template iterate="row in table"> |
| 18 <tr template iterate="cell in row"> | 18 <tr template iterate="cell in row"> |
| 19 <td>{{cell}}</td> | 19 <td>{{cell}}</td> |
| 20 </tr> | 20 </tr> |
| 21 </tbody></table> | 21 </tbody></table> |
| 22 <script type="application/dart"> | 22 <script type="application/dart"> |
| 23 import 'dart:async'; |
| 23 import 'dart:html'; | 24 import 'dart:html'; |
| 24 import 'package:unittest/unittest.dart'; | 25 import 'package:unittest/unittest.dart'; |
| 25 import 'package:web_ui/observe.dart'; | 26 import 'package:web_ui/observe.dart'; |
| 26 | 27 |
| 27 @observable | 28 @observable |
| 28 List<List> table = toObservable([ | 29 List<List> table = toObservable([ |
| 29 toObservable([1, 2, 3]), | 30 toObservable([1, 2, 3]), |
| 30 toObservable(['a', 'b', 'c']), | 31 toObservable(['a', 'b', 'c']), |
| 31 toObservable(['A', 'B', 'C']) | 32 toObservable(['A', 'B', 'C']) |
| 32 ]); | 33 ]); |
| 33 | 34 |
| 34 main() { | 35 main() { |
| 35 window.setImmediate(() { | 36 Timer.run(() { |
| 36 expect(document.query("#test").innerHtml, equalsIgnoringWhitespace( | 37 expect(document.query("#test").innerHtml, equalsIgnoringWhitespace( |
| 37 '<tr> <td>1</td> <td>2</td> <td>3</td> </tr> ' | 38 '<tr> <td>1</td> <td>2</td> <td>3</td> </tr> ' |
| 38 '<tr> <td>a</td> <td>b</td> <td>c</td> </tr> ' | 39 '<tr> <td>a</td> <td>b</td> <td>c</td> </tr> ' |
| 39 '<tr> <td>A</td> <td>B</td> <td>C</td> </tr>')); | 40 '<tr> <td>A</td> <td>B</td> <td>C</td> </tr>')); |
| 40 table[0][2] = 'X'; | 41 table[0][2] = 'X'; |
| 41 table[1][1] = 'Y'; | 42 table[1][1] = 'Y'; |
| 42 table.add(['_', '__', '___']); | 43 table.add(['_', '__', '___']); |
| 43 deliverChangesSync(); | 44 deliverChangesSync(); |
| 44 expect(document.query("#test").innerHtml, equalsIgnoringWhitespace( | 45 expect(document.query("#test").innerHtml, equalsIgnoringWhitespace( |
| 45 '<tr> <td>1</td> <td>2</td> <td>X</td> </tr> ' | 46 '<tr> <td>1</td> <td>2</td> <td>X</td> </tr> ' |
| 46 '<tr> <td>a</td> <td>Y</td> <td>c</td> </tr> ' | 47 '<tr> <td>a</td> <td>Y</td> <td>c</td> </tr> ' |
| 47 '<tr> <td>A</td> <td>B</td> <td>C</td> </tr> ' | 48 '<tr> <td>A</td> <td>B</td> <td>C</td> </tr> ' |
| 48 '<tr> <td>_</td> <td>__</td> <td>___</td> </tr>')); | 49 '<tr> <td>_</td> <td>__</td> <td>___</td> </tr>')); |
| 49 window.postMessage('done', '*'); | 50 window.postMessage('done', '*'); |
| 50 }); | 51 }); |
| 51 } | 52 } |
| 52 </script> | 53 </script> |
| 53 </body> | 54 </body> |
| 54 </html> | 55 </html> |
| OLD | NEW |