From abf5f2215542c1c0302230952f4949e49c54d438 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 3 Feb 2016 16:00:11 -0800 Subject: [PATCH] [Plots] #638 added onchange handling in order to synchronize forms with domain object model. Fixed failing test Added tests jslint errors Minor refactoring of layout bundle revert layout/bundle.json --- platform/commonUI/browse/bundle.js | 2 +- .../commonUI/browse/src/InspectorRegion.js | 2 +- .../browse/src/TypeRegionDecorator.js | 11 +- .../test/InspectorRegionSpec.js | 4 +- .../browse/test/TypeRegionDecoratorSpec.js | 70 +++++++ .../templates/controls/datetime-field.html | 1 + .../regions/src/EditableRegionPolicy.js | 4 +- platform/commonUI/regions/src/Region.js | 14 +- .../commonUI/regions/src/RegionController.js | 13 +- .../regions/test/EditableRegionPolicySpec.js | 75 +++++++ .../regions/test/RegionControllerSpec.js | 82 ++++++++ platform/commonUI/regions/test/RegionSpec.js | 107 ++++++++++ platform/commonUI/regions/test/suite.json | 3 - platform/features/layout/bundle.js | 48 +---- .../res/templates/plot-options-browse.html | 27 ++- .../layout/src/PlotOptionsController.js | 186 +++++++----------- .../features/layout/src/PlotOptionsForm.js | 166 ++++++++++++++++ .../layout/test/PlotOptionsControllerSpec.js | 161 +++++++++++++++ .../layout/test/PlotOptionsFormSpec.js | 73 +++++++ .../res/templates/controls/checkbox.html | 1 + .../forms/res/templates/controls/radio.html | 4 +- .../forms/res/templates/controls/select.html | 1 + .../res/templates/controls/textfield.html | 1 + platform/forms/res/templates/form.html | 1 + 24 files changed, 867 insertions(+), 190 deletions(-) rename platform/commonUI/{regions => browse}/test/InspectorRegionSpec.js (93%) create mode 100644 platform/commonUI/browse/test/TypeRegionDecoratorSpec.js create mode 100644 platform/commonUI/regions/test/EditableRegionPolicySpec.js create mode 100644 platform/commonUI/regions/test/RegionControllerSpec.js create mode 100644 platform/commonUI/regions/test/RegionSpec.js delete mode 100644 platform/commonUI/regions/test/suite.json create mode 100644 platform/features/layout/src/PlotOptionsForm.js create mode 100644 platform/features/layout/test/PlotOptionsControllerSpec.js create mode 100644 platform/features/layout/test/PlotOptionsFormSpec.js diff --git a/platform/commonUI/browse/bundle.js b/platform/commonUI/browse/bundle.js index bc62a1a36e..9c08521f5e 100644 --- a/platform/commonUI/browse/bundle.js +++ b/platform/commonUI/browse/bundle.js @@ -295,7 +295,7 @@ define([ "provides": "typeService", "type": "decorator", "implementation": TypeRegionDecorator - }, + } ], "runs": [ { diff --git a/platform/commonUI/browse/src/InspectorRegion.js b/platform/commonUI/browse/src/InspectorRegion.js index 72b71a1e01..accbac8fbd 100644 --- a/platform/commonUI/browse/src/InspectorRegion.js +++ b/platform/commonUI/browse/src/InspectorRegion.js @@ -62,7 +62,7 @@ define( } }; this.addPart(metadataPart, 0); - } + }; return InspectorRegion; } diff --git a/platform/commonUI/browse/src/TypeRegionDecorator.js b/platform/commonUI/browse/src/TypeRegionDecorator.js index 60e75cac24..7c3f60994f 100644 --- a/platform/commonUI/browse/src/TypeRegionDecorator.js +++ b/platform/commonUI/browse/src/TypeRegionDecorator.js @@ -29,16 +29,17 @@ define( "use strict"; /** - * Adds default screen regions to Type definitions. Screen regions - * are sections of the browse and edit view of an object that can be - * customized on a per-type basis. Within {@link Region}s are {@link RegionPart}s. - * Policies can be used to decide which parts are visible or not based on object state. + * Adds default browse screen regions to Type definitions. Screen + * regions are sections of the browse and edit view of an object + * that can be customized on a per-type basis. Within + * {@link Region}s are {@link RegionPart}s. Policies can be used to + * decide which parts are visible or not based on object state. * @memberOf platform/commonUI/regions * @see {@link Region}, {@link RegionPart}, {@link EditableRegionPolicy} * @constructor */ function TypeRegionDecorator(typeService) { - this.typeService = typeService + this.typeService = typeService; } /** diff --git a/platform/commonUI/regions/test/InspectorRegionSpec.js b/platform/commonUI/browse/test/InspectorRegionSpec.js similarity index 93% rename from platform/commonUI/regions/test/InspectorRegionSpec.js rename to platform/commonUI/browse/test/InspectorRegionSpec.js index 9192ba3f11..3eb9428518 100644 --- a/platform/commonUI/regions/test/InspectorRegionSpec.js +++ b/platform/commonUI/browse/test/InspectorRegionSpec.js @@ -33,11 +33,11 @@ define( var inspectorRegion; beforeEach(function () { - inspectorRegion = new InspectorRegion; + inspectorRegion = new InspectorRegion(); }); it("creates default region parts", function () { - expect(inspectorRegion.parts().length).toBe(2); + expect(inspectorRegion.parts.length).toBe(1); }); }); diff --git a/platform/commonUI/browse/test/TypeRegionDecoratorSpec.js b/platform/commonUI/browse/test/TypeRegionDecoratorSpec.js new file mode 100644 index 0000000000..a525df5b9b --- /dev/null +++ b/platform/commonUI/browse/test/TypeRegionDecoratorSpec.js @@ -0,0 +1,70 @@ +/***************************************************************************** + * Open MCT Web, Copyright (c) 2014-2015, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT Web is licensed under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Open MCT Web includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ + +/** + * MCTIncudeSpec. Created by vwoeltje on 11/6/14. + */ +define( + ["../src/TypeRegionDecorator"], + function (TypeRegionDecorator) { + "use strict"; + + describe("The type region decorator", function () { + var typeRegionDecorator, + mockTypeService, + mockType, + mockTypeDefinition; + + beforeEach(function () { + mockTypeDefinition = {}; + + mockType = jasmine.createSpyObj('type', [ + 'getDefinition' + ]); + mockType.getDefinition.andReturn(mockTypeDefinition); + + mockTypeService = jasmine.createSpyObj('typeService', [ + 'listTypes', + 'getType' + ]); + mockTypeService.getType.andReturn(mockType); + mockTypeService.listTypes.andReturn([mockType]); + + typeRegionDecorator = new TypeRegionDecorator(mockTypeService); + }); + + it("decorates individual type definitions with basic inspector" + + " region", function () { + typeRegionDecorator.getType('someType'); + expect(mockTypeDefinition.regions).toBeDefined(); + }); + + it("decorates all type definitions with basic inspector" + + " region", function () { + typeRegionDecorator.listTypes(); + expect(mockTypeDefinition.regions).toBeDefined(); + }); + + }); + } +); \ No newline at end of file diff --git a/platform/commonUI/general/res/templates/controls/datetime-field.html b/platform/commonUI/general/res/templates/controls/datetime-field.html index 18eb9ec46d..793083ea60 100644 --- a/platform/commonUI/general/res/templates/controls/datetime-field.html +++ b/platform/commonUI/general/res/templates/controls/datetime-field.html @@ -23,6 +23,7 @@ ng-controller="DateTimeFieldController"> +
Display + + + + +
+ Plot Series +