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

Unified Diff: test/data/input/repeat_attribute_test.html

Issue 13592003: add support for template repeat (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: feedback Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/data/input/mix_iterate_if_test.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/data/input/repeat_attribute_test.html
diff --git a/test/data/input/mix_iterate_if_test.html b/test/data/input/repeat_attribute_test.html
similarity index 56%
copy from test/data/input/mix_iterate_if_test.html
copy to test/data/input/repeat_attribute_test.html
index deefcc12675dd0c55062b76ef68bd269ab6af12d..b08a3bb698459715333a4bcd07ac864adaf4cdc4 100644
--- a/test/data/input/mix_iterate_if_test.html
+++ b/test/data/input/repeat_attribute_test.html
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<!--
-Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
for details. All rights reserved. Use of this source code is governed by a
BSD-style license that can be found in the LICENSE file.
-->
@@ -11,13 +11,14 @@ BSD-style license that can be found in the LICENSE file.
<script src="packages/web_ui/testing/testing.js"></script>
</head>
<body>
- <!-- Tests the correct interaction of iteration and conditionals. -->
+ <!-- Tests that repeat and template attribute work. -->
<table>
- <tbody id='test' template iterate="row in table">
- <tr template iterate="cell in row">
- <td template if="cell != 0">{{cell}}</td>
- </tr>
- </tbody></table>
+ <tbody id='test'>
+ <tr template repeat="row in table">
+ <td template repeat="cell in row.where((c) => c != 0)">{{cell}}</td>
+ </tr>
+ </tbody>
+ </table>
<script type="application/dart">
import 'dart:async';
import 'dart:html';
@@ -36,21 +37,20 @@ BSD-style license that can be found in the LICENSE file.
table[1][1] = 9;
Timer.run(() {
var test = document.query('#test');
- expect(test.children.length, table.length);
+ expect(test.children.length, table.length + 1);
+ expect(test.children[0].style.display, 'none');
for (int row = 0; row < table.length; row++) {
- var tr = test.children[row];
+ var tr = test.children[row + 1];
expect(tr.tagName, 'TR');
- int column = -1;
- for (var td in tr.children) {
- expect(td.tagName, 'TD');
- if (td.style.display == 'none') {
- column++;
- continue;
- }
- var value = table[row][column];
- expect(value, greaterThan(0));
- expect(td.innerHtml, value.toString());
+ var filtered = table[row].where((c) => c != 0).toList();
+ expect(tr.children.length, filtered.length + 1);
+ expect(tr.children[0].style.display, 'none');
+
+ for (int col = 0; col < filtered.length; col++) {
+ var td = tr.children[col + 1];
+ expect(td.tagName, 'TD');
+ expect(td.innerHtml, filtered[col].toString());
}
}
window.postMessage('done', '*');
« no previous file with comments | « test/data/input/mix_iterate_if_test.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698