diff --git a/src/plugins/conditionSet/ConditionSetViewProvider.js b/src/plugins/conditionSet/ConditionSetViewProvider.js index da6b30d1e8..00de3bed79 100644 --- a/src/plugins/conditionSet/ConditionSetViewProvider.js +++ b/src/plugins/conditionSet/ConditionSetViewProvider.js @@ -20,42 +20,46 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -import ConditionSetComponent from './components/ConditionSet.vue'; +import ConditionSet from './components/ConditionSet.vue'; import Vue from 'vue'; -export default function ConditionSet(openmct) { +export default function ConditionSetViewProvider(openmct) { return { - key: 'conditionSet', - name: 'Condition Set', - cssClass: 'icon-folder', + key: 'conditionSet.view', canView: function (domainObject) { return domainObject.type === 'conditionSet'; }, - view: function (domainObject) { + canEdit: function (domainObject) { + return domainObject.type === 'conditionSet'; + }, + view: function (domainObject, objectPath) { let component; - return { - show: function (element) { - component = new Vue({ - el: element, + show(container) { + component = new Vue({ + el: container, components: { - ConditionSetComponent + ConditionSet }, provide: { openmct, - domainObject + objectPath }, - template: '' + data() { + return { + domainObject + }; + }, + template: '' }); }, - destroy: function (element) { + destroy() { component.$destroy(); - component = undefined; } }; }, - priority: function () { - return 1; + priority() { + return 100; } }; } diff --git a/src/plugins/conditionSet/components/ConditionSet.vue b/src/plugins/conditionSet/components/ConditionSet.vue index f33ba5fb07..464b5c0f32 100644 --- a/src/plugins/conditionSet/components/ConditionSet.vue +++ b/src/plugins/conditionSet/components/ConditionSet.vue @@ -1,14 +1,46 @@ +/***************************************************************************** + * Open MCT, Copyright (c) 2014-2019, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT 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 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. + *****************************************************************************/ + diff --git a/src/plugins/conditionSet/pluginSpec.js b/src/plugins/conditionSet/pluginSpec.js index dd9422f558..3e44fb223e 100644 --- a/src/plugins/conditionSet/pluginSpec.js +++ b/src/plugins/conditionSet/pluginSpec.js @@ -23,14 +23,28 @@ import { createOpenMct } from 'testTools'; import ConditionSetPlugin from './plugin'; -fdescribe('The plugin', () => { +describe('The plugin', () => { let openmct; let conditionSetDefinition; + let element; + let child; + + beforeEach((done) => { + const appHolder = document.createElement('div'); + appHolder.style.width = '640px'; + appHolder.style.height = '480px'; - beforeEach(() => { openmct = createOpenMct(); + + element = document.createElement('div'); + child = document.createElement('div'); + element.appendChild(child); + openmct.install(new ConditionSetPlugin()); conditionSetDefinition = openmct.types.get('conditionSet').definition; + + openmct.on('start', done); + openmct.start(appHolder); }); it('defines an object type with the correct key', () => { @@ -41,11 +55,22 @@ fdescribe('The plugin', () => { expect(conditionSetDefinition.creatable).toBeTrue(); }); - describe('The object', () => { - it('initializes with an empty composition list', () => { + fit('provides a view', () => { + const testViewObject = { + id:"test-object", + type: "conditionSet" + }; + + const applicableViews = openmct.objectViews.get(testViewObject); + let conditionSetView = applicableViews.find((viewProvider) => viewProvider.key === 'conditionSet.view'); + expect(conditionSetView).toBeDefined(); + }); + + describe('provides an object', () => { + it('which initializes with an empty composition list', () => { let mockDomainObject = { identifier: { - key: 'testConditionSetKey', + key: 'test-key', namespace: '' }, type: 'conditionSet' @@ -56,4 +81,5 @@ fdescribe('The plugin', () => { expect(mockDomainObject.composition.length).toEqual(0); }); }); + });