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

Unified Diff: chrome/test/data/webui/grid_test.html

Issue 916353002: cr.ui.Grid: Consider padding to determine the number of columns in a row. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move the padding-measuring code to updateMetrics_. Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/webui/resources/js/cr/ui/grid.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/grid_test.html
diff --git a/chrome/test/data/webui/grid_test.html b/chrome/test/data/webui/grid_test.html
index 125aed9ac43a39d6b32847457a0a953e0eebce85..889af6330b1a61d1ec08065f0c44bdfa8547da22 100644
--- a/chrome/test/data/webui/grid_test.html
+++ b/chrome/test/data/webui/grid_test.html
@@ -26,6 +26,7 @@ function testGetColumnCount() {
assertEquals(0, columns);
g.dataModel_ = new cr.ui.ArrayDataModel([0, 1, 2]);
+ g.horizontalPadding_ = 0;
g.clientWidthWithoutScrollbar_ = 8;
columns = g.getColumnCount_();
// Client width is smaller than item width.
@@ -66,6 +67,18 @@ function testGetColumnCount() {
columns = g.getColumnCount_();
// Can not fit two columns due to margin on left and right side.
assertEquals(1, columns);
+
+ g.measured_.marginRight = 0;
+ g.horizontalPadding_ = 2;
+ g.clientWidthWithoutScrollbar_ = 22;
+ columns = g.getColumnCount_();
+ // Can fit two columns as (22-2=)20px width is avaiable for grid items.
+ assertEquals(2, columns);
+
+ g.horizontalPadding_ = 3;
+ columns = g.getColumnCount_();
+ // Can not fit two columns due to bigger horizontal padding.
+ assertEquals(1, columns);
}
</script>
« no previous file with comments | « no previous file | ui/webui/resources/js/cr/ui/grid.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698