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

Unified Diff: tracing/tracing/ui/base/table_test.html

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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 | « tracing/tracing/ui/base/table.html ('k') | tracing/tracing/ui/brushing_state.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/ui/base/table_test.html
diff --git a/tracing/tracing/ui/base/table_test.html b/tracing/tracing/ui/base/table_test.html
index b2ca65577d6b0f56d4f1871359bc0a254c6cdd31..ac2f9a2ac9153335aa36727dd4da4f3a83c86bd6 100644
--- a/tracing/tracing/ui/base/table_test.html
+++ b/tracing/tracing/ui/base/table_test.html
@@ -1016,6 +1016,10 @@ tr.b.unittest.testSuite(function() {
table.selectedTableRow = table.tableRows[0];
assert.equal(table.selectedColumnIndex, 1);
+ var selectedCell = table.selectedCell;
+ assert.strictEqual(selectedCell.row, table.tableRows[0]);
+ assert.strictEqual(selectedCell.column, columns[1]);
+ assert.strictEqual(selectedCell.value, '1');
table.performKeyCommand_('ARROW_DOWN');
table.performKeyCommand_('ARROW_RIGHT');
@@ -1023,11 +1027,16 @@ tr.b.unittest.testSuite(function() {
table.performKeyCommand_('ARROW_LEFT');
assert.equal(table.selectedTableRow, table.tableRows[1]);
assert.equal(table.selectedColumnIndex, 2);
+ selectedCell = table.selectedCell;
+ assert.strictEqual(selectedCell.row, table.tableRows[1]);
+ assert.strictEqual(selectedCell.column, columns[2]);
+ assert.strictEqual(selectedCell.value, 4);
table.selectedTableRow = undefined;
- assert.equal(table.selectedTableRow, undefined);
- assert.equal(table.selectedColumnIndex, undefined);
- assert.equal(table.selectedColumnIndex, undefined);
+ assert.isUndefined(table.selectedTableRow);
+ assert.isUndefined(table.selectedColumnIndex);
+ assert.isUndefined(table.selectedColumnIndex);
+ assert.isUndefined(table.selectedCell);
});
test('cellSelectionNested', function() {
@@ -1462,5 +1471,53 @@ tr.b.unittest.testSuite(function() {
// Check that 'A' is still expanded.
assert.isDefined(tr.b.findDeepElementMatchingPredicate(table, isB));
});
+
+ test('columnSelection', function() {
+ var table = document.createElement('tr-ui-b-table');
+ table.tableColumns = [
+ {
+ title: 'Name',
+ value: (row) => row.name
+ },
+ {
+ title: 'colA',
+ selectable: true,
+ value: (row) => row.a,
+ cmp: (rowA, rowB) => rowA.a - rowB.a
+ },
+ {
+ title: 'colB',
+ selectable: true,
+ value: (row) => row.b,
+ cmp: (rowA, rowB) => rowA.b - rowB.b
+ }
+ ];
+ table.tableRows = [
+ {name: 'foo', a: 42, b: -42},
+ {name: 'bar', a: 57, b: 133}
+ ];
+ table.rebuild();
+ table.selectionMode = SelectionMode.CELL;
+ this.addHTMLOutput(table);
+
+ var eventCount = 0;
+ table.addEventListener('selected-column-changed', event => ++eventCount);
+
+ assert.throws(function() {
+ table.selectedTableColumn = table.tableColumns[0];
+ });
+
+ table.selectedTableColumn = table.tableColumns[1];
+ assert.strictEqual(eventCount, 1);
+ assert.strictEqual(table.tableColumns[1], table.selectedTableColumn);
+
+ table.selectedTableColumn = table.tableColumns[2];
+ assert.strictEqual(eventCount, 2);
+ assert.strictEqual(table.tableColumns[2], table.selectedTableColumn);
+
+ table.selectedTableColumn = undefined;
+ assert.strictEqual(eventCount, 3);
+ assert.isUndefined(table.selectedTableColumn);
+ });
});
</script>
« no previous file with comments | « tracing/tracing/ui/base/table.html ('k') | tracing/tracing/ui/brushing_state.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698