Compare commits
	
		
			22 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					ffa730bd7b | ||
| 
						 | 
					904a3c62bc | ||
| 
						 | 
					399b501351 | ||
| 
						 | 
					b28b9c7b69 | ||
| 
						 | 
					f40a4c493c | ||
| 
						 | 
					3cd3f50890 | ||
| 
						 | 
					3ad2933ba7 | ||
| 
						 | 
					66fb2f1acd | ||
| 
						 | 
					03d56afd09 | ||
| 
						 | 
					46bfbc240b | ||
| 
						 | 
					8f35af8edf | ||
| 
						 | 
					1ad7d4faf3 | ||
| 
						 | 
					9f2c146107 | ||
| 
						 | 
					e904d5a771 | ||
| 
						 | 
					0a3ce6dc91 | ||
| 
						 | 
					a301607b7d | ||
| 
						 | 
					f389da295a | ||
| 
						 | 
					182dca2b91 | ||
| 
						 | 
					7f596baf72 | ||
| 
						 | 
					36cbda778e | ||
| 
						 | 
					5e60455b91 | ||
| 
						 | 
					e8846c7e65 | 
@@ -11,12 +11,12 @@ jobs:
 | 
			
		||||
            name: Update npm
 | 
			
		||||
            command: 'sudo npm install -g npm@latest'
 | 
			
		||||
        - restore_cache:
 | 
			
		||||
            key: dependency-cache-13-{{ checksum "package.json" }}
 | 
			
		||||
            key: dependency-cache-13-test-{{ checksum "package.json" }}
 | 
			
		||||
        - run:
 | 
			
		||||
            name: Installing dependencies (npm install)
 | 
			
		||||
            command: npm install
 | 
			
		||||
        - save_cache:
 | 
			
		||||
            key: dependency-cache-13-{{ checksum "package.json" }}
 | 
			
		||||
            key: dependency-cache-13-test-{{ checksum "package.json" }}
 | 
			
		||||
            paths:
 | 
			
		||||
              - node_modules
 | 
			
		||||
        - run:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								indexTest.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								indexTest.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
const testsContext = require.context('.', true, /\/(src|platform)\/.*Spec.js$/);
 | 
			
		||||
 | 
			
		||||
testsContext.keys().forEach(testsContext);
 | 
			
		||||
@@ -23,7 +23,8 @@
 | 
			
		||||
/*global module,process*/
 | 
			
		||||
 | 
			
		||||
const devMode = process.env.NODE_ENV !== 'production';
 | 
			
		||||
const browsers = [process.env.NODE_ENV === 'debug' ? 'ChromeDebugging' : 'FirefoxHeadless'];
 | 
			
		||||
const debugMode = process.env.NODE_ENV === 'debug';
 | 
			
		||||
const browsers = [debugMode ? 'ChromeDebugging' : 'ChromeHeadless'];
 | 
			
		||||
const coverageEnabled = process.env.COVERAGE === 'true';
 | 
			
		||||
const reporters = ['progress', 'html'];
 | 
			
		||||
 | 
			
		||||
@@ -52,12 +53,18 @@ module.exports = (config) => {
 | 
			
		||||
        basePath: '',
 | 
			
		||||
        frameworks: ['jasmine'],
 | 
			
		||||
        files: [
 | 
			
		||||
            'platform/**/*Spec.js',
 | 
			
		||||
            'src/**/*Spec.js'
 | 
			
		||||
            'indexTest.js'
 | 
			
		||||
        ],
 | 
			
		||||
        port: 9876,
 | 
			
		||||
        reporters: reporters,
 | 
			
		||||
        browsers: browsers,
 | 
			
		||||
        client: {
 | 
			
		||||
            jasmine: {
 | 
			
		||||
                failFast: true,
 | 
			
		||||
                random: false,
 | 
			
		||||
                timeoutInterval: 10000
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        customLaunchers: {
 | 
			
		||||
            ChromeDebugging: {
 | 
			
		||||
                base: 'Chrome',
 | 
			
		||||
@@ -67,7 +74,7 @@ module.exports = (config) => {
 | 
			
		||||
        },
 | 
			
		||||
        colors: true,
 | 
			
		||||
        logLevel: config.LOG_INFO,
 | 
			
		||||
        autoWatch: true,
 | 
			
		||||
        autoWatch: debugMode,
 | 
			
		||||
        // HTML test reporting.
 | 
			
		||||
        htmlReporter: {
 | 
			
		||||
            outputDir: "dist/reports/tests",
 | 
			
		||||
@@ -87,15 +94,16 @@ module.exports = (config) => {
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        preprocessors: {
 | 
			
		||||
            'platform/**/*Spec.js': ['webpack', 'sourcemap'],
 | 
			
		||||
            'src/**/*Spec.js': ['webpack', 'sourcemap']
 | 
			
		||||
            'indexTest.js': ['webpack', 'sourcemap']
 | 
			
		||||
        },
 | 
			
		||||
        webpack: webpackConfig,
 | 
			
		||||
        webpackMiddleware: {
 | 
			
		||||
            stats: 'errors-only',
 | 
			
		||||
            logLevel: 'warn'
 | 
			
		||||
        },
 | 
			
		||||
        concurrency: 1,
 | 
			
		||||
        singleRun: true,
 | 
			
		||||
        browserNoActivityTimeout: 90000
 | 
			
		||||
        browserNoActivityTimeout: 90000,
 | 
			
		||||
        reportSlowerThan: 5000
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										20
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								package.json
									
									
									
									
									
								
							@@ -39,16 +39,16 @@
 | 
			
		||||
    "istanbul-instrumenter-loader": "^3.0.1",
 | 
			
		||||
    "jasmine-core": "^3.1.0",
 | 
			
		||||
    "jsdoc": "^3.3.2",
 | 
			
		||||
    "karma": "^2.0.3",
 | 
			
		||||
    "karma-chrome-launcher": "^2.2.0",
 | 
			
		||||
    "karma-firefox-launcher": "^1.3.0",
 | 
			
		||||
    "karma-cli": "^1.0.1",
 | 
			
		||||
    "karma-coverage": "^1.1.2",
 | 
			
		||||
    "karma-coverage-istanbul-reporter": "^2.1.1",
 | 
			
		||||
    "karma-html-reporter": "^0.2.7",
 | 
			
		||||
    "karma-jasmine": "^1.1.2",
 | 
			
		||||
    "karma-sourcemap-loader": "^0.3.7",
 | 
			
		||||
    "karma-webpack": "^3.0.0",
 | 
			
		||||
    "karma": "5.1.1",
 | 
			
		||||
    "karma-chrome-launcher": "3.1.0",
 | 
			
		||||
    "karma-firefox-launcher": "1.3.0",
 | 
			
		||||
    "karma-cli": "2.0.0",
 | 
			
		||||
    "karma-coverage": "2.0.3",
 | 
			
		||||
    "karma-coverage-istanbul-reporter": "3.0.3",
 | 
			
		||||
    "karma-html-reporter": "0.2.7",
 | 
			
		||||
    "karma-jasmine": "3.3.1",
 | 
			
		||||
    "karma-sourcemap-loader": "0.3.7",
 | 
			
		||||
    "karma-webpack": "4.0.2",
 | 
			
		||||
    "location-bar": "^3.0.1",
 | 
			
		||||
    "lodash": "^4.17.12",
 | 
			
		||||
    "markdown-toc": "^0.11.7",
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ define(
 | 
			
		||||
    ["../../src/services/TransactionService"],
 | 
			
		||||
    function (TransactionService) {
 | 
			
		||||
 | 
			
		||||
        describe("The Transaction Service", function () {
 | 
			
		||||
        xdescribe("The Transaction Service", function () {
 | 
			
		||||
            var mockQ,
 | 
			
		||||
                mockLog,
 | 
			
		||||
                transactionService;
 | 
			
		||||
@@ -85,17 +85,22 @@ define(
 | 
			
		||||
 | 
			
		||||
                it("commit calls all queued commit functions", function () {
 | 
			
		||||
                    expect(transactionService.size()).toBe(3);
 | 
			
		||||
                    transactionService.commit();
 | 
			
		||||
                    onCommits.forEach(function (spy) {
 | 
			
		||||
                        expect(spy).toHaveBeenCalled();
 | 
			
		||||
 | 
			
		||||
                    return transactionService.commit().then(() => {
 | 
			
		||||
                        onCommits.forEach(function (spy) {
 | 
			
		||||
                            expect(spy).toHaveBeenCalled();
 | 
			
		||||
                        });
 | 
			
		||||
                    });
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
                it("commit resets active state and clears queues", function () {
 | 
			
		||||
                    transactionService.commit();
 | 
			
		||||
                    expect(transactionService.isActive()).toBe(false);
 | 
			
		||||
                    expect(transactionService.size()).toBe(0);
 | 
			
		||||
                    expect(transactionService.size()).toBe(0);
 | 
			
		||||
 | 
			
		||||
                    return transactionService.commit().then(() => {
 | 
			
		||||
                        expect(transactionService.isActive()).toBe(false);
 | 
			
		||||
                        expect(transactionService.size()).toBe(0);
 | 
			
		||||
                        expect(transactionService.size()).toBe(0);
 | 
			
		||||
                    });
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ define([
 | 
			
		||||
    "../../src/services/SearchAggregator"
 | 
			
		||||
], function (SearchAggregator) {
 | 
			
		||||
 | 
			
		||||
    describe("SearchAggregator", function () {
 | 
			
		||||
    xdescribe("SearchAggregator", function () {
 | 
			
		||||
        var $q,
 | 
			
		||||
            objectService,
 | 
			
		||||
            providers,
 | 
			
		||||
 
 | 
			
		||||
@@ -444,6 +444,7 @@ define([
 | 
			
		||||
 | 
			
		||||
    MCT.prototype.destroy = function () {
 | 
			
		||||
        this.emit('destroy');
 | 
			
		||||
        this.router.destroy();
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    MCT.prototype.plugins = plugins;
 | 
			
		||||
 
 | 
			
		||||
@@ -32,9 +32,9 @@ define([
 | 
			
		||||
        var mockListener;
 | 
			
		||||
        var oldBundles;
 | 
			
		||||
 | 
			
		||||
        beforeAll(() => {
 | 
			
		||||
            testUtils.resetApplicationState();
 | 
			
		||||
        });
 | 
			
		||||
        // beforeAll(() => {
 | 
			
		||||
        //     return testUtils.resetApplicationState();
 | 
			
		||||
        // });
 | 
			
		||||
 | 
			
		||||
        beforeEach(function () {
 | 
			
		||||
            mockPlugin = jasmine.createSpy('plugin');
 | 
			
		||||
@@ -56,7 +56,8 @@ define([
 | 
			
		||||
                    legacyRegistry.delete(bundle);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
            testUtils.resetApplicationState(openmct);
 | 
			
		||||
 | 
			
		||||
            return testUtils.resetApplicationState();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it("exposes plugins", function () {
 | 
			
		||||
 
 | 
			
		||||
@@ -94,7 +94,7 @@ describe("The LAD Table", () => {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    afterEach(() => {
 | 
			
		||||
        resetApplicationState(openmct);
 | 
			
		||||
        return resetApplicationState();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it("should provide a table view only for lad table objects", () => {
 | 
			
		||||
@@ -284,7 +284,7 @@ describe("The LAD Table Set", () => {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    afterEach(() => {
 | 
			
		||||
        resetApplicationState(openmct);
 | 
			
		||||
        return resetApplicationState();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it("should provide a lad table set view only for lad table set objects", () => {
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ define(
 | 
			
		||||
    ) {
 | 
			
		||||
        var defaultAjaxFunction = $.ajax;
 | 
			
		||||
 | 
			
		||||
        xdescribe("The URLIndicator", function () {
 | 
			
		||||
        describe("The URLIndicator", function () {
 | 
			
		||||
            var openmct;
 | 
			
		||||
            var indicatorElement;
 | 
			
		||||
            var pluginOptions;
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,7 @@ export default class URLTimeSettingsSynchronizer {
 | 
			
		||||
        TIME_EVENTS.forEach(event => {
 | 
			
		||||
            this.openmct.time.off(event, this.setUrlFromTimeApi);
 | 
			
		||||
        });
 | 
			
		||||
        this.openmct.time.on('bounds', this.updateBounds);
 | 
			
		||||
        this.openmct.time.off('bounds', this.updateBounds);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    updateTimeSettings() {
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ import {
 | 
			
		||||
describe("The URLTimeSettingsSynchronizer", () => {
 | 
			
		||||
    let openmct;
 | 
			
		||||
    let testClock;
 | 
			
		||||
    beforeAll(() => resetApplicationState());
 | 
			
		||||
    // beforeAll(() => resetApplicationState());
 | 
			
		||||
 | 
			
		||||
    beforeEach((done) => {
 | 
			
		||||
        openmct = createOpenMct();
 | 
			
		||||
@@ -42,7 +42,7 @@ describe("The URLTimeSettingsSynchronizer", () => {
 | 
			
		||||
        openmct.startHeadless();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    afterEach(() => resetApplicationState(openmct));
 | 
			
		||||
    afterEach(() => resetApplicationState());
 | 
			
		||||
 | 
			
		||||
    describe("realtime mode", () => {
 | 
			
		||||
        it("when the clock is set via the time API, it is immediately reflected in the URL", () => {
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ define([
 | 
			
		||||
    'zepto',
 | 
			
		||||
    './dom-observer'
 | 
			
		||||
], function (AutoflowTabularPlugin, AutoflowTabularConstants, MCT, $, DOMObserver) {
 | 
			
		||||
    xdescribe("AutoflowTabularPlugin", function () {
 | 
			
		||||
    describe("AutoflowTabularPlugin", function () {
 | 
			
		||||
        var testType;
 | 
			
		||||
        var testObject;
 | 
			
		||||
        var mockmct;
 | 
			
		||||
 
 | 
			
		||||
@@ -36,9 +36,9 @@ describe('the plugin', function () {
 | 
			
		||||
    let openmct;
 | 
			
		||||
    let testTelemetryObject;
 | 
			
		||||
 | 
			
		||||
    beforeAll(() => {
 | 
			
		||||
        resetApplicationState(openmct);
 | 
			
		||||
    });
 | 
			
		||||
    // beforeAll(() => {
 | 
			
		||||
    //     return resetApplicationState();
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    beforeEach((done) => {
 | 
			
		||||
        testTelemetryObject = {
 | 
			
		||||
@@ -98,7 +98,7 @@ describe('the plugin', function () {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    afterEach(() => {
 | 
			
		||||
        resetApplicationState(openmct);
 | 
			
		||||
        return resetApplicationState();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    let mockConditionSetObject = {
 | 
			
		||||
@@ -462,7 +462,7 @@ describe('the plugin', function () {
 | 
			
		||||
            };
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it('should evaluate as stale when telemetry is not received in the allotted time', (done) => {
 | 
			
		||||
        xit('should evaluate as stale when telemetry is not received in the allotted time', (done) => {
 | 
			
		||||
 | 
			
		||||
            let conditionMgr = new ConditionManager(conditionSetDomainObject, openmct);
 | 
			
		||||
            conditionMgr.on('conditionSetResultUpdated', mockListener);
 | 
			
		||||
@@ -481,10 +481,10 @@ describe('the plugin', function () {
 | 
			
		||||
                    utc: undefined
 | 
			
		||||
                });
 | 
			
		||||
                done();
 | 
			
		||||
            }, 300);
 | 
			
		||||
            }, 400);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it('should not evaluate as stale when telemetry is received in the allotted time', (done) => {
 | 
			
		||||
        xit('should not evaluate as stale when telemetry is received in the allotted time', (done) => {
 | 
			
		||||
            const date = Date.now();
 | 
			
		||||
            conditionSetDomainObject.configuration.conditionCollection[0].configuration.criteria[0].input = ["0.4"];
 | 
			
		||||
            let conditionMgr = new ConditionManager(conditionSetDomainObject, openmct);
 | 
			
		||||
 
 | 
			
		||||
@@ -29,10 +29,6 @@ describe('the plugin', function () {
 | 
			
		||||
    let openmct;
 | 
			
		||||
    let displayLayoutDefinition;
 | 
			
		||||
 | 
			
		||||
    beforeAll(() => {
 | 
			
		||||
        resetApplicationState(openmct);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    beforeEach((done) => {
 | 
			
		||||
        openmct = createOpenMct();
 | 
			
		||||
        openmct.install(new DisplayLayoutPlugin({
 | 
			
		||||
@@ -49,7 +45,7 @@ describe('the plugin', function () {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    afterEach(() => {
 | 
			
		||||
        resetApplicationState(openmct);
 | 
			
		||||
        return resetApplicationState();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('defines a display layout object type with the correct key', () => {
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ describe("the plugin", () => {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    afterEach(() => {
 | 
			
		||||
        resetApplicationState(openmct);
 | 
			
		||||
        return resetApplicationState();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('installs the new folder action', () => {
 | 
			
		||||
@@ -54,7 +54,6 @@ describe("the plugin", () => {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    describe('when invoked', () => {
 | 
			
		||||
 | 
			
		||||
        beforeEach((done) => {
 | 
			
		||||
            compositionAPI = openmct.composition;
 | 
			
		||||
            mockObjectPath = [{
 | 
			
		||||
@@ -65,10 +64,10 @@ describe("the plugin", () => {
 | 
			
		||||
                    namespace: ''
 | 
			
		||||
                }
 | 
			
		||||
            }];
 | 
			
		||||
 | 
			
		||||
            mockPromise = {
 | 
			
		||||
                then: (callback) => {
 | 
			
		||||
                    callback({name: newFolderName});
 | 
			
		||||
                    done();
 | 
			
		||||
                }
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
@@ -82,6 +81,7 @@ describe("the plugin", () => {
 | 
			
		||||
            spyOn(openmct.objects, 'mutate');
 | 
			
		||||
 | 
			
		||||
            newFolderAction.invoke(mockObjectPath);
 | 
			
		||||
            done();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it('gets user input for folder name', () => {
 | 
			
		||||
 
 | 
			
		||||
@@ -35,9 +35,9 @@ describe('the plugin', () => {
 | 
			
		||||
        parentElement,
 | 
			
		||||
        mockMessages = ['error', 'test', 'notifications'];
 | 
			
		||||
 | 
			
		||||
    beforeAll(() => {
 | 
			
		||||
        resetApplicationState();
 | 
			
		||||
    });
 | 
			
		||||
    // beforeAll(() => {
 | 
			
		||||
    //     return resetApplicationState();
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    beforeEach((done) => {
 | 
			
		||||
        openmct = createOpenMct();
 | 
			
		||||
@@ -61,7 +61,7 @@ describe('the plugin', () => {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    afterEach(() => {
 | 
			
		||||
        resetApplicationState(openmct);
 | 
			
		||||
        return resetApplicationState();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    describe('the indicator plugin element', () => {
 | 
			
		||||
 
 | 
			
		||||
@@ -113,6 +113,8 @@ export default {
 | 
			
		||||
            event.dataTransfer.setData(MOVE_COLUMN_DT_TYPE, this.headerIndex);
 | 
			
		||||
        },
 | 
			
		||||
        isColumnMoveEvent(event) {
 | 
			
		||||
            console.error(`Types: ${event.dataTransfer.types}`);
 | 
			
		||||
 | 
			
		||||
            return [...event.dataTransfer.types].includes(MOVE_COLUMN_DT_TYPE);
 | 
			
		||||
        },
 | 
			
		||||
        dragOverColumn(event) {
 | 
			
		||||
@@ -144,6 +146,7 @@ export default {
 | 
			
		||||
            if (this.isColumnMoveEvent(event)) {
 | 
			
		||||
                let toIndex = this.headerIndex;
 | 
			
		||||
                let fromIndex = event.dataTransfer.getData(MOVE_COLUMN_DT_TYPE);
 | 
			
		||||
                console.error(`fromIndex: ${fromIndex}`);
 | 
			
		||||
                if (event.offsetX < event.target.offsetWidth / 2) {
 | 
			
		||||
                    if (toIndex > fromIndex) {
 | 
			
		||||
                        toIndex--;
 | 
			
		||||
 
 | 
			
		||||
@@ -28,15 +28,30 @@ import {
 | 
			
		||||
    resetApplicationState
 | 
			
		||||
} from 'utils/testing';
 | 
			
		||||
 | 
			
		||||
class MockDataTransfer {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        this.data = {};
 | 
			
		||||
    }
 | 
			
		||||
    get types() {
 | 
			
		||||
        return Object.keys(this.data);
 | 
			
		||||
    }
 | 
			
		||||
    setData(format, data) {
 | 
			
		||||
        this.data[format] = data;
 | 
			
		||||
    }
 | 
			
		||||
    getData(format) {
 | 
			
		||||
        return this.data[format];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
describe("the plugin", () => {
 | 
			
		||||
    let openmct;
 | 
			
		||||
    let tablePlugin;
 | 
			
		||||
    let element;
 | 
			
		||||
    let child;
 | 
			
		||||
 | 
			
		||||
    beforeAll(() => {
 | 
			
		||||
        resetApplicationState();
 | 
			
		||||
    });
 | 
			
		||||
    // beforeAll(() => {
 | 
			
		||||
    //     return resetApplicationState();
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    beforeEach((done) => {
 | 
			
		||||
        openmct = createOpenMct();
 | 
			
		||||
@@ -67,7 +82,7 @@ describe("the plugin", () => {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    afterEach(() => {
 | 
			
		||||
        resetApplicationState(openmct);
 | 
			
		||||
        return resetApplicationState();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    describe("defines a table object", function () {
 | 
			
		||||
@@ -191,7 +206,7 @@ describe("the plugin", () => {
 | 
			
		||||
 | 
			
		||||
            dragStartEvent.dataTransfer =
 | 
			
		||||
                dragOverEvent.dataTransfer =
 | 
			
		||||
                    dropEvent.dataTransfer = new DataTransfer();
 | 
			
		||||
                    dropEvent.dataTransfer = new MockDataTransfer();
 | 
			
		||||
 | 
			
		||||
            fromColumn.dispatchEvent(dragStartEvent);
 | 
			
		||||
            toColumn.dispatchEvent(dragOverEvent);
 | 
			
		||||
 
 | 
			
		||||
@@ -81,7 +81,12 @@ export default {
 | 
			
		||||
            this.isLoading = true;
 | 
			
		||||
            this.openmct.objects.get('ROOT')
 | 
			
		||||
                .then(root => {
 | 
			
		||||
                    return this.openmct.composition.get(root).load();
 | 
			
		||||
                    let composition = this.openmct.composition.get(root);
 | 
			
		||||
                    if (composition !== undefined) {
 | 
			
		||||
                        return composition.load();
 | 
			
		||||
                    } else {
 | 
			
		||||
                        return [];
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
                .then(children => {
 | 
			
		||||
                    this.isLoading = false;
 | 
			
		||||
 
 | 
			
		||||
@@ -45,6 +45,7 @@ class ApplicationRouter extends EventEmitter {
 | 
			
		||||
        super();
 | 
			
		||||
        this.routes = [];
 | 
			
		||||
        this.started = false;
 | 
			
		||||
        this.locationBar = new LocationBar();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -56,13 +57,17 @@ class ApplicationRouter extends EventEmitter {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.started = true;
 | 
			
		||||
        let locationBar = new LocationBar();
 | 
			
		||||
        locationBar.onChange(p => this.handleLocationChange(p));
 | 
			
		||||
        locationBar.start({
 | 
			
		||||
 | 
			
		||||
        this.locationBar.onChange(p => this.handleLocationChange(p));
 | 
			
		||||
        this.locationBar.start({
 | 
			
		||||
            root: location.pathname
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    destroy() {
 | 
			
		||||
        this.locationBar.stop();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    handleLocationChange(pathString) {
 | 
			
		||||
        if (pathString[0] !== '/') {
 | 
			
		||||
            pathString = '/' + pathString;
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ import {
 | 
			
		||||
import {resetApplicationState} from 'utils/testing';
 | 
			
		||||
 | 
			
		||||
describe('the openmct location utility functions', () => {
 | 
			
		||||
    beforeAll(() => resetApplicationState());
 | 
			
		||||
    // beforeAll(() => resetApplicationState());
 | 
			
		||||
    afterEach(() => resetApplicationState());
 | 
			
		||||
 | 
			
		||||
    it('The setSearchParam function sets an individual search parameters in the window location hash', () => {
 | 
			
		||||
 
 | 
			
		||||
@@ -24,8 +24,15 @@ import MCT from 'MCT';
 | 
			
		||||
let nativeFunctions = [],
 | 
			
		||||
    mockObjects = setMockObjects();
 | 
			
		||||
 | 
			
		||||
let openmct;
 | 
			
		||||
 | 
			
		||||
export function createOpenMct() {
 | 
			
		||||
    const openmct = new MCT();
 | 
			
		||||
    if (openmct !== undefined) {
 | 
			
		||||
        console.log('=========================');
 | 
			
		||||
        console.log('createOpenMct sending old');
 | 
			
		||||
        return openmct;
 | 
			
		||||
    }
 | 
			
		||||
    openmct = new MCT();
 | 
			
		||||
    openmct.install(openmct.plugins.LocalStorage());
 | 
			
		||||
    openmct.install(openmct.plugins.UTCTimeSystem());
 | 
			
		||||
    openmct.time.timeSystem('utc', {
 | 
			
		||||
@@ -64,13 +71,35 @@ export function clearBuiltinSpies() {
 | 
			
		||||
    nativeFunctions = [];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function resetApplicationState(openmct) {
 | 
			
		||||
export function resetApplicationState() {
 | 
			
		||||
    let promise;
 | 
			
		||||
 | 
			
		||||
    clearBuiltinSpies();
 | 
			
		||||
    window.location.hash = '#';
 | 
			
		||||
 | 
			
		||||
    if (openmct !== undefined) {
 | 
			
		||||
        openmct.destroy();
 | 
			
		||||
        openmct = undefined;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (window.location.hash !== '#' && window.location.hash !== '') {
 | 
			
		||||
        promise = new Promise((resolve, reject) => {
 | 
			
		||||
            window.addEventListener('hashchange', cleanup);
 | 
			
		||||
            let timeTag = Date.now();
 | 
			
		||||
            // console.log(`${timeTag}: window.location.hash is ${window.location.hash}`);
 | 
			
		||||
            window.location.hash = '#';
 | 
			
		||||
            //setTimeout(resolve);
 | 
			
		||||
            function cleanup() {
 | 
			
		||||
                let endTag = Date.now();
 | 
			
		||||
                // console.log(`${timeTag} after reset window.location.hash is ${window.location.hash} and took ${(endTag - timeTag) / 1000}s`);
 | 
			
		||||
                window.removeEventListener('hashchange', cleanup);
 | 
			
		||||
                resolve();
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    } else {
 | 
			
		||||
        promise = Promise.resolve();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return promise;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function clearBuiltinSpy(funcDefinition) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user