[Tables] #670 Addressed issues from code review

This commit is contained in:
Henry
2016-03-03 09:26:12 -08:00
parent 55e00baeaf
commit b63b7b1e5d
4 changed files with 9 additions and 11 deletions

View File

@ -143,7 +143,7 @@ define(
* Set the established configuration on the domain object * Set the established configuration on the domain object
* @private * @private
*/ */
TableConfiguration.prototype.saveColumnConfig = function (columnConfig) { TableConfiguration.prototype.saveColumnConfiguration = function (columnConfig) {
this.domainObject.useCapability('mutation', function (model) { this.domainObject.useCapability('mutation', function (model) {
model.configuration = model.configuration || {}; model.configuration = model.configuration || {};
model.configuration.table = model.configuration.table || {}; model.configuration.table = model.configuration.table || {};
@ -158,7 +158,7 @@ define(
* pairs where the key is the column title, and the value is a * pairs where the key is the column title, and the value is a
* boolean indicating whether the column should be shown. * boolean indicating whether the column should be shown.
*/ */
TableConfiguration.prototype.getColumnConfig = function() { TableConfiguration.prototype.getColumnConfiguration = function() {
var configuration = {}, var configuration = {},
//Use existing persisted config, or default it //Use existing persisted config, or default it
defaultConfig = this.defaultColumnConfiguration(); defaultConfig = this.defaultColumnConfiguration();

View File

@ -175,8 +175,8 @@ define(
*/ */
TelemetryTableController.prototype.filterColumns = function (columnConfig) { TelemetryTableController.prototype.filterColumns = function (columnConfig) {
if (!columnConfig){ if (!columnConfig){
columnConfig = this.table.getColumnConfig(); columnConfig = this.table.getColumnConfiguration();
this.table.saveColumnConfig(columnConfig); this.table.saveColumnConfiguration(columnConfig);
} }
//Populate headers with visible columns (determined by configuration) //Populate headers with visible columns (determined by configuration)
this.$scope.headers = Object.keys(columnConfig).filter(function(column) { this.$scope.headers = Object.keys(columnConfig).filter(function(column) {

View File

@ -23,7 +23,7 @@
define( define(
[ [
"../src/Table", "../src/TableConfiguration",
"../src/DomainColumn" "../src/DomainColumn"
], ],
function (Table, DomainColumn) { function (Table, DomainColumn) {

View File

@ -23,7 +23,7 @@
define( define(
[ [
"../../src/controllers/TableController" "../../src/controllers/TelemetryTableController"
], ],
function (TableController) { function (TableController) {
"use strict"; "use strict";
@ -75,7 +75,8 @@ define(
[ [
'buildColumns', 'buildColumns',
'getColumnConfiguration', 'getColumnConfiguration',
'getRowValues' 'getRowValues',
'saveColumnConfiguration'
] ]
); );
mockTable.columns = []; mockTable.columns = [];
@ -135,10 +136,7 @@ define(
controller.setup(); controller.setup();
expect(mockTable.getColumnConfiguration).toHaveBeenCalled(); expect(mockTable.getColumnConfiguration).toHaveBeenCalled();
expect(mockDomainObject.useCapability).toHaveBeenCalledWith('mutation', jasmine.any(Function)); expect(mockTable.saveColumnConfiguration).toHaveBeenCalled();
mockDomainObject.useCapability.mostRecentCall.args[1](mockModel);
expect(mockModel.configuration).toBeDefined();
}); });
}); });