Merge branch 'master' into remove-action-tests

This commit is contained in:
Shefali Joshi 2020-08-10 11:57:06 -07:00 committed by GitHub
commit 78c7484d54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
185 changed files with 636 additions and 583 deletions

View File

@ -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-{{ checksum "package.json" }}
- run:
name: Installing dependencies (npm install)
command: npm install
- save_cache:
key: dependency-cache-13-{{ checksum "package.json" }}
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules
- run:

View File

@ -120,6 +120,34 @@ module.exports = {
"no-useless-computed-key": "error",
// https://eslint.org/docs/rules/rest-spread-spacing
"rest-spread-spacing": ["error"],
// https://eslint.org/docs/rules/default-case-last
"default-case-last": "error",
// https://eslint.org/docs/rules/default-param-last
"default-param-last": "error",
// https://eslint.org/docs/rules/grouped-accessor-pairs
"grouped-accessor-pairs": "error",
// https://eslint.org/docs/rules/no-constructor-return
"no-constructor-return": "error",
// https://eslint.org/docs/rules/array-callback-return
"array-callback-return": "error",
// https://eslint.org/docs/rules/no-invalid-this
"no-invalid-this": "error", // Believe this one actually surfaces some bugs
// https://eslint.org/docs/rules/func-style
"func-style": ["error", "declaration"],
// https://eslint.org/docs/rules/no-unused-expressions
"no-unused-expressions": "error",
// https://eslint.org/docs/rules/no-useless-concat
"no-useless-concat": "error",
// https://eslint.org/docs/rules/radix
"radix": "error",
// https://eslint.org/docs/rules/require-await
"require-await": "error",
// https://eslint.org/docs/rules/no-alert
"no-alert": "error",
// https://eslint.org/docs/rules/no-useless-constructor
"no-useless-constructor": "error",
// https://eslint.org/docs/rules/no-duplicate-imports
"no-duplicate-imports": "error",
// https://eslint.org/docs/rules/no-implicit-coercion
"no-implicit-coercion": "error",
@ -204,26 +232,21 @@ module.exports = {
}
}],
"vue/multiline-html-element-content-newline": "off",
"vue/singleline-html-element-content-newline": "off"
"vue/singleline-html-element-content-newline": "off",
},
"overrides": [
{
"files": ["*Spec.js"],
"files": LEGACY_FILES,
"rules": {
"no-unused-vars": [
"warn",
{
"vars": "all",
"args": "none",
"varsIgnorePattern": "controller",
"varsIgnorePattern": "controller"
}
]
}
}, {
"files": LEGACY_FILES,
"rules": {
// https://eslint.org/docs/rules/no-nested-ternary
],
"no-nested-ternary": "off",
"no-var": "off"
}

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2017, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/EventTelemetryProvider"

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2017, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define */
/**
* Module defining EventTelemetry.

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
/**
* Module defining EventTelemetryProvider. Created by chacskaylo on 06/18/2015.

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([], function () {
'use strict';

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
'./ExportTelemetryAsCSVAction'

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/ExampleFormController"

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2017, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,window*/
define(
[],
@ -80,7 +79,7 @@ define(
control: "button",
csslass: "icon-save",
click: function () {
window.alert("Save");
console.log("Save");
}
},
{
@ -88,7 +87,7 @@ define(
csslass: "icon-x",
description: "Button B",
click: function () {
window.alert("Cancel");
console.log("Cancel");
}
},
{
@ -97,7 +96,7 @@ define(
description: "Button C",
disabled: true,
click: function () {
window.alert("Delete");
console.log("Delete");
}
}
]

View File

@ -117,7 +117,7 @@ define([
}
GeneratorMetadataProvider.prototype.supportsMetadata = function (domainObject) {
return METADATA_BY_TYPE.hasOwnProperty(domainObject.type);
return Object.prototype.hasOwnProperty.call(METADATA_BY_TYPE, domainObject.type);
};
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {

View File

@ -62,15 +62,15 @@ define([
var workerRequest = {};
props.forEach(function (prop) {
if (domainObject.telemetry && domainObject.telemetry.hasOwnProperty(prop)) {
if (domainObject.telemetry && Object.prototype.hasOwnProperty.call(domainObject.telemetry, prop)) {
workerRequest[prop] = domainObject.telemetry[prop];
}
if (request && request.hasOwnProperty(prop)) {
if (request && Object.prototype.hasOwnProperty.call(request, prop)) {
workerRequest[prop] = request[prop];
}
if (!workerRequest.hasOwnProperty(prop)) {
if (!Object.prototype.hasOwnProperty.call(workerRequest, prop)) {
workerRequest[prop] = REQUEST_DEFAULTS[prop];
}

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([

View File

@ -72,6 +72,7 @@ define([
});
var messageId;
let self = this;
function callback(message) {
if (message.error) {
deferred.reject(message.error);
@ -79,7 +80,8 @@ define([
deferred.resolve(message.data);
}
delete this.callbacks[messageId];
delete self.callbacks[messageId];
}
messageId = this.dispatch('request', request, callback.bind(this));

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2017, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global self*/
(function () {
var FIFTEEN_MINUTES = 15 * 60 * 1000;

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./GeneratorProvider",

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/ExampleIdentityService"

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
function () {

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([], function () {
"use strict";

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/RemsTelemetryServerAdapter",

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
function () {

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define */
define (
['./RemsTelemetrySeries'],
function (RemsTelemetrySeries) {

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define */
define(
function () {
"use strict";

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
/*jslint es5: true */
define(

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/DialogLaunchController",

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,window*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,window*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/BrowserPersistenceProvider"

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
/**
* Stubbed implementation of a persistence provider,

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/ExamplePolicy"

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/WatchIndicator",

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/ScratchPersistenceProvider"

View File

@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,window*/
define(
[],
function () {

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

3
indexTest.js Normal file
View File

@ -0,0 +1,3 @@
const testsContext = require.context('.', true, /\/(src|platform)\/.*Spec.js$/);
testsContext.keys().forEach(testsContext);

View File

@ -52,12 +52,16 @@ module.exports = (config) => {
basePath: '',
frameworks: ['jasmine'],
files: [
'platform/**/*Spec.js',
'src/**/*Spec.js'
'indexTest.js'
],
port: 9876,
reporters: reporters,
browsers: browsers,
client: {
jasmine: {
random: false
}
},
customLaunchers: {
ChromeDebugging: {
base: 'Chrome',
@ -82,20 +86,20 @@ module.exports = (config) => {
reports: ['html', 'lcovonly', 'text-summary'],
thresholds: {
global: {
lines: 62
lines: 64
}
}
},
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
});
}
};

View File

@ -6,7 +6,7 @@
"devDependencies": {
"angular": ">=1.8.0",
"angular-route": "1.4.14",
"babel-eslint": "8.2.6",
"babel-eslint": "10.0.3",
"comma-separated-values": "^3.6.4",
"concurrently": "^3.6.1",
"copy-webpack-plugin": "^4.5.2",
@ -22,7 +22,7 @@
"d3-selection": "1.3.x",
"d3-time": "1.0.x",
"d3-time-format": "2.1.x",
"eslint": "5.2.0",
"eslint": "7.0.0",
"eslint-plugin-vue": "^6.0.0",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0",
"eventemitter3": "^1.2.0",
@ -39,27 +39,27 @@
"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",
"marked": "^0.3.5",
"mini-css-extract-plugin": "^0.4.1",
"minimist": "^1.1.1",
"minimist": "^1.2.5",
"moment": "2.25.3",
"moment-duration-format": "^2.2.2",
"moment-timezone": "0.5.28",
"node-bourbon": "^4.2.3",
"node-sass": "^4.9.2",
"node-sass": "^4.14.1",
"painterro": "^1.0.35",
"printj": "^1.2.1",
"raw-loader": "^0.5.1",

View File

@ -164,7 +164,7 @@ function (
}
function saveAfterClone(clonedObject) {
return this.openmct.editor.save().then(() => {
return self.openmct.editor.save().then(() => {
// Force mutation for search indexing
return clonedObject;
});

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
['./TransactionalPersistenceCapability'],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],

View File

@ -56,10 +56,11 @@ define(
*/
CreateWizard.prototype.getFormStructure = function (includeLocation) {
var sections = [],
domainObject = this.domainObject;
domainObject = this.domainObject,
self = this;
function validateLocation(parent) {
return parent && this.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter'));
return parent && self.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter'));
}
sections.push({

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
['./Transaction', './NestedTransaction'],
function (Transaction, NestedTransaction) {

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global describe,it,expect,beforeEach,jasmine*/
define(
["../../src/actions/SaveAction"],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global describe,it,expect,beforeEach,jasmine*/
define(
["../../src/actions/SaveAndStopEditingAction"],

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global describe,it,expect,beforeEach,jasmine,spyOn*/
define(
["../../src/actions/SaveAsAction"],

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(
[

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global describe,it,expect,beforeEach,jasmine*/
define(
["../../src/controllers/EditActionController"],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(["../../src/services/NestedTransaction"], function (NestedTransaction) {
var TRANSACTION_METHODS = ['add', 'commit', 'cancel', 'size'];

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(
["../../src/services/TransactionManager"],

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(
["../../src/services/TransactionService"],
@ -28,6 +27,7 @@ define(
describe("The Transaction Service", function () {
var mockQ,
mockLog,
mockCacheService,
transactionService;
function fastPromise(val) {
@ -40,9 +40,10 @@ define(
beforeEach(function () {
mockQ = jasmine.createSpyObj("$q", ["all"]);
mockCacheService = jasmine.createSpyObj("cacheService", ["flush"]);
mockQ.all.and.returnValue(fastPromise());
mockLog = jasmine.createSpyObj("$log", ["error"]);
transactionService = new TransactionService(mockQ, mockLog);
transactionService = new TransactionService(mockQ, mockLog, mockCacheService);
});
it("isActive returns true if a transaction is in progress", function () {
@ -85,17 +86,20 @@ 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);
});
});
});

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(
["../../src/services/Transaction"],

View File

@ -58,7 +58,8 @@ define(
var removeSelectable = openmct.selection.selectable(
element[0],
scope.$eval(attrs.mctSelectable),
attrs.hasOwnProperty('mctInitSelect') && scope.$eval(attrs.mctInitSelect) !== false
Object.prototype.hasOwnProperty.call(attrs, 'mctInitSelect')
&& scope.$eval(attrs.mctInitSelect) !== false
);
scope.$on("$destroy", function () {

View File

@ -76,7 +76,7 @@ define(
var search = this.$location.search(),
arr = [];
for (var key in search) {
if (search.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(search, key)) {
arr.push(key + '=' + search[key]);
}
}

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global console*/
define([
'../../src/directives/MCTTree',

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global describe,beforeEach,jasmine,it,expect*/
define([
'../../src/ui/TreeView',

View File

@ -27,7 +27,7 @@ export default class NotificationService {
if (typeof message === 'string') {
return this.openmct.notifications.info(message);
} else {
if (message.hasOwnProperty('progress')) {
if (Object.prototype.hasOwnProperty.call(message, 'progress')) {
return this.openmct.notifications.progress(message.title, message.progress, message.progressText);
} else {
return this.openmct.notifications.info(message.title);

View File

@ -56,7 +56,7 @@ define([], function () {
* @returns {boolean} true if present; false if not
*/
ModelCacheService.prototype.has = function (id) {
return this.cache.hasOwnProperty(id);
return Object.prototype.hasOwnProperty.call(this.cache, id);
};
/**

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([], function () {

View File

@ -75,13 +75,13 @@ define(
function mergeObjects(a, b) {
var result = {};
Object.keys(a).forEach(function (k) {
result[k] = b.hasOwnProperty(k)
result[k] = Object.prototype.hasOwnProperty.call(b, k)
? mergeModels(a[k], b[k], (merger || {})[k])
: a[k];
});
Object.keys(b).forEach(function (k) {
// Copy any properties not already merged
if (!a.hasOwnProperty(k)) {
if (!Object.prototype.hasOwnProperty.call(a, k)) {
result[k] = b[k];
}
});

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global spyOn*/
define(
function () {

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -20,7 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global jasmine*/
define(
function () {
@ -110,7 +109,7 @@ define(
* @returns {*} capability object
*/
domainObject.getCapability.and.callFake(function (capability) {
if (config.capabilities.hasOwnProperty(capability)) {
if (Object.prototype.hasOwnProperty.call(config.capabilities, capability)) {
return config.capabilities[capability];
}
});
@ -124,7 +123,7 @@ define(
* @returns {boolean}
*/
domainObject.hasCapability.and.callFake(function (capability) {
return config.capabilities.hasOwnProperty(capability);
return Object.prototype.hasOwnProperty.call(config.capabilities, capability);
});
/**
@ -137,7 +136,7 @@ define(
* @returns {*} result whatever was returned by `invoke`.
*/
domainObject.useCapability.and.callFake(function (capability) {
if (config.capabilities.hasOwnProperty(capability)) {
if (Object.prototype.hasOwnProperty.call(config.capabilities, capability)) {
if (!config.capabilities[capability].invoke) {
throw new Error(
capability + ' missing invoke function.'

View File

@ -20,7 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global jasmine*/
define(
function () {
@ -60,7 +59,7 @@ define(
]
);
mockCopyService.perform.and.callFake(function () {
mockCopyService.perform.and.callFake(() => {
var performPromise,
callExtensions,
spy;
@ -79,7 +78,7 @@ define(
}
};
spy = this.perform;
spy = mockCopyService.perform;
Object.keys(callExtensions).forEach(function (key) {
spy.calls.mostRecent()[key] = callExtensions[key];

View File

@ -20,7 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global jasmine*/
define(
[
'../ControlledPromise'
@ -63,11 +62,11 @@ define(
]
);
mockLinkService.perform.and.callFake(function (object) {
mockLinkService.perform.and.callFake(object => {
var performPromise = new ControlledPromise();
this.perform.calls.mostRecent().promise = performPromise;
this.perform.calls.all()[this.perform.calls.count() - 1].promise =
mockLinkService.perform.calls.mostRecent().promise = performPromise;
mockLinkService.perform.calls.all()[mockLinkService.perform.calls.count() - 1].promise =
performPromise;
return performPromise.then(function (overrideObject) {

View File

@ -20,7 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global jasmine*/
define(
function () {
@ -60,7 +59,7 @@ define(
]
);
mockMoveService.perform.and.callFake(function () {
mockMoveService.perform.and.callFake(() => {
var performPromise,
callExtensions,
spy;
@ -79,7 +78,7 @@ define(
}
};
spy = this.perform;
spy = mockMoveService.perform;
Object.keys(callExtensions).forEach(function (key) {
spy.calls.mostRecent()[key] = callExtensions[key];

View File

@ -47,6 +47,7 @@ define(["zepto"], function ($) {
return new Promise(function (resolve, reject) {
input.trigger("click");
input.on('change', function (event) {
// eslint-disable-next-line no-invalid-this
file = this.files[0];
input.remove();
if (file) {

View File

@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global window*/
define([
'./Constants',
'./FrameworkInitializer',

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global window*/
/**
* Implements the framework layer, which handles the loading of bundles
* and the wiring-together of the extensions they expose.

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* eslint-disable no-invalid-this */
/**
* Module defining CustomRegistrars. Created by vwoeltje on 11/3/14.

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/actions/ExportAsJSONAction",

View File

@ -86,7 +86,7 @@ define(['lodash'], function (_) {
// Only export if object is creatable
if (this.isCreatable(child)) {
// Prevents infinite export of self-contained objs
if (!this.tree.hasOwnProperty(this.getId(child))) {
if (!Object.prototype.hasOwnProperty.call(this.tree, this.getId(child))) {
// If object is a link to something absent from
// tree, generate new id and treat as new object
if (this.isExternal(child, parent)) {

View File

@ -144,7 +144,7 @@ define(
setTimeout(resolve, 100);
}).then(function () {
expect(Object.keys(action.tree).length).toBe(1);
expect(action.tree.hasOwnProperty("parentId"))
expect(Object.prototype.hasOwnProperty.call(action.tree, "parentId"))
.toBeTruthy();
});
});
@ -184,9 +184,9 @@ define(
setTimeout(resolve, 100);
}).then(function () {
expect(Object.keys(action.tree).length).toBe(2);
expect(action.tree.hasOwnProperty("infiniteParentId"))
expect(Object.prototype.hasOwnProperty.call(action.tree, "infiniteParentId"))
.toBeTruthy();
expect(action.tree.hasOwnProperty("infiniteChildId"))
expect(Object.prototype.hasOwnProperty.call(action.tree, "infiniteChildId"))
.toBeTruthy();
});
});
@ -224,9 +224,9 @@ define(
setTimeout(resolve, 100);
}).then(function () {
expect(Object.keys(action.tree).length).toBe(2);
expect(action.tree.hasOwnProperty('parentId'))
expect(Object.prototype.hasOwnProperty.call(action.tree, "parentId"))
.toBeTruthy();
expect(action.tree.hasOwnProperty('brandNewId'))
expect(Object.prototype.hasOwnProperty.call(action.tree, "brandNewId"))
.toBeTruthy();
expect(action.tree.brandNewId.location).toBe('parentId');
});
@ -239,8 +239,8 @@ define(
setTimeout(resolve, 100);
}).then(function () {
expect(Object.keys(exportedTree).length).toBe(2);
expect(exportedTree.hasOwnProperty('openmct')).toBeTruthy();
expect(exportedTree.hasOwnProperty('rootId')).toBeTruthy();
expect(Object.prototype.hasOwnProperty.call(exportedTree, "openmct")).toBeTruthy();
expect(Object.prototype.hasOwnProperty.call(exportedTree, "rootId")).toBeTruthy();
});
});

View File

@ -46,25 +46,34 @@ define([
spyOn(provider, 'cleanTerm').and.returnValue('cleanedTerm');
spyOn(provider, 'fuzzyMatchUnquotedTerms').and.returnValue('fuzzy');
spyOn(provider, 'parseResponse').and.returnValue('parsedResponse');
$http.and.returnValue(Promise.resolve({}));
$http.and.returnValue(Promise.resolve({
data: {
hits: {
hits: []
}
}
}));
});
it('cleans terms and adds fuzzyness', function () {
provider.query('hello', 10);
expect(provider.cleanTerm).toHaveBeenCalledWith('hello');
expect(provider.fuzzyMatchUnquotedTerms)
.toHaveBeenCalledWith('cleanedTerm');
return provider.query('hello', 10)
.then(() => {
expect(provider.cleanTerm).toHaveBeenCalledWith('hello');
expect(provider.fuzzyMatchUnquotedTerms)
.toHaveBeenCalledWith('cleanedTerm');
});
});
it('calls through to $http', function () {
provider.query('hello', 10);
expect($http).toHaveBeenCalledWith({
method: 'GET',
params: {
q: 'fuzzy',
size: 10
},
url: 'http://localhost:9200/_search/'
return provider.query('hello', 10).then(() => {
expect($http).toHaveBeenCalledWith({
method: 'GET',
params: {
q: 'fuzzy',
size: 10
},
url: 'http://localhost:9200/_search/'
});
});
});

View File

@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global self*/
/**
* Module defining BareBonesSearchWorker. Created by deeptailor on 10/03/2019.
*/

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global setTimeout*/
/**
* Module defining GenericSearchProvider. Created by shale on 07/16/2015.

View File

@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global self*/
/**
* Module defining GenericSearchWorker. Created by shale on 07/21/2015.
*/

View File

@ -20,8 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global require*/
/**
* SearchSpec. Created by shale on 07/31/2015.
*/

View File

@ -27,7 +27,7 @@ define([
"../../src/services/SearchAggregator"
], function (SearchAggregator) {
describe("SearchAggregator", function () {
xdescribe("SearchAggregator", function () {
var $q,
objectService,
providers,
@ -91,18 +91,19 @@ define([
});
it('filters results with a function', function () {
var modelResults = {
hits: [
{model: {thing: 1}},
{model: {thing: 2}},
{model: {thing: 3}}
],
total: 3
},
filterFunc = function (model) {
return model.thing < 2;
},
filtered = aggregator.applyFilter(modelResults, filterFunc);
const modelResults = {
hits: [
{model: {thing: 1}},
{model: {thing: 2}},
{model: {thing: 3}}
],
total: 3
};
let filtered = aggregator.applyFilter(modelResults, filterFunc);
function filterFunc(model) {
return model.thing < 2;
}
expect(filtered.hits).toEqual([
{model: {thing: 1}}

View File

@ -33,14 +33,11 @@ define(
_
) {
var ZERO = function () {
return 0;
},
EMPTY_SERIES = {
getPointCount: ZERO,
getDomainValue: ZERO,
getRangeValue: ZERO
};
const EMPTY_SERIES = {
getPointCount: () => 0,
getDomainValue: () => 0,
getRangeValue: () => 0
};
/**
* Provides metadata about telemetry associated with a

View File

@ -28,7 +28,7 @@ define(function () {
}
BundleRegistry.prototype.register = function (path, definition) {
if (this.knownBundles.hasOwnProperty(path)) {
if (Object.prototype.hasOwnProperty.call(this.knownBundles, path)) {
throw new Error('Cannot register bundle with duplicate path', path);
}

View File

@ -444,6 +444,7 @@ define([
MCT.prototype.destroy = function () {
this.emit('destroy');
this.router.destroy();
};
MCT.prototype.plugins = plugins;

View File

@ -32,10 +32,6 @@ define([
var mockListener;
var oldBundles;
beforeAll(() => {
testUtils.resetApplicationState();
});
beforeEach(function () {
mockPlugin = jasmine.createSpy('plugin');
mockPlugin2 = jasmine.createSpy('plugin2');
@ -56,7 +52,8 @@ define([
legacyRegistry.delete(bundle);
}
});
testUtils.resetApplicationState(openmct);
return testUtils.resetApplicationState(openmct);
});
it("exposes plugins", function () {

View File

@ -29,7 +29,7 @@ define([], function () {
view,
legacyObject
) {
if (view.hasOwnProperty('provider')) {
if (Object.prototype.hasOwnProperty.call(view, 'provider')) {
var domainObject = legacyObject.useCapability('adapter');
return view.provider.canView(domainObject);

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open openmct, Copyright (c) 2014-2018, United States Government
* Open openmct, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -20,7 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global console */
define([
], function (
@ -28,7 +27,7 @@ define([
) {
function checkForDeprecatedFunctionality(typeDef) {
if (typeDef.hasOwnProperty('telemetry')) {
if (Object.prototype.hasOwnProperty.call(typeDef, 'telemetry')) {
console.warn(
'DEPRECATION WARNING: Telemetry data on type '
+ 'registrations will be deprecated in a future version, '

View File

@ -72,21 +72,25 @@ define([
ObjectServiceProvider.prototype.create = async function (object) {
let model = utils.toOldFormat(object);
return this.getPersistenceService().createObject(
let result = await this.getPersistenceService().createObject(
this.getSpace(utils.makeKeyString(object.identifier)),
object.identifier.key,
model
);
return result;
};
ObjectServiceProvider.prototype.update = async function (object) {
let model = utils.toOldFormat(object);
return this.getPersistenceService().updateObject(
let result = await this.getPersistenceService().updateObject(
this.getSpace(utils.makeKeyString(object.identifier)),
object.identifier.key,
model
);
return result;
};
/**

View File

@ -21,7 +21,7 @@ define([
});
let inspectorTypes = openmct.$injector.get('types[]')
.filter((t) => t.hasOwnProperty('inspector'));
.filter((t) => Object.prototype.hasOwnProperty.call(t, 'inspector'));
inspectorTypes.forEach(function (typeDefinition) {
openmct.inspectorViews.addProvider(new TypeInspectorViewProvider(typeDefinition, openmct, convertToLegacyObject));

View File

@ -299,7 +299,7 @@ export default class NotificationAPI extends EventEmitter {
this._dismiss(notification);
};
if (notificationModel.hasOwnProperty('progressPerc')) {
if (Object.prototype.hasOwnProperty.call(notificationModel, 'progressPerc')) {
notification.progress = (progressPerc, progressText) => {
notification.model.progressPerc = progressPerc;
notification.model.progressText = progressText;

View File

@ -32,8 +32,8 @@ define([
*/
function isIdentifier(thing) {
return typeof thing === 'object'
&& thing.hasOwnProperty('key')
&& thing.hasOwnProperty('namespace');
&& Object.prototype.hasOwnProperty.call(thing, 'key')
&& Object.prototype.hasOwnProperty.call(thing, 'namespace');
}
/**

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global console*/
define([
'./TelemetryMetadataManager',
'./TelemetryValueFormatter',
@ -247,15 +247,15 @@ define([
* @private
*/
TelemetryAPI.prototype.standardizeRequestOptions = function (options) {
if (!options.hasOwnProperty('start')) {
if (!Object.prototype.hasOwnProperty.call(options, 'start')) {
options.start = this.openmct.time.bounds().start;
}
if (!options.hasOwnProperty('end')) {
if (!Object.prototype.hasOwnProperty.call(options, 'end')) {
options.end = this.openmct.time.bounds().end;
}
if (!options.hasOwnProperty('domain')) {
if (!Object.prototype.hasOwnProperty.call(options, 'domain')) {
options.domain = this.openmct.time.timeSystem().key;
}
};
@ -386,7 +386,7 @@ define([
}).reduce(function (a, b) {
var results = {};
Object.keys(a).forEach(function (key) {
if (b.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(b, key)) {
results[key] = a[key];
}
});

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global console*/
define([
'lodash'
@ -31,26 +30,26 @@ define([
valueMetadata.source = valueMetadata.source || valueMetadata.key;
valueMetadata.hints = valueMetadata.hints || {};
if (valueMetadata.hints.hasOwnProperty('x')) {
if (Object.prototype.hasOwnProperty.call(valueMetadata.hints, 'x')) {
console.warn(
'DEPRECATION WARNING: `x` hints should be replaced with '
+ '`domain` hints moving forward. '
+ 'https://github.com/nasa/openmct/issues/1546'
);
if (!valueMetadata.hints.hasOwnProperty('domain')) {
if (!Object.prototype.hasOwnProperty.call(valueMetadata.hints, 'domain')) {
valueMetadata.hints.domain = valueMetadata.hints.x;
}
delete valueMetadata.hints.x;
}
if (valueMetadata.hints.hasOwnProperty('y')) {
if (Object.prototype.hasOwnProperty.call(valueMetadata.hints, 'y')) {
console.warn(
'DEPRECATION WARNING: `y` hints should be replaced with '
+ '`range` hints moving forward. '
+ 'https://github.com/nasa/openmct/issues/1546'
);
if (!valueMetadata.hints.hasOwnProperty('range')) {
if (!Object.prototype.hasOwnProperty.call(valueMetadata.hints, 'range')) {
valueMetadata.hints.range = valueMetadata.hints.y;
}
@ -62,16 +61,16 @@ define([
valueMetadata.values = valueMetadata.enumerations.map(e => e.value);
}
if (!valueMetadata.hasOwnProperty('max')) {
if (!Object.prototype.hasOwnProperty.call(valueMetadata, 'max')) {
valueMetadata.max = Math.max(valueMetadata.values) + 1;
}
if (!valueMetadata.hasOwnProperty('min')) {
if (!Object.prototype.hasOwnProperty.call(valueMetadata, 'min')) {
valueMetadata.min = Math.min(valueMetadata.values) - 1;
}
}
if (!valueMetadata.hints.hasOwnProperty('priority')) {
if (!Object.prototype.hasOwnProperty.call(valueMetadata.hints, 'priority')) {
valueMetadata.hints.priority = index;
}
@ -114,8 +113,8 @@ define([
hints
) {
function hasHint(hint) {
/*jshint validthis: true */
return this.hints.hasOwnProperty(hint);
// eslint-disable-next-line no-invalid-this
return Object.prototype.hasOwnProperty.call(this.hints, hint);
}
function hasHints(metadata) {

View File

@ -63,7 +63,7 @@ define([
byString: {}
});
this.formatter.format = function (value) {
if (this.enumerations.byValue.hasOwnProperty(value)) {
if (Object.prototype.hasOwnProperty.call(this.enumerations.byValue, value)) {
return this.enumerations.byValue[value];
}
@ -71,7 +71,7 @@ define([
}.bind(this);
this.formatter.parse = function (string) {
if (typeof string === "string") {
if (this.enumerations.byString.hasOwnProperty(string)) {
if (Object.prototype.hasOwnProperty.call(this.enumerations.byString, string)) {
return this.enumerations.byString[string];
}
}

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global console*/
define(['./Type'], function (Type) {
/**
@ -63,7 +62,7 @@ define(['./Type'], function (Type) {
* @private
*/
TypeRegistry.prototype.standardizeType = function (typeDef) {
if (typeDef.hasOwnProperty('label')) {
if (Object.prototype.hasOwnProperty.call(typeDef, 'label')) {
console.warn(
'DEPRECATION WARNING typeDef: ' + typeDef.label + '. '
+ '`label` is deprecated in type definitions. Please use '

View File

@ -94,7 +94,7 @@ describe("The LAD Table", () => {
});
afterEach(() => {
resetApplicationState(openmct);
return resetApplicationState(openmct);
});
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(openmct);
});
it("should provide a lad table set view only for lad table set objects", () => {

View File

@ -35,7 +35,7 @@ define(
) {
var defaultAjaxFunction = $.ajax;
xdescribe("The URLIndicator", function () {
describe("The URLIndicator", function () {
var openmct;
var indicatorElement;
var pluginOptions;

View File

@ -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() {

View File

@ -27,7 +27,6 @@ import {
describe("The URLTimeSettingsSynchronizer", () => {
let openmct;
let testClock;
beforeAll(() => resetApplicationState());
beforeEach((done) => {
openmct = createOpenMct();

Some files were not shown because too many files have changed in this diff Show More