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

Side by Side Diff: test/data/input/mix_iterate_if_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
« no previous file with comments | « test/data/input/main_code_in_dart_file.dart ('k') | test/data/input/news_index_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 the correct interaction of iteration and conditionals. --> 14 <!-- Tests the correct interaction of iteration and conditionals. -->
15 <table> 15 <table>
16 <tbody id='test' template iterate="row in table"> 16 <tbody id='test' template iterate="row in table">
17 <tr template iterate="cell in row"> 17 <tr template iterate="cell in row">
18 <td template if="cell != 0">{{cell}}</td> 18 <td template if="cell != 0">{{cell}}</td>
19 </tr> 19 </tr>
20 </tbody></table> 20 </tbody></table>
21 <script type="application/dart"> 21 <script type="application/dart">
22 import 'dart:html'; 22 import 'dart:html';
23 import 'package:unittest/unittest.dart'; 23 import 'package:unittest/unittest.dart';
24 import 'package:web_ui/watcher.dart'; 24 import 'package:web_ui/observe.dart';
25 25
26 List<List> table = [[1, 2, 3], [4, 0, 5], [0, 2, 4]]; 26 @observable
27 List<List> table = toObservable([
28 toObservable([1, 2, 3]),
29 toObservable([4, 0, 5]),
30 toObservable([0, 2, 4])
31 ]);
32
27 main() { 33 main() {
28 window.setTimeout(() { 34 window.setTimeout(() {
29 table[1][1] = 9; 35 table[1][1] = 9;
30 dispatch();
31 window.setTimeout(() { 36 window.setTimeout(() {
32 var test = document.query('#test'); 37 var test = document.query('#test');
33 expect(test.children.length, table.length); 38 expect(test.children.length, table.length);
34 for (int row = 0; row < table.length; row++) { 39 for (int row = 0; row < table.length; row++) {
35 var tr = test.children[row]; 40 var tr = test.children[row];
36 expect(tr.tagName, 'TR'); 41 expect(tr.tagName, 'TR');
37 int column = -1; 42 int column = -1;
38 for (var td in tr.children) { 43 for (var td in tr.children) {
39 expect(td.tagName, 'TD'); 44 expect(td.tagName, 'TD');
40 if (td.style.display == 'none') { 45 if (td.style.display == 'none') {
41 column++; 46 column++;
42 continue; 47 continue;
43 } 48 }
44 49
45 var value = table[row][column]; 50 var value = table[row][column];
46 expect(value, greaterThan(0)); 51 expect(value, greaterThan(0));
47 expect(td.innerHtml, value.toString()); 52 expect(td.innerHtml, value.toString());
48 } 53 }
49 } 54 }
50 window.setTimeout(() => window.postMessage('done', '*'), 0); 55 window.setImmediate(() => window.postMessage('done', '*'));
51 }, 0); 56 }, 0);
52 }, 0); 57 }, 0);
53 } 58 }
54 </script> 59 </script>
55 </body> 60 </body>
56 </html> 61 </html>
OLDNEW
« no previous file with comments | « test/data/input/main_code_in_dart_file.dart ('k') | test/data/input/news_index_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698