completed tests for condition collection object

This commit is contained in:
Joel McKinnon 2019-12-17 13:24:34 -08:00
parent 0a95db1a51
commit 10c4340475
4 changed files with 29 additions and 26 deletions

View File

@ -20,16 +20,16 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import ConditionComponent from './components/Condition.vue';
import ConditionCollectionComponent from './components/ConditionCollection.vue';
import Vue from 'vue';
export default function Condition(openmct) {
export default function ConditionCollection(openmct) {
return {
key: 'condition',
name: 'Condition',
key: 'conditionCollection',
name: 'Condition Collection',
cssClass: 'icon-page',
canView: function (domainObject) {
return domainObject.type === 'condition';
return domainObject.type === 'conditionCollection';
},
view: function (domainObject) {
let component;
@ -39,13 +39,13 @@ export default function Condition(openmct) {
component = new Vue({
el: element,
components: {
ConditionComponent: ConditionComponent
ConditionCollectionComponent
},
provide: {
openmct,
domainObject
},
template: '<condition-component></condition-component>'
template: '<condition-collection-component></condition-collection-component>'
});
},
destroy: function (element) {

View File

@ -1,7 +1,5 @@
<template>
<div class="l-iframe abs">
<iframe :src="currentDomainObject.url"></iframe>
</div>
<div><!-- Condition Collection component contents will go here --></div>
</template>
<script>

View File

@ -20,10 +20,11 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
export default function ConditionPlugin() {
export default function ConditionCollectionPlugin() {
const conditionType = {
name: 'Condition',
description: 'A conditional rule based on user-specified criteria.',
name: 'Condition Collection',
key: 'conditionCollection',
description: 'A set of conditional rules based on user-specified criteria.',
creatable: true,
cssClass: 'icon-summary-widget',
initialize: function (domainObject) {
@ -33,6 +34,6 @@ export default function ConditionPlugin() {
};
return function install(openmct) {
openmct.types.addType('condition', conditionType);
openmct.types.addType('conditionCollection', conditionType);
};
}

View File

@ -20,33 +20,37 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import ConditionPlugin from './plugin';
import ConditionCollectionPlugin from './plugin';
import { createOpenMct } from 'testTools';
fdescribe("The plugin", () => {
let openmct;
let conditionType;
let mockDomainObject;
beforeEach(() => {
mockDomainObject = {};
openmct = createOpenMct();
openmct.install(new ConditionPlugin());
conditionType = openmct.types.get('condition');
openmct.install(new ConditionCollectionPlugin());
mockDomainObject = {
identifier: {
key: 'testKey',
namespace: ''
},
type: 'conditionCollection'
};
});
it('defines a condition object with the correct name', () => {
expect(conditionType.definition.name).toEqual('Condition');
it('defines a condition collection object type with the correct key', () => {
expect(openmct.types.get('conditionCollection').definition.key).toEqual('conditionCollection');
});
it('defines a condition object that is creatable', () => {
expect(conditionType.definition.creatable).toBeTrue();
it('defines a condition collection object type that is creatable', () => {
expect(openmct.types.get('conditionCollection').definition.creatable).toBeTrue();
});
describe("shows the condition object is initialized with", () => {
describe("shows the condition collection object is initialized with", () => {
beforeEach(() => {
conditionType.definition.initialize(mockDomainObject);
openmct.types.get('conditionCollection').definition.initialize(mockDomainObject);
});
it('a composition array', () => {