Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1052)

Side by Side Diff: test/data/input/table_test.html

Issue 12225039: Support for observable models, fixes #259 (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 type="application/javascript" src="testing.js"></script> 11 <script type="application/javascript" src="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:html'; 23 import 'dart:html';
24 import 'package:unittest/unittest.dart'; 24 import 'package:unittest/unittest.dart';
25 import 'package:web_ui/watcher.dart'; 25 import 'package:web_ui/observe.dart';
26 26
27 List<List> table = [[1, 2, 3], ['a', 'b', 'c'], ['A', 'B', 'C']]; 27 @observable
28 List<List> table = toObservable([
29 toObservable([1, 2, 3]),
30 toObservable(['a', 'b', 'c']),
31 toObservable(['A', 'B', 'C'])
32 ]);
33
28 main() { 34 main() {
29 window.setTimeout(() { 35 window.setImmediate(() {
30 expect(document.query("#test").innerHtml, equalsIgnoringWhitespace( 36 expect(document.query("#test").innerHtml, equalsIgnoringWhitespace(
31 '<tr> <td>1</td> <td>2</td> <td>3</td> </tr> ' 37 '<tr> <td>1</td> <td>2</td> <td>3</td> </tr> '
32 '<tr> <td>a</td> <td>b</td> <td>c</td> </tr> ' 38 '<tr> <td>a</td> <td>b</td> <td>c</td> </tr> '
33 '<tr> <td>A</td> <td>B</td> <td>C</td> </tr>')); 39 '<tr> <td>A</td> <td>B</td> <td>C</td> </tr>'));
34 table[0][2] = 'X'; 40 table[0][2] = 'X';
35 table[1][1] = 'Y'; 41 table[1][1] = 'Y';
36 table.add(['_', '__', '___']); 42 table.add(['_', '__', '___']);
37 dispatch(); 43 deliverChangesSync();
38 window.setTimeout(() { 44 expect(document.query("#test").innerHtml, equalsIgnoringWhitespace(
39 expect(document.query("#test").innerHtml, equalsIgnoringWhitespace( 45 '<tr> <td>1</td> <td>2</td> <td>X</td> </tr> '
40 '<tr> <td>1</td> <td>2</td> <td>X</td> </tr> ' 46 '<tr> <td>a</td> <td>Y</td> <td>c</td> </tr> '
41 '<tr> <td>a</td> <td>Y</td> <td>c</td> </tr> ' 47 '<tr> <td>A</td> <td>B</td> <td>C</td> </tr> '
42 '<tr> <td>A</td> <td>B</td> <td>C</td> </tr> ' 48 '<tr> <td>_</td> <td>__</td> <td>___</td> </tr>'));
43 '<tr> <td>_</td> <td>__</td> <td>___</td> </tr>')); 49 window.postMessage('done', '*');
44 window.setTimeout(() => window.postMessage('done', '*'), 0); 50 });
45 }, 0);
46 }, 0);
47 } 51 }
48 </script> 52 </script>
49 </body> 53 </body>
50 </html> 54 </html>
OLDNEW
« no previous file with comments | « test/data/input/style_binding_test.html ('k') | test/data/input/template_multiple_children_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698