mirror of
https://github.com/nasa/openmct.git
synced 2025-06-06 17:31:40 +00:00
completed tests for condition collection object
This commit is contained in:
parent
0a95db1a51
commit
10c4340475
@ -20,16 +20,16 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* 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';
|
import Vue from 'vue';
|
||||||
|
|
||||||
export default function Condition(openmct) {
|
export default function ConditionCollection(openmct) {
|
||||||
return {
|
return {
|
||||||
key: 'condition',
|
key: 'conditionCollection',
|
||||||
name: 'Condition',
|
name: 'Condition Collection',
|
||||||
cssClass: 'icon-page',
|
cssClass: 'icon-page',
|
||||||
canView: function (domainObject) {
|
canView: function (domainObject) {
|
||||||
return domainObject.type === 'condition';
|
return domainObject.type === 'conditionCollection';
|
||||||
},
|
},
|
||||||
view: function (domainObject) {
|
view: function (domainObject) {
|
||||||
let component;
|
let component;
|
||||||
@ -39,13 +39,13 @@ export default function Condition(openmct) {
|
|||||||
component = new Vue({
|
component = new Vue({
|
||||||
el: element,
|
el: element,
|
||||||
components: {
|
components: {
|
||||||
ConditionComponent: ConditionComponent
|
ConditionCollectionComponent
|
||||||
},
|
},
|
||||||
provide: {
|
provide: {
|
||||||
openmct,
|
openmct,
|
||||||
domainObject
|
domainObject
|
||||||
},
|
},
|
||||||
template: '<condition-component></condition-component>'
|
template: '<condition-collection-component></condition-collection-component>'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroy: function (element) {
|
destroy: function (element) {
|
@ -1,7 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="l-iframe abs">
|
<div><!-- Condition Collection component contents will go here --></div>
|
||||||
<iframe :src="currentDomainObject.url"></iframe>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
@ -20,10 +20,11 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
export default function ConditionPlugin() {
|
export default function ConditionCollectionPlugin() {
|
||||||
const conditionType = {
|
const conditionType = {
|
||||||
name: 'Condition',
|
name: 'Condition Collection',
|
||||||
description: 'A conditional rule based on user-specified criteria.',
|
key: 'conditionCollection',
|
||||||
|
description: 'A set of conditional rules based on user-specified criteria.',
|
||||||
creatable: true,
|
creatable: true,
|
||||||
cssClass: 'icon-summary-widget',
|
cssClass: 'icon-summary-widget',
|
||||||
initialize: function (domainObject) {
|
initialize: function (domainObject) {
|
||||||
@ -33,6 +34,6 @@ export default function ConditionPlugin() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return function install(openmct) {
|
return function install(openmct) {
|
||||||
openmct.types.addType('condition', conditionType);
|
openmct.types.addType('conditionCollection', conditionType);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -20,33 +20,37 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
import ConditionPlugin from './plugin';
|
import ConditionCollectionPlugin from './plugin';
|
||||||
import { createOpenMct } from 'testTools';
|
import { createOpenMct } from 'testTools';
|
||||||
|
|
||||||
fdescribe("The plugin", () => {
|
fdescribe("The plugin", () => {
|
||||||
let openmct;
|
let openmct;
|
||||||
let conditionType;
|
|
||||||
let mockDomainObject;
|
let mockDomainObject;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockDomainObject = {};
|
|
||||||
|
|
||||||
openmct = createOpenMct();
|
openmct = createOpenMct();
|
||||||
openmct.install(new ConditionPlugin());
|
openmct.install(new ConditionCollectionPlugin());
|
||||||
conditionType = openmct.types.get('condition');
|
|
||||||
|
mockDomainObject = {
|
||||||
|
identifier: {
|
||||||
|
key: 'testKey',
|
||||||
|
namespace: ''
|
||||||
|
},
|
||||||
|
type: 'conditionCollection'
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
it('defines a condition object with the correct name', () => {
|
it('defines a condition collection object type with the correct key', () => {
|
||||||
expect(conditionType.definition.name).toEqual('Condition');
|
expect(openmct.types.get('conditionCollection').definition.key).toEqual('conditionCollection');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('defines a condition object that is creatable', () => {
|
it('defines a condition collection object type that is creatable', () => {
|
||||||
expect(conditionType.definition.creatable).toBeTrue();
|
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(() => {
|
beforeEach(() => {
|
||||||
conditionType.definition.initialize(mockDomainObject);
|
openmct.types.get('conditionCollection').definition.initialize(mockDomainObject);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('a composition array', () => {
|
it('a composition array', () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user