Compare commits

...

2 Commits

Author SHA1 Message Date
a04fba579b Add test for identifier generation 2018-01-02 16:05:13 -05:00
77fa775f7b [SummaryWidget] Use objectutil to get legacy id
Use objectUtils to get a proper legacy id so that namespaces are
properly handled.  Fixes https://github.com/nasa/openmct/issues/1858
2018-01-02 15:58:30 -05:00
2 changed files with 10 additions and 3 deletions

View File

@ -5,6 +5,7 @@ define([
'./TestDataManager',
'./WidgetDnD',
'./eventHelpers',
'../../../api/objects/object-utils',
'lodash',
'zepto'
], function (
@ -14,6 +15,7 @@ define([
TestDataManager,
WidgetDnD,
eventHelpers,
objectUtils,
_,
$
) {
@ -77,7 +79,7 @@ define([
this.addHyperlink(domainObject.url, domainObject.openNewTab);
this.watchForChanges(openmct, domainObject);
var id = this.domainObject.identifier.key,
var id = objectUtils.makeKeyString(this.domainObject.identifier),
self = this,
oldDomainObject,
statusCapability;

View File

@ -14,7 +14,8 @@ define(['../src/SummaryWidget', 'zepto'], function (SummaryWidget, $) {
beforeEach(function () {
mockDomainObject = {
identifier: {
key: 'testKey'
key: 'testKey',
namespace: 'testNamespace'
},
name: 'testName',
composition: [],
@ -49,7 +50,7 @@ define(['../src/SummaryWidget', 'zepto'], function (SummaryWidget, $) {
mockObjectService.getObjects = jasmine.createSpy('objectService');
mockObjectService.getObjects.andReturn(new Promise(function (resolve, reject) {
resolve({
testKey: mockOldDomainObject
'testNamespace:testKey': mockOldDomainObject
});
}));
mockOpenMCT = jasmine.createSpyObj('openmct', [
@ -73,6 +74,10 @@ define(['../src/SummaryWidget', 'zepto'], function (SummaryWidget, $) {
summaryWidget.show(mockContainer);
});
it('queries with legacyId', function () {
expect(mockObjectService.getObjects).toHaveBeenCalledWith(['testNamespace:testKey']);
});
it('adds its DOM element to the view', function () {
expect(mockContainer.getElementsByClassName('w-summary-widget').length).toBeGreaterThan(0);
});