From b63b7b1e5d53f8b750fa916298971152be50aea2 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 3 Mar 2016 09:26:12 -0800 Subject: [PATCH] [Tables] #670 Addressed issues from code review --- platform/features/table/src/TableConfiguration.js | 4 ++-- .../table/src/controllers/TelemetryTableController.js | 4 ++-- .../test/{TableSpec.js => TableConfigurationSpec.js} | 2 +- ...ntrollerSpec.js => TelemetryTableControllerSpec.js} | 10 ++++------ 4 files changed, 9 insertions(+), 11 deletions(-) rename platform/features/table/test/{TableSpec.js => TableConfigurationSpec.js} (99%) rename platform/features/table/test/controllers/{TableControllerSpec.js => TelemetryTableControllerSpec.js} (96%) diff --git a/platform/features/table/src/TableConfiguration.js b/platform/features/table/src/TableConfiguration.js index 9b4ef7ff05..594638a5b4 100644 --- a/platform/features/table/src/TableConfiguration.js +++ b/platform/features/table/src/TableConfiguration.js @@ -143,7 +143,7 @@ define( * Set the established configuration on the domain object * @private */ - TableConfiguration.prototype.saveColumnConfig = function (columnConfig) { + TableConfiguration.prototype.saveColumnConfiguration = function (columnConfig) { this.domainObject.useCapability('mutation', function (model) { model.configuration = model.configuration || {}; model.configuration.table = model.configuration.table || {}; @@ -158,7 +158,7 @@ define( * pairs where the key is the column title, and the value is a * boolean indicating whether the column should be shown. */ - TableConfiguration.prototype.getColumnConfig = function() { + TableConfiguration.prototype.getColumnConfiguration = function() { var configuration = {}, //Use existing persisted config, or default it defaultConfig = this.defaultColumnConfiguration(); diff --git a/platform/features/table/src/controllers/TelemetryTableController.js b/platform/features/table/src/controllers/TelemetryTableController.js index b28f87ba21..bb26e135c3 100644 --- a/platform/features/table/src/controllers/TelemetryTableController.js +++ b/platform/features/table/src/controllers/TelemetryTableController.js @@ -175,8 +175,8 @@ define( */ TelemetryTableController.prototype.filterColumns = function (columnConfig) { if (!columnConfig){ - columnConfig = this.table.getColumnConfig(); - this.table.saveColumnConfig(columnConfig); + columnConfig = this.table.getColumnConfiguration(); + this.table.saveColumnConfiguration(columnConfig); } //Populate headers with visible columns (determined by configuration) this.$scope.headers = Object.keys(columnConfig).filter(function(column) { diff --git a/platform/features/table/test/TableSpec.js b/platform/features/table/test/TableConfigurationSpec.js similarity index 99% rename from platform/features/table/test/TableSpec.js rename to platform/features/table/test/TableConfigurationSpec.js index f042ec6c1d..efba3c2063 100644 --- a/platform/features/table/test/TableSpec.js +++ b/platform/features/table/test/TableConfigurationSpec.js @@ -23,7 +23,7 @@ define( [ - "../src/Table", + "../src/TableConfiguration", "../src/DomainColumn" ], function (Table, DomainColumn) { diff --git a/platform/features/table/test/controllers/TableControllerSpec.js b/platform/features/table/test/controllers/TelemetryTableControllerSpec.js similarity index 96% rename from platform/features/table/test/controllers/TableControllerSpec.js rename to platform/features/table/test/controllers/TelemetryTableControllerSpec.js index f87789eccf..43422d73af 100644 --- a/platform/features/table/test/controllers/TableControllerSpec.js +++ b/platform/features/table/test/controllers/TelemetryTableControllerSpec.js @@ -23,7 +23,7 @@ define( [ - "../../src/controllers/TableController" + "../../src/controllers/TelemetryTableController" ], function (TableController) { "use strict"; @@ -75,7 +75,8 @@ define( [ 'buildColumns', 'getColumnConfiguration', - 'getRowValues' + 'getRowValues', + 'saveColumnConfiguration' ] ); mockTable.columns = []; @@ -135,10 +136,7 @@ define( controller.setup(); expect(mockTable.getColumnConfiguration).toHaveBeenCalled(); - expect(mockDomainObject.useCapability).toHaveBeenCalledWith('mutation', jasmine.any(Function)); - - mockDomainObject.useCapability.mostRecentCall.args[1](mockModel); - expect(mockModel.configuration).toBeDefined(); + expect(mockTable.saveColumnConfiguration).toHaveBeenCalled(); }); });