mirror of
https://github.com/nasa/openmct.git
synced 2025-03-20 02:55:18 +00:00
* refactor: url tools use named exports * fix: refactor method and remove customUrlParams * test(e2e): verify bounds are preserved in data pivoting * test: remove test as feature is no longer needed - dataVisualization logic has moved from MMGIS plugin to the open source. As such, we can just use the time conductor bounds * refactor: autoformat keeps changing this so i'mma just commit it * refactor: remove unnecessary code * refactor: simplify, add docs * Revert "refactor: remove unnecessary code" This reverts commit 87aef35c510230835fb682b80e89a6006ef2d923. * a11y: improve aria labels for ITC * fix: simplify url method * fix: update ITC app actions * test: add test to generate test data for display layout w/ overlay plot + ITC enabled * test(e2e): add suite + test for open in new tab from subobject - needs cleanup * a11y: various a11y improvement drivebys * a11y: clock indicator needs to be quiet * a11y: add `aria-live` to SuperMenu details * a11y: greatly improve a11y of Menus and SuperMenus * test(e2e): clean up test * fix: improve a11y for context menus, fix test * chore: remove nop-longer-recommended extension * feat: provide one more bound option for example data viz * fix: no need for `mount`, use dynamic rendering instead * Revert "fix: simplify url method" This reverts commit b24c7dabc783a9a1c3f2460eada99f452259f566. * fix: correct time conductor bounds when opening in a new tab from a plot in the inspector * test: fix e2e tests * Revert "test: remove test as feature is no longer needed" This reverts commit 759ebd4667bffb1979d5f62af6b47f349dcd9f77. * test: move 2p annotation to test * test: fix e2e * fix: no words for the word god today * test: fix e2e * fix: e2e test * test: fix test * driveby: fix perf test * fix: revert required prop change --------- Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com> Co-authored-by: John Hill <john.c.hill@nasa.gov>
80 lines
2.3 KiB
JavaScript
80 lines
2.3 KiB
JavaScript
import { createOpenMct, resetApplicationState } from '../utils/testing.js';
|
|
import { identifierToString, objectPathToUrl, paramsToArray } from './url.js';
|
|
|
|
describe('the url tool', function () {
|
|
let openmct;
|
|
let mockObjectPath;
|
|
|
|
beforeEach((done) => {
|
|
mockObjectPath = [
|
|
{
|
|
name: 'mock folder',
|
|
type: 'fake-folder',
|
|
identifier: {
|
|
key: 'mock-folder',
|
|
namespace: ''
|
|
}
|
|
},
|
|
{
|
|
name: 'mock parent folder',
|
|
type: 'fake-folder',
|
|
identifier: {
|
|
key: 'mock-parent-folder',
|
|
namespace: ''
|
|
}
|
|
}
|
|
];
|
|
openmct = createOpenMct();
|
|
openmct.on('start', () => {
|
|
openmct.router.setPath('/browse/mine?testParam1=testValue1');
|
|
done();
|
|
});
|
|
openmct.startHeadless();
|
|
});
|
|
|
|
afterEach(() => {
|
|
return resetApplicationState(openmct);
|
|
});
|
|
|
|
describe('paramsToArray', () => {
|
|
it('exists', () => {
|
|
expect(paramsToArray).toBeDefined();
|
|
});
|
|
it('can construct an array properly from query parameters', () => {
|
|
const arrayOfParams = paramsToArray(openmct);
|
|
expect(arrayOfParams.length).toBeDefined();
|
|
expect(arrayOfParams.length).toBeGreaterThan(0);
|
|
});
|
|
});
|
|
|
|
describe('identifierToString', () => {
|
|
it('exists', () => {
|
|
expect(identifierToString).toBeDefined();
|
|
});
|
|
it('can construct a String properly from a path', () => {
|
|
const constructedString = identifierToString(openmct, mockObjectPath);
|
|
expect(constructedString).toEqual('#/browse/mock-parent-folder/mock-folder');
|
|
});
|
|
});
|
|
|
|
describe('objectPathToUrl', () => {
|
|
it('exists', () => {
|
|
expect(objectPathToUrl).toBeDefined();
|
|
});
|
|
it('can construct URL properly from a path', () => {
|
|
const constructedURL = objectPathToUrl(openmct, mockObjectPath);
|
|
expect(constructedURL).toContain('#/browse/mock-parent-folder/mock-folder');
|
|
});
|
|
it('can take params to set a custom url', () => {
|
|
const customParams = {
|
|
'tc.startBound': 1669911059,
|
|
'tc.endBound': 1669911082,
|
|
'tc.mode': 'fixed'
|
|
};
|
|
const constructedURL = objectPathToUrl(openmct, mockObjectPath, customParams);
|
|
expect(constructedURL).toContain('tc.startBound=1669911059&tc.endBound=1669911082');
|
|
expect(constructedURL).toContain('tc.mode=fixed');
|
|
});
|
|
});
|
|
});
|