New eslint rules auto fix (#3058)

* no-implicit-coercion and no-unneeded-ternary

* End every line with a semicolon

* Spacing and formatting

* Enabled semi-spacing

* Applies npm run lint:fix to code after master merge

* Fix merge issues

* Switched operator-linebreak to 'before'

Co-authored-by: Joshi <simplyrender@gmail.com>
This commit is contained in:
Andrew Henry 2020-07-31 12:11:03 -07:00 committed by GitHub
parent 573a63d359
commit a09da30768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
739 changed files with 4660 additions and 2339 deletions

View File

@ -121,6 +121,59 @@ module.exports = {
// https://eslint.org/docs/rules/rest-spread-spacing
"rest-spread-spacing": ["error"],
// https://eslint.org/docs/rules/no-implicit-coercion
"no-implicit-coercion": "error",
//https://eslint.org/docs/rules/no-unneeded-ternary
"no-unneeded-ternary": "error",
// https://eslint.org/docs/rules/semi
"semi": ["error", "always"],
// https://eslint.org/docs/rules/no-multi-spaces
"no-multi-spaces": "error",
// https://eslint.org/docs/rules/key-spacing
"key-spacing": ["error", {
"afterColon": true
}],
// https://eslint.org/docs/rules/keyword-spacing
"keyword-spacing": ["error", {
"before": true,
"after": true
}],
// https://eslint.org/docs/rules/comma-spacing
// Also requires one line code fix
"comma-spacing": ["error", {
"after": true
}],
//https://eslint.org/docs/rules/no-whitespace-before-property
"no-whitespace-before-property": "error",
// https://eslint.org/docs/rules/object-curly-newline
"object-curly-newline": ["error", {"consistent": true, "multiline": true}],
// https://eslint.org/docs/rules/object-property-newline
"object-property-newline": "error",
// https://eslint.org/docs/rules/brace-style
"brace-style": "error",
// https://eslint.org/docs/rules/no-multiple-empty-lines
"no-multiple-empty-lines": ["error", {"max": 1}],
// https://eslint.org/docs/rules/operator-linebreak
"operator-linebreak": ["error", "before", {"overrides": {"=": "after"}}],
// https://eslint.org/docs/rules/padding-line-between-statements
"padding-line-between-statements":["error", {
"blankLine": "always",
"prev": "multiline-block-like",
"next": "*"
}, {
"blankLine": "always",
"prev": "*",
"next": "return"
}],
// https://eslint.org/docs/rules/space-infix-ops
"space-infix-ops": "error",
// https://eslint.org/docs/rules/space-unary-ops
"space-unary-ops": ["error", {"words": true, "nonwords": false}],
// https://eslint.org/docs/rules/arrow-spacing
"arrow-spacing": "error",
// https://eslint.org/docs/rules/semi-spacing
"semi-spacing": ["error", {"before": false, "after": true}],
"vue/html-indent": [
"error",
4,

View File

@ -29,7 +29,7 @@ define([
"use strict";
return {
name:"example/eventGenerator",
name: "example/eventGenerator",
definition: {
"name": "Event Message Generator",
"description": "For development use. Creates sample event message data that mimics a live data stream.",

View File

@ -44,13 +44,14 @@ define(
};
generatorData.getDomainValue = function (i, domain) {
return i * interval +
(domain !== 'delta' ? firstObservedTime : 0);
return i * interval
+ (domain !== 'delta' ? firstObservedTime : 0);
};
generatorData.getRangeValue = function (i, range) {
var domainDelta = this.getDomainValue(i) - firstObservedTime,
ind = i % messages.length;
return messages[ind] + " - [" + domainDelta.toString() + "]";
};

View File

@ -57,6 +57,7 @@ define(
results.forEach(function (result) {
packaged[result.key] = result.telemetry;
});
// Format as expected (sources -> keys -> telemetry)
return { eventGenerator: packaged };
}

View File

@ -76,13 +76,14 @@ define([], function () {
copyRangesToRow(row, i);
rows.push(row);
}
exportService.exportCSV(rows, { headers: headers });
});
};
ExportTelemetryAsCSVAction.appliesTo = function (context) {
return context.domainObject &&
context.domainObject.hasCapability("telemetry");
return context.domainObject
&& context.domainObject.hasCapability("telemetry");
};
return ExportTelemetryAsCSVAction;

View File

@ -27,7 +27,7 @@ define([
"use strict";
return {
name:"example/export",
name: "example/export",
definition: {
"name": "Example of using CSV Export",
"extensions": {

View File

@ -29,7 +29,7 @@ define([
"use strict";
return {
name:"example/forms",
name: "example/forms",
definition: {
"name": "Declarative Forms example",
"sources": "src",

View File

@ -152,10 +152,22 @@ define(
name: "Choose something",
control: "select",
options: [
{ name: "Hats", value: "hats" },
{ name: "Bats", value: "bats" },
{ name: "Cats", value: "cats" },
{ name: "Mats", value: "mats" }
{
name: "Hats",
value: "hats"
},
{
name: "Bats",
value: "bats"
},
{
name: "Cats",
value: "cats"
},
{
name: "Mats",
value: "mats"
}
],
key: "aChoice"
},
@ -164,10 +176,22 @@ define(
control: "select",
required: true,
options: [
{ name: "Hats", value: "hats" },
{ name: "Bats", value: "bats" },
{ name: "Cats", value: "cats" },
{ name: "Mats", value: "mats" }
{
name: "Hats",
value: "hats"
},
{
name: "Bats",
value: "bats"
},
{
name: "Cats",
value: "cats"
},
{
name: "Mats",
value: "mats"
}
],
key: "aRequiredChoice"
}

View File

@ -108,7 +108,7 @@ define([
}
]
}
}
};
function GeneratorMetadataProvider() {

View File

@ -65,15 +65,19 @@ define([
if (domainObject.telemetry && domainObject.telemetry.hasOwnProperty(prop)) {
workerRequest[prop] = domainObject.telemetry[prop];
}
if (request && request.hasOwnProperty(prop)) {
workerRequest[prop] = request[prop];
}
if (!workerRequest.hasOwnProperty(prop)) {
workerRequest[prop] = REQUEST_DEFAULTS[prop];
}
workerRequest[prop] = Number(workerRequest[prop]);
});
workerRequest.name = domainObject.name;
return workerRequest;
};
@ -81,11 +85,13 @@ define([
var workerRequest = this.makeWorkerRequest(domainObject, request);
workerRequest.start = request.start;
workerRequest.end = request.end;
return this.workerInterface.request(workerRequest);
};
GeneratorProvider.prototype.subscribe = function (domainObject, callback) {
var workerRequest = this.makeWorkerRequest(domainObject, {});
return this.workerInterface.subscribe(workerRequest, callback);
};

View File

@ -78,12 +78,15 @@ define([
if (datum[range] > RED[range]) {
return LIMITS.rh;
}
if (datum[range] < -RED[range]) {
return LIMITS.rl;
}
if (datum[range] > YELLOW[range]) {
return LIMITS.yh;
}
if (datum[range] < -YELLOW[range]) {
return LIMITS.yl;
}

View File

@ -48,7 +48,7 @@ define([
var interval = setInterval(function () {
var now = Date.now();
var datum = pointForTimestamp(now, duration, domainObject.name);
datum.value += "";
datum.value = String(datum.value);
callback(datum);
}, duration);
@ -57,7 +57,6 @@ define([
};
};
StateGeneratorProvider.prototype.supportsRequest = function (domainObject, options) {
return domainObject.type === 'example.state-generator';
};
@ -69,11 +68,13 @@ define([
if (options.strategy === 'latest' || options.size === 1) {
start = end;
}
var data = [];
while (start <= end && data.length < 5000) {
data.push(pointForTimestamp(start, duration, domainObject.name));
start += duration;
}
return Promise.resolve(data);
};

View File

@ -78,6 +78,7 @@ define([
} else {
deferred.resolve(message.data);
}
delete this.callbacks[messageId];
}
@ -101,8 +102,5 @@ define([
}.bind(this);
};
return WorkerInterface;
});

View File

@ -64,13 +64,14 @@
data: {
name: data.name,
utc: nextStep,
yesterday: nextStep - 60*60*24*1000,
yesterday: nextStep - 60 * 60 * 24 * 1000,
sin: sin(nextStep, data.period, data.amplitude, data.offset, data.phase, data.randomness),
cos: cos(nextStep, data.period, data.amplitude, data.offset, data.phase, data.randomness)
}
});
nextStep += step;
}
return nextStep;
}
@ -87,6 +88,7 @@
if (request.end === undefined) {
request.end = Date.now();
}
if (request.start === undefined) {
request.start = request.end - FIFTEEN_MINUTES;
}
@ -110,11 +112,12 @@
data.push({
name: request.name,
utc: nextStep,
yesterday: nextStep - 60*60*24*1000,
yesterday: nextStep - 60 * 60 * 24 * 1000,
sin: sin(nextStep, period, amplitude, offset, phase, randomness),
cos: cos(nextStep, period, amplitude, offset, phase, randomness)
});
}
self.postMessage({
id: message.id,
data: data
@ -122,13 +125,13 @@
}
function cos(timestamp, period, amplitude, offset, phase, randomness) {
return amplitude *
Math.cos(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset;
return amplitude
* Math.cos(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset;
}
function sin(timestamp, period, amplitude, offset, phase, randomness) {
return amplitude *
Math.sin(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset;
return amplitude
* Math.sin(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset;
}
function sendError(error, message) {

View File

@ -56,7 +56,7 @@ define([
initialize: function (object) {
object.telemetry = {
duration: 5
}
};
}
});

View File

@ -29,7 +29,7 @@ define([
"use strict";
return {
name:"example/identity",
name: "example/identity",
definition: {
"extensions": {
"components": [

View File

@ -25,26 +25,30 @@ define(
function () {
"use strict";
var DEFAULT_IDENTITY = { key: "user", name: "Example User" },
var DEFAULT_IDENTITY = {
key: "user",
name: "Example User"
},
DIALOG_STRUCTURE = {
name: "Identify Yourself",
sections: [{ rows: [
{
name: "User ID",
control: "textfield",
key: "key",
required: true
},
{
name: "Human name",
control: "textfield",
key: "name",
required: true
}
]}]
sections: [{
rows: [
{
name: "User ID",
control: "textfield",
key: "key",
required: true
},
{
name: "Human name",
control: "textfield",
key: "name",
required: true
}
]
}]
};
/**
* Example implementation of an identity service. This prompts the
* user to enter a name and user ID; in a more realistic
@ -77,14 +81,14 @@ define(
*/
ExampleIdentityProvider.prototype.returnUser = function (user) {
return this.user = user;
}
};
/**
* @private
*/
ExampleIdentityProvider.prototype.returnUndefined = function () {
return undefined;
}
};
return ExampleIdentityProvider;
}

View File

@ -85,28 +85,28 @@ define([
data.push(pointForTimestamp(start, domainObject.name));
start += 5000;
}
return Promise.resolve(data);
}
};
var ladProvider = {
supportsRequest: function (domainObject, options) {
return domainObject.type === 'example.imagery' &&
options.strategy === 'latest';
return domainObject.type === 'example.imagery'
&& options.strategy === 'latest';
},
request: function (domainObject, options) {
return Promise.resolve([pointForTimestamp(Date.now(), domainObject.name)]);
}
};
return function install(openmct) {
openmct.types.addType('example.imagery', {
key: 'example.imagery',
name: 'Example Imagery',
cssClass: 'icon-image',
description: 'For development use. Creates example imagery ' +
'data that mimics a live imagery stream.',
description: 'For development use. Creates example imagery '
+ 'data that mimics a live imagery stream.',
creatable: true,
initialize: function (object) {
object.telemetry = {
@ -140,7 +140,7 @@ define([
}
}
]
}
};
}
});

View File

@ -25,7 +25,7 @@ define([], function () {
"use strict";
return {
name:"example/mobile",
name: "example/mobile",
definition: {
"name": "Mobile",
"description": "Allows elements with pertinence to mobile usage and development",

View File

@ -31,14 +31,15 @@ define([
RemsTelemetryProvider
) {
"use strict";
return {
name:"example/msl",
name: "example/msl",
definition: {
"name" : "Mars Science Laboratory Data Adapter",
"extensions" : {
"name": "Mars Science Laboratory Data Adapter",
"extensions": {
"types": [
{
"name":"Mars Science Laboratory",
"name": "Mars Science Laboratory",
"key": "msl.curiosity",
"cssClass": "icon-object"
},
@ -89,7 +90,7 @@ define([
],
"services": [
{
"key":"rems.adapter",
"key": "rems.adapter",
"implementation": RemsTelemetryServerAdapter,
"depends": ["$http", "$log", "REMS_WS_URL"]
}

View File

@ -38,7 +38,7 @@ define(
"identifier": "msl",
"instruments": [
{
"name":"rems",
"name": "rems",
"identifier": "rems",
"measurements": [
{

View File

@ -81,6 +81,7 @@ define(
(dictionary.instruments || []).forEach(function (instrument) {
addInstrument(instrument, "msl:curiosity");
});
return models;
}
@ -90,6 +91,7 @@ define(
}
};
}
return RemsTelemetryModelProvider;
}
);

View File

@ -74,6 +74,7 @@ define (
RemsTelemetryProvider.prototype.subscribe = function (callback, requests) {
return function () {};
};
RemsTelemetryProvider.prototype.unsubscribe = function (callback, requests) {
return function () {};
};

View File

@ -57,6 +57,7 @@ define(
RemsTelemetrySeries.prototype.getPointCount = function () {
return this.data.length;
};
/**
* The domain value at the given index. The Rems telemetry data is
* time ordered, so the domain value is the time stamp of each data

View File

@ -95,28 +95,32 @@ define(
});
}
});
return data;
}
function fallbackToLocal() {
self.$log.warn("Loading REMS data failed, probably due to" +
" cross origin policy. Falling back to local data");
self.$log.warn("Loading REMS data failed, probably due to"
+ " cross origin policy. Falling back to local data");
return self.$http.get(self.localDataURI);
}
//Filter results to match request parameters
function filterResults(results) {
return results.filter(function (result) {
return result.date >= (request.start || Number.MIN_VALUE) &&
result.date <= (request.end || Number.MAX_VALUE);
return result.date >= (request.start || Number.MIN_VALUE)
&& result.date <= (request.end || Number.MAX_VALUE);
});
}
function packageAndResolve(results) {
return {id: id, values: results};
return {
id: id,
values: results
};
}
return (this.promise = this.promise || this.$http.get(this.REMS_WS_URL))
.catch(fallbackToLocal)
.then(processResponse)

View File

@ -39,7 +39,7 @@ define([
"use strict";
return {
name:"example/notifications",
name: "example/notifications",
definition: {
"extensions": {
"templates": [

View File

@ -91,7 +91,6 @@ define(
}
};
/*
Demonstrates launching an error dialog
*/
@ -132,9 +131,9 @@ define(
var dialog,
model = {
title: "Info Dialog Example",
actionText: "This is an example of a blocking info" +
" dialog. This dialog can be used to draw the user's" +
" attention to an event.",
actionText: "This is an example of a blocking info"
+ " dialog. This dialog can be used to draw the user's"
+ " attention to an event.",
severity: "info",
primaryOption: {
label: "OK",
@ -153,6 +152,7 @@ define(
};
}
return DialogLaunchController;
}
);

View File

@ -42,9 +42,11 @@ define(
DialogLaunchIndicator.prototype.getGlyphClass = function () {
return 'ok';
};
DialogLaunchIndicator.prototype.getText = function () {
return "Launch test dialog";
};
DialogLaunchIndicator.prototype.getDescription = function () {
return "Launch test dialog";
};

View File

@ -48,7 +48,8 @@ define(
"Eros turpis, pulvinar turpis eros eu",
"Lundium nascetur a, lectus montes ac, parturient in natoque, duis risus risus pulvinar pid rhoncus, habitasse auctor natoque!"
];
return actionTexts[Math.floor(Math.random()*3)];
return actionTexts[Math.floor(Math.random() * 3)];
}
/**
@ -61,6 +62,7 @@ define(
severity: "error"
});
};
/**
* Launch a new notification with a severity of 'Alert'.
*/
@ -73,7 +75,6 @@ define(
});
};
/**
* Launch a new notification with a progress bar that is updated
* periodically, tracking an ongoing process.
@ -93,10 +94,10 @@ define(
* @param notification
*/
function incrementProgress() {
progress = Math.min(100, Math.floor(progress + Math.random() * 30))
let progressText = ["Estimated time" +
" remaining:" +
" about ", 60 - Math.floor((progress / 100) * 60), " seconds"].join(" ");
progress = Math.min(100, Math.floor(progress + Math.random() * 30));
let progressText = ["Estimated time"
+ " remaining:"
+ " about ", 60 - Math.floor((progress / 100) * 60), " seconds"].join(" ");
notification.progress(progress, progressText);
if (progress < 100) {
@ -120,6 +121,7 @@ define(
};
}
return NotificationLaunchController;
}
);

View File

@ -42,9 +42,11 @@ define(
NotificationLaunchIndicator.prototype.getGlyphClass = function () {
return 'ok';
};
NotificationLaunchIndicator.prototype.getText = function () {
return "Launch notification";
};
NotificationLaunchIndicator.prototype.getDescription = function () {
return "Launch notification";
};

View File

@ -29,7 +29,7 @@ define([
"use strict";
return {
name:"example/persistence",
name: "example/persistence",
definition: {
"extensions": {
"components": [

View File

@ -30,8 +30,6 @@ define(
function () {
'use strict';
function BrowserPersistenceProvider($q, SPACE) {
var spaces = SPACE ? [SPACE] : [],
caches = {},
@ -51,6 +49,7 @@ define(
},
listObjects: function (space) {
var cache = caches[space];
return promises.as(
cache ? Object.keys(cache) : null
);
@ -68,6 +67,7 @@ define(
},
readObject: function (space, key) {
var cache = caches[space];
return promises.as(
cache ? cache[key] : null
);

View File

@ -29,7 +29,7 @@ define([
"use strict";
return {
name:"example/policy",
name: "example/policy",
definition: {
"name": "Example Policy",
"description": "Provides an example of using policies to prohibit actions.",

View File

@ -37,6 +37,7 @@ define(
model = (domainObject && domainObject.getModel()) || {},
name = model.name || "",
metadata = action.getMetadata() || {};
return metadata.key !== 'remove' || name.indexOf('foo') < 0;
}
};

View File

@ -31,7 +31,7 @@ define([
"use strict";
return {
name:"example/profiling",
name: "example/profiling",
definition: {
"extensions": {
"indicators": [

View File

@ -29,7 +29,7 @@ define([
"use strict";
return {
name:"example/scratchpad",
name: "example/scratchpad",
definition: {
"extensions": {
"roots": [

View File

@ -54,13 +54,14 @@ define(
if (space === 'scratch') {
this.table[key] = JSON.stringify(value);
}
return this.$q.when(space === 'scratch');
};
ScratchPersistenceProvider.prototype.readObject = function (space, key) {
return this.$q.when(
(space === 'scratch' && this.table[key]) ?
JSON.parse(this.table[key]) : undefined
(space === 'scratch' && this.table[key])
? JSON.parse(this.table[key]) : undefined
);
};
@ -68,6 +69,7 @@ define(
if (space === 'scratch') {
delete this.table[key];
}
return this.$q.when(space === 'scratch');
};

View File

@ -7,9 +7,9 @@ export default {
data() {
return {
msg: 'Hello world!'
}
};
}
}
};
</script>
<style>

View File

@ -17,6 +17,7 @@ function SimpleVuePlugin() {
},
view: function (domainObject) {
var vm;
return {
show: function (container) {
vm = new Vue(HelloWorld);
@ -29,7 +30,7 @@ function SimpleVuePlugin() {
}
});
}
};
}
export default SimpleVuePlugin
export default SimpleVuePlugin;

View File

@ -22,31 +22,111 @@ define([
menusTemplate
) {
return {
name:"example/styleguide",
name: "example/styleguide",
definition: {
"name": "Open MCT Style Guide",
"description": "Examples and documentation illustrating UI styles in use in Open MCT.",
"extensions":
{
"types": [
{ "key": "styleguide.intro", "name": "Introduction", "cssClass": "icon-page", "description": "Introduction and overview to the style guide" },
{ "key": "styleguide.standards", "name": "Standards", "cssClass": "icon-page", "description": "" },
{ "key": "styleguide.colors", "name": "Colors", "cssClass": "icon-page", "description": "" },
{ "key": "styleguide.status", "name": "status", "cssClass": "icon-page", "description": "Limits, telemetry paused, etc." },
{ "key": "styleguide.glyphs", "name": "Glyphs", "cssClass": "icon-page", "description": "Glyphs overview" },
{ "key": "styleguide.controls", "name": "Controls", "cssClass": "icon-page", "description": "Buttons, selects, HTML controls" },
{ "key": "styleguide.input", "name": "Text Inputs", "cssClass": "icon-page", "description": "Various text inputs" },
{ "key": "styleguide.menus", "name": "Menus", "cssClass": "icon-page", "description": "Context menus, dropdowns" }
{
"key": "styleguide.intro",
"name": "Introduction",
"cssClass": "icon-page",
"description": "Introduction and overview to the style guide"
},
{
"key": "styleguide.standards",
"name": "Standards",
"cssClass": "icon-page",
"description": ""
},
{
"key": "styleguide.colors",
"name": "Colors",
"cssClass": "icon-page",
"description": ""
},
{
"key": "styleguide.status",
"name": "status",
"cssClass": "icon-page",
"description": "Limits, telemetry paused, etc."
},
{
"key": "styleguide.glyphs",
"name": "Glyphs",
"cssClass": "icon-page",
"description": "Glyphs overview"
},
{
"key": "styleguide.controls",
"name": "Controls",
"cssClass": "icon-page",
"description": "Buttons, selects, HTML controls"
},
{
"key": "styleguide.input",
"name": "Text Inputs",
"cssClass": "icon-page",
"description": "Various text inputs"
},
{
"key": "styleguide.menus",
"name": "Menus",
"cssClass": "icon-page",
"description": "Context menus, dropdowns"
}
],
"views": [
{ "key": "styleguide.intro", "type": "styleguide.intro", "template": introTemplate, "editable": false },
{ "key": "styleguide.standards", "type": "styleguide.standards", "template": standardsTemplate, "editable": false },
{ "key": "styleguide.colors", "type": "styleguide.colors", "template": colorsTemplate, "editable": false },
{ "key": "styleguide.status", "type": "styleguide.status", "template": statusTemplate, "editable": false },
{ "key": "styleguide.glyphs", "type": "styleguide.glyphs", "template": glyphsTemplate, "editable": false },
{ "key": "styleguide.controls", "type": "styleguide.controls", "template": controlsTemplate, "editable": false },
{ "key": "styleguide.input", "type": "styleguide.input", "template": inputTemplate, "editable": false },
{ "key": "styleguide.menus", "type": "styleguide.menus", "template": menusTemplate, "editable": false }
{
"key": "styleguide.intro",
"type": "styleguide.intro",
"template": introTemplate,
"editable": false
},
{
"key": "styleguide.standards",
"type": "styleguide.standards",
"template": standardsTemplate,
"editable": false
},
{
"key": "styleguide.colors",
"type": "styleguide.colors",
"template": colorsTemplate,
"editable": false
},
{
"key": "styleguide.status",
"type": "styleguide.status",
"template": statusTemplate,
"editable": false
},
{
"key": "styleguide.glyphs",
"type": "styleguide.glyphs",
"template": glyphsTemplate,
"editable": false
},
{
"key": "styleguide.controls",
"type": "styleguide.controls",
"template": controlsTemplate,
"editable": false
},
{
"key": "styleguide.input",
"type": "styleguide.input",
"template": inputTemplate,
"editable": false
},
{
"key": "styleguide.menus",
"type": "styleguide.menus",
"template": menusTemplate,
"editable": false
}
],
"roots": [
{
@ -56,7 +136,7 @@ define([
"models": [
{
"id": "styleguide:home",
"priority" : "preferred",
"priority": "preferred",
"model": {
"type": "folder",
"name": "Style Guide Home",
@ -73,7 +153,7 @@ define([
},
{
"id": "styleguide:ui-elements",
"priority" : "preferred",
"priority": "preferred",
"model": {
"type": "folder",
"name": "UI Elements",

View File

@ -30,14 +30,46 @@ define(
var pages = {};
// Add pages
pages.intro = { name: "Introduction", type: "styleguide.intro", location: "styleguide:home" };
pages.standards = { name: "Standards", type: "styleguide.standards", location: "styleguide:home" };
pages.colors = { name: "Colors", type: "styleguide.colors", location: "styleguide:home" };
pages.glyphs = { name: "Glyphs", type: "styleguide.glyphs", location: "styleguide:home" };
pages.status = { name: "Status Indication", type: "styleguide.status", location: "styleguide:home" };
pages.controls = { name: "Controls", type: "styleguide.controls", location: "styleguide:ui-elements" };
pages.input = { name: "Text Inputs", type: "styleguide.input", location: "styleguide:ui-elements" };
pages.menus = { name: "Menus", type: "styleguide.menus", location: "styleguide:ui-elements" };
pages.intro = {
name: "Introduction",
type: "styleguide.intro",
location: "styleguide:home"
};
pages.standards = {
name: "Standards",
type: "styleguide.standards",
location: "styleguide:home"
};
pages.colors = {
name: "Colors",
type: "styleguide.colors",
location: "styleguide:home"
};
pages.glyphs = {
name: "Glyphs",
type: "styleguide.glyphs",
location: "styleguide:home"
};
pages.status = {
name: "Status Indication",
type: "styleguide.status",
location: "styleguide:home"
};
pages.controls = {
name: "Controls",
type: "styleguide.controls",
location: "styleguide:ui-elements"
};
pages.input = {
name: "Text Inputs",
type: "styleguide.input",
location: "styleguide:ui-elements"
};
pages.menus = {
name: "Menus",
type: "styleguide.menus",
location: "styleguide:ui-elements"
};
return {
getModels: function () {
@ -46,6 +78,6 @@ define(
};
}
return ExampleStyleGuideModelProvider
return ExampleStyleGuideModelProvider;
}
);

View File

@ -47,7 +47,7 @@ define([
) {
return {
name:"platform/commonUI/about",
name: "platform/commonUI/about",
definition: {
"name": "About Open MCT",
"extensions": {

View File

@ -20,7 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/**
* Implements Open MCT's About dialog.
* @namespace platform/commonUI/about

View File

@ -31,8 +31,14 @@ define(
beforeEach(function () {
testVersions = [
{ name: "Some name", value: "1.2.3" },
{ name: "Some other name", value: "3.2.1" }
{
name: "Some name",
value: "1.2.3"
},
{
name: "Some other name",
value: "3.2.1"
}
];
mockWindow = jasmine.createSpyObj("$window", ["open"]);
controller = new AboutController(testVersions, mockWindow);
@ -51,7 +57,6 @@ define(
expect(mockWindow.open).toHaveBeenCalledWith("#/licenses");
});
});
}

View File

@ -49,7 +49,7 @@ define([
) {
return {
name:"platform/commonUI/browse",
name: "platform/commonUI/browse",
definition: {
"extensions": {
"routes": [

View File

@ -46,6 +46,7 @@ define(
NavigateAction.prototype.perform = function () {
if (this.navigationService.shouldNavigate()) {
this.navigationService.setNavigation(this.domainObject, true);
return Promise.resolve({});
}

View File

@ -69,8 +69,10 @@ define(
NavigationService.prototype.setNavigation = function (domainObject, force) {
if (force) {
this.doNavigation(domainObject);
return true;
}
if (this.navigated === domainObject) {
return true;
}
@ -81,6 +83,7 @@ define(
}
this.doNavigation(domainObject);
return true;
};
@ -120,6 +123,7 @@ define(
*/
NavigationService.prototype.shouldNavigate = function () {
var doNotNavigate = this.shouldWarnBeforeNavigate();
return !doNotNavigate || this.$window.confirm(doNotNavigate);
};
@ -135,6 +139,7 @@ define(
*/
NavigationService.prototype.checkBeforeNavigation = function (checkFn) {
this.checks.push(checkFn);
return function removeCheck() {
this.checks = this.checks.filter(function (fn) {
return checkFn !== fn;
@ -172,6 +177,7 @@ define(
if (reasons.length) {
return reasons.join('\n');
}
return false;
};
@ -186,6 +192,7 @@ define(
if (shouldWarnBeforeNavigate) {
return shouldWarnBeforeNavigate;
}
if (this.oldUnload) {
return this.oldUnload.apply(undefined, [].slice.apply(arguments));
}

View File

@ -40,6 +40,7 @@ define([], function () {
function getParent(domainObject) {
var context = domainObject.getCapability('context');
return context.getParent();
}

View File

@ -53,6 +53,7 @@ define([
it("sets navigation if it is allowed", function () {
mockNavigationService.shouldNavigate.and.returnValue(true);
return action.perform()
.then(function () {
expect(mockNavigationService.setNavigation)
@ -63,6 +64,7 @@ define([
it("does not set navigation if it is not allowed", function () {
mockNavigationService.shouldNavigate.and.returnValue(false);
var onSuccess = jasmine.createSpy('onSuccess');
return action.perform()
.then(onSuccess, function () {
expect(onSuccess).not.toHaveBeenCalled();

View File

@ -79,7 +79,6 @@ define(
navigationService.addListener(callback);
navigationService.removeListener(callback);
navigationService.setNavigation(testObject);
expect(callback).not.toHaveBeenCalled();
});

View File

@ -70,6 +70,7 @@ define([
jasmine.createSpy('throttled-' + mockThrottledFns.length);
mockThrottledFn.and.callFake(fn);
mockThrottledFns.push(mockThrottledFn);
return mockThrottledFn;
});
mockTopic.and.returnValue(mockMutationTopic);
@ -81,7 +82,7 @@ define([
}[c];
});
mockDomainObject.hasCapability.and.callFake(function (c) {
return !!mockDomainObject.getCapability(c);
return Boolean(mockDomainObject.getCapability(c));
});
mockParentObject.getCapability.and.callFake(function (c) {
return {
@ -102,7 +103,6 @@ define([
);
});
it("listens for mutation with a throttled function", function () {
expect(mockMutationTopic.listen)
.toHaveBeenCalledWith(jasmine.any(Function));
@ -129,8 +129,8 @@ define([
});
[false, true].forEach(function (isEditRoot) {
var caseName = isEditRoot ?
"that are being edited" : "that are not being edited";
var caseName = isEditRoot
? "that are being edited" : "that are not being edited";
function itNavigatesAsExpected() {
if (isOrphan && !isEditRoot) {

View File

@ -45,7 +45,7 @@ define([
) {
return {
name:"platform/commonUI/dialog",
name: "platform/commonUI/dialog",
definition: {
"extensions": {
"services": [

View File

@ -28,7 +28,6 @@ define(
// the a specific template that can be included via mct-include
var TEMPLATE = '<mct-include ng-model="overlay" key="key" ng-class="typeClass"></mct-include>';
/**
* The OverlayService is responsible for pre-pending templates to
* the body of the document, which is useful for displaying templates
@ -53,6 +52,7 @@ define(
this.findBody = function () {
return $document.find('body');
};
this.newScope = function () {
return $rootScope.$new();
};

View File

@ -129,8 +129,8 @@ define(
);
});
it("invokes the overlay service with the correct parameters when" +
" a blocking dialog is requested", function () {
it("invokes the overlay service with the correct parameters when"
+ " a blocking dialog is requested", function () {
var dialogModel = {};
expect(dialogService.showBlockingMessage(dialogModel)).not.toBe(false);
expect(mockOverlayService.createOverlay).toHaveBeenCalledWith(

View File

@ -48,7 +48,7 @@ define(
mockScope = jasmine.createSpyObj("scope", ["$destroy"]);
mockTimeout = function (callback) {
callback();
}
};
mockDocument.find.and.returnValue(mockBody);
mockCompile.and.returnValue(mockTemplate);

View File

@ -56,6 +56,7 @@ define(
//navigate back to parent because nothing to show.
return domainObject.getCapability("location").getOriginal().then(function (original) {
parent = original.getCapability("context").getParent();
return parent.getCapability("action").perform("navigate");
});
}
@ -78,9 +79,10 @@ define(
*/
CancelAction.appliesTo = function (context) {
var domainObject = (context || {}).domainObject;
return domainObject !== undefined &&
domainObject.hasCapability('editor') &&
domainObject.getCapability('editor').isEditContextRoot();
return domainObject !== undefined
&& domainObject.hasCapability('editor')
&& domainObject.getCapability('editor').isEditContextRoot();
};
return CancelAction;

View File

@ -91,9 +91,9 @@ define(
// Only allow editing of types that support it and are not already
// being edited
return type && type.hasFeature('creation') &&
domainObject.hasCapability('editor') &&
!domainObject.getCapability('editor').isEditContextRoot();
return type && type.hasFeature('creation')
&& domainObject.hasCapability('editor')
&& !domainObject.getCapability('editor').isEditContextRoot();
};
return EditAction;

View File

@ -24,7 +24,6 @@ define(
[],
function () {
/**
* Add one domain object to another's composition.
* @constructor
@ -42,8 +41,9 @@ define(
// Link these objects
function doLink() {
var composition = self.domainObject &&
self.domainObject.getCapability('composition');
var composition = self.domainObject
&& self.domainObject.getCapability('composition');
return composition && composition.add(self.selectedObject);
}

View File

@ -99,4 +99,3 @@ define(
);

View File

@ -51,6 +51,7 @@ define(
// Property definition is same as form row definition
var row = JSON.parse(JSON.stringify(property.getDefinition()));
row.key = index;
return row;
}).filter(function (row) {
// Only show properties which are editable

View File

@ -86,10 +86,11 @@ define(
*/
SaveAction.appliesTo = function (context) {
var domainObject = (context || {}).domainObject;
return domainObject !== undefined &&
domainObject.hasCapability('editor') &&
domainObject.getCapability('editor').isEditContextRoot() &&
domainObject.getModel().persisted !== undefined;
return domainObject !== undefined
&& domainObject.hasCapability('editor')
&& domainObject.getCapability('editor').isEditContextRoot()
&& domainObject.getModel().persisted !== undefined;
};
return SaveAction;

View File

@ -20,7 +20,6 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
'../creation/CreateWizard',
'./SaveInProgressDialog'
@ -50,6 +49,7 @@ function (
this.injectObjectService = function () {
this.objectService = $injector.get("objectService");
};
this.dialogService = dialogService;
this.copyService = copyService;
this.notificationService = notificationService;
@ -75,6 +75,7 @@ function (
if (!this.objectService) {
this.injectObjectService();
}
return this.objectService;
};
@ -118,11 +119,13 @@ function (
function showBlockingDialog(object) {
dialog.show();
return object;
}
function hideBlockingDialog(object) {
dialog.hide();
return object;
}
@ -138,11 +141,12 @@ function (
function allowClone(objectToClone) {
var allowed =
(objectToClone.getId() === domainObject.getId()) ||
objectToClone.getCapability('location').isOriginal();
(objectToClone.getId() === domainObject.getId())
|| objectToClone.getCapability('location').isOriginal();
if (allowed) {
toUndirty.push(objectToClone);
}
return allowed;
}
@ -163,11 +167,11 @@ function (
return this.openmct.editor.save().then(() => {
// Force mutation for search indexing
return clonedObject;
})
});
}
function finishEditing(clonedObject) {
return fetchObject(clonedObject.getId())
return fetchObject(clonedObject.getId());
}
function indexForSearch(savedObject) {
@ -180,6 +184,7 @@ function (
function onSuccess(object) {
self.notificationService.info("Save Succeeded");
return object;
}
@ -188,6 +193,7 @@ function (
if (reason !== "user canceled") {
self.notificationService.error("Save Failed");
}
throw reason;
}
@ -205,7 +211,6 @@ function (
.catch(onFailure);
};
/**
* Check if this action is applicable in a given context.
* This will ensure that a domain object is present in the context,
@ -214,10 +219,11 @@ function (
*/
SaveAsAction.appliesTo = function (context) {
var domainObject = (context || {}).domainObject;
return domainObject !== undefined &&
domainObject.hasCapability('editor') &&
domainObject.getCapability('editor').isEditContextRoot() &&
domainObject.getModel().persisted === undefined;
return domainObject !== undefined
&& domainObject.hasCapability('editor')
&& domainObject.getCapability('editor').isEditContextRoot()
&& domainObject.getModel().persisted === undefined;
};
return SaveAsAction;

View File

@ -83,6 +83,7 @@ define(
*/
EditorCapability.prototype.save = function () {
console.warn('DEPRECATED: cannot save via edit capability, use openmct.editor instead.');
return Promise.resolve();
};
@ -95,6 +96,7 @@ define(
*/
EditorCapability.prototype.finish = function () {
console.warn('DEPRECATED: cannot finish via edit capability, use openmct.editor instead.');
return Promise.resolve();
};

View File

@ -56,9 +56,10 @@ define(
capabilities.persistence = function (domainObject) {
var original =
(typeof persistenceCapability === 'function') ?
persistenceCapability(domainObject) :
persistenceCapability;
(typeof persistenceCapability === 'function')
? persistenceCapability(domainObject)
: persistenceCapability;
return new TransactionalPersistenceCapability(
self.$q,
self.transactionService,
@ -66,6 +67,7 @@ define(
domainObject
);
};
return capabilities;
};

View File

@ -64,6 +64,7 @@ define(
wrappedPersistence.persist.bind(wrappedPersistence),
wrappedPersistence.refresh.bind(wrappedPersistence)
);
//Need to return a promise from this function
return this.$q.when(true);
} else {
@ -74,6 +75,7 @@ define(
TransactionalPersistenceCapability.prototype.refresh = function () {
this.transactionManager
.clearTransactionsFor(this.domainObject.getId());
return this.persistenceCapability.refresh();
};

View File

@ -48,9 +48,9 @@ define(
// Maintain all "conclude-editing" and "save" actions in the
// present context.
function updateActions() {
$scope.saveActions = $scope.action ?
$scope.action.getActions(SAVE_ACTION_CONTEXT) :
[];
$scope.saveActions = $scope.action
? $scope.action.getActions(SAVE_ACTION_CONTEXT)
: [];
$scope.saveActionsAsMenuOptions = $scope.saveActions.map(actionToMenuOption);
@ -58,9 +58,9 @@ define(
clickedAction.perform();
};
$scope.otherEditActions = $scope.action ?
$scope.action.getActions(OTHERS_ACTION_CONTEXT) :
[];
$scope.otherEditActions = $scope.action
? $scope.action.getActions(OTHERS_ACTION_CONTEXT)
: [];
// Required because Angular does not allow 'bind'
// in expressions.

View File

@ -30,11 +30,11 @@ define(
function cancelEditing(domainObject) {
var navigatedObject = domainObject,
editorCapability = navigatedObject &&
navigatedObject.getCapability("editor");
editorCapability = navigatedObject
&& navigatedObject.getCapability("editor");
return editorCapability &&
editorCapability.finish();
return editorCapability
&& editorCapability.finish();
}
/**

View File

@ -35,8 +35,8 @@ define(
// Update root object based on represented object
function updateRoot(domainObject) {
var root = self.rootDomainObject,
context = domainObject &&
domainObject.getCapability('context'),
context = domainObject
&& domainObject.getCapability('context'),
newRoot = context && context.getTrueRoot(),
oldId = root && root.getId(),
newId = newRoot && newRoot.getId();
@ -51,6 +51,7 @@ define(
// Update root when represented object changes
$scope.$watch('domainObject', updateRoot);
}
/**
* Get the root-level domain object, as reported by the
* represented domain object.

View File

@ -104,7 +104,6 @@ define(
// We will disable this.
};
/**
* Metadata associated with a Create action.
* @typedef {ActionMetadata} CreateActionMetadata

View File

@ -38,9 +38,9 @@ define(
function CreateMenuController($scope) {
// Update the set of Create actions
function refreshActions() {
$scope.createActions = $scope.action ?
$scope.action.getActions('create') :
[];
$scope.createActions = $scope.action
? $scope.action.getActions('create')
: [];
}
// Listen for new instances of the represented object's

View File

@ -114,6 +114,7 @@ define(
this.domainObject.useCapability("mutation", function () {
return formModel;
});
return this.domainObject;
};

View File

@ -73,12 +73,13 @@ define(
// as a child contained by that parent.
function addToComposition() {
var compositionCapability = parent.getCapability('composition'),
addResult = compositionCapability &&
compositionCapability.add(newObject);
addResult = compositionCapability
&& compositionCapability.add(newObject);
return self.$q.when(addResult).then(function (result) {
if (!result) {
self.$log.error("Could not modify " + parent.getId());
return undefined;
}
@ -92,6 +93,7 @@ define(
// what space to create the new object's model in.
if (!persistence || !newObjectPersistence) {
self.$log.warn(NON_PERSISTENT_WARNING);
return self.$q.reject(new Error(NON_PERSISTENT_WARNING));
}
@ -99,8 +101,6 @@ define(
return newObjectPersistence.persist().then(addToComposition);
};
return CreationService;
}
);

View File

@ -38,8 +38,8 @@ define(
// * treeModel: The model for the embedded tree representation,
// used for bi-directional object selection.
function setLocatingObject(domainObject, priorObject) {
var context = domainObject &&
domainObject.getCapability("context"),
var context = domainObject
&& domainObject.getCapability("context"),
contextRoot = context && context.getRoot();
if (contextRoot && contextRoot !== $scope.rootObject) {
@ -65,11 +65,12 @@ define(
$scope.ngModel[$scope.field] = domainObject;
// Restrict which locations can be selected
if (domainObject &&
$scope.structure &&
$scope.structure.validate) {
if (domainObject
&& $scope.structure
&& $scope.structure.validate) {
if (!$scope.structure.validate(domainObject)) {
setLocatingObject(priorObject, undefined);
return;
}
}
@ -78,7 +79,7 @@ define(
if ($scope.ngModelController) {
$scope.ngModelController.$setValidity(
'composition',
!!$scope.treeModel.selectedObject
Boolean($scope.treeModel.selectedObject)
);
}
}

View File

@ -45,6 +45,7 @@ define(
// because it may be saved elsewhere
if ((key === 'edit' && category === 'view-control') || key === 'properties') {
let newStyleObject = objectUtils.toNewFormat(domainObject, domainObject.getId());
return this.openmct.objects.isPersistable(newStyleObject);
}

View File

@ -74,6 +74,7 @@ define(
model.configuration = model.configuration || {};
model.configuration[this.key] = configuration;
}
domainObject.useCapability('mutation', function () {
return model;
});

View File

@ -41,6 +41,7 @@ define(['./Transaction'], function (Transaction) {
Transaction.prototype.commit.bind(this),
Transaction.prototype.cancel.bind(this)
);
return Promise.resolve(true);
};

View File

@ -41,8 +41,12 @@ define([], function () {
* pair of callbacks from the transaction
*/
Transaction.prototype.add = function (commit, cancel) {
var callback = { commit: commit, cancel: cancel };
var callback = {
commit: commit,
cancel: cancel
};
this.callbacks.push(callback);
return function () {
this.callbacks = this.callbacks.filter(function (c) {
return c !== callback;
@ -91,6 +95,5 @@ define([], function () {
};
});
return Transaction;
});

View File

@ -50,7 +50,7 @@ define([], function () {
* @returns {boolean} true if callbacks have been added
*/
TransactionManager.prototype.isScheduled = function (id) {
return !!this.clearTransactionFns[id];
return Boolean(this.clearTransactionFns[id]);
};
/**
@ -77,6 +77,7 @@ define([], function () {
return promiseFn().then(nextFn);
};
}
/**
* Clear any existing persistence calls for object with given ID. This ensures only the most recent persistence
* call is executed. This should prevent stale objects being persisted and overwriting fresh ones.

View File

@ -48,9 +48,9 @@ define(
* #cancel} are called
*/
TransactionService.prototype.startTransaction = function () {
var transaction = this.isActive() ?
new NestedTransaction(this.transactions[0]) :
new Transaction(this.$log);
var transaction = this.isActive()
? new NestedTransaction(this.transactions[0])
: new Transaction(this.$log);
this.transactions.push(transaction);
};
@ -99,13 +99,16 @@ define(
if (!transaction) {
return Promise.reject();
}
if (!this.isActive()) {
return transaction.commit()
.then(function (r) {
this.cacheService.flush();
return r;
}.bind(this));
}
return transaction.commit();
};
@ -119,6 +122,7 @@ define(
*/
TransactionService.prototype.cancel = function () {
var transaction = this.transactions.pop();
return transaction ? transaction.cancel() : Promise.reject();
};

View File

@ -102,7 +102,7 @@ define(
});
mockDomainObject.hasCapability.and.callFake(function (name) {
return !!capabilities[name];
return Boolean(capabilities[name]);
});
capabilities.editor.finish.and.returnValue(mockPromise(true));
@ -123,8 +123,8 @@ define(
expect(CancelAction.appliesTo(actionContext)).toBeFalsy();
});
it("invokes the editor capability's cancel functionality when" +
" performed", function () {
it("invokes the editor capability's cancel functionality when"
+ " performed", function () {
mockDomainObject.getModel.and.returnValue({persisted: 1});
//Return true from navigate action
capabilities.action.perform.and.returnValue(mockPromise(true));

View File

@ -93,7 +93,6 @@ define(
action = new EditAndComposeAction(actionContext);
});
it("adds to the parent's composition when performed", function () {
action.perform();
expect(mockComposition.add)
@ -106,8 +105,8 @@ define(
expect(mockEditAction.perform).toHaveBeenCalled();
});
it("Does not enable edit mode for objects that do not have an" +
" edit action", function () {
it("Does not enable edit mode for objects that do not have an"
+ " edit action", function () {
mockActionCapability.getActions.and.returnValue([]);
action.perform();
expect(mockEditAction.perform).not.toHaveBeenCalled();

View File

@ -64,7 +64,10 @@ define(
return true;
}
};
context = { someKey: "some value", domainObject: object };
context = {
someKey: "some value",
domainObject: object
};
dialogService = {
getUserInput: function () {
return mockPromise(input);

View File

@ -138,6 +138,7 @@ define(
it("notifies if saving succeeded", function () {
var mockCallback = jasmine.createSpy("callback");
mockEditorCapability.save.and.returnValue(Promise.resolve());
return action.perform().then(mockCallback).then(function () {
expect(mockNotificationService.info).toHaveBeenCalled();
expect(mockNotificationService.error).not.toHaveBeenCalled();
@ -147,6 +148,7 @@ define(
it("notifies if saving failed", function () {
var mockCallback = jasmine.createSpy("callback");
mockEditorCapability.save.and.returnValue(Promise.reject("some failure reason"));
return action.perform().then(mockCallback).then(function () {
expect(mockNotificationService.error).toHaveBeenCalled();
expect(mockNotificationService.info).not.toHaveBeenCalled();

View File

@ -97,7 +97,6 @@ define(
action = new SaveAndStopEditingAction(dialogService, notificationService, actionContext);
});
it("only applies to domain object with an editor capability", function () {
expect(SaveAndStopEditingAction.appliesTo(actionContext)).toBe(true);
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");

View File

@ -42,15 +42,15 @@ define(
function noop() {}
function mockPromise(value) {
return (value || {}).then ? value :
{
return (value || {}).then ? value
: {
then: function (callback) {
return mockPromise(callback(value));
},
catch: function (callback) {
return mockPromise(callback(value));
}
} ;
};
}
beforeEach(function () {
@ -67,7 +67,10 @@ define(
mockDomainObject.getCapability.and.callFake(function (capability) {
return capabilities[capability];
});
mockDomainObject.getModel.and.returnValue({location: 'a', persisted: undefined});
mockDomainObject.getModel.and.returnValue({
location: 'a',
persisted: undefined
});
mockDomainObject.getId.and.returnValue(0);
mockClonedObject = jasmine.createSpyObj(
@ -168,8 +171,8 @@ define(
expect(SaveAsAction.appliesTo(actionContext)).toBe(false);
});
it("only applies to domain object that has not already been" +
" persisted", function () {
it("only applies to domain object that has not already been"
+ " persisted", function () {
expect(SaveAsAction.appliesTo(actionContext)).toBe(true);
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");

View File

@ -118,8 +118,8 @@ define(
expect(capability.isEditContextRoot()).toBe(true);
});
it("inEditingContext returns true if parent object is being" +
" edited", function () {
it("inEditingContext returns true if parent object is being"
+ " edited", function () {
mockStatusCapability.get.and.returnValue(false);
mockParentStatus.get.and.returnValue(false);
expect(capability.inEditContext()).toBe(false);
@ -179,8 +179,8 @@ define(
capability.edit();
capability.finish();
});
it("returns true if the object has been modified since it" +
" was last persisted", function () {
it("returns true if the object has been modified since it"
+ " was last persisted", function () {
mockTransactionService.size.and.returnValue(0);
expect(capability.dirty()).toBe(false);
mockTransactionService.size.and.returnValue(1);

View File

@ -76,15 +76,15 @@ define(
);
});
it("if no transaction is active, passes through to persistence" +
" provider", function () {
it("if no transaction is active, passes through to persistence"
+ " provider", function () {
mockTransactionManager.isActive.and.returnValue(false);
capability.persist();
expect(mockPersistence.persist).toHaveBeenCalled();
});
it("if transaction is active, persist and cancel calls are" +
" queued", function () {
it("if transaction is active, persist and cancel calls are"
+ " queued", function () {
mockTransactionManager.isActive.and.returnValue(true);
capability.persist();
expect(mockTransactionManager.addToTransaction).toHaveBeenCalled();

View File

@ -40,6 +40,7 @@ define(
mockedSaveActions.forEach(function (action) {
action.getMetadata.and.returnValue(mockSaveActionMetadata);
});
return mockedSaveActions;
} else if (actionContext.category === "conclude-editing") {
return ["a", "b", "c"];

View File

@ -54,7 +54,7 @@ define(
);
mockCapabilities = {
"editor" : mockEditorCapability,
"editor": mockEditorCapability,
"status": mockStatusCapability
};
@ -77,7 +77,10 @@ define(
testViews = [
{ key: 'abc' },
{ key: 'def', someKey: 'some value' },
{
key: 'def',
someKey: 'some value'
},
{ key: 'xyz' }
];

View File

@ -48,10 +48,10 @@ define(
mockContext.getTrueRoot.and.callFake(function () {
var mockRoot = jasmine.createSpyObj('root', ['getId']);
mockRoot.getId.and.returnValue('root-id');
return mockRoot;
});
controller = new EditPanesController(mockScope);
});
@ -97,6 +97,7 @@ define(
mockContext.getTrueRoot.and.callFake(function () {
var mockRoot = jasmine.createSpyObj('root', ['getId']);
mockRoot.getId.and.returnValue('other-root-id');
return mockRoot;
});

View File

@ -51,6 +51,7 @@ define(
);
mockType.hasFeature.and.returnValue(true);
mockType.getName.and.returnValue(name);
return mockType;
}
@ -75,7 +76,7 @@ define(
};
mockPolicyService.allow.and.callFake(function (category, type) {
return category === "creation" && mockCreationPolicy(type) ? true : false;
return Boolean(category === "creation" && mockCreationPolicy(type));
});
mockTypeService.listTypes.and.returnValue(mockTypes);

View File

@ -77,7 +77,7 @@ define(
]
);
mockDomainObject.hasCapability.and.callFake(function (name) {
return !!capabilities[name];
return Boolean(capabilities[name]);
});
mockDomainObject.getCapability.and.callFake(function (name) {
return capabilities[name];
@ -150,8 +150,8 @@ define(
expect(mockEditAction.perform).toHaveBeenCalled();
});
it("uses the save-as action if object does not have an edit action" +
" available", function () {
it("uses the save-as action if object does not have an edit action"
+ " available", function () {
capabilities.action.getActions.and.returnValue([]);
capabilities.action.perform.and.returnValue(mockPromise(undefined));
capabilities.editor.save.and.returnValue(promise);

View File

@ -45,6 +45,7 @@ define(
control: "textfield"
});
mockProperty.getValue.and.returnValue(name);
return mockProperty;
}
@ -120,7 +121,10 @@ define(
// Should have gotten a setValue call
mockProperties.forEach(function (mockProperty, i) {
expect(mockProperty.setValue).toHaveBeenCalledWith(
{ someKey: "some value", type: 'test' },
{
someKey: "some value",
type: 'test'
},
"field " + i
);
});
@ -188,7 +192,6 @@ define(
})).toEqual(false);
});
});
}
);

View File

@ -58,7 +58,10 @@ define(
}
beforeEach(function () {
mockQ = { when: mockPromise, reject: mockReject };
mockQ = {
when: mockPromise,
reject: mockReject
};
mockLog = jasmine.createSpyObj(
"$log",
["error", "warn", "info", "debug"]
@ -113,8 +116,8 @@ define(
mockNewObject.getId.and.returnValue('newId');
mockNewObject.getCapability.and.callFake(function (c) {
return c === 'persistence' ?
mockNewPersistenceCapability : undefined;
return c === 'persistence'
? mockNewPersistenceCapability : undefined;
});
mockPersistenceCapability.persist
@ -167,6 +170,7 @@ define(
mockDomainObject.getId.and.returnValue(id);
mockCompositionCapability.invoke
.and.returnValue(mockPromise([mockDomainObject]));
return mockPromise(mockDomainObject);
});
@ -207,7 +211,6 @@ define(
expect(mockLog.error).toHaveBeenCalled();
});
});
}
);

View File

@ -30,7 +30,6 @@ define([
$scope,
representer;
beforeEach(function () {
$log = jasmine.createSpyObj('$log', ['debug']);
$scope = {};
@ -84,6 +83,5 @@ define([
});
});
});

View File

@ -74,4 +74,3 @@ define(["../../src/services/NestedTransaction"], function (NestedTransaction) {
});
});

View File

@ -51,6 +51,7 @@ define(
var mockRemove =
jasmine.createSpy('remove-' + mockRemoves.length);
mockRemoves.push(mockRemove);
return mockRemove;
});

View File

@ -31,7 +31,7 @@ define([
) {
return {
name:"platform/commonUI/formats",
name: "platform/commonUI/formats",
definition: {
"name": "Format Registry",
"description": "Provides a registry for formats, which allow parsing and formatting of values.",
@ -68,8 +68,8 @@ define([
"version": "3.0.0",
"description": "Incorporates modified code from d3 Time Scales",
"author": "Mike Bostock",
"copyright": "Copyright 2010-2016 Mike Bostock. " +
"All rights reserved.",
"copyright": "Copyright 2010-2016 Mike Bostock. "
+ "All rights reserved.",
"link": "https://github.com/d3/d3/blob/master/LICENSE"
}
]

View File

@ -31,7 +31,6 @@ define([
DATE_FORMAT
];
/**
* Formatter for duration. Uses moment to produce a date from a given
* value, but output is formatted to display only time. Can be used for

View File

@ -114,6 +114,7 @@ define([
if (!format) {
throw new Error("FormatProvider: No format found for " + key);
}
return format;
};

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