From cae85f3e30c32c79ca19c5e7ebb3750e09962a3f Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Mon, 9 May 2016 10:16:54 -0700 Subject: [PATCH 01/59] [Frontend] Mods to slider .range-value elems open #889 - Text smaller, line breaks; - Height adjustments - Increased with of slider area; --- .../commonUI/general/res/sass/_constants.scss | 2 +- .../general/res/sass/controls/_controls.scss | 4 +-- .../res/sass/controls/_time-controller.scss | 27 +++++++++++-------- .../themes/espresso/res/sass/_constants.scss | 3 ++- .../themes/snow/res/sass/_constants.scss | 3 ++- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/platform/commonUI/general/res/sass/_constants.scss b/platform/commonUI/general/res/sass/_constants.scss index 659025960f..59fe5ed65c 100644 --- a/platform/commonUI/general/res/sass/_constants.scss +++ b/platform/commonUI/general/res/sass/_constants.scss @@ -48,7 +48,7 @@ $uePaneMiniTabW: 10px; $uePaneMiniTabCollapsedW: 11px; $ueEditLeftPaneW: 75%; $treeSearchInputBarH: 25px; -$ueTimeControlH: (33px, 20px, 20px); +$ueTimeControlH: (33px, 23px, 15px); // Panes $ueBrowseLeftPaneTreeMinW: 150px; $ueBrowseLeftPaneTreeMaxW: 35%; diff --git a/platform/commonUI/general/res/sass/controls/_controls.scss b/platform/commonUI/general/res/sass/controls/_controls.scss index a2bb0b73bb..7177e87abe 100644 --- a/platform/commonUI/general/res/sass/controls/_controls.scss +++ b/platform/commonUI/general/res/sass/controls/_controls.scss @@ -404,11 +404,11 @@ body.desktop .object-header { left: auto; } .knob-l { - @include border-left-radius($sliderKnobW); + @include border-left-radius($sliderKnobR); cursor: w-resize; } .knob-r { - @include border-right-radius($sliderKnobW); + @include border-right-radius($sliderKnobR); cursor: e-resize; } .range { diff --git a/platform/commonUI/general/res/sass/controls/_time-controller.scss b/platform/commonUI/general/res/sass/controls/_time-controller.scss index f6201d60cf..b9d7e26b0e 100644 --- a/platform/commonUI/general/res/sass/controls/_time-controller.scss +++ b/platform/commonUI/general/res/sass/controls/_time-controller.scss @@ -11,7 +11,7 @@ $knobM: ($sliderKnobW + $knobHOffset) * -1; $rangeValPad: $interiorMargin; $rangeValOffset: $sliderKnobW; - $timeRangeSliderLROffset: 130px + $sliderKnobW + $rangeValOffset; + $timeRangeSliderLROffset: 80px + ($sliderKnobW * 2); $r1H: nth($ueTimeControlH,1); $r2H: nth($ueTimeControlH,2); $r3H: nth($ueTimeControlH,3); @@ -76,22 +76,23 @@ &:before, &:after { background-color: $myC; - content: ""; + //content: ""; position: absolute; } &:before { // Vert line + content: ""; top: 0; right: auto; bottom: -10px; left: floor($myW/2) - 1; - width: 2px; + width: 1px; } - &:after { +/* &:after { // Circle element border-radius: $myW; @include transform(translateY(-50%)); top: 50%; right: 0; bottom: auto; left: 0; width: auto; height: $myW; - } + }*/ } &:hover .toi-line { @include toiLineHovEffects; @@ -126,9 +127,9 @@ @include webkitProp(transform, translateX(-50%)); color: $colorPlotLabelFg; display: inline-block; - font-size: 0.9em; + font-size: 0.7rem; position: absolute; - top: 8px; + top: 5px; white-space: nowrap; z-index: 2; } @@ -140,14 +141,18 @@ z-index: 2; .range-value { @include trans-prop-nice-fade(.25s); + //background: rgba(red, 0.4); + font-size: 0.7rem; padding: 0 $rangeValOffset; position: absolute; height: $r2H; - line-height: $r2H; - white-space: nowrap; + line-height: $r2H/2; + z-index: 1; } - &:hover .range-value { - color: $sliderColorKnobHov; + &:hover { + .range-value { + color: $sliderColorKnobHov; + } } &.knob-l { margin-left: $knobM; diff --git a/platform/commonUI/themes/espresso/res/sass/_constants.scss b/platform/commonUI/themes/espresso/res/sass/_constants.scss index 729a813a12..a17f8040c0 100644 --- a/platform/commonUI/themes/espresso/res/sass/_constants.scss +++ b/platform/commonUI/themes/espresso/res/sass/_constants.scss @@ -36,7 +36,8 @@ $sliderColorKnob: rgba($sliderColorBase, 0.6); $sliderColorKnobHov: $sliderColorBase; $sliderColorRangeValHovBg: rgba($sliderColorBase, 0.1); $sliderColorRangeValHovFg: $colorKeyFg; -$sliderKnobW: nth($ueTimeControlH,2)/2; +$sliderKnobW: 5px; //nth($ueTimeControlH,2)/2; +$sliderKnobR: 2px; $timeControllerToiLineColor: #00c2ff; $timeControllerToiLineColorHov: #fff; diff --git a/platform/commonUI/themes/snow/res/sass/_constants.scss b/platform/commonUI/themes/snow/res/sass/_constants.scss index 0d8430a7ec..fbb6cc8d87 100644 --- a/platform/commonUI/themes/snow/res/sass/_constants.scss +++ b/platform/commonUI/themes/snow/res/sass/_constants.scss @@ -36,7 +36,8 @@ $sliderColorKnob: rgba($sliderColorBase, 0.5); $sliderColorKnobHov: rgba($sliderColorBase, 0.7); $sliderColorRangeValHovBg: $sliderColorRange; //rgba($sliderColorBase, 0.1); $sliderColorRangeValHovFg: $colorBodyFg; -$sliderKnobW: nth($ueTimeControlH,2)/2; +$sliderKnobW: 5px; //nth($ueTimeControlH,2)/2; +$sliderKnobR: 2px; $timeControllerToiLineColor: $colorBodyFg; $timeControllerToiLineColorHov: #0052b5; From 2e8604e18d7995528c9ab288b968326e9f8e828f Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Mon, 9 May 2016 10:38:18 -0700 Subject: [PATCH 02/59] [Frontend] Layout and positioning fixes for TC controls open #889 --- .../general/res/sass/controls/_time-controller.scss | 12 +++++++++--- .../res/templates/controls/time-controller.html | 10 +++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/platform/commonUI/general/res/sass/controls/_time-controller.scss b/platform/commonUI/general/res/sass/controls/_time-controller.scss index b9d7e26b0e..e8051b058f 100644 --- a/platform/commonUI/general/res/sass/controls/_time-controller.scss +++ b/platform/commonUI/general/res/sass/controls/_time-controller.scss @@ -38,8 +38,15 @@ .l-time-range-inputs-holder { height: $r1H; bottom: $r2H + $r3H + ($interiorMarginSm * 2); - padding-top: $interiorMargin; + //padding-top: $interiorMargin; border-top: 1px solid $colorInteriorBorder; + &.l-flex-row { + @include align-items(center); + .flex-elem { + height: auto; + line-height: normal; + } + } .type-icon { font-size: 120%; vertical-align: middle; @@ -141,7 +148,6 @@ z-index: 2; .range-value { @include trans-prop-nice-fade(.25s); - //background: rgba(red, 0.4); font-size: 0.7rem; padding: 0 $rangeValOffset; position: absolute; @@ -175,7 +181,7 @@ .l-time-domain-selector { position: absolute; right: 0px; - bottom: 46px; + bottom: 43px; } } diff --git a/platform/commonUI/general/res/templates/controls/time-controller.html b/platform/commonUI/general/res/templates/controls/time-controller.html index 281447e251..91fe8099ee 100644 --- a/platform/commonUI/general/res/templates/controls/time-controller.html +++ b/platform/commonUI/general/res/templates/controls/time-controller.html @@ -20,10 +20,10 @@ at runtime from the About dialog for additional information. -->
-
- C - + C + to + to - + - + - - diff --git a/platform/commonUI/general/res/templates/controls/time-controller.html b/platform/commonUI/general/res/templates/controls/time-controller.html index 91fe8099ee..2d617c951f 100644 --- a/platform/commonUI/general/res/templates/controls/time-controller.html +++ b/platform/commonUI/general/res/templates/controls/time-controller.html @@ -23,7 +23,7 @@ C - + to - + -   + diff --git a/platform/commonUI/themes/espresso/res/sass/_constants.scss b/platform/commonUI/themes/espresso/res/sass/_constants.scss index a17f8040c0..d1390c91a7 100644 --- a/platform/commonUI/themes/espresso/res/sass/_constants.scss +++ b/platform/commonUI/themes/espresso/res/sass/_constants.scss @@ -70,8 +70,10 @@ $colorCreateMenuText: $colorMenuFg; $colorCheck: $colorKey; $colorFormRequired: $colorAlt1; $colorFormValid: #33cc33; -$colorFormError: #cc0000; +$colorFormError: #990000; $colorFormInvalid: #ff3300; +$colorFormFieldErrorBg: $colorFormError; +$colorFormFieldErrorFg: rgba(#fff, 0.6); $colorFormLines: rgba(#fff, 0.1); $colorFormSectionHeader: rgba(#fff, 0.1); $colorInputBg: rgba(#000, 0.1); diff --git a/platform/commonUI/themes/snow/res/sass/_constants.scss b/platform/commonUI/themes/snow/res/sass/_constants.scss index fbb6cc8d87..bbd3a475be 100644 --- a/platform/commonUI/themes/snow/res/sass/_constants.scss +++ b/platform/commonUI/themes/snow/res/sass/_constants.scss @@ -36,7 +36,7 @@ $sliderColorKnob: rgba($sliderColorBase, 0.5); $sliderColorKnobHov: rgba($sliderColorBase, 0.7); $sliderColorRangeValHovBg: $sliderColorRange; //rgba($sliderColorBase, 0.1); $sliderColorRangeValHovFg: $colorBodyFg; -$sliderKnobW: 5px; //nth($ueTimeControlH,2)/2; +$sliderKnobW: 10px; $sliderKnobR: 2px; $timeControllerToiLineColor: $colorBodyFg; $timeControllerToiLineColorHov: #0052b5; @@ -70,8 +70,10 @@ $colorCreateMenuText: $colorBodyFg; $colorCheck: $colorKey; $colorFormRequired: $colorKey; $colorFormValid: #33cc33; -$colorFormError: #cc0000; +$colorFormError: #990000; $colorFormInvalid: #ff2200; +$colorFormFieldErrorBg: $colorFormError; +$colorFormFieldErrorFg: rgba(#fff, 0.6); $colorFormLines: rgba(#000, 0.1); $colorFormSectionHeader: rgba(#000, 0.05); $colorInputBg: $colorGenBg; From 8788523c25019255e14b3fe8ddd42264214fe359 Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Tue, 10 May 2016 14:28:23 -0700 Subject: [PATCH 04/59] [Frontend] Tweaks to slider knobs open #889 - Knob size increased; - Knob grippies added; --- platform/commonUI/general/res/sass/_mixins.scss | 11 +++++++++++ .../general/res/sass/controls/_time-controller.scss | 12 ++++++++++++ .../themes/espresso/res/sass/_constants.scss | 4 ++-- .../commonUI/themes/snow/res/sass/_constants.scss | 6 +++--- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/platform/commonUI/general/res/sass/_mixins.scss b/platform/commonUI/general/res/sass/_mixins.scss index 663edb9762..d7fa694100 100644 --- a/platform/commonUI/general/res/sass/_mixins.scss +++ b/platform/commonUI/general/res/sass/_mixins.scss @@ -139,6 +139,17 @@ background-size: $d $d; } +@mixin bgStripes($c: yellow, $a: 0.1, $bgsize: 5px, $angle: 90deg) { + @include background-image(linear-gradient($angle, + rgba($c, $a) 25%, transparent 25%, + transparent 50%, rgba($c, $a) 50%, + rgba($c, $a) 75%, transparent 75%, + transparent 100% + )); + background-repeat: repeat; + background-size: $bgsize $bgsize; +} + @mixin bgVertStripes($c: yellow, $a: 0.1, $d: 40px) { @include background-image(linear-gradient(-90deg, rgba($c, $a) 0%, rgba($c, $a) 50%, diff --git a/platform/commonUI/general/res/sass/controls/_time-controller.scss b/platform/commonUI/general/res/sass/controls/_time-controller.scss index 88f79bdb1c..c8a52bdce3 100644 --- a/platform/commonUI/general/res/sass/controls/_time-controller.scss +++ b/platform/commonUI/general/res/sass/controls/_time-controller.scss @@ -147,6 +147,16 @@ .knob { z-index: 2; + &:before { + $mTB: 2px; + $grippyW: 3px; + $mLR: ($sliderKnobW - $grippyW)/2; + @include bgStripes($c: pullForward($sliderColorKnob, 20%), $a: 1, $bgsize: 4px, $angle: 0deg); + content: ''; + display: block; + position: absolute; + top: $mTB; right: $mLR; bottom: $mTB; left: $mLR; + } .range-value { @include trans-prop-nice-fade(.25s); font-size: 0.7rem; @@ -193,6 +203,8 @@ padding: 1px 1px 0 $interiorMargin; } +/******************************************************************** MOBILE */ + @include phoneandtablet { .l-time-controller, .l-time-range-inputs-holder { min-width: 0px; diff --git a/platform/commonUI/themes/espresso/res/sass/_constants.scss b/platform/commonUI/themes/espresso/res/sass/_constants.scss index d1390c91a7..c6fd55e8ca 100644 --- a/platform/commonUI/themes/espresso/res/sass/_constants.scss +++ b/platform/commonUI/themes/espresso/res/sass/_constants.scss @@ -32,11 +32,11 @@ $sliderColorBase: $colorKey; $sliderColorRangeHolder: rgba(black, 0.1); $sliderColorRange: rgba($sliderColorBase, 0.3); $sliderColorRangeHov: rgba($sliderColorBase, 0.5); -$sliderColorKnob: rgba($sliderColorBase, 0.6); +$sliderColorKnob: pushBack($sliderColorBase, 15%); $sliderColorKnobHov: $sliderColorBase; $sliderColorRangeValHovBg: rgba($sliderColorBase, 0.1); $sliderColorRangeValHovFg: $colorKeyFg; -$sliderKnobW: 5px; //nth($ueTimeControlH,2)/2; +$sliderKnobW: 15px; $sliderKnobR: 2px; $timeControllerToiLineColor: #00c2ff; $timeControllerToiLineColorHov: #fff; diff --git a/platform/commonUI/themes/snow/res/sass/_constants.scss b/platform/commonUI/themes/snow/res/sass/_constants.scss index bbd3a475be..f85b5c328f 100644 --- a/platform/commonUI/themes/snow/res/sass/_constants.scss +++ b/platform/commonUI/themes/snow/res/sass/_constants.scss @@ -32,11 +32,11 @@ $sliderColorBase: $colorKey; $sliderColorRangeHolder: rgba(black, 0.07); $sliderColorRange: rgba($sliderColorBase, 0.2); $sliderColorRangeHov: rgba($sliderColorBase, 0.4); -$sliderColorKnob: rgba($sliderColorBase, 0.5); +$sliderColorKnob: pushBack($sliderColorBase, 20%); $sliderColorKnobHov: rgba($sliderColorBase, 0.7); -$sliderColorRangeValHovBg: $sliderColorRange; //rgba($sliderColorBase, 0.1); +$sliderColorRangeValHovBg: $sliderColorRange; $sliderColorRangeValHovFg: $colorBodyFg; -$sliderKnobW: 10px; +$sliderKnobW: 15px; $sliderKnobR: 2px; $timeControllerToiLineColor: $colorBodyFg; $timeControllerToiLineColorHov: #0052b5; From 7ade873365ac842a67c5873d5cdde9dc183610fd Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Tue, 10 May 2016 15:12:50 -0700 Subject: [PATCH 05/59] [Frontend] Flex; Tweaks to slider knobs open #889 - Converted TC elements to use flex layout instead of abs pos; - Knob size increased; - Knob grippies added; --- .../commonUI/general/res/sass/_constants.scss | 2 +- .../res/sass/controls/_time-controller.scss | 16 ++++++++-------- .../general/res/sass/user-environ/_layout.scss | 8 ++++---- .../res/templates/controls/time-controller.html | 8 ++++---- .../themes/espresso/res/sass/_constants.scss | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/platform/commonUI/general/res/sass/_constants.scss b/platform/commonUI/general/res/sass/_constants.scss index a7abd1ac8b..c36a6cb00a 100644 --- a/platform/commonUI/general/res/sass/_constants.scss +++ b/platform/commonUI/general/res/sass/_constants.scss @@ -48,7 +48,7 @@ $uePaneMiniTabW: 10px; $uePaneMiniTabCollapsedW: 11px; $ueEditLeftPaneW: 75%; $treeSearchInputBarH: 25px; -$ueTimeControlH: (33px, 15px, 15px); +$ueTimeControlH: (33px, 18px, 20px); // Panes $ueBrowseLeftPaneTreeMinW: 150px; $ueBrowseLeftPaneTreeMaxW: 35%; diff --git a/platform/commonUI/general/res/sass/controls/_time-controller.scss b/platform/commonUI/general/res/sass/controls/_time-controller.scss index c8a52bdce3..bf6568508c 100644 --- a/platform/commonUI/general/res/sass/controls/_time-controller.scss +++ b/platform/commonUI/general/res/sass/controls/_time-controller.scss @@ -12,23 +12,23 @@ $rangeValPad: $interiorMargin; $rangeValOffset: $sliderKnobW + $interiorMargin; $timeRangeSliderLROffset: 150px + ($sliderKnobW * 2); - $r1H: nth($ueTimeControlH,1); + $r1H: nth($ueTimeControlH,1); // Not currently used $r2H: nth($ueTimeControlH,2); $r3H: nth($ueTimeControlH,3); - display: block; - height: $r1H + $r2H + $r3H + ($interiorMargin * 2); min-width: $minW; font-size: 0.8rem; - .l-time-range-inputs-holder, .l-time-range-slider-holder, .l-time-range-ticks-holder { - @include absPosDefault(0, visible); box-sizing: border-box; - top: auto; + position: relative; + //top: auto; + &:not(:first-child) { + margin-top: $interiorMargin; + } } .l-time-range-slider, .l-time-range-ticks { @@ -37,8 +37,8 @@ } .l-time-range-inputs-holder { - height: $r1H; bottom: $r2H + $r3H + ($interiorMarginSm * 2); border-top: 1px solid $colorInteriorBorder; + padding-top: $interiorMargin; &.l-flex-row { @include align-items(center); .flex-elem { @@ -78,7 +78,7 @@ } .l-time-range-slider-holder { - height: $r2H; bottom: $r3H + ($interiorMarginSm * 1); + height: $r2H; .range-holder { box-shadow: none; background: none; diff --git a/platform/commonUI/general/res/sass/user-environ/_layout.scss b/platform/commonUI/general/res/sass/user-environ/_layout.scss index 99d8fb9d14..9e8e9aaae1 100644 --- a/platform/commonUI/general/res/sass/user-environ/_layout.scss +++ b/platform/commonUI/general/res/sass/user-environ/_layout.scss @@ -194,7 +194,7 @@ body.desktop .pane .mini-tab-icon.toggle-pane { .holder.holder-treeview-elements { top: $bodyMargin; right: 0; - bottom: $bodyMargin; + bottom: $interiorMargin; left: $bodyMargin; .create-btn-holder { &.s-status-editing { @@ -215,17 +215,17 @@ body.desktop .pane .mini-tab-icon.toggle-pane { left: 0; .holder-object { top: $bodyMargin; - bottom: $bodyMargin; + bottom: $interiorMargin; } .holder-inspector { top: $bodyMargin; - bottom: $bodyMargin; + bottom: $interiorMargin; left: $bodyMargin; right: $bodyMargin; } .holder-elements { top: 0; - bottom: $bodyMargin; + bottom: $interiorMargin; left: $bodyMargin; right: $bodyMargin; } diff --git a/platform/commonUI/general/res/templates/controls/time-controller.html b/platform/commonUI/general/res/templates/controls/time-controller.html index 2d617c951f..3ac4542644 100644 --- a/platform/commonUI/general/res/templates/controls/time-controller.html +++ b/platform/commonUI/general/res/templates/controls/time-controller.html @@ -19,8 +19,8 @@ this source code distribution or the Licensing information page available at runtime from the About dialog for additional information. --> -
- + C @@ -54,7 +54,7 @@ -
+
@@ -85,7 +85,7 @@
-
+
Date: Tue, 10 May 2016 19:52:11 -0700 Subject: [PATCH 06/59] [Frontend] Time Conductor mobile open #889 - Major refactoring of mobile approach, leveraging flex-box layout change; --- .../res/sass/controls/_time-controller.scss | 221 +++++------------- .../templates/controls/time-controller.html | 55 ++--- 2 files changed, 83 insertions(+), 193 deletions(-) diff --git a/platform/commonUI/general/res/sass/controls/_time-controller.scss b/platform/commonUI/general/res/sass/controls/_time-controller.scss index bf6568508c..ba2cf5b3ee 100644 --- a/platform/commonUI/general/res/sass/controls/_time-controller.scss +++ b/platform/commonUI/general/res/sass/controls/_time-controller.scss @@ -25,7 +25,6 @@ { box-sizing: border-box; position: relative; - //top: auto; &:not(:first-child) { margin-top: $interiorMargin; } @@ -39,7 +38,8 @@ .l-time-range-inputs-holder { border-top: 1px solid $colorInteriorBorder; padding-top: $interiorMargin; - &.l-flex-row { + &.l-flex-row, + .l-flex-row { @include align-items(center); .flex-elem { height: auto; @@ -192,7 +192,7 @@ .l-time-domain-selector { position: absolute; right: 0px; - bottom: $r2H + $r3H + $interiorMargin; + top: $interiorMargin; } } @@ -206,172 +206,61 @@ /******************************************************************** MOBILE */ @include phoneandtablet { - .l-time-controller, .l-time-range-inputs-holder { - min-width: 0px; - } - - .l-time-controller { - - .l-time-domain-selector { - select { - height: 25px; - margin-bottom: 0px; - } - } - - .l-time-range-slider-holder, .l-time-range-ticks-holder { - display: none; - } - - .time-range-start, .time-range-end, { - width: 100%; - } - - .l-time-range-inputs-holder { - .l-time-range-input { - display: block; - .s-btn { - padding-right: 18px; - white-space: nowrap; - input { - width: 100%; - } - } - } - .l-time-range-inputs-elem { - - } - } - } + .l-time-controller { + min-width: 0; + .l-time-range-slider-holder, + .l-time-range-ticks-holder { + display: none; + } + } } @include phone { - .l-time-controller { - height: 48px; - - .l-time-range-inputs-holder { - bottom: 24px; - } - - .l-time-domain-selector { - width: 33%; - bottom: -9px; - } - - .l-time-range-inputs-holder { - .l-time-range-input { - margin-bottom: 5px; - .s-btn { - width: 66%; - } - } - .l-time-range-inputs-elem { - &.ui-symbol { - display: none; - } - - &.lbl { - width: 33%; - right: 0px; - top: 5px; - display: block; - height: 25px; - margin: 0; - line-height: 25px; - position: absolute; - } - } - } - } + .l-time-controller { + .l-time-range-inputs-holder { + &.l-flex-row, + .l-flex-row { + @include align-items(flex-start); + } + .l-time-range-inputs-elem { + &.type-icon { + margin-top: 3px; + } + } + .t-inputs-w { + @include flex-direction(column); + .l-time-range-input-w:not(:first-child) { + &:not(:first-child) { + margin-top: $interiorMargin; + } + margin-right: 0; + } + .l-time-range-inputs-elem { + &.lbl { display: none; } + } + } + } + } } -@include tablet { - .l-time-controller { - height: 17px; - - .l-time-range-inputs-holder { - bottom: -7px; - left: -5px; - } - - .l-time-domain-selector { - width: 23%; - right: -4px; - bottom: -10px; - } - - .l-time-range-inputs-holder { - .l-time-range-input { - float: left; - .s-btn { - width: 100%; - padding-left: 4px; - } - } - } - } -} - -@include tabletLandscape { - .l-time-controller { - height: 17px; - - .l-time-range-inputs-holder { - bottom: -7px; - } - - .l-time-domain-selector { - width: 23%; - right: auto; - bottom: -10px; - left: 391px; - } - - .l-time-range-inputs-holder { - .l-time-range-inputs-elem { - &.ui-symbol, &.lbl { - display: block; - float: left; - line-height: 25px; - } - } - } - } - - .pane-tree-hidden .l-time-controller { - .l-time-domain-selector { - left: 667px; - } - .l-time-range-inputs-holder { - padding-left: 277px; - } - } -} -@include tabletPortrait { - .l-time-controller { - height: 17px; - - .l-time-range-inputs-holder { - bottom: -7px; - left: -5px; - } - - .l-time-domain-selector { - width: 23%; - right: -4px; - bottom: -10px; - } - - .l-time-range-inputs-holder { - .l-time-range-input { - width: 38%; - float: left; - } - .l-time-range-inputs-elem { - &.ui-symbol, &.lbl { - display: none; - } - } - } - } +@include phonePortrait { + .l-time-controller { + .l-time-range-inputs-holder { + .t-inputs-w { + @include flex(1 1 auto); + padding-top: 25px; // Make room for the ever lovin' Time Domain Selector + .flex-elem { + @include flex(1 1 auto); + width: 100%; + } + input[type="text"] { + width: 100%; + } + } + } + } + .l-time-domain-selector { + right: auto; + left: 20px; + } } diff --git a/platform/commonUI/general/res/templates/controls/time-controller.html b/platform/commonUI/general/res/templates/controls/time-controller.html index 3ac4542644..cd36236358 100644 --- a/platform/commonUI/general/res/templates/controls/time-controller.html +++ b/platform/commonUI/general/res/templates/controls/time-controller.html @@ -23,34 +23,35 @@
C - - - + + + + + + + to + + + + + - - to - - - - - - From 73c2c01def9b063ca444bf2b1be42a2d7386fede Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Wed, 11 May 2016 11:32:39 -0700 Subject: [PATCH 07/59] [Frontend] Layout and styling of Time Conductor open #889 open #298 Fixes for mobile; Moved popup z-index def into sass; Datetime picker compressed for better fit in mobile phone; Removed hours selector from datetime picker to enable better fit in mobile; --- .../commonUI/general/res/sass/_archetypes.scss | 5 +++++ .../general/res/sass/controls/_controls.scss | 14 +++++++++++++- .../res/templates/controls/datetime-field.html | 3 +-- .../commonUI/general/src/directives/MCTPopup.js | 5 +---- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/platform/commonUI/general/res/sass/_archetypes.scss b/platform/commonUI/general/res/sass/_archetypes.scss index 84045c2520..4abad717ea 100644 --- a/platform/commonUI/general/res/sass/_archetypes.scss +++ b/platform/commonUI/general/res/sass/_archetypes.scss @@ -145,3 +145,8 @@ .flex-justify-end { @include justify-content(flex-end); } + +/********************************************* POPUPS */ +.t-popup { + z-index: 75; +} diff --git a/platform/commonUI/general/res/sass/controls/_controls.scss b/platform/commonUI/general/res/sass/controls/_controls.scss index 6374efaaa0..51f35b505e 100644 --- a/platform/commonUI/general/res/sass/controls/_controls.scss +++ b/platform/commonUI/general/res/sass/controls/_controls.scss @@ -434,7 +434,6 @@ body.desktop .object-header { @include user-select(none); font-size: 0.8rem; padding: $interiorMarginLg !important; - width: 230px; .l-month-year-pager { $pagerW: 20px; height: $r1H; @@ -526,6 +525,19 @@ body.desktop .object-header { } } +@include phone { + .l-datetime-picker { + padding: $interiorMargin !important; + } + .l-calendar { + ul.l-cal-row { + li { + padding: 2px $interiorMargin; + } + } + } +} + /******************************************************** TEXTAREA */ textarea { @include nice-textarea($colorInputBg, $colorInputFg); diff --git a/platform/commonUI/general/res/templates/controls/datetime-field.html b/platform/commonUI/general/res/templates/controls/datetime-field.html index e890843754..47551fa25b 100644 --- a/platform/commonUI/general/res/templates/controls/datetime-field.html +++ b/platform/commonUI/general/res/templates/controls/datetime-field.html @@ -37,8 +37,7 @@
+ field="'value'">
diff --git a/platform/commonUI/general/src/directives/MCTPopup.js b/platform/commonUI/general/src/directives/MCTPopup.js index e96c1c0327..f1c6ca79d6 100644 --- a/platform/commonUI/general/src/directives/MCTPopup.js +++ b/platform/commonUI/general/src/directives/MCTPopup.js @@ -49,10 +49,7 @@ define( position = [ rect.left, rect.top ], popup = popupService.display(div, position); - // TODO: Handle in CSS; - // https://github.com/nasa/openmctweb/issues/298 - div.css('z-index', 75); - + div.addClass('t-popup'); transclude(function (clone) { div.append(clone); }); From 3d891073dab9b1f109c105294a7d51274b658952 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 11 May 2016 14:25:23 -0700 Subject: [PATCH 08/59] [Popup] Add method to jqlite mocks ...to resolve build failure preventing merge, https://github.com/nasa/openmct/pull/922#issuecomment-218588876 --- .../commonUI/general/test/directives/MCTPopupSpec.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/platform/commonUI/general/test/directives/MCTPopupSpec.js b/platform/commonUI/general/test/directives/MCTPopupSpec.js index bfe6b469cb..9893e85b30 100644 --- a/platform/commonUI/general/test/directives/MCTPopupSpec.js +++ b/platform/commonUI/general/test/directives/MCTPopupSpec.js @@ -24,7 +24,15 @@ define( ["../../src/directives/MCTPopup"], function (MCTPopup) { - var JQLITE_METHODS = [ "on", "off", "find", "parent", "css", "append" ]; + var JQLITE_METHODS = [ + "on", + "off", + "find", + "parent", + "css", + "addClass", + "append" + ]; describe("The mct-popup directive", function () { var mockCompile, From 031a46aa8e34f2e428c71b9cf9e4c83412c8d438 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 12 May 2016 15:32:38 -0700 Subject: [PATCH 09/59] [Code Style] Add JSHint rules Add JSHint rules to complement allowing multiple var statements, https://github.com/nasa/openmct/issues/142#issuecomment-212187972 [Code Style] Require one decl per var [Code Style] Don't require separate var decls ...but allow them (for compatibility with existing code style) [Code Style] Allow var decl after start of scope [Code Style] Enforce codestyle during verify task --- .jscsrc | 4 +++- .jshintrc | 3 ++- gulpfile.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.jscsrc b/.jscsrc index ac17b5dc9c..7229391def 100644 --- a/.jscsrc +++ b/.jscsrc @@ -1,3 +1,5 @@ { - "preset": "crockford" + "preset": "crockford", + "requireMultipleVarDecl": false, + "requireVarDeclFirst": false } diff --git a/.jshintrc b/.jshintrc index df3f02a1ff..ca549530ff 100644 --- a/.jshintrc +++ b/.jshintrc @@ -5,7 +5,7 @@ "eqeqeq": true, "forin": true, "freeze": true, - "funcscope": true, + "funcscope": false, "futurehostile": true, "latedef": true, "noarg": true, @@ -16,6 +16,7 @@ "define", "Promise" ], + "shadow": "inner", "strict": "implied", "undef": true, "unused": "vars" diff --git a/gulpfile.js b/gulpfile.js index 28d4530b9c..c3e82295d6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -147,6 +147,6 @@ gulp.task('develop', ['serve', 'stylesheets', 'watch']); gulp.task('install', [ 'static', 'scripts' ]); -gulp.task('verify', [ 'lint', 'test' ]); +gulp.task('verify', [ 'lint', 'test', 'checkstyle' ]); gulp.task('build', [ 'verify', 'install' ]); From a11dba88b239e0be0d46ac3bb158d62d65ffc1e3 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 20:23:33 -0700 Subject: [PATCH 10/59] [New Edit Mode] #634 Removed edit concerns from MctRepresentation --- .../regions/src/InspectorController.js | 8 +++- .../regions/test/InspectorControllerSpec.js | 39 +++++++++++++++++-- .../representation/src/MCTRepresentation.js | 29 ++------------ .../test/MCTRepresentationSpec.js | 15 ------- 4 files changed, 45 insertions(+), 46 deletions(-) diff --git a/platform/commonUI/regions/src/InspectorController.js b/platform/commonUI/regions/src/InspectorController.js index 32b0e1903d..89b88d4b15 100644 --- a/platform/commonUI/regions/src/InspectorController.js +++ b/platform/commonUI/regions/src/InspectorController.js @@ -32,7 +32,8 @@ define( */ function InspectorController($scope, policyService) { var domainObject = $scope.domainObject, - typeCapability = domainObject.getCapability('type'); + typeCapability = domainObject.getCapability('type'), + statusListener; /** * Filters region parts to only those allowed by region policies @@ -50,6 +51,11 @@ define( $scope.regions = filterRegions(typeCapability.getDefinition().inspector || new InspectorRegion()); } + statusListener = domainObject.getCapability("status").listen(setRegions); + $scope.$on("$destroy", function () { + statusListener(); + }); + setRegions(); } diff --git a/platform/commonUI/regions/test/InspectorControllerSpec.js b/platform/commonUI/regions/test/InspectorControllerSpec.js index ad3243c348..9d815e2851 100644 --- a/platform/commonUI/regions/test/InspectorControllerSpec.js +++ b/platform/commonUI/regions/test/InspectorControllerSpec.js @@ -30,6 +30,8 @@ define( mockTypeCapability, mockTypeDefinition, mockPolicyService, + mockStatusCapability, + capabilities = {}, controller; beforeEach(function(){ @@ -47,19 +49,29 @@ define( 'getDefinition' ]); mockTypeCapability.getDefinition.andReturn(mockTypeDefinition); + capabilities.type = mockTypeCapability; + + mockStatusCapability = jasmine.createSpyObj('statusCapability', [ + 'listen' + ]); + capabilities.status = mockStatusCapability; mockDomainObject = jasmine.createSpyObj('domainObject', [ 'getCapability' ]); - mockDomainObject.getCapability.andReturn(mockTypeCapability); + mockDomainObject.getCapability.andCallFake(function (name) { + return capabilities[name]; + }); mockPolicyService = jasmine.createSpyObj('policyService', [ 'allow' ]); - mockScope = { - domainObject: mockDomainObject - }; + mockScope = jasmine.createSpyObj('$scope', + ['$on'] + ); + + mockScope.domainObject = mockDomainObject; }); it("filters out regions disallowed by region policy", function() { @@ -73,6 +85,25 @@ define( controller = new InspectorController(mockScope, mockPolicyService); expect(mockScope.regions.length).toBe(2); }); + + it("Responds to status changes", function() { + mockPolicyService.allow.andReturn(true); + controller = new InspectorController(mockScope, mockPolicyService); + expect(mockScope.regions.length).toBe(2); + expect(mockStatusCapability.listen).toHaveBeenCalled(); + mockPolicyService.allow.andReturn(false); + mockStatusCapability.listen.mostRecentCall.args[0](); + expect(mockScope.regions.length).toBe(0); + }); + + it("Unregisters status listener", function() { + var mockListener = jasmine.createSpy('listener'); + mockStatusCapability.listen.andReturn(mockListener); + controller = new InspectorController(mockScope, mockPolicyService); + expect(mockScope.$on).toHaveBeenCalledWith("$destroy", jasmine.any(Function)); + mockScope.$on.mostRecentCall.args[1](); + expect(mockListener).toHaveBeenCalled(); + }); }); } ); diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index bcaa90e4e7..331139b793 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -88,7 +88,6 @@ define( toClear = [], // Properties to clear out of scope on change counter = 0, couldRepresent = false, - couldEdit = false, lastIdPath = [], lastKey, statusListener, @@ -137,14 +136,13 @@ define( }); } - function unchanged(canRepresent, canEdit, idPath, key) { + function unchanged(canRepresent, idPath, key) { return (canRepresent === couldRepresent) && (key === lastKey) && (idPath.length === lastIdPath.length) && idPath.every(function (id, i) { return id === lastIdPath[i]; - }) && - (canEdit === couldEdit); + }); } function getIdPath(domainObject) { @@ -168,11 +166,10 @@ define( representation = lookup($scope.key, domainObject), uses = ((representation || {}).uses || []), canRepresent = !!(representation && domainObject), - canEdit = !!(domainObject && domainObject.hasCapability('editor') && domainObject.getCapability('editor').inEditContext()), idPath = getIdPath(domainObject), key = $scope.key; - if (unchanged(canRepresent, canEdit, idPath, key)) { + if (unchanged(canRepresent, idPath, key)) { return; } @@ -201,7 +198,6 @@ define( // To allow simplified change detection next time around couldRepresent = canRepresent; lastIdPath = idPath; - couldEdit = canEdit; lastKey = key; // Populate scope with fields associated with the current @@ -240,25 +236,6 @@ define( // (to a different object) $scope.$watch("domainObject", refresh); - function listenForStatusChange(object) { - if (statusListener) { - statusListener(); - } - statusListener = object.getCapability("status").listen(refresh); - } - - /** - * Add a listener to the object for status changes. - */ - $scope.$watch("domainObject", function (domainObject, oldDomainObject) { - if (domainObject !== oldDomainObject){ - listenForStatusChange(domainObject); - } - }); - if ($scope.domainObject) { - listenForStatusChange($scope.domainObject); - } - // Finally, also update when there is a new version of that // same domain object; these changes should be tracked in the // model's "modified" field, by the mutation capability. diff --git a/platform/representation/test/MCTRepresentationSpec.js b/platform/representation/test/MCTRepresentationSpec.js index 52d6c70d55..b5e78fec2a 100644 --- a/platform/representation/test/MCTRepresentationSpec.js +++ b/platform/representation/test/MCTRepresentationSpec.js @@ -253,21 +253,6 @@ define( expect(mockScope.testCapability).toBeUndefined(); }); - it("registers a status change listener", function () { - mockScope.$watch.calls[2].args[1](mockDomainObject); - expect(mockStatusCapability.listen).toHaveBeenCalled(); - }); - - it("unlistens for status change on scope destruction", function () { - var mockUnlistener = jasmine.createSpy("unlisten"); - mockStatusCapability.listen.andReturn(mockUnlistener); - mockScope.$watch.calls[2].args[1](mockDomainObject); - expect(mockStatusCapability.listen).toHaveBeenCalled(); - - mockScope.$on.calls[1].args[1](); - expect(mockUnlistener).toHaveBeenCalled(); - }); - describe("when a domain object has been observed", function () { var mockContext, mockContext2, From 54a0de4a08868b637f2937e1e136ebadcde3c40b Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 13 May 2016 13:45:14 -0700 Subject: [PATCH 11/59] [New Edit Mode] #636 Removed edit concerns from DropGesture --- platform/commonUI/edit/bundle.js | 6 +++--- .../{LinkAction.js => EditAndComposeAction.js} | 10 +++++++--- ...ctionSpec.js => EditAndComposeActionSpec.js} | 17 +++++++++++++---- .../representation/src/gestures/DropGesture.js | 13 +------------ 4 files changed, 24 insertions(+), 22 deletions(-) rename platform/commonUI/edit/src/actions/{LinkAction.js => EditAndComposeAction.js} (87%) rename platform/commonUI/edit/test/actions/{LinkActionSpec.js => EditAndComposeActionSpec.js} (87%) diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index fb357c0934..3d00dd80df 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -26,7 +26,7 @@ define([ "./src/controllers/ElementsController", "./src/controllers/EditObjectController", "./src/directives/MCTBeforeUnload", - "./src/actions/LinkAction", + "./src/actions/EditAndComposeAction", "./src/actions/EditAction", "./src/actions/PropertiesAction", "./src/actions/RemoveAction", @@ -55,7 +55,7 @@ define([ ElementsController, EditObjectController, MCTBeforeUnload, - LinkAction, + EditAndComposeAction, EditAction, PropertiesAction, RemoveAction, @@ -126,7 +126,7 @@ define([ "actions": [ { "key": "compose", - "implementation": LinkAction + "implementation": EditAndComposeAction }, { "key": "edit", diff --git a/platform/commonUI/edit/src/actions/LinkAction.js b/platform/commonUI/edit/src/actions/EditAndComposeAction.js similarity index 87% rename from platform/commonUI/edit/src/actions/LinkAction.js rename to platform/commonUI/edit/src/actions/EditAndComposeAction.js index f12539b1fe..974ab2f001 100644 --- a/platform/commonUI/edit/src/actions/LinkAction.js +++ b/platform/commonUI/edit/src/actions/EditAndComposeAction.js @@ -31,12 +31,12 @@ define( * @memberof platform/commonUI/edit * @implements {Action} */ - function LinkAction(context) { + function EditAndComposeAction(context) { this.domainObject = (context || {}).domainObject; this.selectedObject = (context || {}).selectedObject; } - LinkAction.prototype.perform = function () { + EditAndComposeAction.prototype.perform = function () { var self = this; // Persist changes to the domain object @@ -54,9 +54,13 @@ define( .then(doPersist); } + if (this.domainObject.getCapability('type').getKey() !== 'folder') { + this.domainObject.getCapability('action').perform('edit'); + } + return this.selectedObject && doLink(); }; - return LinkAction; + return EditAndComposeAction; } ); diff --git a/platform/commonUI/edit/test/actions/LinkActionSpec.js b/platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js similarity index 87% rename from platform/commonUI/edit/test/actions/LinkActionSpec.js rename to platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js index 144dd4e395..a02c259fd1 100644 --- a/platform/commonUI/edit/test/actions/LinkActionSpec.js +++ b/platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js @@ -21,8 +21,8 @@ *****************************************************************************/ define( - ["../../src/actions/LinkAction"], - function (LinkAction) { + ["../../src/actions/EditAndComposeAction"], + function (EditAndComposeAction) { describe("The Link action", function () { var mockQ, @@ -31,6 +31,7 @@ define( mockContext, mockComposition, mockPersistence, + mockActionCapability, mockType, actionContext, model, @@ -67,18 +68,21 @@ define( mockContext = jasmine.createSpyObj("context", [ "getParent" ]); mockComposition = jasmine.createSpyObj("composition", [ "invoke", "add" ]); mockPersistence = jasmine.createSpyObj("persistence", [ "persist" ]); - mockType = jasmine.createSpyObj("type", [ "hasFeature" ]); + mockType = jasmine.createSpyObj("type", [ "hasFeature", "getKey" ]); + mockActionCapability = jasmine.createSpyObj("actionCapability", [ "perform"]); mockDomainObject.getId.andReturn("test"); mockDomainObject.getCapability.andReturn(mockContext); mockContext.getParent.andReturn(mockParent); mockType.hasFeature.andReturn(true); + mockType.getKey.andReturn("layout"); mockComposition.invoke.andReturn(mockPromise(true)); mockComposition.add.andReturn(mockPromise(true)); capabilities = { composition: mockComposition, persistence: mockPersistence, + action: mockActionCapability, type: mockType }; model = { @@ -90,7 +94,7 @@ define( selectedObject: mockDomainObject }; - action = new LinkAction(actionContext); + action = new EditAndComposeAction(actionContext); }); @@ -105,6 +109,11 @@ define( expect(mockPersistence.persist).toHaveBeenCalled(); }); + it("enables edit mode", function () { + action.perform(); + expect(mockActionCapability.perform).toHaveBeenCalledWith("edit"); + }); + }); } ); diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index f2d64024a3..f76d163ad4 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -54,9 +54,6 @@ define( // ...and broadcast the event. This allows specific // views to have post-drop behavior which depends on // drop position. - // Also broadcast the editableDomainObject to - // avoid race condition against non-editable - // version in EditRepresenter scope.$broadcast( GestureConstants.MCT_DROP_EVENT, id, @@ -93,21 +90,13 @@ define( function drop(e) { var event = (e || {}).originalEvent || e, - id = event.dataTransfer.getData(GestureConstants.MCT_DRAG_TYPE), - domainObjectType = domainObject.getModel().type; + id = event.dataTransfer.getData(GestureConstants.MCT_DRAG_TYPE); // Handle the drop; add the dropped identifier to the // destination domain object's composition, and persist // the change. if (id) { e.preventDefault(); - - //Use scope.apply, drop event is outside digest cycle - scope.$apply(function () { - if (domainObjectType !== 'folder') { - domainObject.getCapability('action').perform('edit'); - } - }); $q.when(action && action.perform()).then(function () { broadcastDrop(id, event); }); From 70a13a75d5fde20d5b459c72e8b066f3c655da76 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 17 May 2016 13:22:15 -0700 Subject: [PATCH 12/59] Updating tutorials --- docs/src/tutorials/index.md | 655 ++++++++++++++++++++++++------------ 1 file changed, 434 insertions(+), 221 deletions(-) diff --git a/docs/src/tutorials/index.md b/docs/src/tutorials/index.md index 2ebc32b957..7a7f74a166 100644 --- a/docs/src/tutorials/index.md +++ b/docs/src/tutorials/index.md @@ -62,74 +62,19 @@ At this point, it will also be useful to branch off of Open MCT v0.6.2 git branch open-v0.6.2 git checkout -### Configuring Persistence -In its default configuration, Open MCT will try to use ElasticSearch -(expected to be deployed at /elastic on the same HTTP server running Open MCT -Web) to persist user-created domain objects. We don't need that for these -tutorials, so we will replace the ElasticSearch plugin with the example -persistence plugin. This doesn't actually persist, so anything we create within -Open MCT will be lost on reload, but that's fine for purposes of these -tutorials. +### Building Open MCT +Once downloaded, Open MCT can be built with the following command: -To change this configuration, edit bundles.json (at the top level of the Open -MCT Web repository) and replace platform/persistence/elastic with -example/persistence. + npm install -#### Bundle Before -```diff -[ - "platform/framework", - "platform/core", - "platform/representation", - "platform/commonUI/about", - "platform/commonUI/browse", - "platform/commonUI/edit", - "platform/commonUI/dialog", - "platform/commonUI/general", - "platform/containment", - "platform/telemetry", - "platform/features/layout", - "platform/features/pages", - "platform/features/plot", - "platform/features/scrolling", - "platform/forms", - "platform/persistence/queue", -- "platform/persistence/elastic", - "platform/policy", +This will install various dependencies, build CSS from Sass files, run tests, +and lint the source code. - "example/generator" -] -``` -__bundles.json__ +It's not necessary to do this after every code change, unless you are making +changes to stylesheets, or you are running the minified version of the app +(under `dist`). -#### Bundle After -```diff -[ - "platform/framework", - "platform/core", - "platform/representation", - "platform/commonUI/about", - "platform/commonUI/browse", - "platform/commonUI/edit", - "platform/commonUI/dialog", - "platform/commonUI/general", - "platform/containment", - "platform/telemetry", - "platform/features/layout", - "platform/features/pages", - "platform/features/plot", - "platform/features/scrolling", - "platform/forms", - "platform/persistence/queue", - "platform/policy", - -+ "example/persistence", - "example/generator" -] -``` -__bundles.json__ - ### Run a Web Server The next step is to run a web server so that you can view the Open MCT @@ -140,7 +85,7 @@ should not be used in a production environment To run the tutorial web server - node app.js + npm start ### Viewing in Browser @@ -176,7 +121,7 @@ they need to do. This is modelled after the to-do lists at http://todomvc.com/. The first step to adding a new feature to Open MCT is to create the plugin which will expose that feature. A plugin in Open MCT is represented by what is called a bundle; a bundle, in turn, is a directory which contains a file -bundle.json, which in turn describes where other relevant sources & resources +bundle.js, which in turn describes where other relevant sources & resources will be. The syntax of this file is described in more detail in the Open MCT Developer Guide. @@ -185,74 +130,203 @@ to this plugin as tutorials/todo as well.) We will start with an "empty bundle", one which exposes no extensions - which looks like: ```diff -{ - "name": "To-do Plugin", - "description": "Allows creating and editing to-do lists.", - "extensions": { - } -} +define([ + 'legacyRegistry' +], function ( + legacyRegistry +) { + legacyRegistry.register("tutorials/todo", { + "name": "To-do Plugin", + "description": "Allows creating and editing to-do lists.", + "extensions": + { + } + }); +}); + ``` -__tutorials/todo/bundle.json__ +__tutorials/todo/bundle.js__ -We will also include this in our list of active bundles. +With the new bundle defined, it is now necessary to register the bundle with +the application. The details of how a new bundle is defined are in the +process of changing. The Open MCT codebase has started to shift from a +declarative registration style toward an imperative registration style. +The tutorials will be updated with the new bundle registration mechanism once it +has been finalized. #### Before ```diff -[ - "platform/framework", - "platform/core", - "platform/representation", - "platform/commonUI/about", - "platform/commonUI/browse", - "platform/commonUI/edit", - "platform/commonUI/dialog", - "platform/commonUI/general", - "platform/containment", - "platform/telemetry", - "platform/features/layout", - "platform/features/pages", - "platform/features/plot", - "platform/features/scrolling", - "platform/forms", - "platform/persistence/queue", - "platform/policy", +requirejs.config({ + "paths": { + "legacyRegistry": "src/legacyRegistry", + "angular": "bower_components/angular/angular.min", + "angular-route": "bower_components/angular-route/angular-route.min", + "csv": "bower_components/comma-separated-values/csv.min", + "es6-promise": "bower_components/es6-promise/promise.min", + "moment": "bower_components/moment/moment", + "moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format", + "saveAs": "bower_components/FileSaver.js/FileSaver.min", + "screenfull": "bower_components/screenfull/dist/screenfull.min", + "text": "bower_components/text/text", + "uuid": "bower_components/node-uuid/uuid", + "zepto": "bower_components/zepto/zepto.min" + }, + "shim": { + "angular": { + "exports": "angular" + }, + "angular-route": { + "deps": [ "angular" ] + }, + "moment-duration-format": { + "deps": [ "moment" ] + }, + "screenfull": { + "exports": "screenfull" + }, + "zepto": { + "exports": "Zepto" + } + } +}); - "example/persistence", - "example/generator" -] +define([ + './platform/framework/src/Main', + 'legacyRegistry', + + './platform/framework/bundle', + './platform/core/bundle', + './platform/representation/bundle', + './platform/commonUI/about/bundle', + './platform/commonUI/browse/bundle', + './platform/commonUI/edit/bundle', + './platform/commonUI/dialog/bundle', + './platform/commonUI/formats/bundle', + './platform/commonUI/general/bundle', + './platform/commonUI/inspect/bundle', + './platform/commonUI/mobile/bundle', + './platform/commonUI/themes/espresso/bundle', + './platform/commonUI/notification/bundle', + './platform/containment/bundle', + './platform/execution/bundle', + './platform/exporters/bundle', + './platform/telemetry/bundle', + './platform/features/clock/bundle', + './platform/features/imagery/bundle', + './platform/features/layout/bundle', + './platform/features/pages/bundle', + './platform/features/plot/bundle', + './platform/features/timeline/bundle', + './platform/features/table/bundle', + './platform/forms/bundle', + './platform/identity/bundle', + './platform/persistence/aggregator/bundle', + './platform/persistence/local/bundle', + './platform/persistence/queue/bundle', + './platform/policy/bundle', + './platform/entanglement/bundle', + './platform/search/bundle', + './platform/status/bundle', + './platform/commonUI/regions/bundle' +], function (Main, legacyRegistry) { + return { + legacyRegistry: legacyRegistry, + run: function () { + return new Main().run(legacyRegistry); + } + }; +}); ``` -__bundles.json__ +__main.js__ #### After ```diff -[ - "platform/framework", - "platform/core", - "platform/representation", - "platform/commonUI/about", - "platform/commonUI/browse", - "platform/commonUI/edit", - "platform/commonUI/dialog", - "platform/commonUI/general", - "platform/containment", - "platform/telemetry", - "platform/features/layout", - "platform/features/pages", - "platform/features/plot", - "platform/features/scrolling", - "platform/forms", - "platform/persistence/queue", - "platform/policy", +requirejs.config({ + "paths": { + "legacyRegistry": "src/legacyRegistry", + "angular": "bower_components/angular/angular.min", + "angular-route": "bower_components/angular-route/angular-route.min", + "csv": "bower_components/comma-separated-values/csv.min", + "es6-promise": "bower_components/es6-promise/promise.min", + "moment": "bower_components/moment/moment", + "moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format", + "saveAs": "bower_components/FileSaver.js/FileSaver.min", + "screenfull": "bower_components/screenfull/dist/screenfull.min", + "text": "bower_components/text/text", + "uuid": "bower_components/node-uuid/uuid", + "zepto": "bower_components/zepto/zepto.min" + }, + "shim": { + "angular": { + "exports": "angular" + }, + "angular-route": { + "deps": [ "angular" ] + }, + "moment-duration-format": { + "deps": [ "moment" ] + }, + "screenfull": { + "exports": "screenfull" + }, + "zepto": { + "exports": "Zepto" + } + } +}); - "example/persistence", - "example/generator", +define([ + './platform/framework/src/Main', + 'legacyRegistry', -+ "tutorials/todo" -] + './platform/framework/bundle', + './platform/core/bundle', + './platform/representation/bundle', + './platform/commonUI/about/bundle', + './platform/commonUI/browse/bundle', + './platform/commonUI/edit/bundle', + './platform/commonUI/dialog/bundle', + './platform/commonUI/formats/bundle', + './platform/commonUI/general/bundle', + './platform/commonUI/inspect/bundle', + './platform/commonUI/mobile/bundle', + './platform/commonUI/themes/espresso/bundle', + './platform/commonUI/notification/bundle', + './platform/containment/bundle', + './platform/execution/bundle', + './platform/exporters/bundle', + './platform/telemetry/bundle', + './platform/features/clock/bundle', + './platform/features/imagery/bundle', + './platform/features/layout/bundle', + './platform/features/pages/bundle', + './platform/features/plot/bundle', + './platform/features/timeline/bundle', + './platform/features/table/bundle', + './platform/forms/bundle', + './platform/identity/bundle', + './platform/persistence/aggregator/bundle', + './platform/persistence/local/bundle', + './platform/persistence/queue/bundle', + './platform/policy/bundle', + './platform/entanglement/bundle', + './platform/search/bundle', + './platform/status/bundle', + './platform/commonUI/regions/bundle', + ++ './tutorials/todo/bundle' +], function (Main, legacyRegistry) { + return { + legacyRegistry: legacyRegistry, + run: function () { + return new Main().run(legacyRegistry); + } + }; +}); ``` -__bundles.json__ +__main.js__ At this point, we can reload Open MCT. We haven't introduced any new functionality, so we don't see anything different, but if we run with logging @@ -275,11 +349,17 @@ In the case of our to-do list feature, the to-do list itself is the thing we'll want users to be able to create and edit. So, we will add that as a new type in our bundle definition: ```diff -{ - "name": "To-do Plugin", - "description": "Allows creating and editing to-do lists.", - "extensions": { -+ "types": [ +define([ + 'legacyRegistry' +], function ( + legacyRegistry +) { + legacyRegistry.register("tutorials/todo", { + "name": "To-do Plugin", + "description": "Allows creating and editing to-do lists.", + "extensions": + { ++ "types": [ + { + "key": "example.todo", + "name": "To-Do List", @@ -287,11 +367,12 @@ our bundle definition: + "description": "A list of things that need to be done.", + "features": ["creation"] + } - ] - } -} + } + }); +}); + ``` -__tutorials/todo/bundle.json__ +__tutorials/todo/bundle.js__ What have we done here? We've stated that this bundle includes extensions of the category _types_, which is used to describe domain object types. Then, we've @@ -366,7 +447,12 @@ To expose this view in Open MCT, we need to declare it in our bundle definition: ```diff -{ +define([ + 'legacyRegistry' +], function ( + legacyRegistry +) { + legacyRegistry.register("tutorials/todo", { "name": "To-do Plugin", "description": "Allows creating and editing to-do lists.", "extensions": { @@ -389,9 +475,10 @@ definition: + } + ] } -} + }); +}); ``` -__tutorials/todo/bundle.json__ +__tutorials/todo/bundle.js__ Here, we've added another extension, this time belonging to category `views`. It contains the following properties: @@ -416,7 +503,12 @@ will specify an initial state for To-do List domain object models in the definition of that type. ```diff -{ +define([ + 'legacyRegistry' +], function ( + legacyRegistry +) { + legacyRegistry.register("tutorials/todo", { "name": "To-do Plugin", "description": "Allows creating and editing to-do lists.", "extensions": { @@ -445,9 +537,10 @@ definition of that type. } ] } -} + }); +}); ``` -__tutorials/todo/bundle.json__ +__tutorials/todo/bundle.js__ Now, when To-do List objects are created in Open MCT, they will initially have the state described by that model property. @@ -580,7 +673,14 @@ If we were to try to run at this point, we'd run into problems because the it in our bundle definition, as an extension of category `controllers`: ```diff -{ +define([ + 'legacyRegistry', + './controllers/TodoController' +], function ( + legacyRegistry, + TodoController +) { + legacyRegistry.register("tutorials/todo", { "name": "To-do Plugin", "description": "Allows creating and editing to-do lists.", "extensions": { @@ -611,14 +711,15 @@ it in our bundle definition, as an extension of category `controllers`: + "controllers": [ + { + "key": "TodoController", -+ "implementation": "controllers/TodoController.js", ++ "implementation": TodoController, + "depends": [ "$scope" ] + } + ] } -} + }); +}); ``` -__tutorials/todo/bundle.json__ +__tutorials/todo/bundle.js__ In this extension definition we have: @@ -665,7 +766,14 @@ view. The contents of this tool bar are defined declaratively in a view's extension definition. ```diff -{ +define([ + 'legacyRegistry', + './controllers/TodoController' +], function ( + legacyRegistry, + TodoController +) { + legacyRegistry.register("tutorials/todo", { "name": "To-do Plugin", "description": "Allows creating and editing to-do lists.", "extensions": { @@ -719,14 +827,15 @@ extension definition. "controllers": [ { "key": "TodoController", - "implementation": "controllers/TodoController.js", + "implementation": TodoController, "depends": [ "$scope" ] } ] } -} + }); +}); ``` -__tutorials/todo/bundle.json__ +__tutorials/todo/bundle.js__ What we've stated here is that the To-Do List's view will have a toolbar which contains two sections (which will be visually separated by a divider), each of @@ -884,7 +993,14 @@ __tutorials/todo/res/templates/todo.html__ Finally, the `TodoController` uses the `dialogService` now, so we need to declare that dependency in its extension definition: ```diff -{ +define([ + 'legacyRegistry', + './controllers/TodoController' +], function ( + legacyRegistry, + TodoController +) { + legacyRegistry.register("tutorials/todo", { "name": "To-do Plugin", "description": "Allows creating and editing to-do lists.", "extensions": { @@ -938,14 +1054,15 @@ declare that dependency in its extension definition: "controllers": [ { "key": "TodoController", - "implementation": "controllers/TodoController.js", + "implementation": TodoController, + "depends": [ "$scope", "dialogService" ] } ] } -} + }); +}); ``` -__tutorials/todo/bundle.json__ +__tutorials/todo/bundle.js__ If we now reload Open MCT, we'll be able to see the new functionality we've added. If we Create a new To-Do List, navigate to it, and click the button with @@ -1140,7 +1257,14 @@ To include this CSS file in our running instance of Open MCT, we need to declare it in our bundle definition, this time as an extension of category `stylesheets`: ```diff -{ +define([ + 'legacyRegistry', + './controllers/TodoController' +], function ( + legacyRegistry, + TodoController +) { + legacyRegistry.register("tutorials/todo", { "name": "To-do Plugin", "description": "Allows creating and editing to-do lists.", "extensions": { @@ -1191,7 +1315,7 @@ declare it in our bundle definition, this time as an extension of category "controllers": [ { "key": "TodoController", - "implementation": "controllers/TodoController.js", + "implementation": TodoController, "depends": [ "$scope", "dialogService" ] } ], @@ -1201,9 +1325,10 @@ declare it in our bundle definition, this time as an extension of category + } + ] } -} + }); +}); ``` -__tutorials/todo/bundle.json__ +__tutorials/todo/bundle.js__ Note that we've also removed our placeholder tasks from the `model` of the To-Do List's type above; now To-Do Lists will start off empty. @@ -1270,7 +1395,12 @@ well. We'll be creating this plugin in `tutorials/bargraph`, so our initial bundle definition looks like: ```diff -{ +define([ + 'legacyRegistry' +], function ( + legacyRegistry +) { + legacyRegistry.register("tutorials/bargraph", { "name": "Bar Graph", "description": "Provides the Bar Graph view of telemetry elements.", "extensions": { @@ -1290,10 +1420,11 @@ bundle definition looks like: } ] } -} + }); +}); ``` -__tutorials/bargraph/bundle.json__ +__tutorials/bargraph/bundle.js__ The view definition should look familiar after the To-Do List tutorial, with some additions: @@ -1435,7 +1566,7 @@ The corresponding CSS file which styles and positions these elements: ``` __tutorials/bargraph/res/css/bargraph.css__ -This is already enough that, if we add `"tutorials/bargraph"` to `bundles.json`, +This is already enough that, if we add `"tutorials/bargraph"` to `main.js`, we should be able to run Open MCT and see our Bar Graph as an available view for domain objects which provide telemetry (such as the example _Sine Wave Generator_) as well as for _Telemetry Panel_ objects: @@ -1563,7 +1694,14 @@ depends declaration includes both `$scope` as well as the `telemetryHandler` service we made use of. ```diff -{ +define([ + 'legacyRegistry', + './controllers/BarGraphController' +], function ( + legacyRegistry, + BarGraphController +) { + legacyRegistry.register("tutorials/bargraph", { "name": "Bar Graph", "description": "Provides the Bar Graph view of telemetry elements.", "extensions": { @@ -1585,14 +1723,15 @@ service we made use of. + "controllers": [ + { + "key": "BarGraphController", -+ "implementation": "controllers/BarGraphController.js", ++ "implementation": BarGraphController, + "depends": [ "$scope", "telemetryHandler" ] + } + ] } -} + }); +}); ``` -__tutorials/bargraph/bundle.json__ +__tutorials/bargraph/bundle.js__ When we reload Open MCT, we are now able to see that our bar graph view correctly labels one bar per telemetry-providing domain object, as shown for @@ -1721,7 +1860,14 @@ when we return to our view later, those changes will be persisted. First, let's add a tool bar for changing these three values in Edit mode: ```diff -{ +define([ + 'legacyRegistry', + './controllers/BarGraphController' +], function ( + legacyRegistry, + BarGraphController +) { + legacyRegistry.register("tutorials/bargraph", { "name": "Bar Graph", "description": "Provides the Bar Graph view of telemetry elements.", "extensions": { @@ -1772,14 +1918,15 @@ First, let's add a tool bar for changing these three values in Edit mode: "controllers": [ { "key": "BarGraphController", - "implementation": "controllers/BarGraphController.js", + "implementation": BarGraphController, "depends": [ "$scope", "telemetryHandler" ] } ] } -} + }); +}); ``` -__tutorials/bargraph/bundle.json__ +__tutorials/bargraph/bundle.js__ As we saw in to To-Do List plugin, a tool bar needs either a selected object or a view proxy to work from. We will add this to our controller, and additionally @@ -2192,7 +2339,12 @@ add a top-level object which will serve as a container; in the next step, we will populate this with the contents of the telemetry dictionary (which we will retrieve from the server.) - { +define([ + 'legacyRegistry' +], function ( + legacyRegistry +) { + legacyRegistry.register("tutorials/telemetry", { "name": "Example Telemetry Adapter", "extensions": { "types": [ @@ -2214,8 +2366,9 @@ will retrieve from the server.) } ] } - } -__tutorials/telemetry/bundle.json__ + }); +}); +__tutorials/telemetry/bundle.js__ Here, we've created our initial telemetry plugin. This exposes a new domain object type (the "Spacecraft", which will be represented by the contents of the @@ -2226,55 +2379,91 @@ preferred so that this shows up near the top, instead of below My Items. If we include this in our set of active bundles: ```diff -[ - "platform/framework", - "platform/core", - "platform/representation", - "platform/commonUI/about", - "platform/commonUI/browse", - "platform/commonUI/edit", - "platform/commonUI/dialog", - "platform/commonUI/general", - "platform/containment", - "platform/telemetry", - "platform/features/layout", - "platform/features/pages", - "platform/features/plot", - "platform/features/scrolling", - "platform/forms", - "platform/persistence/queue", - "platform/policy", +requirejs.config({ + "paths": { + "legacyRegistry": "src/legacyRegistry", + "angular": "bower_components/angular/angular.min", + "angular-route": "bower_components/angular-route/angular-route.min", + "csv": "bower_components/comma-separated-values/csv.min", + "es6-promise": "bower_components/es6-promise/promise.min", + "moment": "bower_components/moment/moment", + "moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format", + "saveAs": "bower_components/FileSaver.js/FileSaver.min", + "screenfull": "bower_components/screenfull/dist/screenfull.min", + "text": "bower_components/text/text", + "uuid": "bower_components/node-uuid/uuid", + "zepto": "bower_components/zepto/zepto.min" + }, + "shim": { + "angular": { + "exports": "angular" + }, + "angular-route": { + "deps": [ "angular" ] + }, + "moment-duration-format": { + "deps": [ "moment" ] + }, + "screenfull": { + "exports": "screenfull" + }, + "zepto": { + "exports": "Zepto" + } + } +}); - "example/persistence", - "example/generator" -] -[ - "platform/framework", - "platform/core", - "platform/representation", - "platform/commonUI/about", - "platform/commonUI/browse", - "platform/commonUI/edit", - "platform/commonUI/dialog", - "platform/commonUI/general", - "platform/containment", - "platform/telemetry", - "platform/features/layout", - "platform/features/pages", - "platform/features/plot", - "platform/features/scrolling", - "platform/forms", - "platform/persistence/queue", - "platform/policy", +define([ + './platform/framework/src/Main', + 'legacyRegistry', - "example/persistence", - "example/generator", - -+ "tutorials/telemetry" -] + './platform/framework/bundle', + './platform/core/bundle', + './platform/representation/bundle', + './platform/commonUI/about/bundle', + './platform/commonUI/browse/bundle', + './platform/commonUI/edit/bundle', + './platform/commonUI/dialog/bundle', + './platform/commonUI/formats/bundle', + './platform/commonUI/general/bundle', + './platform/commonUI/inspect/bundle', + './platform/commonUI/mobile/bundle', + './platform/commonUI/themes/espresso/bundle', + './platform/commonUI/notification/bundle', + './platform/containment/bundle', + './platform/execution/bundle', + './platform/exporters/bundle', + './platform/telemetry/bundle', + './platform/features/clock/bundle', + './platform/features/imagery/bundle', + './platform/features/layout/bundle', + './platform/features/pages/bundle', + './platform/features/plot/bundle', + './platform/features/timeline/bundle', + './platform/features/table/bundle', + './platform/forms/bundle', + './platform/identity/bundle', + './platform/persistence/aggregator/bundle', + './platform/persistence/local/bundle', + './platform/persistence/queue/bundle', + './platform/policy/bundle', + './platform/entanglement/bundle', + './platform/search/bundle', + './platform/status/bundle', + './platform/commonUI/regions/bundle', + ++ './tutorials/telemetry/bundle' +], function (Main, legacyRegistry) { + return { + legacyRegistry: legacyRegistry, + run: function () { + return new Main().run(legacyRegistry); + } + }; +}); ``` -__bundles.json__ +__main.js__ ...we will be able to reload Open MCT and see that it is present: @@ -2534,12 +2723,23 @@ name to match what was in the dictionary, and set its `composition` to an array of domain object identifiers for all subsystems contained in the dictionary (using the same identifier prefix as before.) -Finally, we wire in these changes by modifying our plugin's `bundle.json` to +Finally, we wire in these changes by modifying our plugin's `bundle.js` to provide metadata about how these pieces interact (both with each other, and with the platform): ```diff -{ +define([ + 'legacyRegistry', + './ExampleTelemetryServerAdapter', + './ExampleTelemetryInitializer', + './ExampleTelemetryModelProvider' +], function ( + legacyRegistry, + ExampleTelemetryServerAdapter, + ExampleTelemetryInitializer, + ExampleTelemetryModelProvider +) { + legacyRegistry.register("tutorials/telemetry", { "name": "Example Telemetry Adapter", "extensions": { "types": [ @@ -2584,7 +2784,7 @@ with the platform): + "services": [ + { + "key": "example.adapter", -+ "implementation": "ExampleTelemetryServerAdapter.js", ++ "implementation": ExampleTelemetryServerAdapter, + "depends": [ "$q", "EXAMPLE_WS_URL" ] + } + ], @@ -2597,7 +2797,7 @@ with the platform): + ], + "runs": [ + { -+ "implementation": "ExampleTelemetryInitializer.js", ++ "implementation": ExampleTelemetryInitializer, + "depends": [ "example.adapter", "objectService" ] + } + ], @@ -2605,14 +2805,15 @@ with the platform): + { + "provides": "modelService", + "type": "provider", -+ "implementation": "ExampleTelemetryModelProvider.js", ++ "implementation": ExampleTelemetryModelProvider, + "depends": [ "example.adapter", "$q" ] + } + ] - } -} + } + }); +}); ``` -__tutorials/telemetry/bundle.json__ +__tutorials/telemetry/bundle.js__ A summary of what we've added here: @@ -2843,7 +3044,18 @@ it with the interface expected by the platform (the methods shown.) Finally, we expose this `telemetryService` provider declaratively: ```diff -{ +define([ + 'legacyRegistry', + './ExampleTelemetryServerAdapter', + './ExampleTelemetryInitializer', + './ExampleTelemetryModelProvider' +], function ( + legacyRegistry, + ExampleTelemetryServerAdapter, + ExampleTelemetryInitializer, + ExampleTelemetryModelProvider +) { + legacyRegistry.register("tutorials/telemetry", { "name": "Example Telemetry Adapter", "extensions": { "types": [ @@ -2919,10 +3131,11 @@ Finally, we expose this `telemetryService` provider declaratively: + "depends": [ "example.adapter", "$q" ] + } ] - } -} + } + }); +}); ``` -__tutorials/telemetry/bundle.json__ +__tutorials/telemetry/bundle.js__ Now, if we navigate to one of our numeric measurements, we should see a plot of its historical telemetry: From 5eff4e45c9c585b881ae33f43ad0f8890ac3724f Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 17 May 2016 17:24:32 -0700 Subject: [PATCH 13/59] [Tutorials] #907 Updated tutorials to use new bundle registration mechanism --- docs/src/tutorials/index.md | 73 ++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/docs/src/tutorials/index.md b/docs/src/tutorials/index.md index 7a7f74a166..84c571bec8 100644 --- a/docs/src/tutorials/index.md +++ b/docs/src/tutorials/index.md @@ -363,11 +363,11 @@ define([ + { + "key": "example.todo", + "name": "To-Do List", -+ "glyph": "j", ++ "glyph": "2", + "description": "A list of things that need to be done.", + "features": ["creation"] + } - } ++ ]} }); }); @@ -460,7 +460,7 @@ define([ { "key": "example.todo", "name": "To-Do List", - "glyph": "j", + "glyph": "2", "description": "A list of things that need to be done.", "features": ["creation"] } @@ -469,9 +469,10 @@ define([ + { + "key": "example.todo", + "type": "example.todo", -+ "glyph": "j", ++ "glyph": "2", + "name": "List", -+ "templateUrl": "templates/todo.html" ++ "templateUrl": "templates/todo.html", ++ "editable": true + } + ] } @@ -516,7 +517,7 @@ define([ { "key": "example.todo", "name": "To-Do List", - "glyph": "j", + "glyph": "2", "description": "A list of things that need to be done.", "features": ["creation"], + "model": { @@ -531,9 +532,10 @@ define([ { "key": "example.todo", "type": "example.todo", - "glyph": "j", + "glyph": "2", "name": "List", - "templateUrl": "templates/todo.html" + "templateUrl": "templates/todo.html", + "editable": true } ] } @@ -675,7 +677,7 @@ it in our bundle definition, as an extension of category `controllers`: ```diff define([ 'legacyRegistry', - './controllers/TodoController' + './src/controllers/TodoController' ], function ( legacyRegistry, TodoController @@ -688,7 +690,7 @@ define([ { "key": "example.todo", "name": "To-Do List", - "glyph": "j", + "glyph": "2", "description": "A list of things that need to be done.", "features": ["creation"], "model": { @@ -703,9 +705,10 @@ define([ { "key": "example.todo", "type": "example.todo", - "glyph": "j", + "glyph": "2", "name": "List", - "templateUrl": "templates/todo.html" + "templateUrl": "templates/todo.html", + "editable": true } ], + "controllers": [ @@ -768,7 +771,7 @@ extension definition. ```diff define([ 'legacyRegistry', - './controllers/TodoController' + './src/controllers/TodoController' ], function ( legacyRegistry, TodoController @@ -781,7 +784,7 @@ define([ { "key": "example.todo", "name": "To-Do List", - "glyph": "j", + "glyph": "2", "description": "A list of things that need to be done.", "features": ["creation"], "model": { @@ -796,9 +799,10 @@ define([ { "key": "example.todo", "type": "example.todo", - "glyph": "j", + "glyph": "2", "name": "List", "templateUrl": "templates/todo.html", + "editable": true, + "toolbar": { + "sections": [ + { @@ -995,7 +999,7 @@ declare that dependency in its extension definition: ```diff define([ 'legacyRegistry', - './controllers/TodoController' + './src/controllers/TodoController' ], function ( legacyRegistry, TodoController @@ -1008,7 +1012,7 @@ define([ { "key": "example.todo", "name": "To-Do List", - "glyph": "j", + "glyph": "2", "description": "A list of things that need to be done.", "features": ["creation"], "model": { @@ -1023,9 +1027,10 @@ define([ { "key": "example.todo", "type": "example.todo", - "glyph": "j", + "glyph": "2", "name": "List", "templateUrl": "templates/todo.html", + "editable": true, "toolbar": { "sections": [ { @@ -1259,7 +1264,7 @@ declare it in our bundle definition, this time as an extension of category ```diff define([ 'legacyRegistry', - './controllers/TodoController' + './src/controllers/TodoController' ], function ( legacyRegistry, TodoController @@ -1272,7 +1277,7 @@ define([ { "key": "example.todo", "name": "To-Do List", - "glyph": "j", + "glyph": "2", "description": "A list of things that need to be done.", "features": ["creation"], "model": { @@ -1284,9 +1289,10 @@ define([ { "key": "example.todo", "type": "example.todo", - "glyph": "j", + "glyph": "2", "name": "List", "templateUrl": "templates/todo.html", + "editable": true, "toolbar": { "sections": [ { @@ -1334,6 +1340,7 @@ Note that we've also removed our placeholder tasks from the `model` of the To-Do List's type above; now To-Do Lists will start off empty. Finally, let's utilize these changes from our view's template: + ```diff +
+
@@ -1641,7 +1648,7 @@ telemetry objects in view, as well as the width for each bar. We will also utilize this from our template: ```diff -
++
+
+
Date: Wed, 18 May 2016 16:59:23 -0700 Subject: [PATCH 14/59] [Website] Automate site build process --- build-docs.sh | 27 +++++++++++++-------------- circle.yml | 6 ++++++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/build-docs.sh b/build-docs.sh index c318a0dbda..5b94f65d13 100755 --- a/build-docs.sh +++ b/build-docs.sh @@ -25,14 +25,15 @@ # Script to build and deploy docs to github pages. OUTPUT_DIRECTORY="target/docs" -REPOSITORY_URL="git@github.com:nasa/openmctweb.git" +REPOSITORY_URL="git@github.com:nasa/openmct-website.git" +WEBSITE_DIRECTORY="website" BUILD_SHA=`git rev-parse head` # A remote will be created for the git repository we are pushing to. # Don't worry, as this entire directory will get trashed inbetween builds. REMOTE_NAME="documentation" -WEBSITE_BRANCH="gh-pages" +WEBSITE_BRANCH="master" # Clean output directory, JSDOC will recreate if [ -d $OUTPUT_DIRECTORY ]; then @@ -40,23 +41,21 @@ if [ -d $OUTPUT_DIRECTORY ]; then fi npm run docs -cd $OUTPUT_DIRECTORY || exit 1 -echo "git init" -git init +echo "git clone $REPOSITORY_URL website" +git clone $REPOSITORY_URL website +echo "cp -r $OUTPUT_DIRECTORY $WEBSITE_DIRECTORY/docs" +cp -r $OUTPUT_DIRECTORY $WEBSITE_DIRECTORY/docs +echo "cd $WEBSITE_DIRECTORY" +cd $WEBSITE_DIRECTORY # Configure github for CircleCI user. git config user.email "buildbot@circleci.com" git config user.name "BuildBot" -echo "git remote add $REMOTE_NAME $REPOSITORY_URL" -git remote add $REMOTE_NAME $REPOSITORY_URL echo "git add ." git add . -echo "git commit -m \"Generate docs from build $BUILD_SHA\"" -git commit -m "Generate docs from build $BUILD_SHA" - -echo "git push $REMOTE_NAME HEAD:$WEBSITE_BRANCH -f" -git push $REMOTE_NAME HEAD:$WEBSITE_BRANCH -f - -echo "Documentation pushed to gh-pages branch." +echo "git commit -m \"Docs updated from build build $BUILD_SHA\"" +git commit -m "Docs updated from build build $BUILD_SHA" +echo "git push" +git push diff --git a/circle.yml b/circle.yml index 472fdf7c17..aba013d239 100644 --- a/circle.yml +++ b/circle.yml @@ -3,6 +3,12 @@ deployment: branch: master heroku: appname: openmctweb-demo + website: + branch: openmct-website + commands: + - git clone + - git push git@heroku.com:openmctweb-demo.git $CIRCLE_SHA1:refs/heads/master + openmct-demo: branch: live_demo heroku: From b2c6db6207069488958e57f69eb9ab567d917316 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 18 May 2016 17:00:16 -0700 Subject: [PATCH 15/59] Changed circleci.yml --- build-docs.sh | 6 ++---- circle.yml | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/build-docs.sh b/build-docs.sh index 5b94f65d13..abdb7bbdbd 100755 --- a/build-docs.sh +++ b/build-docs.sh @@ -43,11 +43,11 @@ fi npm run docs echo "git clone $REPOSITORY_URL website" -git clone $REPOSITORY_URL website +git clone $REPOSITORY_URL website || exit 1 echo "cp -r $OUTPUT_DIRECTORY $WEBSITE_DIRECTORY/docs" cp -r $OUTPUT_DIRECTORY $WEBSITE_DIRECTORY/docs echo "cd $WEBSITE_DIRECTORY" -cd $WEBSITE_DIRECTORY +cd $WEBSITE_DIRECTORY || exit 1 # Configure github for CircleCI user. git config user.email "buildbot@circleci.com" @@ -57,5 +57,3 @@ echo "git add ." git add . echo "git commit -m \"Docs updated from build build $BUILD_SHA\"" git commit -m "Docs updated from build build $BUILD_SHA" -echo "git push" -git push diff --git a/circle.yml b/circle.yml index aba013d239..5ed3bf7147 100644 --- a/circle.yml +++ b/circle.yml @@ -6,9 +6,8 @@ deployment: website: branch: openmct-website commands: - - git clone - - git push git@heroku.com:openmctweb-demo.git $CIRCLE_SHA1:refs/heads/master - + - npm install canvas nomnoml + - ./build-docs.sh openmct-demo: branch: live_demo heroku: From edb158f2d345b3621e768dd30320388611bd6f67 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 19 May 2016 10:30:28 -0700 Subject: [PATCH 16/59] [Website] Added push to website repo --- build-docs.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build-docs.sh b/build-docs.sh index abdb7bbdbd..9fdfdc91d3 100755 --- a/build-docs.sh +++ b/build-docs.sh @@ -57,3 +57,4 @@ echo "git add ." git add . echo "git commit -m \"Docs updated from build build $BUILD_SHA\"" git commit -m "Docs updated from build build $BUILD_SHA" +git push From fa77139077256b4d55669b1e3d2ae779d60b6a71 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 19 May 2016 11:29:13 -0700 Subject: [PATCH 17/59] [Code Style] Run gulp fixstyle ...to apply code style settings from #142. --- main.js | 4 +- .../about/test/AboutControllerSpec.js | 2 +- .../about/test/LicenseControllerSpec.js | 2 +- .../commonUI/about/test/LogoControllerSpec.js | 2 +- .../commonUI/browse/src/BrowseController.js | 18 ++-- .../browse/src/BrowseObjectController.js | 4 +- .../commonUI/browse/src/InspectorRegion.js | 2 +- .../browse/src/MenuArrowController.js | 8 +- .../commonUI/browse/src/creation/AddAction.js | 8 +- .../browse/src/creation/CreateAction.js | 4 +- .../browse/src/creation/CreateWizard.js | 4 +- .../browse/src/creation/CreationPolicy.js | 2 +- .../browse/src/creation/LocatorController.js | 4 +- .../browse/test/BrowseControllerSpec.js | 14 +-- .../browse/test/BrowseObjectControllerSpec.js | 6 +- .../browse/test/InspectorRegionSpec.js | 2 +- .../browse/test/MenuArrowControllerSpec.js | 24 +++--- .../browse/test/PaneControllerSpec.js | 6 +- .../test/creation/AddActionProviderSpec.js | 18 ++-- .../test/creation/CreateActionProviderSpec.js | 18 ++-- .../browse/test/creation/CreateActionSpec.js | 6 +- .../test/creation/CreateMenuControllerSpec.js | 2 +- .../browse/test/creation/CreateWizardSpec.js | 10 +-- .../test/creation/CreationPolicySpec.js | 2 +- .../test/creation/CreationServiceSpec.js | 12 +-- .../test/creation/LocatorControllerSpec.js | 32 +++---- .../test/navigation/NavigateActionSpec.js | 6 +- .../test/windowing/FullscreenActionSpec.js | 2 +- .../browse/test/windowing/NewTabActionSpec.js | 22 ++--- .../browse/test/windowing/WindowTitlerSpec.js | 6 +- platform/commonUI/dialog/src/DialogService.js | 6 +- .../commonUI/dialog/test/DialogServiceSpec.js | 12 +-- .../dialog/test/OverlayServiceSpec.js | 12 +-- platform/commonUI/edit/bundle.js | 4 +- .../commonUI/edit/src/actions/CancelAction.js | 2 +- .../commonUI/edit/src/actions/EditAction.js | 2 +- .../commonUI/edit/src/actions/SaveAction.js | 2 +- .../commonUI/edit/src/actions/SaveAsAction.js | 12 +-- .../edit/src/capabilities/EditorCapability.js | 8 +- .../TransactionalPersistenceCapability.js | 4 +- .../src/controllers/EditObjectController.js | 6 +- .../src/controllers/ElementsController.js | 2 +- .../edit/src/policies/EditActionPolicy.js | 2 +- .../policies/EditContextualActionPolicy.js | 2 +- .../edit/src/policies/EditNavigationPolicy.js | 2 +- .../edit/src/representers/EditRepresenter.js | 8 +- .../edit/src/representers/EditToolbar.js | 8 +- .../edit/src/services/TransactionService.js | 6 +- .../edit/test/actions/CancelActionSpec.js | 8 +- .../edit/test/actions/EditActionSpec.js | 14 +-- .../edit/test/actions/LinkActionSpec.js | 12 +-- .../edit/test/actions/PropertiesActionSpec.js | 24 ++++-- .../edit/test/actions/PropertiesDialogSpec.js | 16 +++- .../edit/test/actions/RemoveActionSpec.js | 58 ++++++------- .../edit/test/actions/SaveActionSpec.js | 8 +- .../edit/test/actions/SaveAsActionSpec.js | 8 +- .../test/capabilities/EditorCapabilitySpec.js | 16 ++-- .../TransactionCapabilityDecoratorSpec.js | 8 +- .../TransactionalPersistenceCapabilitySpec.js | 12 +-- .../controllers/EditActionControllerSpec.js | 2 +- .../test/controllers/EditControllerSpec.js | 10 +-- .../controllers/EditPanesControllerSpec.js | 6 +- .../controllers/ElementsControllerSpec.js | 4 +- .../test/directives/MCTBeforeUnloadSpec.js | 2 +- .../test/policies/EditActionPolicySpec.js | 22 ++--- .../EditContextualActionPolicySpec.js | 12 +-- .../test/policies/EditableViewPolicySpec.js | 4 +- .../test/representers/EditRepresenterSpec.js | 2 +- .../EditToolbarRepresenterSpec.js | 10 +-- .../edit/test/representers/EditToolbarSpec.js | 46 +++++----- .../test/services/TransactionServiceSpec.js | 16 ++-- .../formats/test/FormatProviderSpec.js | 8 +- platform/commonUI/general/bundle.js | 2 +- .../src/controllers/BannerController.js | 14 +-- .../src/controllers/ClickAwayController.js | 2 +- .../controllers/DateTimePickerController.js | 2 +- .../controllers/ObjectInspectorController.js | 42 ++++----- .../src/controllers/SelectorController.js | 4 +- .../general/src/directives/MCTDrag.js | 2 +- .../general/src/directives/MCTPopup.js | 2 +- .../general/src/directives/MCTSplitter.js | 2 +- .../general/src/services/PopupService.js | 4 +- .../commonUI/general/src/ui/TreeLabelView.js | 2 +- .../general/test/StyleSheetLoaderSpec.js | 2 +- .../controllers/ActionGroupControllerSpec.js | 2 +- .../controllers/BottomBarControllerSpec.js | 8 +- .../controllers/ClickAwayControllerSpec.js | 2 +- .../controllers/ContextMenuControllerSpec.js | 2 +- .../DateTimePickerControllerSpec.js | 2 +- .../controllers/GetterSetterControllerSpec.js | 2 +- .../ObjectInspectorControllerSpec.js | 28 +++--- .../controllers/SelectorControllerSpec.js | 12 +-- .../controllers/TimeRangeControllerSpec.js | 6 +- .../test/controllers/ToggleControllerSpec.js | 2 +- .../controllers/TreeNodeControllerSpec.js | 20 +++-- .../controllers/ViewSwitcherControllerSpec.js | 8 +- .../test/directives/MCTClickElsewhereSpec.js | 4 +- .../test/directives/MCTContainerSpec.js | 4 +- .../general/test/directives/MCTDragSpec.js | 4 +- .../general/test/directives/MCTPopupSpec.js | 6 +- .../general/test/directives/MCTScrollSpec.js | 2 +- .../test/directives/MCTSplitPaneSpec.js | 2 +- .../test/directives/MCTSplitterSpec.js | 8 +- .../general/test/directives/MCTTreeSpec.js | 2 +- .../general/test/services/PopupServiceSpec.js | 14 +-- .../general/test/services/PopupSpec.js | 2 +- .../general/test/services/UrlServiceSpec.js | 26 +++--- .../commonUI/general/test/ui/TreeViewSpec.js | 16 ++-- .../commonUI/inspect/src/InfoConstants.js | 2 +- .../inspect/src/gestures/InfoButtonGesture.js | 2 +- .../inspect/src/gestures/InfoGesture.js | 2 +- .../test/gestures/InfoButtonGestureSpec.js | 12 +-- .../inspect/test/gestures/InfoGestureSpec.js | 14 +-- .../inspect/test/services/InfoServiceSpec.js | 12 +-- .../commonUI/mobile/src/DeviceClassifier.js | 2 +- .../commonUI/mobile/src/DeviceMatchers.js | 2 +- .../mobile/test/DeviceClassifierSpec.js | 14 +-- .../mobile/test/DeviceMatchersSpec.js | 2 +- .../commonUI/mobile/test/MCTDeviceSpec.js | 4 +- .../src/NotificationIndicatorController.js | 6 +- .../notification/src/NotificationService.js | 42 ++++----- .../NotificationIndicatorControllerSpec.js | 8 +- .../test/NotificationServiceSpec.js | 24 +++--- .../regions/src/EditableRegionPolicy.js | 6 +- .../regions/src/InspectorController.js | 4 +- platform/commonUI/regions/src/Region.js | 8 +- .../regions/test/EditableRegionPolicySpec.js | 8 +- .../regions/test/InspectorControllerSpec.js | 6 +- platform/commonUI/regions/test/RegionSpec.js | 26 +++--- platform/commonUI/themes/espresso/bundle.js | 4 +- platform/commonUI/themes/snow/bundle.js | 4 +- .../containment/test/CapabilityTableSpec.js | 6 +- .../test/ComposeActionPolicySpec.js | 4 +- .../test/CompositionMutabilityPolicySpec.js | 2 +- .../containment/test/CompositionPolicySpec.js | 6 +- .../containment/test/ContainmentTableSpec.js | 8 +- .../src/capabilities/ContextCapability.js | 2 +- .../src/capabilities/PersistenceCapability.js | 14 +-- platform/core/src/models/RootModelProvider.js | 4 +- .../core/src/types/TypePropertyConversion.js | 8 +- platform/core/src/types/TypeProvider.js | 2 +- .../core/test/actions/ActionAggregatorSpec.js | 4 +- .../core/test/actions/ActionCapabilitySpec.js | 10 +-- .../core/test/actions/ActionProviderSpec.js | 26 ++++-- .../actions/LoggingActionDecoratorSpec.js | 8 +- .../capabilities/CompositionCapabilitySpec.js | 12 +-- .../capabilities/ContextCapabilitySpec.js | 4 +- .../ContextualDomainObjectSpec.js | 2 +- .../CoreCapabilityProviderSpec.js | 12 ++- .../capabilities/DelegationCapabilitySpec.js | 18 ++-- .../InstantiationCapabilitySpec.js | 6 +- .../capabilities/MutationCapabilitySpec.js | 8 +- .../capabilities/PersistenceCapabilitySpec.js | 26 +++--- .../RelationshipCapabilitySpec.js | 8 +- .../test/models/MissingModelDecoratorSpec.js | 10 ++- .../core/test/models/ModelAggregatorSpec.js | 10 ++- .../core/test/models/ModelCacheServiceSpec.js | 2 +- .../core/test/models/RootModelProviderSpec.js | 4 +- .../test/models/StaticModelProviderSpec.js | 6 +- .../test/objects/DomainObjectProviderSpec.js | 6 +- .../core/test/objects/DomainObjectSpec.js | 2 +- .../core/test/services/ContextualizeSpec.js | 2 +- .../core/test/services/InstantiateSpec.js | 4 +- platform/core/test/services/NowSpec.js | 2 +- platform/core/test/services/TopicSpec.js | 2 +- platform/core/test/types/MergeModelsSpec.js | 14 +-- .../core/test/types/TypeCapabilitySpec.js | 6 +- platform/core/test/types/TypeImplSpec.js | 12 ++- .../test/types/TypePropertyConversionSpec.js | 4 +- platform/core/test/types/TypePropertySpec.js | 12 +-- platform/core/test/types/TypeProviderSpec.js | 2 +- .../core/test/views/ViewCapabilitySpec.js | 8 +- platform/core/test/views/ViewProviderSpec.js | 6 +- .../entanglement/src/actions/CopyAction.js | 14 +-- .../entanglement/src/services/CopyService.js | 2 +- .../entanglement/src/services/CopyTask.js | 49 +++++------ .../entanglement/src/services/LinkService.js | 4 +- .../entanglement/test/ControlledPromise.js | 16 ++-- .../entanglement/test/DomainObjectFactory.js | 2 +- .../test/actions/AbstractComposeActionSpec.js | 2 +- .../test/actions/CopyActionSpec.js | 8 +- .../test/actions/GoToOriginalActionSpec.js | 4 +- .../test/actions/LinkActionSpec.js | 2 +- .../test/actions/MoveActionSpec.js | 2 +- .../actions/SetPrimaryLocationActionSpec.js | 2 +- .../test/policies/CrossSpacePolicySpec.js | 2 +- .../test/services/CopyServiceSpec.js | 42 +++++---- .../test/services/CopyTaskSpec.js | 12 +-- .../services/LocatingObjectDecoratorSpec.js | 6 +- .../test/services/LocationServiceSpec.js | 4 +- platform/exporters/ExportService.js | 2 +- platform/exporters/ExportServiceSpec.js | 6 +- .../clock/src/actions/RestartTimerAction.js | 2 +- .../clock/src/actions/StartTimerAction.js | 2 +- .../actions/AbstractStartTimerActionSpec.js | 2 +- .../test/actions/RestartTimerActionSpec.js | 2 +- .../test/actions/StartTimerActionSpec.js | 2 +- .../controllers/RefreshingControllerSpec.js | 4 +- .../test/controllers/TimerControllerSpec.js | 2 +- .../test/ConductorRepresenterSpec.js | 2 +- .../test/ConductorTelemetryDecoratorSpec.js | 4 +- .../test/directives/MCTBackgroundImageSpec.js | 2 +- .../test/policies/ImageryViewPolicySpec.js | 8 +- .../features/layout/src/FixedController.js | 4 +- .../features/layout/src/FixedDragHandle.js | 2 +- .../features/layout/src/LayoutController.js | 12 +-- .../layout/src/elements/ElementProxy.js | 2 +- .../layout/test/FixedControllerSpec.js | 18 ++-- .../layout/test/FixedDragHandleSpec.js | 10 +-- .../layout/test/LayoutControllerSpec.js | 16 ++-- .../features/layout/test/LayoutDragSpec.js | 48 +++++------ .../layout/test/elements/BoxProxySpec.js | 2 +- .../test/elements/ElementFactorySpec.js | 10 +-- .../layout/test/elements/ElementProxySpec.js | 2 +- .../layout/test/elements/ImageProxySpec.js | 2 +- .../layout/test/elements/LineHandleSpec.js | 2 +- .../layout/test/elements/LineProxySpec.js | 2 +- .../layout/test/elements/ResizeHandleSpec.js | 2 +- .../test/elements/TelemetryProxySpec.js | 2 +- .../layout/test/elements/TextProxySpec.js | 2 +- platform/features/plot/src/Canvas2DChart.js | 4 +- .../plot/src/PlotOptionsController.js | 32 +++---- platform/features/plot/src/PlotOptionsForm.js | 34 ++++---- platform/features/plot/src/SubPlot.js | 8 +- .../plot/src/elements/PlotLineBuffer.js | 2 +- .../features/plot/src/elements/PlotPalette.js | 60 ++++++------- .../src/elements/PlotPanZoomStackGroup.js | 4 +- .../plot/src/elements/PlotPosition.js | 2 +- .../plot/src/elements/PlotPreparer.js | 4 +- .../features/plot/src/elements/PlotUpdater.js | 6 +- .../plot/src/modes/PlotModeOptions.js | 2 +- .../plot/src/modes/PlotOverlayMode.js | 2 +- .../features/plot/test/Canvas2DChartSpec.js | 10 +-- platform/features/plot/test/GLChartSpec.js | 10 +-- platform/features/plot/test/MCTChartSpec.js | 4 +- .../features/plot/test/PlotControllerSpec.js | 10 ++- .../plot/test/PlotOptionsControllerSpec.js | 4 +- .../features/plot/test/SubPlotFactorySpec.js | 12 +-- platform/features/plot/test/SubPlotSpec.js | 14 +-- .../plot/test/elements/PlotAxisSpec.js | 2 +- .../test/elements/PlotLimitTrackerSpec.js | 4 +- .../plot/test/elements/PlotLineBufferSpec.js | 12 +-- .../plot/test/elements/PlotLineSpec.js | 6 +- .../plot/test/elements/PlotPaletteSpec.js | 2 +- .../elements/PlotPanZoomStackGroupSpec.js | 12 +-- .../test/elements/PlotPanZoomStackSpec.js | 10 +-- .../plot/test/elements/PlotPositionSpec.js | 8 +- .../plot/test/elements/PlotPreparerSpec.js | 4 +- .../test/elements/PlotSeriesWindowSpec.js | 12 +-- .../test/elements/PlotTickGeneratorSpec.js | 10 +-- .../plot/test/elements/PlotUpdaterSpec.js | 6 +- .../plot/test/modes/PlotModeOptionsSpec.js | 6 +- .../plot/test/modes/PlotOverlayModeSpec.js | 6 +- .../plot/test/modes/PlotStackModeSpec.js | 8 +- .../plot/test/policies/PlotViewPolicySpec.js | 8 +- platform/features/static-markup/bundle.js | 4 +- platform/features/table/src/RangeColumn.js | 2 +- .../features/table/src/TableConfiguration.js | 12 +-- .../controllers/HistoricalTableController.js | 2 +- .../src/controllers/MCTTableController.js | 30 +++---- .../controllers/RealtimeTableController.js | 6 +- .../src/controllers/TableOptionsController.js | 12 +-- .../controllers/TelemetryTableController.js | 2 +- .../features/table/src/directives/MCTTable.js | 2 +- .../features/table/test/DomainColumnSpec.js | 4 +- .../features/table/test/NameColumnSpec.js | 2 +- .../features/table/test/RangeColumnSpec.js | 4 +- .../table/test/TableConfigurationSpec.js | 26 +++--- .../HistoricalTableControllerSpec.js | 24 +++--- .../controllers/MCTTableControllerSpec.js | 86 +++++++++---------- .../RealtimeTableControllerSpec.js | 18 ++-- .../controllers/TableOptionsControllerSpec.js | 26 +++--- platform/features/timeline/bundle.js | 2 +- .../timeline/src/TimelineConstants.js | 2 +- .../timeline/src/TimelineFormatter.js | 2 +- .../src/actions/ExportTimelineAsCSVAction.js | 2 +- .../timeline/src/actions/TimelineTraverser.js | 2 +- .../src/capabilities/ActivityTimespan.js | 2 +- .../src/capabilities/ActivityUtilization.js | 2 +- .../src/capabilities/CumulativeGraph.js | 2 +- .../src/capabilities/ResourceGraph.js | 2 +- .../src/capabilities/TimelineTimespan.js | 2 +- .../src/capabilities/TimelineUtilization.js | 2 +- .../src/controllers/TimelineController.js | 2 +- .../controllers/TimelineDateTimeController.js | 2 +- .../controllers/TimelineGanttController.js | 2 +- .../controllers/TimelineGraphController.js | 2 +- .../src/controllers/TimelineTickController.js | 2 +- .../src/controllers/TimelineZoomController.js | 2 +- .../controllers/drag/TimelineDragHandler.js | 2 +- .../controllers/drag/TimelineDragPopulator.js | 2 +- .../src/controllers/drag/TimelineEndHandle.js | 2 +- .../controllers/drag/TimelineMoveHandle.js | 2 +- .../controllers/drag/TimelineSnapHandler.js | 6 +- .../controllers/drag/TimelineStartHandle.js | 2 +- .../src/controllers/graph/TimelineGraph.js | 6 +- .../graph/TimelineGraphPopulator.js | 2 +- .../graph/TimelineGraphRenderer.js | 2 +- .../swimlane/TimelineColorAssigner.js | 2 +- .../src/controllers/swimlane/TimelineProxy.js | 2 +- .../controllers/swimlane/TimelineSwimlane.js | 2 +- .../swimlane/TimelineSwimlanePopulator.js | 2 +- .../timeline/src/services/ObjectLoader.js | 2 +- .../timeline/test/TimelineFormatterSpec.js | 2 +- .../test/actions/CompositionColumnSpec.js | 8 +- .../actions/ExportTimelineAsCSVActionSpec.js | 12 +-- .../actions/ExportTimelineAsCSVTaskSpec.js | 2 +- .../timeline/test/actions/IdColumnSpec.js | 4 +- .../test/actions/MetadataColumnSpec.js | 4 +- .../timeline/test/actions/ModeColumnSpec.js | 8 +- .../test/actions/TimelineColumnizerSpec.js | 6 +- .../test/actions/TimelineTraverserSpec.js | 8 +- .../test/actions/TimespanColumnSpec.js | 8 +- .../ActivityTimespanCapabilitySpec.js | 2 +- .../test/capabilities/ActivityTimespanSpec.js | 2 +- .../capabilities/ActivityUtilizationSpec.js | 2 +- .../test/capabilities/CostCapabilitySpec.js | 2 +- .../test/capabilities/CumulativeGraphSpec.js | 6 +- .../test/capabilities/GraphCapabilitySpec.js | 2 +- .../test/capabilities/ResourceGraphSpec.js | 6 +- .../TimelineTimespanCapabilitySpec.js | 20 +++-- .../test/capabilities/TimelineTimespanSpec.js | 4 +- .../capabilities/TimelineUtilizationSpec.js | 2 +- .../capabilities/UtilizationCapabilitySpec.js | 6 +- .../ActivityModeValuesControllerSpec.js | 2 +- .../controllers/TimelineControllerSpec.js | 4 +- .../TimelineGanttControllerSpec.js | 6 +- .../TimelineGraphControllerSpec.js | 4 +- .../TimelineTableControllerSpec.js | 2 +- .../controllers/TimelineTickControllerSpec.js | 2 +- .../controllers/TimelineZoomControllerSpec.js | 4 +- .../drag/TimelineDragHandleFactorySpec.js | 8 +- .../drag/TimelineDragHandlerSpec.js | 8 +- .../drag/TimelineDragPopulatorSpec.js | 2 +- .../controllers/drag/TimelineEndHandleSpec.js | 8 +- .../drag/TimelineMoveHandleSpec.js | 8 +- .../drag/TimelineSnapHandlerSpec.js | 4 +- .../drag/TimelineStartHandleSpec.js | 8 +- .../graph/TimelineGraphPopulatorSpec.js | 14 +-- .../graph/TimelineGraphRendererSpec.js | 2 +- .../controllers/graph/TimelineGraphSpec.js | 14 +-- .../swimlane/TimelineColorAssignerSpec.js | 8 +- .../controllers/swimlane/TimelineProxySpec.js | 6 +- .../swimlane/TimelineSwimlaneDecoratorSpec.js | 6 +- .../TimelineSwimlaneDropHandlerSpec.js | 36 ++++---- .../swimlane/TimelineSwimlanePopulatorSpec.js | 2 +- .../swimlane/TimelineSwimlaneSpec.js | 6 +- .../test/directives/MCTSwimlaneDropSpec.js | 4 +- .../test/services/ObjectLoaderSpec.js | 14 +-- platform/forms/src/MCTForm.js | 2 +- .../forms/src/controllers/ColorController.js | 20 ++--- .../src/controllers/DialogButtonController.js | 2 +- platform/forms/test/MCTControlSpec.js | 4 +- platform/forms/test/MCTFormSpec.js | 4 +- platform/forms/test/MCTToolbarSpec.js | 4 +- .../test/controllers/ColorControllerSpec.js | 2 +- .../controllers/CompositeControllerSpec.js | 2 +- .../controllers/DateTimeControllerSpec.js | 2 +- .../controllers/DialogButtonControllerSpec.js | 8 +- .../test/controllers/FormControllerSpec.js | 4 +- platform/framework/bundle.js | 4 +- platform/framework/src/FrameworkLayer.js | 2 +- platform/framework/src/load/Bundle.js | 12 +-- platform/framework/src/load/BundleLoader.js | 4 +- .../src/register/ExtensionRegistrar.js | 4 +- .../test/FrameworkInitializerSpec.js | 16 ++-- platform/framework/test/LogLevelSpec.js | 2 +- .../bootstrap/ApplicationBootstrapperSpec.js | 2 +- .../framework/test/load/BundleLoaderSpec.js | 6 +- platform/framework/test/load/BundleSpec.js | 6 +- platform/framework/test/load/ExtensionSpec.js | 2 +- .../test/register/ExtensionRegistrarSpec.js | 26 +++--- .../test/register/PartialConstructorSpec.js | 2 +- .../test/register/ServiceCompositorSpec.js | 78 +++++++++++------ .../test/resolve/BundleResolverSpec.js | 28 +++--- .../test/resolve/ExtensionResolverSpec.js | 56 +++++++----- .../test/resolve/ImplementationLoaderSpec.js | 36 +++++--- .../test/resolve/RequireConfiguratorSpec.js | 4 +- .../identity/test/IdentityAggregatorSpec.js | 4 +- .../aggregator/src/PersistenceAggregator.js | 4 +- .../test/PersistenceAggregatorSpec.js | 4 +- .../couch/src/CouchPersistenceProvider.js | 6 +- .../couch/test/CouchDocumentSpec.js | 2 +- .../couch/test/CouchIndicatorSpec.js | 6 +- .../test/CouchPersistenceProviderSpec.js | 4 +- .../elastic/src/ElasticPersistenceProvider.js | 2 +- .../elastic/test/ElasticIndicatorSpec.js | 6 +- .../test/ElasticPersistenceProviderSpec.js | 2 +- .../queue/src/PersistenceFailureDialog.js | 2 +- .../queue/src/PersistenceFailureHandler.js | 8 +- .../test/PersistenceFailureConstantsSpec.js | 2 +- .../test/PersistenceFailureControllerSpec.js | 2 +- .../test/PersistenceFailureDialogSpec.js | 2 +- .../test/PersistenceFailureHandlerSpec.js | 2 +- .../queue/test/PersistenceQueueHandlerSpec.js | 6 +- .../queue/test/PersistenceQueueImplSpec.js | 6 +- .../queue/test/PersistenceQueueSpec.js | 2 +- ...euingPersistenceCapabilityDecoratorSpec.js | 2 +- .../test/QueuingPersistenceCapabilitySpec.js | 2 +- platform/policy/src/PolicyActionDecorator.js | 2 +- .../policy/test/PolicyActionDecoratorSpec.js | 4 +- platform/policy/test/PolicyProviderSpec.js | 6 +- .../policy/test/PolicyViewDecoratorSpec.js | 4 +- .../representation/src/MCTRepresentation.js | 2 +- .../src/actions/ContextMenuAction.js | 8 +- .../src/gestures/DropGesture.js | 2 +- .../src/gestures/GestureConstants.js | 2 +- .../test/MCTRepresentationSpec.js | 14 +-- .../representation/test/TemplateLinkerSpec.js | 4 +- .../test/TemplatePrefetcherSpec.js | 2 +- .../test/actions/ContextMenuActionSpec.js | 8 +- .../test/gestures/ContextMenuGestureSpec.js | 24 +++--- .../test/gestures/DragGestureSpec.js | 10 +-- .../test/gestures/DropGestureSpec.js | 26 +++--- .../test/gestures/GestureProviderSpec.js | 6 +- .../test/gestures/GestureRepresenterSpec.js | 8 +- .../test/services/DndServiceSpec.js | 6 +- .../src/controllers/SearchMenuController.js | 44 +++++----- .../src/services/GenericSearchWorker.js | 2 +- .../test/controllers/SearchControllerSpec.js | 10 +-- .../controllers/SearchMenuControllerSpec.js | 46 +++++----- .../services/GenericSearchProviderSpec.js | 2 +- platform/status/test/StatusCapabilitySpec.js | 6 +- platform/status/test/StatusRepresenterSpec.js | 6 +- platform/status/test/StatusServiceSpec.js | 4 +- platform/telemetry/src/TelemetryCapability.js | 4 +- platform/telemetry/src/TelemetryController.js | 2 +- platform/telemetry/src/TelemetryDelegator.js | 4 +- platform/telemetry/src/TelemetryQueue.js | 10 +-- .../telemetry/test/TelemetryAggregatorSpec.js | 8 +- .../telemetry/test/TelemetryCapabilitySpec.js | 12 ++- .../telemetry/test/TelemetryControllerSpec.js | 8 +- .../telemetry/test/TelemetryHandleSpec.js | 4 +- platform/telemetry/test/TelemetryQueueSpec.js | 2 +- .../telemetry/test/TelemetrySubscriberSpec.js | 4 +- .../test/TelemetrySubscriptionSpec.js | 10 +-- platform/telemetry/test/TelemetryTableSpec.js | 2 +- src/BundleRegistry.js | 2 +- src/BundleRegistrySpec.js | 2 +- src/legacyRegistry.js | 2 +- 440 files changed, 1885 insertions(+), 1662 deletions(-) diff --git a/main.js b/main.js index d6b3dc2db7..4fba458a4c 100644 --- a/main.js +++ b/main.js @@ -41,10 +41,10 @@ requirejs.config({ "exports": "angular" }, "angular-route": { - "deps": [ "angular" ] + "deps": ["angular"] }, "moment-duration-format": { - "deps": [ "moment" ] + "deps": ["moment"] }, "screenfull": { "exports": "screenfull" diff --git a/platform/commonUI/about/test/AboutControllerSpec.js b/platform/commonUI/about/test/AboutControllerSpec.js index f902c7b6dc..e3af1f5b01 100644 --- a/platform/commonUI/about/test/AboutControllerSpec.js +++ b/platform/commonUI/about/test/AboutControllerSpec.js @@ -55,4 +55,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/about/test/LicenseControllerSpec.js b/platform/commonUI/about/test/LicenseControllerSpec.js index ba99fc1f0d..b5c1af4080 100644 --- a/platform/commonUI/about/test/LicenseControllerSpec.js +++ b/platform/commonUI/about/test/LicenseControllerSpec.js @@ -46,4 +46,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/about/test/LogoControllerSpec.js b/platform/commonUI/about/test/LogoControllerSpec.js index da1c4b0a84..b877658a23 100644 --- a/platform/commonUI/about/test/LogoControllerSpec.js +++ b/platform/commonUI/about/test/LogoControllerSpec.js @@ -48,4 +48,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/src/BrowseController.js b/platform/commonUI/browse/src/BrowseController.js index e5d0fcf2b9..53ddc14e79 100644 --- a/platform/commonUI/browse/src/BrowseController.js +++ b/platform/commonUI/browse/src/BrowseController.js @@ -41,13 +41,13 @@ define( * @constructor */ function BrowseController( - $scope, - $route, - $location, - $window, - objectService, - navigationService, - urlService, + $scope, + $route, + $location, + $window, + objectService, + navigationService, + urlService, policyService, defaultPath ) { @@ -80,12 +80,12 @@ define( function setNavigation(domainObject) { var navigationAllowed = true; - if (domainObject === $scope.navigatedObject){ + if (domainObject === $scope.navigatedObject) { //do nothing; return; } - policyService.allow("navigation", $scope.navigatedObject, domainObject, function(message){ + policyService.allow("navigation", $scope.navigatedObject, domainObject, function (message) { navigationAllowed = $window.confirm(message + "\r\n\r\n" + " Are you sure you want to continue?"); }); diff --git a/platform/commonUI/browse/src/BrowseObjectController.js b/platform/commonUI/browse/src/BrowseObjectController.js index 63547993f8..441bb83d02 100644 --- a/platform/commonUI/browse/src/BrowseObjectController.js +++ b/platform/commonUI/browse/src/BrowseObjectController.js @@ -33,7 +33,7 @@ define( function BrowseObjectController($scope, $location, $route) { var navigatedObject; function setViewForDomainObject(domainObject) { - + var locationViewKey = $location.search().view; function selectViewIfMatching(view) { @@ -70,7 +70,7 @@ define( $scope.$watch('domainObject', setViewForDomainObject); $scope.$watch('representation.selected.key', updateQueryParam); - $scope.doAction = function (action){ + $scope.doAction = function (action) { return $scope[action] && $scope[action](); }; diff --git a/platform/commonUI/browse/src/InspectorRegion.js b/platform/commonUI/browse/src/InspectorRegion.js index e227d3d452..382f6a9a0c 100644 --- a/platform/commonUI/browse/src/InspectorRegion.js +++ b/platform/commonUI/browse/src/InspectorRegion.js @@ -45,7 +45,7 @@ define( /** * @private */ - InspectorRegion.prototype.buildRegion = function() { + InspectorRegion.prototype.buildRegion = function () { var metadataRegion = { name: 'metadata', title: 'Metadata Region', diff --git a/platform/commonUI/browse/src/MenuArrowController.js b/platform/commonUI/browse/src/MenuArrowController.js index f222871ccc..ccb0b3b65e 100644 --- a/platform/commonUI/browse/src/MenuArrowController.js +++ b/platform/commonUI/browse/src/MenuArrowController.js @@ -26,11 +26,11 @@ define( [], function () { - + /** - * A left-click on the menu arrow should display a - * context menu. This controller launches the context - * menu. + * A left-click on the menu arrow should display a + * context menu. This controller launches the context + * menu. * @memberof platform/commonUI/browse * @constructor */ diff --git a/platform/commonUI/browse/src/creation/AddAction.js b/platform/commonUI/browse/src/creation/AddAction.js index b68fda10d6..0ac56957a2 100644 --- a/platform/commonUI/browse/src/creation/AddAction.js +++ b/platform/commonUI/browse/src/creation/AddAction.js @@ -81,13 +81,13 @@ define( newModel.type = this.type.getKey(); newObject = parentObject.getCapability('instantiation').instantiate(newModel); - newObject.useCapability('mutation', function(model){ + newObject.useCapability('mutation', function (model) { model.location = parentObject.getId(); }); wizard = new CreateWizard(newObject, this.parent, this.policyService); - function populateObjectFromInput (formValue) { + function populateObjectFromInput(formValue) { return wizard.populateObjectFromInput(formValue, newObject); } @@ -99,7 +99,7 @@ define( }); } - function addToParent (populatedObject) { + function addToParent(populatedObject) { parentObject.getCapability('composition').add(populatedObject); return persistAndReturn(parentObject); } @@ -125,7 +125,7 @@ define( * @returns {AddActionMetadata} metadata about this action */ AddAction.prototype.getMetadata = function () { - return this.metadata; + return this.metadata; }; return AddAction; diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index 9ac86d2dc8..c5097e166d 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -101,7 +101,7 @@ define( return editorCapability.save(); }, function () { return editorCapability.cancel(); - }); + }); } }; @@ -118,7 +118,7 @@ define( * @returns {CreateActionMetadata} metadata about this action */ CreateAction.prototype.getMetadata = function () { - return this.metadata; + return this.metadata; }; return CreateAction; diff --git a/platform/commonUI/browse/src/creation/CreateWizard.js b/platform/commonUI/browse/src/creation/CreateWizard.js index 660a577905..1ec234ee08 100644 --- a/platform/commonUI/browse/src/creation/CreateWizard.js +++ b/platform/commonUI/browse/src/creation/CreateWizard.js @@ -111,12 +111,12 @@ define( * @param formValue * @returns {DomainObject} */ - CreateWizard.prototype.populateObjectFromInput = function(formValue) { + CreateWizard.prototype.populateObjectFromInput = function (formValue) { var parent = this.getLocation(formValue), formModel = this.createModel(formValue); formModel.location = parent.getId(); - this.domainObject.useCapability("mutation", function(){ + this.domainObject.useCapability("mutation", function () { return formModel; }); return this.domainObject; diff --git a/platform/commonUI/browse/src/creation/CreationPolicy.js b/platform/commonUI/browse/src/creation/CreationPolicy.js index 480d0adec4..4880f884b9 100644 --- a/platform/commonUI/browse/src/creation/CreationPolicy.js +++ b/platform/commonUI/browse/src/creation/CreationPolicy.js @@ -40,4 +40,4 @@ define( return CreationPolicy; } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/src/creation/LocatorController.js b/platform/commonUI/browse/src/creation/LocatorController.js index 43a1a4ed10..b8c3f6a2dc 100644 --- a/platform/commonUI/browse/src/creation/LocatorController.js +++ b/platform/commonUI/browse/src/creation/LocatorController.js @@ -50,14 +50,14 @@ define( $scope.rootObject = (context && context.getRoot()) || $scope.rootObject; }, 0); - } else if (!contextRoot){ + } else if (!contextRoot) { //If no context root is available, default to the root // object $scope.rootObject = undefined; // Update the displayed tree on a timeout to avoid // an infinite digest exception. objectService.getObjects(['ROOT']) - .then(function(objects){ + .then(function (objects) { $timeout(function () { $scope.rootObject = objects.ROOT; }, 0); diff --git a/platform/commonUI/browse/test/BrowseControllerSpec.js b/platform/commonUI/browse/test/BrowseControllerSpec.js index 6bb41b4e6e..2c20467185 100644 --- a/platform/commonUI/browse/test/BrowseControllerSpec.js +++ b/platform/commonUI/browse/test/BrowseControllerSpec.js @@ -78,12 +78,12 @@ define( mockScope = jasmine.createSpyObj( "$scope", - [ "$on", "$watch" ] + ["$on", "$watch"] ); mockRoute = { current: { params: {} } }; mockLocation = jasmine.createSpyObj( "$location", - [ "path" ] + ["path"] ); mockUrlService = jasmine.createSpyObj( "urlService", @@ -91,7 +91,7 @@ define( ); mockObjectService = jasmine.createSpyObj( "objectService", - [ "getObjects" ] + ["getObjects"] ); mockNavigationService = jasmine.createSpyObj( "navigationService", @@ -104,15 +104,15 @@ define( ); mockRootObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability", "getModel", "useCapability" ] + ["getId", "getCapability", "getModel", "useCapability"] ); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability", "getModel", "useCapability" ] + ["getId", "getCapability", "getModel", "useCapability"] ); mockNextObject = jasmine.createSpyObj( "nextObject", - [ "getId", "getCapability", "getModel", "useCapability" ] + ["getId", "getCapability", "getModel", "useCapability"] ); mockObjectService.getObjects.andReturn(mockPromise({ @@ -255,7 +255,7 @@ define( " object", function () { mockScope.navigatedObject = mockDomainObject; mockWindow.confirm.andReturn(false); - mockPolicyService.allow.andCallFake(function(category, object, context, callback){ + mockPolicyService.allow.andCallFake(function (category, object, context, callback) { callback("unsaved changes"); return false; }); diff --git a/platform/commonUI/browse/test/BrowseObjectControllerSpec.js b/platform/commonUI/browse/test/BrowseObjectControllerSpec.js index dd873030f5..255badaf97 100644 --- a/platform/commonUI/browse/test/BrowseObjectControllerSpec.js +++ b/platform/commonUI/browse/test/BrowseObjectControllerSpec.js @@ -44,12 +44,12 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( "$scope", - [ "$on", "$watch" ] + ["$on", "$watch"] ); mockRoute = { current: { params: {} } }; mockLocation = jasmine.createSpyObj( "$location", - [ "path", "search" ] + ["path", "search"] ); mockUnlisten = jasmine.createSpy("unlisten"); @@ -69,7 +69,7 @@ define( // Allows the path index to be checked // prior to setting $route.current mockLocation.path.andReturn("/browse/"); - + // Exercise the Angular workaround mockScope.$on.mostRecentCall.args[1](); expect(mockUnlisten).toHaveBeenCalled(); diff --git a/platform/commonUI/browse/test/InspectorRegionSpec.js b/platform/commonUI/browse/test/InspectorRegionSpec.js index b7ce021cdc..a5fac51a30 100644 --- a/platform/commonUI/browse/test/InspectorRegionSpec.js +++ b/platform/commonUI/browse/test/InspectorRegionSpec.js @@ -40,4 +40,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/test/MenuArrowControllerSpec.js b/platform/commonUI/browse/test/MenuArrowControllerSpec.js index 22f9882115..94246b94f2 100644 --- a/platform/commonUI/browse/test/MenuArrowControllerSpec.js +++ b/platform/commonUI/browse/test/MenuArrowControllerSpec.js @@ -26,7 +26,7 @@ define( ["../src/MenuArrowController"], function (MenuArrowController) { - + describe("The menu arrow controller ", function () { var mockScope, mockDomainObject, @@ -34,43 +34,43 @@ define( mockContextMenuAction, mockActionContext, controller; - + beforeEach(function () { mockScope = jasmine.createSpyObj( "$scope", - [ "" ] + [""] ); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getCapability" ] + ["getCapability"] ); mockEvent = jasmine.createSpyObj( "event", - [ "preventDefault" ] + ["preventDefault"] ); mockContextMenuAction = jasmine.createSpyObj( "action", - [ "perform", "getActions" ] + ["perform", "getActions"] ); mockActionContext = jasmine.createSpyObj( "actionContext", - [ "" ] + [""] ); - + mockActionContext.domainObject = mockDomainObject; mockActionContext.event = mockEvent; mockScope.domainObject = mockDomainObject; mockDomainObject.getCapability.andReturn(mockContextMenuAction); mockContextMenuAction.perform.andReturn(jasmine.any(Function)); - + controller = new MenuArrowController(mockScope); }); - + it("calls the context menu action when clicked", function () { // Simulate a click on the menu arrow controller.showMenu(mockEvent); - - // Expect the menu action to be performed + + // Expect the menu action to be performed expect(mockDomainObject.getCapability).toHaveBeenCalledWith('action'); expect(mockContextMenuAction.perform).toHaveBeenCalled(); }); diff --git a/platform/commonUI/browse/test/PaneControllerSpec.js b/platform/commonUI/browse/test/PaneControllerSpec.js index 8654884f39..cbb792cc00 100644 --- a/platform/commonUI/browse/test/PaneControllerSpec.js +++ b/platform/commonUI/browse/test/PaneControllerSpec.js @@ -42,11 +42,11 @@ define( } beforeEach(function () { - mockScope = jasmine.createSpyObj("$scope", [ "$on" ]); + mockScope = jasmine.createSpyObj("$scope", ["$on"]); mockDomainObjects = ['a', 'b'].map(function (id) { var mockDomainObject = jasmine.createSpyObj( 'domainObject-' + id, - [ 'getId', 'getModel', 'getCapability' ] + ['getId', 'getModel', 'getCapability'] ); mockDomainObject.getId.andReturn(id); @@ -56,7 +56,7 @@ define( }); mockAgentService = jasmine.createSpyObj( "agentService", - [ "isMobile", "isPhone", "isTablet", "isPortrait", "isLandscape" ] + ["isMobile", "isPhone", "isTablet", "isPortrait", "isLandscape"] ); mockWindow = jasmine.createSpyObj("$window", ["open"]); }); diff --git a/platform/commonUI/browse/test/creation/AddActionProviderSpec.js b/platform/commonUI/browse/test/creation/AddActionProviderSpec.js index 3b391d0258..121f9b193d 100644 --- a/platform/commonUI/browse/test/creation/AddActionProviderSpec.js +++ b/platform/commonUI/browse/test/creation/AddActionProviderSpec.js @@ -60,37 +60,37 @@ define( beforeEach(function () { mockTypeService = jasmine.createSpyObj( "typeService", - [ "listTypes" ] + ["listTypes"] ); mockDialogService = jasmine.createSpyObj( "dialogService", - [ "getUserInput" ] + ["getUserInput"] ); mockPolicyService = jasmine.createSpyObj( "policyService", - [ "allow" ] + ["allow"] ); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getCapability" ] + ["getCapability"] ); //Mocking getCapability because AddActionProvider uses the // type capability of the destination object. mockDomainObject.getCapability.andReturn({}); - mockTypes = [ "A", "B", "C" ].map(createMockType); + mockTypes = ["A", "B", "C"].map(createMockType); - mockTypes.forEach(function(type){ + mockTypes.forEach(function (type) { mockPolicyMap[type.getName()] = true; }); - mockCreationPolicy = function(type){ + mockCreationPolicy = function (type) { return mockPolicyMap[type.getName()]; }; - mockCompositionPolicy = function(){ + mockCompositionPolicy = function () { return true; }; @@ -132,4 +132,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/test/creation/CreateActionProviderSpec.js b/platform/commonUI/browse/test/creation/CreateActionProviderSpec.js index b5bb794b04..fbfc4a1140 100644 --- a/platform/commonUI/browse/test/creation/CreateActionProviderSpec.js +++ b/platform/commonUI/browse/test/creation/CreateActionProviderSpec.js @@ -59,32 +59,32 @@ define( beforeEach(function () { mockTypeService = jasmine.createSpyObj( "typeService", - [ "listTypes" ] + ["listTypes"] ); mockDialogService = jasmine.createSpyObj( "dialogService", - [ "getUserInput" ] + ["getUserInput"] ); mockNavigationService = jasmine.createSpyObj( "navigationService", - [ "setNavigation" ] + ["setNavigation"] ); mockPolicyService = jasmine.createSpyObj( "policyService", - [ "allow" ] + ["allow"] ); - mockTypes = [ "A", "B", "C" ].map(createMockType); + mockTypes = ["A", "B", "C"].map(createMockType); - mockTypes.forEach(function(type){ + mockTypes.forEach(function (type) { mockPolicyMap[type.getName()] = true; }); - mockCreationPolicy = function(type){ + mockCreationPolicy = function (type) { return mockPolicyMap[type.getName()]; }; - mockPolicyService.allow.andCallFake(function(category, type){ + mockPolicyService.allow.andCallFake(function (category, type) { return category === "creation" && mockCreationPolicy(type) ? true : false; }); @@ -126,4 +126,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/test/creation/CreateActionSpec.js b/platform/commonUI/browse/test/creation/CreateActionSpec.js index 600bfadbdb..5fa89512e0 100644 --- a/platform/commonUI/browse/test/creation/CreateActionSpec.js +++ b/platform/commonUI/browse/test/creation/CreateActionSpec.js @@ -68,11 +68,11 @@ define( }; mockDialogService = jasmine.createSpyObj( "dialogService", - [ "getUserInput" ] + ["getUserInput"] ); mockCreationService = jasmine.createSpyObj( "creationService", - [ "createObject" ] + ["createObject"] ); mockType.getKey.andReturn("test"); @@ -127,4 +127,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/test/creation/CreateMenuControllerSpec.js b/platform/commonUI/browse/test/creation/CreateMenuControllerSpec.js index a2f5473199..b2c1f4afa4 100644 --- a/platform/commonUI/browse/test/creation/CreateMenuControllerSpec.js +++ b/platform/commonUI/browse/test/creation/CreateMenuControllerSpec.js @@ -62,4 +62,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/test/creation/CreateWizardSpec.js b/platform/commonUI/browse/test/creation/CreateWizardSpec.js index 577fb9b9ff..713b1d33d3 100644 --- a/platform/commonUI/browse/test/creation/CreateWizardSpec.js +++ b/platform/commonUI/browse/test/creation/CreateWizardSpec.js @@ -39,7 +39,7 @@ define( function createMockProperty(name) { var mockProperty = jasmine.createSpyObj( "property" + name, - [ "getDefinition", "getValue", "setValue" ] + ["getDefinition", "getValue", "setValue"] ); mockProperty.getDefinition.andReturn({ control: "textfield" @@ -68,7 +68,7 @@ define( "getCapability" ] ); - mockProperties = [ "A", "B", "C" ].map(createMockProperty); + mockProperties = ["A", "B", "C"].map(createMockProperty); mockPolicyService = jasmine.createSpyObj('policyService', ['allow']); testModel = { someKey: "some value" }; @@ -144,8 +144,8 @@ define( "A": "ValueA", "B": "ValueB", "C": "ValueC" - }, - compareModel = wizard.createModel(formValue); + }, + compareModel = wizard.createModel(formValue); wizard.populateObjectFromInput(formValue); expect(mockDomainObject.useCapability).toHaveBeenCalledWith('mutation', jasmine.any(Function)); expect(mockDomainObject.useCapability.mostRecentCall.args[1]()).toEqual(compareModel); @@ -179,7 +179,7 @@ define( }); it("creates a form model without a location if not requested", function () { - expect(wizard.getFormStructure(false).sections.some(function(section){ + expect(wizard.getFormStructure(false).sections.some(function (section) { return section.name === 'Location'; })).toEqual(false); }); diff --git a/platform/commonUI/browse/test/creation/CreationPolicySpec.js b/platform/commonUI/browse/test/creation/CreationPolicySpec.js index a12d2c752d..1c6a5421ca 100644 --- a/platform/commonUI/browse/test/creation/CreationPolicySpec.js +++ b/platform/commonUI/browse/test/creation/CreationPolicySpec.js @@ -48,4 +48,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/test/creation/CreationServiceSpec.js b/platform/commonUI/browse/test/creation/CreationServiceSpec.js index 270f5f8c90..fe740ca87a 100644 --- a/platform/commonUI/browse/test/creation/CreationServiceSpec.js +++ b/platform/commonUI/browse/test/creation/CreationServiceSpec.js @@ -61,23 +61,23 @@ define( mockQ = { when: mockPromise, reject: mockReject }; mockLog = jasmine.createSpyObj( "$log", - [ "error", "warn", "info", "debug" ] + ["error", "warn", "info", "debug"] ); mockParentObject = jasmine.createSpyObj( "parentObject", - [ "getId", "getCapability", "useCapability" ] + ["getId", "getCapability", "useCapability"] ); mockNewObject = jasmine.createSpyObj( "newObject", - [ "getId", "getCapability", "useCapability" ] + ["getId", "getCapability", "useCapability"] ); mockMutationCapability = jasmine.createSpyObj( "mutation", - [ "invoke" ] + ["invoke"] ); mockPersistenceCapability = jasmine.createSpyObj( "persistence", - [ "persist", "getSpace" ] + ["persist", "getSpace"] ); mockCompositionCapability = jasmine.createSpyObj( "composition", @@ -100,7 +100,7 @@ define( }; mockNewPersistenceCapability = jasmine.createSpyObj( "new-persistence", - [ "persist", "getSpace" ] + ["persist", "getSpace"] ); mockParentObject.getCapability.andCallFake(function (key) { diff --git a/platform/commonUI/browse/test/creation/LocatorControllerSpec.js b/platform/commonUI/browse/test/creation/LocatorControllerSpec.js index a601d5ea42..ffdf6514fb 100644 --- a/platform/commonUI/browse/test/creation/LocatorControllerSpec.js +++ b/platform/commonUI/browse/test/creation/LocatorControllerSpec.js @@ -40,20 +40,20 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( "$scope", - [ "$watch" ] + ["$watch"] ); mockTimeout = jasmine.createSpy("$timeout"); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getCapability" ] + ["getCapability"] ); mockRootObject = jasmine.createSpyObj( "rootObject", - [ "getCapability" ] + ["getCapability"] ); mockContext = jasmine.createSpyObj( "context", - [ "getRoot" ] + ["getRoot"] ); mockObjectService = jasmine.createSpyObj( "objectService", @@ -73,18 +73,18 @@ define( controller = new LocatorController(mockScope, mockTimeout, mockObjectService); }); - describe("when context is available", function () { + describe("when context is available", function () { - beforeEach(function () { + beforeEach(function () { mockContext.getRoot.andReturn(mockRootObject); controller = new LocatorController(mockScope, mockTimeout, mockObjectService); }); - it("adds a treeModel to scope", function () { + it("adds a treeModel to scope", function () { expect(mockScope.treeModel).toBeDefined(); }); - it("watches for changes to treeModel", function () { + it("watches for changes to treeModel", function () { // This is what the embedded tree representation // will be modifying. expect(mockScope.$watch).toHaveBeenCalledWith( @@ -93,7 +93,7 @@ define( ); }); - it("changes its own model on embedded model updates", function () { + it("changes its own model on embedded model updates", function () { // Need to pass on selection changes as updates to // the control's value mockScope.$watch.mostRecentCall.args[1](mockDomainObject); @@ -107,7 +107,7 @@ define( .toHaveBeenCalledWith("context"); }); - it("rejects changes which fail validation", function () { + it("rejects changes which fail validation", function () { mockScope.structure = { validate: jasmine.createSpy('validate') }; mockScope.structure.validate.andReturn(false); @@ -120,10 +120,10 @@ define( expect(mockScope.ngModel.someField).not.toEqual(mockDomainObject); }); - it("treats a lack of a selection as invalid", function () { + it("treats a lack of a selection as invalid", function () { mockScope.ngModelController = jasmine.createSpyObj( 'ngModelController', - [ '$setValidity' ] + ['$setValidity'] ); mockScope.$watch.mostRecentCall.args[1](mockDomainObject); @@ -136,14 +136,14 @@ define( expect(mockScope.ngModelController.$setValidity) .toHaveBeenCalledWith(jasmine.any(String), false); }); - }); - describe("when no context is available", function () { + }); + describe("when no context is available", function () { var defaultRoot = "DEFAULT_ROOT"; beforeEach(function () { mockContext.getRoot.andReturn(undefined); - getObjectsPromise.then.andCallFake(function(callback){ - callback({'ROOT':defaultRoot}); + getObjectsPromise.then.andCallFake(function (callback) { + callback({'ROOT': defaultRoot}); }); controller = new LocatorController(mockScope, mockTimeout, mockObjectService); }); diff --git a/platform/commonUI/browse/test/navigation/NavigateActionSpec.js b/platform/commonUI/browse/test/navigation/NavigateActionSpec.js index 0295651a1f..d872022049 100644 --- a/platform/commonUI/browse/test/navigation/NavigateActionSpec.js +++ b/platform/commonUI/browse/test/navigation/NavigateActionSpec.js @@ -44,12 +44,12 @@ define( beforeEach(function () { mockNavigationService = jasmine.createSpyObj( "navigationService", - [ "setNavigation" ] + ["setNavigation"] ); mockQ = { when: mockPromise }; mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability" ] + ["getId", "getModel", "getCapability"] ); action = new NavigateAction( @@ -74,4 +74,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/test/windowing/FullscreenActionSpec.js b/platform/commonUI/browse/test/windowing/FullscreenActionSpec.js index 7b3dfdab80..3b9710184c 100644 --- a/platform/commonUI/browse/test/windowing/FullscreenActionSpec.js +++ b/platform/commonUI/browse/test/windowing/FullscreenActionSpec.js @@ -56,4 +56,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/test/windowing/NewTabActionSpec.js b/platform/commonUI/browse/test/windowing/NewTabActionSpec.js index 335c4fe42b..fa820d3fcd 100644 --- a/platform/commonUI/browse/test/windowing/NewTabActionSpec.js +++ b/platform/commonUI/browse/test/windowing/NewTabActionSpec.js @@ -23,7 +23,7 @@ define( ["../../src/windowing/NewTabAction"], function (NewTabAction) { - + describe("The new tab action", function () { var actionSelected, actionCurrent, @@ -37,39 +37,39 @@ define( // Context if the current object is selected // For example, when the top right new tab - // button is clicked, the user is using the + // button is clicked, the user is using the // current domainObject mockContextCurrent = jasmine.createSpyObj("context", ["domainObject"]); - + // Context if the selected object is selected // For example, when an object in the left // tree is opened in a new tab using the // context menu mockContextSelected = jasmine.createSpyObj("context", ["selectedObject", "domainObject"]); - + // Mocks the urlService used to make the new tab's url from a // domainObject and mode mockUrlService = jasmine.createSpyObj("urlService", ["urlForNewTab"]); - + // Action done using the current context or mockContextCurrent actionCurrent = new NewTabAction(mockUrlService, mockWindow, mockContextCurrent); - + // Action done using the selected context or mockContextSelected actionSelected = new NewTabAction(mockUrlService, mockWindow, mockContextSelected); - + }); - + it("new tab with current url is opened", function () { actionCurrent.perform(); }); - + it("new tab with a selected url is opened", function () { actionSelected.perform(); }); - + }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/test/windowing/WindowTitlerSpec.js b/platform/commonUI/browse/test/windowing/WindowTitlerSpec.js index f4a0bfb4bc..095fa9923e 100644 --- a/platform/commonUI/browse/test/windowing/WindowTitlerSpec.js +++ b/platform/commonUI/browse/test/windowing/WindowTitlerSpec.js @@ -37,11 +37,11 @@ define( beforeEach(function () { mockNavigationService = jasmine.createSpyObj( 'navigationService', - [ 'getNavigation' ] + ['getNavigation'] ); mockRootScope = jasmine.createSpyObj( '$rootScope', - [ '$watch' ] + ['$watch'] ); mockDomainObject = jasmine.createSpyObj( 'domainObject', @@ -75,4 +75,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/dialog/src/DialogService.js b/platform/commonUI/dialog/src/DialogService.js index 94b59e0156..778a172147 100644 --- a/platform/commonUI/dialog/src/DialogService.js +++ b/platform/commonUI/dialog/src/DialogService.js @@ -155,8 +155,8 @@ define( * @returns {boolean} true if dialog is currently visible, false * otherwise */ - DialogService.prototype.canShowDialog = function(dialogModel){ - if (this.dialogVisible){ + DialogService.prototype.canShowDialog = function (dialogModel) { + if (this.dialogVisible) { // Only one dialog should be shown at a time. // The application design should be such that // we never even try to do this. @@ -224,7 +224,7 @@ define( * @param {typeClass} string tells overlayService that this overlay should use appropriate CSS class * @returns {boolean} */ - DialogService.prototype.showBlockingMessage = function(dialogModel) { + DialogService.prototype.showBlockingMessage = function (dialogModel) { if (this.canShowDialog(dialogModel)) { // Add the overlay using the OverlayService, which // will handle actual insertion into the DOM diff --git a/platform/commonUI/dialog/test/DialogServiceSpec.js b/platform/commonUI/dialog/test/DialogServiceSpec.js index cfaf21fe76..2d801eb028 100644 --- a/platform/commonUI/dialog/test/DialogServiceSpec.js +++ b/platform/commonUI/dialog/test/DialogServiceSpec.js @@ -38,23 +38,23 @@ define( beforeEach(function () { mockOverlayService = jasmine.createSpyObj( "overlayService", - [ "createOverlay" ] + ["createOverlay"] ); mockQ = jasmine.createSpyObj( "$q", - [ "defer" ] + ["defer"] ); mockLog = jasmine.createSpyObj( "$log", - [ "warn", "info", "debug" ] + ["warn", "info", "debug"] ); mockOverlay = jasmine.createSpyObj( "overlay", - [ "dismiss" ] + ["dismiss"] ); mockDeferred = jasmine.createSpyObj( "deferred", - [ "resolve", "reject"] + ["resolve", "reject"] ); mockDeferred.promise = "mock promise"; @@ -120,7 +120,7 @@ define( }); it("invokes the overlay service with the correct parameters when" + - " a blocking dialog is requested", function() { + " a blocking dialog is requested", function () { var dialogModel = {}; expect(dialogService.showBlockingMessage(dialogModel)).toBe(true); expect(mockOverlayService.createOverlay).toHaveBeenCalledWith( diff --git a/platform/commonUI/dialog/test/OverlayServiceSpec.js b/platform/commonUI/dialog/test/OverlayServiceSpec.js index 42fec48efd..7756cdf2c6 100644 --- a/platform/commonUI/dialog/test/OverlayServiceSpec.js +++ b/platform/commonUI/dialog/test/OverlayServiceSpec.js @@ -38,13 +38,13 @@ define( overlayService; beforeEach(function () { - mockDocument = jasmine.createSpyObj("$document", [ "find" ]); + mockDocument = jasmine.createSpyObj("$document", ["find"]); mockCompile = jasmine.createSpy("$compile"); - mockRootScope = jasmine.createSpyObj("$rootScope", [ "$new" ]); - mockBody = jasmine.createSpyObj("body", [ "prepend" ]); + mockRootScope = jasmine.createSpyObj("$rootScope", ["$new"]); + mockBody = jasmine.createSpyObj("body", ["prepend"]); mockTemplate = jasmine.createSpy("template"); - mockElement = jasmine.createSpyObj("element", [ "remove" ]); - mockScope = jasmine.createSpyObj("scope", [ "$destroy" ]); + mockElement = jasmine.createSpyObj("element", ["remove"]); + mockScope = jasmine.createSpyObj("scope", ["$destroy"]); mockDocument.find.andReturn(mockBody); mockCompile.andReturn(mockTemplate); @@ -96,4 +96,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index fb357c0934..4437e77f72 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -298,7 +298,7 @@ define([ ], "constants": [ { - "key":"editModeBlacklist", + "key": "editModeBlacklist", "value": ["copy", "follow", "window", "link", "locate"] }, { @@ -316,7 +316,7 @@ define([ "transactionService" ] } - ], + ] } }); }); diff --git a/platform/commonUI/edit/src/actions/CancelAction.js b/platform/commonUI/edit/src/actions/CancelAction.js index 77013ee8f5..9fc02a6121 100644 --- a/platform/commonUI/edit/src/actions/CancelAction.js +++ b/platform/commonUI/edit/src/actions/CancelAction.js @@ -44,7 +44,7 @@ define( CancelAction.prototype.perform = function () { var domainObject = this.domainObject; - function returnToBrowse () { + function returnToBrowse() { var parent; //If the object existed already, navigate to refresh view diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index acb83c0407..b2aae8fa1b 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -70,7 +70,7 @@ define( */ EditAction.prototype.perform = function () { var self = this; - function cancelEditing(){ + function cancelEditing() { self.domainObject.getCapability('editor').cancel(); self.navigationService.removeListener(cancelEditing); } diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index 3879685b9f..8a45913288 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -48,7 +48,7 @@ define( SaveAction.prototype.perform = function () { var domainObject = this.domainObject; - function resolveWith(object){ + function resolveWith(object) { return function () { return object; }; diff --git a/platform/commonUI/edit/src/actions/SaveAsAction.js b/platform/commonUI/edit/src/actions/SaveAsAction.js index f347cad899..05a9fe7918 100644 --- a/platform/commonUI/edit/src/actions/SaveAsAction.js +++ b/platform/commonUI/edit/src/actions/SaveAsAction.js @@ -42,7 +42,7 @@ define( context ) { this.domainObject = (context || {}).domainObject; - this.injectObjectService = function(){ + this.injectObjectService = function () { this.objectService = $injector.get("objectService"); }; this.policyService = policyService; @@ -65,7 +65,7 @@ define( /** * @private */ - SaveAsAction.prototype.getObjectService = function(){ + SaveAsAction.prototype.getObjectService = function () { // Lazily acquire object service (avoids cyclical dependency) if (!this.objectService) { this.injectObjectService(); @@ -73,7 +73,7 @@ define( return this.objectService; }; - function resolveWith(object){ + function resolveWith(object) { return function () { return object; }; @@ -116,13 +116,13 @@ define( ).then(wizard.populateObjectFromInput.bind(wizard)); } - function fetchObject(objectId){ - return self.getObjectService().getObjects([objectId]).then(function(objects){ + function fetchObject(objectId) { + return self.getObjectService().getObjects([objectId]).then(function (objects) { return objects[objectId]; }); } - function getParent(object){ + function getParent(object) { return fetchObject(object.getModel().location); } diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 69eb773d73..2fa11691c9 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -52,11 +52,11 @@ define( this.domainObject.getCapability('status').set('editing', true); }; - function isEditContextRoot (domainObject) { + function isEditContextRoot(domainObject) { return domainObject.getCapability('status').get('editing'); } - function isEditing (domainObject) { + function isEditing(domainObject) { return isEditContextRoot(domainObject) || domainObject.hasCapability('context') && isEditing(domainObject.getCapability('context').getParent()); @@ -87,7 +87,7 @@ define( */ EditorCapability.prototype.save = function () { var domainObject = this.domainObject; - return this.transactionService.commit().then(function() { + return this.transactionService.commit().then(function () { domainObject.getCapability('status').set('editing', false); }); }; @@ -101,7 +101,7 @@ define( */ EditorCapability.prototype.cancel = function () { var domainObject = this.domainObject; - return this.transactionService.cancel().then(function(){ + return this.transactionService.cancel().then(function () { domainObject.getCapability("status").set("editing", false); return domainObject; }); diff --git a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js index 9dc7968d3b..ffa6097125 100644 --- a/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js +++ b/platform/commonUI/edit/src/capabilities/TransactionalPersistenceCapability.js @@ -60,14 +60,14 @@ define( var self = this; function onCommit() { - return self.persistenceCapability.persist().then(function(result) { + return self.persistenceCapability.persist().then(function (result) { self.persistPending = false; return result; }); } function onCancel() { - return self.persistenceCapability.refresh().then(function(result) { + return self.persistenceCapability.refresh().then(function (result) { self.persistPending = false; return result; }); diff --git a/platform/commonUI/edit/src/controllers/EditObjectController.js b/platform/commonUI/edit/src/controllers/EditObjectController.js index 2b41f344b5..b398398f63 100644 --- a/platform/commonUI/edit/src/controllers/EditObjectController.js +++ b/platform/commonUI/edit/src/controllers/EditObjectController.js @@ -59,7 +59,7 @@ define( $scope.$watch('domainObject', setViewForDomainObject); - $scope.doAction = function (action){ + $scope.doAction = function (action) { return $scope[action] && $scope[action](); }; } @@ -74,8 +74,8 @@ define( var navigatedObject = this.scope.domainObject, policyMessage; - this.policyService.allow("navigation", navigatedObject, undefined, function(message) { - policyMessage = message; + this.policyService.allow("navigation", navigatedObject, undefined, function (message) { + policyMessage = message; }); return policyMessage; diff --git a/platform/commonUI/edit/src/controllers/ElementsController.js b/platform/commonUI/edit/src/controllers/ElementsController.js index 180b60dddc..6d1f552081 100644 --- a/platform/commonUI/edit/src/controllers/ElementsController.js +++ b/platform/commonUI/edit/src/controllers/ElementsController.js @@ -30,7 +30,7 @@ define( * @constructor */ function ElementsController($scope) { - function filterBy(text){ + function filterBy(text) { if (typeof text === 'undefined') { return $scope.searchText; } else { diff --git a/platform/commonUI/edit/src/policies/EditActionPolicy.js b/platform/commonUI/edit/src/policies/EditActionPolicy.js index f266d580eb..fda1cc9e1e 100644 --- a/platform/commonUI/edit/src/policies/EditActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditActionPolicy.js @@ -45,7 +45,7 @@ define( count = 0, type, views; - if (!domainObject){ + if (!domainObject) { return count; } diff --git a/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js b/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js index af30b5933e..53fd7f6395 100644 --- a/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditContextualActionPolicy.js @@ -56,7 +56,7 @@ define( actionMetadata = action.getMetadata ? action.getMetadata() : {}; if (navigatedObject.hasCapability("editor") && navigatedObject.getCapability("editor").isEditContextRoot()) { - if (selectedObject.hasCapability("editor") && selectedObject.getCapability("editor").inEditContext()){ + if (selectedObject.hasCapability("editor") && selectedObject.getCapability("editor").inEditContext()) { return this.editModeBlacklist.indexOf(actionMetadata.key) === -1; } else { //Target is in the context menu diff --git a/platform/commonUI/edit/src/policies/EditNavigationPolicy.js b/platform/commonUI/edit/src/policies/EditNavigationPolicy.js index 83563b5ced..b4b9855d4b 100644 --- a/platform/commonUI/edit/src/policies/EditNavigationPolicy.js +++ b/platform/commonUI/edit/src/policies/EditNavigationPolicy.js @@ -38,7 +38,7 @@ define( /** * @private */ - EditNavigationPolicy.prototype.isDirty = function(domainObject) { + EditNavigationPolicy.prototype.isDirty = function (domainObject) { var navigatedObject = domainObject, editorCapability = navigatedObject && navigatedObject.getCapability("editor"); diff --git a/platform/commonUI/edit/src/representers/EditRepresenter.js b/platform/commonUI/edit/src/representers/EditRepresenter.js index e853669eff..a5d4af9b14 100644 --- a/platform/commonUI/edit/src/representers/EditRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditRepresenter.js @@ -119,7 +119,7 @@ define( // Ensure existing watches are released this.destroy(); - function setEditing(){ + function setEditing() { scope.viewObjectTemplate = 'edit-object'; } @@ -128,15 +128,15 @@ define( * editable then change the view and inspector regions * object representation accordingly */ - this.listenHandle = this.domainObject.getCapability('status').listen(function(statuses){ - if (statuses.indexOf('editing') !== -1){ + this.listenHandle = this.domainObject.getCapability('status').listen(function (statuses) { + if (statuses.indexOf('editing') !== -1) { setEditing(); } else { delete scope.viewObjectTemplate; } }); - if (representedObject.hasCapability('editor') && representedObject.getCapability('editor').isEditContextRoot()){ + if (representedObject.hasCapability('editor') && representedObject.getCapability('editor').isEditContextRoot()) { setEditing(); } }; diff --git a/platform/commonUI/edit/src/representers/EditToolbar.js b/platform/commonUI/edit/src/representers/EditToolbar.js index aabea1cf4a..7659367dc6 100644 --- a/platform/commonUI/edit/src/representers/EditToolbar.js +++ b/platform/commonUI/edit/src/representers/EditToolbar.js @@ -24,8 +24,12 @@ define( function () { // Utility functions for reducing truth arrays - function and(a, b) { return a && b; } - function or(a, b) { return a || b; } + function and(a, b) { + return a && b; + } + function or(a, b) { + return a || b; + } /** diff --git a/platform/commonUI/edit/src/services/TransactionService.js b/platform/commonUI/edit/src/services/TransactionService.js index 8d57e1e809..8d6c465959 100644 --- a/platform/commonUI/edit/src/services/TransactionService.js +++ b/platform/commonUI/edit/src/services/TransactionService.js @@ -22,7 +22,7 @@ /*global define*/ define( [], - function() { + function () { /** * Implements an application-wide transaction state. Once a * transaction is started, calls to @@ -103,7 +103,7 @@ define( this.$log.error("Error committing transaction."); } } - return this.$q.all(promises).then( function () { + return this.$q.all(promises).then(function () { self.transaction = false; self.onCommits = []; @@ -145,4 +145,4 @@ define( }; return TransactionService; -}); + }); diff --git a/platform/commonUI/edit/test/actions/CancelActionSpec.js b/platform/commonUI/edit/test/actions/CancelActionSpec.js index 2131bbf999..411fdb1659 100644 --- a/platform/commonUI/edit/test/actions/CancelActionSpec.js +++ b/platform/commonUI/edit/test/actions/CancelActionSpec.js @@ -44,15 +44,15 @@ define( beforeEach(function () { mockLocation = jasmine.createSpyObj( "$location", - [ "path" ] + ["path"] ); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getCapability", "hasCapability" ] + ["getCapability", "hasCapability"] ); mockEditorCapability = jasmine.createSpyObj( "editor", - [ "save", "cancel" ] + ["save", "cancel"] ); mockUrlService = jasmine.createSpyObj( "urlService", @@ -100,4 +100,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/actions/EditActionSpec.js b/platform/commonUI/edit/test/actions/EditActionSpec.js index f645e1cd08..fe6fcb1eae 100644 --- a/platform/commonUI/edit/test/actions/EditActionSpec.js +++ b/platform/commonUI/edit/test/actions/EditActionSpec.js @@ -38,23 +38,23 @@ define( beforeEach(function () { mockLocation = jasmine.createSpyObj( "$location", - [ "path" ] + ["path"] ); mockNavigationService = jasmine.createSpyObj( "navigationService", - [ "setNavigation", "getNavigation", "addListener", "removeListener" ] + ["setNavigation", "getNavigation", "addListener", "removeListener"] ); mockLog = jasmine.createSpyObj( "$log", - [ "error", "warn", "info", "debug" ] + ["error", "warn", "info", "debug"] ); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability", "hasCapability", "useCapability" ] + ["getId", "getModel", "getCapability", "hasCapability", "useCapability"] ); mockType = jasmine.createSpyObj( "type", - [ "hasFeature" ] + ["hasFeature"] ); mockEditor = jasmine.createSpyObj( "editorCapability", @@ -66,7 +66,7 @@ define( editor: mockEditor }; - mockDomainObject.getCapability.andCallFake( function (name) { + mockDomainObject.getCapability.andCallFake(function (name) { return capabilities[name]; }); mockDomainObject.hasCapability.andReturn(true); @@ -112,4 +112,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/actions/LinkActionSpec.js b/platform/commonUI/edit/test/actions/LinkActionSpec.js index 144dd4e395..b116044b00 100644 --- a/platform/commonUI/edit/test/actions/LinkActionSpec.js +++ b/platform/commonUI/edit/test/actions/LinkActionSpec.js @@ -50,7 +50,7 @@ define( mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability" ] + ["getId", "getCapability"] ); mockQ = { when: mockPromise }; mockParent = { @@ -64,10 +64,10 @@ define( return capabilities[k].invoke(v); } }; - mockContext = jasmine.createSpyObj("context", [ "getParent" ]); - mockComposition = jasmine.createSpyObj("composition", [ "invoke", "add" ]); - mockPersistence = jasmine.createSpyObj("persistence", [ "persist" ]); - mockType = jasmine.createSpyObj("type", [ "hasFeature" ]); + mockContext = jasmine.createSpyObj("context", ["getParent"]); + mockComposition = jasmine.createSpyObj("composition", ["invoke", "add"]); + mockPersistence = jasmine.createSpyObj("persistence", ["persist"]); + mockType = jasmine.createSpyObj("type", ["hasFeature"]); mockDomainObject.getId.andReturn("test"); mockDomainObject.getCapability.andReturn(mockContext); @@ -82,7 +82,7 @@ define( type: mockType }; model = { - composition: [ "a", "b", "c" ] + composition: ["a", "b", "c"] }; actionContext = { diff --git a/platform/commonUI/edit/test/actions/PropertiesActionSpec.js b/platform/commonUI/edit/test/actions/PropertiesActionSpec.js index cad091cff5..785ac24d35 100644 --- a/platform/commonUI/edit/test/actions/PropertiesActionSpec.js +++ b/platform/commonUI/edit/test/actions/PropertiesActionSpec.js @@ -38,7 +38,9 @@ define( beforeEach(function () { capabilities = { type: { - getProperties: function () { return []; }, + getProperties: function () { + return []; + }, hasFeature: jasmine.createSpy('hasFeature') }, persistence: jasmine.createSpyObj("persistence", ["persist"]), @@ -47,11 +49,21 @@ define( model = {}; input = {}; object = { - getId: function () { return 'test-id'; }, - getCapability: function (k) { return capabilities[k]; }, - getModel: function () { return model; }, - useCapability: function (k, v) { return capabilities[k](v); }, - hasCapability: function () { return true; } + getId: function () { + return 'test-id'; + }, + getCapability: function (k) { + return capabilities[k]; + }, + getModel: function () { + return model; + }, + useCapability: function (k, v) { + return capabilities[k](v); + }, + hasCapability: function () { + return true; + } }; context = { someKey: "some value", domainObject: object }; dialogService = { diff --git a/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js b/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js index 2de6c12885..eebf513464 100644 --- a/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js +++ b/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js @@ -30,14 +30,22 @@ define( beforeEach(function () { type = { - getProperties: function () { return properties; } + getProperties: function () { + return properties; + } }; model = { x: "initial value" }; properties = ["x", "y", "z"].map(function (k) { return { - getValue: function (model) { return model[k]; }, - setValue: function (model, v) { model[k] = v; }, - getDefinition: function () { return { control: 'textfield '}; } + getValue: function (model) { + return model[k]; + }, + setValue: function (model, v) { + model[k] = v; + }, + getDefinition: function () { + return { control: 'textfield '}; + } }; }); diff --git a/platform/commonUI/edit/test/actions/RemoveActionSpec.js b/platform/commonUI/edit/test/actions/RemoveActionSpec.js index f9f36e36a8..a9ae1143af 100644 --- a/platform/commonUI/edit/test/actions/RemoveActionSpec.js +++ b/platform/commonUI/edit/test/actions/RemoveActionSpec.js @@ -57,19 +57,19 @@ define( mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability" ] + ["getId", "getCapability"] ); mockChildObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability" ] + ["getId", "getCapability"] ); mockGrandchildObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability" ] + ["getId", "getCapability"] ); mockRootObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability" ] + ["getId", "getCapability"] ); mockQ = { when: mockPromise }; mockParent = { @@ -83,13 +83,13 @@ define( return capabilities[k].invoke(v); } }; - mockContext = jasmine.createSpyObj("context", [ "getParent" ]); - mockChildContext = jasmine.createSpyObj("context", [ "getParent" ]); - mockGrandchildContext = jasmine.createSpyObj("context", [ "getParent" ]); - mockRootContext = jasmine.createSpyObj("context", [ "getParent" ]); - mockMutation = jasmine.createSpyObj("mutation", [ "invoke" ]); - mockPersistence = jasmine.createSpyObj("persistence", [ "persist" ]); - mockType = jasmine.createSpyObj("type", [ "hasFeature" ]); + mockContext = jasmine.createSpyObj("context", ["getParent"]); + mockChildContext = jasmine.createSpyObj("context", ["getParent"]); + mockGrandchildContext = jasmine.createSpyObj("context", ["getParent"]); + mockRootContext = jasmine.createSpyObj("context", ["getParent"]); + mockMutation = jasmine.createSpyObj("mutation", ["invoke"]); + mockPersistence = jasmine.createSpyObj("persistence", ["persist"]); + mockType = jasmine.createSpyObj("type", ["hasFeature"]); mockNavigationService = jasmine.createSpyObj( "navigationService", [ @@ -100,8 +100,8 @@ define( ] ); mockNavigationService.getNavigation.andReturn(mockDomainObject); - - + + mockDomainObject.getId.andReturn("test"); mockDomainObject.getCapability.andReturn(mockContext); mockContext.getParent.andReturn(mockParent); @@ -113,7 +113,7 @@ define( type: mockType }; model = { - composition: [ "a", "test", "b" ] + composition: ["a", "test", "b"] }; actionContext = { domainObject: mockDomainObject }; @@ -158,60 +158,60 @@ define( // Finally, should have persisted expect(mockPersistence.persist).toHaveBeenCalled(); }); - + it("removes parent of object currently navigated to", function () { // Navigates to child object mockNavigationService.getNavigation.andReturn(mockChildObject); - + // Test is id of object being removed // Child object has different id mockDomainObject.getId.andReturn("test"); mockChildObject.getId.andReturn("not test"); - + // Sets context for the child and domainObject mockDomainObject.getCapability.andReturn(mockContext); mockChildObject.getCapability.andReturn(mockChildContext); - + // Parents of child and domainObject are set mockContext.getParent.andReturn(mockParent); mockChildContext.getParent.andReturn(mockDomainObject); - + mockType.hasFeature.andReturn(true); - + action.perform(); - + // Expects navigation to parent of domainObject (removed object) expect(mockNavigationService.setNavigation).toHaveBeenCalledWith(mockParent); }); - + it("checks if removing object not in ascendent path (reaches ROOT)", function () { // Navigates to grandchild of ROOT mockNavigationService.getNavigation.andReturn(mockGrandchildObject); - + // domainObject (grandparent) is set as ROOT, child and grandchild // are set objects not being removed mockDomainObject.getId.andReturn("test 1"); mockRootObject.getId.andReturn("ROOT"); mockChildObject.getId.andReturn("not test 2"); mockGrandchildObject.getId.andReturn("not test 3"); - + // Sets context for the grandchild, child, and domainObject mockRootObject.getCapability.andReturn(mockRootContext); mockChildObject.getCapability.andReturn(mockChildContext); mockGrandchildObject.getCapability.andReturn(mockGrandchildContext); - + // Parents of grandchild and child are set mockChildContext.getParent.andReturn(mockRootObject); mockGrandchildContext.getParent.andReturn(mockChildObject); - + mockType.hasFeature.andReturn(true); - + action.perform(); - + // Expects no navigation to occur expect(mockNavigationService.setNavigation).not.toHaveBeenCalled(); }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/actions/SaveActionSpec.js b/platform/commonUI/edit/test/actions/SaveActionSpec.js index 09df5e53b5..2d15b46679 100644 --- a/platform/commonUI/edit/test/actions/SaveActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveActionSpec.js @@ -52,11 +52,11 @@ define( ); mockEditorCapability = jasmine.createSpyObj( "editor", - [ "save", "cancel", "isEditContextRoot" ] + ["save", "cancel", "isEditContextRoot"] ); mockActionCapability = jasmine.createSpyObj( "actionCapability", - [ "perform"] + ["perform"] ); capabilities.editor = mockEditorCapability; capabilities.action = mockActionCapability; @@ -90,7 +90,7 @@ define( function () { mockDomainObject.getModel.andReturn({persisted: undefined}); expect(SaveAction.appliesTo(actionContext)).toBe(false); - }); + }); it("uses the editor capability to save the object", function () { @@ -106,4 +106,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js index bac173ddcc..8ea603b623 100644 --- a/platform/commonUI/edit/test/actions/SaveAsActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveAsActionSpec.js @@ -38,7 +38,7 @@ define( capabilities = {}, action; - function noop () {} + function noop() {} function mockPromise(value) { return (value || {}).then ? value : @@ -49,7 +49,7 @@ define( catch: function (callback) { return mockPromise(callback(value)); } - } ; + } ; } beforeEach(function () { @@ -78,7 +78,7 @@ define( mockEditorCapability = jasmine.createSpyObj( "editor", - [ "save", "cancel", "isEditContextRoot" ] + ["save", "cancel", "isEditContextRoot"] ); mockEditorCapability.cancel.andReturn(mockPromise(undefined)); mockEditorCapability.save.andReturn(mockPromise(true)); @@ -130,7 +130,7 @@ define( action.createWizard.andReturn({ getFormStructure: noop, getInitialFormValue: noop, - populateObjectFromInput: function() { + populateObjectFromInput: function () { return mockDomainObject; } }); diff --git a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js index fe42ec92f7..fa4d1a43b6 100644 --- a/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/EditorCapabilitySpec.js @@ -82,7 +82,7 @@ define( status: mockStatusCapability }; - mockDomainObject.hasCapability.andCallFake(function(name) { + mockDomainObject.hasCapability.andCallFake(function (name) { return capabilities[name] !== undefined; }); @@ -126,8 +126,8 @@ define( expect(capability.inEditContext()).toBe(true); }); - describe("save", function() { - beforeEach(function() { + describe("save", function () { + beforeEach(function () { capability.edit(); capability.save(); }); @@ -139,8 +139,8 @@ define( }); }); - describe("cancel", function() { - beforeEach(function() { + describe("cancel", function () { + beforeEach(function () { capability.edit(); capability.cancel(); }); @@ -152,10 +152,10 @@ define( }); }); - describe("dirty", function() { + describe("dirty", function () { var model = {}; - beforeEach(function() { + beforeEach(function () { mockDomainObject.getModel.andReturn(model); capability.edit(); capability.cancel(); @@ -170,4 +170,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/capabilities/TransactionCapabilityDecoratorSpec.js b/platform/commonUI/edit/test/capabilities/TransactionCapabilityDecoratorSpec.js index f710cf215e..e1a48af7d1 100644 --- a/platform/commonUI/edit/test/capabilities/TransactionCapabilityDecoratorSpec.js +++ b/platform/commonUI/edit/test/capabilities/TransactionCapabilityDecoratorSpec.js @@ -33,22 +33,22 @@ define( mockCapabilityService, provider; - beforeEach(function() { + beforeEach(function () { mockQ = {}; mockTransactionService = {}; mockCapabilityService = jasmine.createSpyObj("capabilityService", ["getCapabilities"]); mockCapabilityService.getCapabilities.andReturn({ - persistence: function() {} + persistence: function () {} }); provider = new TransactionCapabilityDecorator(mockQ, mockTransactionService, mockCapabilityService); }); - it("decorates the persistence capability", function() { + it("decorates the persistence capability", function () { var capabilities = provider.getCapabilities(); expect(capabilities.persistence({}) instanceof TransactionalPersistenceCapability).toBe(true); }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js b/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js index c0892e6db2..63a9119826 100644 --- a/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js +++ b/platform/commonUI/edit/test/capabilities/TransactionalPersistenceCapabilitySpec.js @@ -29,7 +29,7 @@ define( function fastPromise(val) { return { - then: function(callback) { + then: function (callback) { return callback(val); } }; @@ -42,7 +42,7 @@ define( mockDomainObject, capability; - beforeEach(function() { + beforeEach(function () { mockQ = jasmine.createSpyObj("$q", ["when"]); mockQ.when.andCallFake(function (val) { return fastPromise(val); @@ -61,14 +61,14 @@ define( }); it("if no transaction is active, passes through to persistence" + - " provider", function() { + " provider", function () { mockTransactionService.isActive.andReturn(false); capability.persist(); expect(mockPersistence.persist).toHaveBeenCalled(); }); it("if transaction is active, persist and cancel calls are" + - " queued", function() { + " queued", function () { mockTransactionService.isActive.andReturn(true); capability.persist(); expect(mockTransactionService.addToTransaction).toHaveBeenCalled(); @@ -78,7 +78,7 @@ define( expect(mockPersistence.refresh).toHaveBeenCalled(); }); - it("persist call is only added to transaction once", function() { + it("persist call is only added to transaction once", function () { mockTransactionService.isActive.andReturn(true); capability.persist(); expect(mockTransactionService.addToTransaction).toHaveBeenCalled(); @@ -89,4 +89,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js b/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js index 6478837ce6..2fe3e32d63 100644 --- a/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/EditActionControllerSpec.js @@ -56,4 +56,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/controllers/EditControllerSpec.js b/platform/commonUI/edit/test/controllers/EditControllerSpec.js index 8c6a1ee31f..b616d6006d 100644 --- a/platform/commonUI/edit/test/controllers/EditControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/EditControllerSpec.js @@ -52,15 +52,15 @@ define( ); mockScope = jasmine.createSpyObj( "$scope", - [ "$on", "$watch" ] + ["$on", "$watch"] ); mockObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability", "hasCapability", "useCapability" ] + ["getId", "getModel", "getCapability", "hasCapability", "useCapability"] ); mockType = jasmine.createSpyObj( "type", - [ "hasFeature" ] + ["hasFeature"] ); mockStatusCapability = jasmine.createSpyObj('statusCapability', ["get"] @@ -99,8 +99,8 @@ define( expect(controller.getUnloadWarning()).toBeUndefined(); // Override the policy service to prevent navigation - mockPolicyService.allow.andCallFake(function(category, object, context, callback){ - callback(errorMessage); + mockPolicyService.allow.andCallFake(function (category, object, context, callback) { + callback(errorMessage); }); // Should have some warning message here now diff --git a/platform/commonUI/edit/test/controllers/EditPanesControllerSpec.js b/platform/commonUI/edit/test/controllers/EditPanesControllerSpec.js index d0d6aea413..4d6291ae7f 100644 --- a/platform/commonUI/edit/test/controllers/EditPanesControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/EditPanesControllerSpec.js @@ -34,11 +34,11 @@ define( mockScope = jasmine.createSpyObj("$scope", ["$watch"]); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getCapability' ] + ['getId', 'getCapability'] ); mockContext = jasmine.createSpyObj( 'context', - [ 'getTrueRoot' ] + ['getTrueRoot'] ); mockDomainObject.getId.andReturn('test-id'); @@ -110,4 +110,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/controllers/ElementsControllerSpec.js b/platform/commonUI/edit/test/controllers/ElementsControllerSpec.js index 2837eb03df..a40c318c51 100644 --- a/platform/commonUI/edit/test/controllers/ElementsControllerSpec.js +++ b/platform/commonUI/edit/test/controllers/ElementsControllerSpec.js @@ -34,8 +34,8 @@ define( controller = new ElementsController(mockScope); }); - function getModel (model) { - return function() { + function getModel(model) { + return function () { return model; }; } diff --git a/platform/commonUI/edit/test/directives/MCTBeforeUnloadSpec.js b/platform/commonUI/edit/test/directives/MCTBeforeUnloadSpec.js index f025cef20d..ab108f6feb 100644 --- a/platform/commonUI/edit/test/directives/MCTBeforeUnloadSpec.js +++ b/platform/commonUI/edit/test/directives/MCTBeforeUnloadSpec.js @@ -111,4 +111,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/policies/EditActionPolicySpec.js b/platform/commonUI/edit/test/policies/EditActionPolicySpec.js index 0cdf1be85d..539e37a373 100644 --- a/platform/commonUI/edit/test/policies/EditActionPolicySpec.js +++ b/platform/commonUI/edit/test/policies/EditActionPolicySpec.js @@ -58,10 +58,10 @@ define( mockEditAction = jasmine.createSpyObj('edit', ['getMetadata']); mockPropertiesAction = jasmine.createSpyObj('edit', ['getMetadata']); - mockDomainObject.getCapability.andCallFake(function(capability){ + mockDomainObject.getCapability.andCallFake(function (capability) { return capabilities[capability]; }); - mockDomainObject.hasCapability.andCallFake(function(capability){ + mockDomainObject.hasCapability.andCallFake(function (capability) { return !!capabilities[capability]; }); @@ -88,42 +88,42 @@ define( }); it("allows the edit action when there are editable views", function () { - testViews = [ editableView ]; + testViews = [editableView]; expect(policy.allow(mockEditAction, testContext)).toBe(true); }); it("allows the edit properties action when there are no editable views", function () { - testViews = [ nonEditableView, nonEditableView ]; + testViews = [nonEditableView, nonEditableView]; expect(policy.allow(mockPropertiesAction, testContext)).toBe(true); }); it("disallows the edit action when there are no editable views", function () { - testViews = [ nonEditableView, nonEditableView ]; + testViews = [nonEditableView, nonEditableView]; expect(policy.allow(mockEditAction, testContext)).toBe(false); }); it("disallows the edit properties action when there are" + " editable views", function () { - testViews = [ editableView ]; + testViews = [editableView]; expect(policy.allow(mockPropertiesAction, testContext)).toBe(false); }); it("disallows the edit action when object is already being" + " edited", function () { - testViews = [ editableView ]; + testViews = [editableView]; mockEditorCapability.isEditContextRoot.andReturn(true); expect(policy.allow(mockEditAction, testContext)).toBe(false); }); it("allows editing of panels in plot view", function () { - testViews = [ plotView ]; + testViews = [plotView]; mockTypeCapability.getKey.andReturn('telemetry.panel'); expect(policy.allow(mockEditAction, testContext)).toBe(true); }); it("disallows editing of plot view when object not a panel type", function () { - testViews = [ plotView ]; + testViews = [plotView]; mockTypeCapability.getKey.andReturn('something.else'); expect(policy.allow(mockEditAction, testContext)).toBe(false); @@ -131,10 +131,10 @@ define( it("allows the edit properties outside of the 'view-control' category", function () { - testViews = [ nonEditableView ]; + testViews = [nonEditableView]; testContext.category = "something-else"; expect(policy.allow(mockPropertiesAction, testContext)).toBe(true); }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/policies/EditContextualActionPolicySpec.js b/platform/commonUI/edit/test/policies/EditContextualActionPolicySpec.js index a516061e80..23e7ec8c1e 100644 --- a/platform/commonUI/edit/test/policies/EditContextualActionPolicySpec.js +++ b/platform/commonUI/edit/test/policies/EditContextualActionPolicySpec.js @@ -61,12 +61,12 @@ define( policy = new EditContextualActionPolicy(navigationService, editModeBlacklist, nonEditContextBlacklist); }); - it('Allows all actions when navigated object not in edit mode', function() { + it('Allows all actions when navigated object not in edit mode', function () { expect(policy.allow(mockAction, context)).toBe(true); }); it('Allows "window" action when navigated object in edit mode,' + - ' but selected object not in edit mode ', function() { + ' but selected object not in edit mode ', function () { navigatedObject.hasCapability.andReturn(true); mockEditorCapability.isEditContextRoot.andReturn(true); metadata.key = "window"; @@ -75,7 +75,7 @@ define( it('Allows "remove" action when navigated object in edit mode,' + ' and selected object not editable, but its parent is.', - function() { + function () { var mockParent = jasmine.createSpyObj("parentObject", ["hasCapability"]), mockContextCapability = jasmine.createSpyObj("contextCapability", ["getParent"]); @@ -93,10 +93,10 @@ define( metadata.key = "remove"; expect(policy.allow(mockAction, context)).toBe(true); - }); + }); it('Disallows "move" action when navigated object in edit mode,' + - ' but selected object not in edit mode ', function() { + ' but selected object not in edit mode ', function () { navigatedObject.hasCapability.andReturn(true); mockEditorCapability.isEditContextRoot.andReturn(true); mockEditorCapability.inEditContext.andReturn(false); @@ -105,7 +105,7 @@ define( }); it('Disallows copy action when navigated object and' + - ' selected object in edit mode', function() { + ' selected object in edit mode', function () { navigatedObject.hasCapability.andReturn(true); mockDomainObject.hasCapability.andReturn(true); mockEditorCapability.isEditContextRoot.andReturn(true); diff --git a/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js b/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js index 32400a7453..e849e49c5f 100644 --- a/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js +++ b/platform/commonUI/edit/test/policies/EditableViewPolicySpec.js @@ -36,7 +36,7 @@ define( ['hasCapability', 'getCapability'] ); mockDomainObject.getCapability.andReturn({ - inEditContext: function () { + inEditContext: function () { return true; } }); @@ -76,4 +76,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/representers/EditRepresenterSpec.js b/platform/commonUI/edit/test/representers/EditRepresenterSpec.js index fe0c17c5bd..d535e19bac 100644 --- a/platform/commonUI/edit/test/representers/EditRepresenterSpec.js +++ b/platform/commonUI/edit/test/representers/EditRepresenterSpec.js @@ -72,7 +72,7 @@ define( mockDomainObject.getModel.andReturn({}); mockDomainObject.hasCapability.andReturn(true); mockDomainObject.useCapability.andReturn(true); - mockDomainObject.getCapability.andCallFake(function(capability){ + mockDomainObject.getCapability.andCallFake(function (capability) { return mockCapabilities[capability]; }); diff --git a/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js b/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js index cc566c71f3..d0833e490c 100644 --- a/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js +++ b/platform/commonUI/edit/test/representers/EditToolbarRepresenterSpec.js @@ -34,13 +34,13 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( '$scope', - [ '$on', '$watch', '$watchCollection', "commit" ] + ['$on', '$watch', '$watchCollection', "commit"] ); mockElement = {}; testAttrs = { toolbar: 'testToolbar' }; mockScope.$parent = jasmine.createSpyObj( '$parent', - [ '$watch', '$watchCollection' ] + ['$watch', '$watchCollection'] ); mockUnwatch = jasmine.createSpy('unwatch'); @@ -92,7 +92,7 @@ define( // Provide a view which has a toolbar representer.represent({ - toolbar: { sections: [ { items: [ { property: 'k' } ] } ] } + toolbar: { sections: [{ items: [{ property: 'k' }] }] } }); // Update the selection @@ -120,7 +120,7 @@ define( // Provide a view which has a toolbar representer.represent({ - toolbar: { sections: [ { items: [ { property: 'k' } ] } ] } + toolbar: { sections: [{ items: [{ property: 'k' }] }] } }); // Update the selection @@ -140,4 +140,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/representers/EditToolbarSpec.js b/platform/commonUI/edit/test/representers/EditToolbarSpec.js index a252b32612..2e4946dd76 100644 --- a/platform/commonUI/edit/test/representers/EditToolbarSpec.js +++ b/platform/commonUI/edit/test/representers/EditToolbarSpec.js @@ -76,7 +76,7 @@ define( it("provides properties from the original structure", function () { expect( - new EditToolbar(testStructure, [ testABC ]) + new EditToolbar(testStructure, [testABC]) .getStructure() .sections[0] .items[1] @@ -87,7 +87,7 @@ define( // This is needed by mct-toolbar it("adds keys to form structure", function () { expect( - new EditToolbar(testStructure, [ testABC ]) + new EditToolbar(testStructure, [testABC]) .getStructure() .sections[0] .items[1] @@ -97,20 +97,20 @@ define( it("marks empty sections as hidden", function () { // Verify that all sections are included when applicable... - toolbar.setSelection([ testABCXYZ ]); + toolbar.setSelection([testABCXYZ]); expect(toolbar.getStructure().sections.map(getVisibility)) - .toEqual([ true, true, false ]); + .toEqual([true, true, false]); // ...but omitted when only some are applicable - toolbar.setSelection([ testABC ]); + toolbar.setSelection([testABC]); expect(toolbar.getStructure().sections.map(getVisibility)) - .toEqual([ true, false, false ]); + .toEqual([true, false, false]); }); it("reads properties from selections", function () { var structure, state; - toolbar.setSelection([ testABC ]); + toolbar.setSelection([testABC]); structure = toolbar.getStructure(); state = toolbar.getState(); @@ -126,9 +126,11 @@ define( it("reads properties from getters", function () { var structure, state; - testABC.a = function () { return "from a getter!"; }; + testABC.a = function () { + return "from a getter!"; + }; - toolbar.setSelection([ testABC ]); + toolbar.setSelection([testABC]); structure = toolbar.getStructure(); state = toolbar.getState(); @@ -137,7 +139,7 @@ define( }); it("sets properties on update", function () { - toolbar.setSelection([ testABC ]); + toolbar.setSelection([testABC]); toolbar.updateState( toolbar.getStructure().sections[0].items[0].key, "new value" @@ -151,7 +153,7 @@ define( testABC.a = jasmine.createSpy('a'); - toolbar.setSelection([ testABC ]); + toolbar.setSelection([testABC]); structure = toolbar.getStructure(); toolbar.updateState( @@ -165,7 +167,7 @@ define( it("provides a return value describing update status", function () { // Should return true if actually updated, otherwise false var key; - toolbar.setSelection([ testABC ]); + toolbar.setSelection([testABC]); key = toolbar.getStructure().sections[0].items[0].key; expect(toolbar.updateState(key, testABC.a)).toBeFalsy(); expect(toolbar.updateState(key, "new value")).toBeTruthy(); @@ -173,35 +175,35 @@ define( it("removes inapplicable items", function () { // First, verify with all items - toolbar.setSelection([ testABC ]); + toolbar.setSelection([testABC]); expect(toolbar.getStructure().sections[0].items.map(getVisibility)) - .toEqual([ true, true, true ]); + .toEqual([true, true, true]); // Then, try with some items omitted - toolbar.setSelection([ testABC, testAB ]); + toolbar.setSelection([testABC, testAB]); expect(toolbar.getStructure().sections[0].items.map(getVisibility)) - .toEqual([ true, true, false ]); + .toEqual([true, true, false]); }); it("removes inconsistent states", function () { // Only two of three values match among these selections - toolbar.setSelection([ testABC, testABC2 ]); + toolbar.setSelection([testABC, testABC2]); expect(toolbar.getStructure().sections[0].items.map(getVisibility)) - .toEqual([ false, true, true ]); + .toEqual([false, true, true]); }); it("allows inclusive items", function () { // One inclusive item is in the set, property 'x' of the // second section; make sure items are pruned down // when only some of the selection has x,y,z properties - toolbar.setSelection([ testABC, testABCXYZ ]); + toolbar.setSelection([testABC, testABCXYZ]); expect(toolbar.getStructure().sections[1].items.map(getVisibility)) - .toEqual([ true, false, false ]); + .toEqual([true, false, false]); }); it("removes inclusive items when there are no matches", function () { - toolbar.setSelection([ testABCYZ ]); + toolbar.setSelection([testABCYZ]); expect(toolbar.getStructure().sections[1].items.map(getVisibility)) - .toEqual([ false, true, true ]); + .toEqual([false, true, true]); }); it("adds click functions when a method is specified", function () { diff --git a/platform/commonUI/edit/test/services/TransactionServiceSpec.js b/platform/commonUI/edit/test/services/TransactionServiceSpec.js index 5f965decf9..91fa859b73 100644 --- a/platform/commonUI/edit/test/services/TransactionServiceSpec.js +++ b/platform/commonUI/edit/test/services/TransactionServiceSpec.js @@ -30,7 +30,7 @@ define( mockLog, transactionService; - function fastPromise (val) { + function fastPromise(val) { return { then: function (callback) { return fastPromise(callback(val)); @@ -75,8 +75,8 @@ define( describe("commit", function () { var onCommits; - beforeEach(function() { - onCommits = [0, 1, 2].map(function(val) { + beforeEach(function () { + onCommits = [0, 1, 2].map(function (val) { return jasmine.createSpy("onCommit" + val); }); @@ -87,7 +87,7 @@ define( it("commit calls all queued commit functions", function () { expect(transactionService.onCommits.length).toBe(3); transactionService.commit(); - onCommits.forEach( function (spy) { + onCommits.forEach(function (spy) { expect(spy).toHaveBeenCalled(); }); }); @@ -104,8 +104,8 @@ define( describe("cancel", function () { var onCancels; - beforeEach(function() { - onCancels = [0, 1, 2].map(function(val) { + beforeEach(function () { + onCancels = [0, 1, 2].map(function (val) { return jasmine.createSpy("onCancel" + val); }); @@ -118,7 +118,7 @@ define( it("cancel calls all queued cancel functions", function () { expect(transactionService.onCancels.length).toBe(3); transactionService.cancel(); - onCancels.forEach( function (spy) { + onCancels.forEach(function (spy) { expect(spy).toHaveBeenCalled(); }); }); @@ -134,4 +134,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/formats/test/FormatProviderSpec.js b/platform/commonUI/formats/test/FormatProviderSpec.js index 527a0182af..94d951ff6a 100644 --- a/platform/commonUI/formats/test/FormatProviderSpec.js +++ b/platform/commonUI/formats/test/FormatProviderSpec.js @@ -24,7 +24,7 @@ define( ['../src/FormatProvider'], function (FormatProvider) { - var KEYS = [ 'a', 'b', 'c' ]; + var KEYS = ['a', 'b', 'c']; describe("The FormatProvider", function () { var mockFormats, @@ -35,12 +35,14 @@ define( mockFormatInstances = KEYS.map(function (k) { return jasmine.createSpyObj( 'format-' + k, - [ 'parse', 'validate', 'format' ] + ['parse', 'validate', 'format'] ); }); // Return constructors mockFormats = KEYS.map(function (k, i) { - function MockFormat() { return mockFormatInstances[i]; } + function MockFormat() { + return mockFormatInstances[i]; + } MockFormat.key = k; return MockFormat; }); diff --git a/platform/commonUI/general/bundle.js b/platform/commonUI/general/bundle.js index f78233e135..daadacbc45 100644 --- a/platform/commonUI/general/bundle.js +++ b/platform/commonUI/general/bundle.js @@ -380,7 +380,7 @@ define([ { "key": "mctTree", "implementation": MCTTree, - "depends": [ '$parse', 'gestureService' ] + "depends": ['$parse', 'gestureService'] } ], "constants": [ diff --git a/platform/commonUI/general/src/controllers/BannerController.js b/platform/commonUI/general/src/controllers/BannerController.js index b3f7e23131..5b0cdd61bc 100644 --- a/platform/commonUI/general/src/controllers/BannerController.js +++ b/platform/commonUI/general/src/controllers/BannerController.js @@ -40,7 +40,7 @@ define( function BannerController($scope, notificationService, dialogService) { $scope.active = notificationService.active; - $scope.action = function (action, $event){ + $scope.action = function (action, $event) { /* Prevents default 'maximize' behaviour when clicking on notification button @@ -48,19 +48,19 @@ define( $event.stopPropagation(); return action(); }; - $scope.dismiss = function(notification, $event) { + $scope.dismiss = function (notification, $event) { $event.stopPropagation(); notification.dismissOrMinimize(); }; - $scope.maximize = function(notification) { - if (notification.model.severity !== "info"){ + $scope.maximize = function (notification) { + if (notification.model.severity !== "info") { - notification.model.cancel = function(){ + notification.model.cancel = function () { dialogService.dismiss(); }; //If the notification is dismissed by the user, close // the dialog. - notification.onDismiss(function(){ + notification.onDismiss(function () { dialogService.dismiss(); }); @@ -69,4 +69,4 @@ define( }; } return BannerController; - }); \ No newline at end of file + }); diff --git a/platform/commonUI/general/src/controllers/ClickAwayController.js b/platform/commonUI/general/src/controllers/ClickAwayController.js index 2f6520df5e..18d9ca41c5 100644 --- a/platform/commonUI/general/src/controllers/ClickAwayController.js +++ b/platform/commonUI/general/src/controllers/ClickAwayController.js @@ -65,7 +65,7 @@ define( * Get the current state of the toggle. * @return {boolean} true if active */ - ClickAwayController.prototype.isActive =function () { + ClickAwayController.prototype.isActive = function () { return this.state; }; diff --git a/platform/commonUI/general/src/controllers/DateTimePickerController.js b/platform/commonUI/general/src/controllers/DateTimePickerController.js index 81708d353e..77194f5ab8 100644 --- a/platform/commonUI/general/src/controllers/DateTimePickerController.js +++ b/platform/commonUI/general/src/controllers/DateTimePickerController.js @@ -21,7 +21,7 @@ *****************************************************************************/ define( - [ 'moment' ], + ['moment'], function (moment) { var TIME_NAMES = { diff --git a/platform/commonUI/general/src/controllers/ObjectInspectorController.js b/platform/commonUI/general/src/controllers/ObjectInspectorController.js index abdc27c154..fcf34a55b3 100644 --- a/platform/commonUI/general/src/controllers/ObjectInspectorController.js +++ b/platform/commonUI/general/src/controllers/ObjectInspectorController.js @@ -28,7 +28,7 @@ define( function () { /** - * The ObjectInspectorController gets and formats the data for + * The ObjectInspectorController gets and formats the data for * the inspector display * * @constructor @@ -37,67 +37,67 @@ define( $scope.primaryParents = []; $scope.contextutalParents = []; //$scope.isLink = false; - + // Gets an array of the contextual parents/anscestors of the selected object function getContextualPath() { var currentObj = $scope.ngModel.selectedObject, currentParent, parents = []; - + currentParent = currentObj && currentObj.hasCapability('context') && currentObj.getCapability('context').getParent(); - + while (currentParent && currentParent.getModel().type !== 'root' && currentParent.hasCapability('context')) { - // Record this object + // Record this object parents.unshift(currentParent); - - // Get the next one up the tree + + // Get the next one up the tree currentObj = currentParent; currentParent = currentObj.getCapability('context').getParent(); } - + $scope.contextutalParents = parents; } - - // Gets an array of the parents/anscestors of the selected object's + + // Gets an array of the parents/anscestors of the selected object's // primary location (locational of original non-link) function getPrimaryPath(current) { var location; - + // If this the the initial call of this recursive function if (!current) { current = $scope.ngModel.selectedObject; $scope.primaryParents = []; } - + location = current.getModel().location; - + if (location && location !== 'root') { objectService.getObjects([location]).then(function (obj) { var next = obj[location]; - + $scope.primaryParents.unshift(next); getPrimaryPath(next); }); } - + } - + // Gets the metadata for the selected object function getMetadata() { $scope.metadata = $scope.ngModel.selectedObject && $scope.ngModel.selectedObject.hasCapability('metadata') && $scope.ngModel.selectedObject.useCapability('metadata'); } - - // Set scope variables when the selected object changes + + // Set scope variables when the selected object changes $scope.$watch('ngModel.selectedObject', function () { $scope.isLink = $scope.ngModel.selectedObject && $scope.ngModel.selectedObject.hasCapability('location') && $scope.ngModel.selectedObject.getCapability('location').isLink(); - + if ($scope.isLink) { getPrimaryPath(); getContextualPath(); @@ -105,11 +105,11 @@ define( $scope.primaryParents = []; getContextualPath(); } - + getMetadata(); }); } return ObjectInspectorController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/controllers/SelectorController.js b/platform/commonUI/general/src/controllers/SelectorController.js index 55a79af308..d5e85be820 100644 --- a/platform/commonUI/general/src/controllers/SelectorController.js +++ b/platform/commonUI/general/src/controllers/SelectorController.js @@ -69,7 +69,9 @@ define( function updateList(ids) { function updateSelectedObjects(objects) { // Look up from the - function getObject(id) { return objects[id]; } + function getObject(id) { + return objects[id]; + } self.selectedObjects = ids.filter(getObject).map(getObject); } diff --git a/platform/commonUI/general/src/directives/MCTDrag.js b/platform/commonUI/general/src/directives/MCTDrag.js index ac96357da8..29757552f2 100644 --- a/platform/commonUI/general/src/directives/MCTDrag.js +++ b/platform/commonUI/general/src/directives/MCTDrag.js @@ -76,7 +76,7 @@ define( // based on a new mouse event object. function updatePosition(event) { // Get the current position, as an array - var currentPosition = [ event.pageX, event.pageY ]; + var currentPosition = [event.pageX, event.pageY]; // Track the initial position, if one hasn't been observed initialPosition = initialPosition || currentPosition; diff --git a/platform/commonUI/general/src/directives/MCTPopup.js b/platform/commonUI/general/src/directives/MCTPopup.js index e96c1c0327..7ce409acba 100644 --- a/platform/commonUI/general/src/directives/MCTPopup.js +++ b/platform/commonUI/general/src/directives/MCTPopup.js @@ -46,7 +46,7 @@ define( function link(scope, element, attrs, ctrl, transclude) { var div = $compile(TEMPLATE)(scope), rect = element.parent()[0].getBoundingClientRect(), - position = [ rect.left, rect.top ], + position = [rect.left, rect.top], popup = popupService.display(div, position); // TODO: Handle in CSS; diff --git a/platform/commonUI/general/src/directives/MCTSplitter.js b/platform/commonUI/general/src/directives/MCTSplitter.js index 0f8c77da96..edff3822bd 100644 --- a/platform/commonUI/general/src/directives/MCTSplitter.js +++ b/platform/commonUI/general/src/directives/MCTSplitter.js @@ -59,7 +59,7 @@ define( }, // Grab the event when the user is done moving // the splitter and pass it on - endMove: function() { + endMove: function () { mctSplitPane.toggleClass('resizing'); } }; diff --git a/platform/commonUI/general/src/services/PopupService.js b/platform/commonUI/general/src/services/PopupService.js index b869be6d76..d6b08e752f 100644 --- a/platform/commonUI/general/src/services/PopupService.js +++ b/platform/commonUI/general/src/services/PopupService.js @@ -78,7 +78,7 @@ define( var $document = this.$document, $window = this.$window, body = $document.find('body'), - winDim = [ $window.innerWidth, $window.innerHeight ], + winDim = [$window.innerWidth, $window.innerHeight], styles = { position: 'absolute' }, margin, offset; @@ -93,7 +93,7 @@ define( options.offsetX !== undefined ? options.offsetX : 0, options.offsetY !== undefined ? options.offsetY : 0 ]; - margin = [ options.marginX, options.marginY ].map(function (m, i) { + margin = [options.marginX, options.marginY].map(function (m, i) { return m === undefined ? (winDim[i] / 2) : m; }).map(adjustNegatives); diff --git a/platform/commonUI/general/src/ui/TreeLabelView.js b/platform/commonUI/general/src/ui/TreeLabelView.js index d5dffb0068..98a82c963d 100644 --- a/platform/commonUI/general/src/ui/TreeLabelView.js +++ b/platform/commonUI/general/src/ui/TreeLabelView.js @@ -75,7 +75,7 @@ define([ this.activeGestures = this.gestureService.attachGestures( this.elements(), domainObject, - [ 'info', 'menu', 'drag' ] + ['info', 'menu', 'drag'] ); } }; diff --git a/platform/commonUI/general/test/StyleSheetLoaderSpec.js b/platform/commonUI/general/test/StyleSheetLoaderSpec.js index a00bdfee81..fe6d8bcc50 100644 --- a/platform/commonUI/general/test/StyleSheetLoaderSpec.js +++ b/platform/commonUI/general/test/StyleSheetLoaderSpec.js @@ -47,7 +47,7 @@ define( mockPlainDocument = jasmine.createSpyObj("document", ["createElement"]); - mockDocument = [ mockPlainDocument ]; + mockDocument = [mockPlainDocument]; mockDocument.find = jasmine.createSpy("$document.find"); mockHead = jasmine.createSpyObj("head", ["append"]); mockElement = jasmine.createSpyObj("link", ["setAttribute"]); diff --git a/platform/commonUI/general/test/controllers/ActionGroupControllerSpec.js b/platform/commonUI/general/test/controllers/ActionGroupControllerSpec.js index 104f9dd9db..4e0195f09d 100644 --- a/platform/commonUI/general/test/controllers/ActionGroupControllerSpec.js +++ b/platform/commonUI/general/test/controllers/ActionGroupControllerSpec.js @@ -92,4 +92,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/test/controllers/BottomBarControllerSpec.js b/platform/commonUI/general/test/controllers/BottomBarControllerSpec.js index 2b3614fe67..cc58d4558c 100644 --- a/platform/commonUI/general/test/controllers/BottomBarControllerSpec.js +++ b/platform/commonUI/general/test/controllers/BottomBarControllerSpec.js @@ -35,11 +35,13 @@ define( beforeEach(function () { mockIndicator = jasmine.createSpyObj( "indicator", - [ "getGlyph", "getText" ] + ["getGlyph", "getText"] ); testIndicatorA = {}; - testIndicatorB = function () { return mockIndicator; }; + testIndicatorB = function () { + return mockIndicator; + }; testIndicatorC = { template: "someTemplate" }; testIndicators = [ @@ -71,4 +73,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/test/controllers/ClickAwayControllerSpec.js b/platform/commonUI/general/test/controllers/ClickAwayControllerSpec.js index 0bd6cc0bdb..e2b9f62c91 100644 --- a/platform/commonUI/general/test/controllers/ClickAwayControllerSpec.js +++ b/platform/commonUI/general/test/controllers/ClickAwayControllerSpec.js @@ -32,7 +32,7 @@ define( beforeEach(function () { mockDocument = jasmine.createSpyObj( "$document", - [ "on", "off" ] + ["on", "off"] ); mockTimeout = jasmine.createSpy('timeout'); controller = new ClickAwayController( diff --git a/platform/commonUI/general/test/controllers/ContextMenuControllerSpec.js b/platform/commonUI/general/test/controllers/ContextMenuControllerSpec.js index 215a06727f..0f56caa714 100644 --- a/platform/commonUI/general/test/controllers/ContextMenuControllerSpec.js +++ b/platform/commonUI/general/test/controllers/ContextMenuControllerSpec.js @@ -57,4 +57,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/test/controllers/DateTimePickerControllerSpec.js b/platform/commonUI/general/test/controllers/DateTimePickerControllerSpec.js index 25f6b7b7a7..0f7b4069ad 100644 --- a/platform/commonUI/general/test/controllers/DateTimePickerControllerSpec.js +++ b/platform/commonUI/general/test/controllers/DateTimePickerControllerSpec.js @@ -48,7 +48,7 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( "$scope", - [ "$apply", "$watch", "$watchCollection" ] + ["$apply", "$watch", "$watchCollection"] ); mockScope.ngModel = {}; mockScope.field = "testField"; diff --git a/platform/commonUI/general/test/controllers/GetterSetterControllerSpec.js b/platform/commonUI/general/test/controllers/GetterSetterControllerSpec.js index eed62b58e3..a9b1ff7440 100644 --- a/platform/commonUI/general/test/controllers/GetterSetterControllerSpec.js +++ b/platform/commonUI/general/test/controllers/GetterSetterControllerSpec.js @@ -80,4 +80,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/test/controllers/ObjectInspectorControllerSpec.js b/platform/commonUI/general/test/controllers/ObjectInspectorControllerSpec.js index 77562aca7e..197a5f3745 100644 --- a/platform/commonUI/general/test/controllers/ObjectInspectorControllerSpec.js +++ b/platform/commonUI/general/test/controllers/ObjectInspectorControllerSpec.js @@ -39,35 +39,35 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( "$scope", - [ "$watch" ] + ["$watch"] ); mockScope.ngModel = {}; mockScope.ngModel.selectedObject = 'mock selected object'; - + mockObjectService = jasmine.createSpyObj( "objectService", - [ "getObjects" ] + ["getObjects"] ); mockPromise = jasmine.createSpyObj( "promise", - [ "then" ] + ["then"] ); mockObjectService.getObjects.andReturn(mockPromise); - + mockDomainObject = jasmine.createSpyObj( "selectedObject", - [ "hasCapability", "getCapability", "useCapability", "getModel" ] + ["hasCapability", "getCapability", "useCapability", "getModel"] ); mockDomainObject.getModel.andReturn({location: 'somewhere'}); mockDomainObject.hasCapability.andReturn(true); - + mockContextCapability = jasmine.createSpyObj( "context capability", - [ "getParent" ] + ["getParent"] ); mockLocationCapability = jasmine.createSpyObj( "location capability", - [ "isLink" ] + ["isLink"] ); mockDomainObject.getCapability.andCallFake(function (param) { if (param === 'location') { @@ -76,9 +76,9 @@ define( return mockContextCapability; } }); - + controller = new ObjectInspectorController(mockScope, mockObjectService); - + // Change the selected object to trigger the watch call mockScope.ngModel.selectedObject = mockDomainObject; }); @@ -94,17 +94,17 @@ define( it("if link, looks for primary parent objects", function () { mockLocationCapability.isLink.andReturn(true); - + mockScope.$watch.mostRecentCall.args[1](); expect(mockDomainObject.getModel).toHaveBeenCalled(); expect(mockObjectService.getObjects).toHaveBeenCalled(); mockPromise.then.mostRecentCall.args[0]({'somewhere': mockDomainObject}); }); - + it("gets metadata", function () { mockScope.$watch.mostRecentCall.args[1](); expect(mockDomainObject.useCapability).toHaveBeenCalledWith('metadata'); }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/test/controllers/SelectorControllerSpec.js b/platform/commonUI/general/test/controllers/SelectorControllerSpec.js index 9deba559c0..584c7fb8bb 100644 --- a/platform/commonUI/general/test/controllers/SelectorControllerSpec.js +++ b/platform/commonUI/general/test/controllers/SelectorControllerSpec.js @@ -43,7 +43,7 @@ define( function makeMockObject(id) { var mockObject = jasmine.createSpyObj( 'object-' + id, - [ 'getId' ] + ['getId'] ); mockObject.getId.andReturn(id); return mockObject; @@ -60,15 +60,15 @@ define( ); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getCapability', 'hasCapability' ] + ['getCapability', 'hasCapability'] ); mockType = jasmine.createSpyObj( 'type', - [ 'instanceOf' ] + ['instanceOf'] ); mockDomainObjects = {}; - [ "ROOT", "abc", "def", "xyz" ].forEach(function (id) { + ["ROOT", "abc", "def", "xyz"].forEach(function (id) { mockDomainObjects[id] = makeMockObject(id); }); @@ -98,7 +98,7 @@ define( }); it("watches for changes in controlled property", function () { - var testValue = [ "a", "b", 1, 2 ]; + var testValue = ["a", "b", 1, 2]; // This test is sensitive to ordering of watch calls expect(mockScope.$watchCollection.calls.length).toEqual(1); // Make sure we're watching the correct object @@ -131,7 +131,7 @@ define( }); it("loads objects when the underlying list changes", function () { - var testIds = [ "abc", "def", "xyz" ]; + var testIds = ["abc", "def", "xyz"]; // This test is sensitive to ordering of watch calls expect(mockScope.$watchCollection.calls.length).toEqual(1); // Make sure we're watching the correct object diff --git a/platform/commonUI/general/test/controllers/TimeRangeControllerSpec.js b/platform/commonUI/general/test/controllers/TimeRangeControllerSpec.js index 99a1ad288f..718dd2664f 100644 --- a/platform/commonUI/general/test/controllers/TimeRangeControllerSpec.js +++ b/platform/commonUI/general/test/controllers/TimeRangeControllerSpec.js @@ -56,16 +56,16 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( "$scope", - [ "$apply", "$watch", "$watchCollection" ] + ["$apply", "$watch", "$watchCollection"] ); mockFormatService = jasmine.createSpyObj( "formatService", - [ "getFormat" ] + ["getFormat"] ); testDefaultFormat = 'utc'; mockFormat = jasmine.createSpyObj( "format", - [ "validate", "format", "parse" ] + ["validate", "format", "parse"] ); mockFormatService.getFormat.andReturn(mockFormat); diff --git a/platform/commonUI/general/test/controllers/ToggleControllerSpec.js b/platform/commonUI/general/test/controllers/ToggleControllerSpec.js index 3ee52e2702..e4f56237ca 100644 --- a/platform/commonUI/general/test/controllers/ToggleControllerSpec.js +++ b/platform/commonUI/general/test/controllers/ToggleControllerSpec.js @@ -59,4 +59,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/test/controllers/TreeNodeControllerSpec.js b/platform/commonUI/general/test/controllers/TreeNodeControllerSpec.js index e6954574a3..0a196b10a8 100644 --- a/platform/commonUI/general/test/controllers/TreeNodeControllerSpec.js +++ b/platform/commonUI/general/test/controllers/TreeNodeControllerSpec.js @@ -32,7 +32,9 @@ define( function TestObject(id, context) { return { - getId: function () { return id; }, + getId: function () { + return id; + }, getCapability: function (key) { return key === 'context' ? context : undefined; } @@ -44,7 +46,7 @@ define( mockTimeout = jasmine.createSpy("$timeout"); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability", "getModel", "useCapability" ] + ["getId", "getCapability", "getModel", "useCapability"] ); controller = new TreeNodeController(mockScope, mockTimeout); @@ -71,7 +73,7 @@ define( // This is needed to highlight the current selection var mockContext = jasmine.createSpyObj( "context", - [ "getParent", "getPath", "getRoot" ] + ["getParent", "getPath", "getRoot"] ), obj = new TestObject("test-object", mockContext); @@ -92,11 +94,11 @@ define( it("expands a node if it is on the navigation path", function () { var mockParentContext = jasmine.createSpyObj( "parentContext", - [ "getParent", "getPath", "getRoot" ] + ["getParent", "getPath", "getRoot"] ), mockChildContext = jasmine.createSpyObj( "childContext", - [ "getParent", "getPath", "getRoot" ] + ["getParent", "getPath", "getRoot"] ), parent = new TestObject("parent", mockParentContext), child = new TestObject("child", mockChildContext); @@ -128,11 +130,11 @@ define( it("does not expand a node if it is not on the navigation path", function () { var mockParentContext = jasmine.createSpyObj( "parentContext", - [ "getParent", "getPath", "getRoot" ] + ["getParent", "getPath", "getRoot"] ), mockChildContext = jasmine.createSpyObj( "childContext", - [ "getParent", "getPath", "getRoot" ] + ["getParent", "getPath", "getRoot"] ), parent = new TestObject("parent", mockParentContext), child = new TestObject("child", mockChildContext); @@ -161,11 +163,11 @@ define( it("does not expand a node if no context is available", function () { var mockParentContext = jasmine.createSpyObj( "parentContext", - [ "getParent", "getPath", "getRoot" ] + ["getParent", "getPath", "getRoot"] ), mockChildContext = jasmine.createSpyObj( "childContext", - [ "getParent", "getPath", "getRoot" ] + ["getParent", "getPath", "getRoot"] ), parent = new TestObject("parent", mockParentContext), child = new TestObject("child", undefined); diff --git a/platform/commonUI/general/test/controllers/ViewSwitcherControllerSpec.js b/platform/commonUI/general/test/controllers/ViewSwitcherControllerSpec.js index a1c87b07a5..fb381e680d 100644 --- a/platform/commonUI/general/test/controllers/ViewSwitcherControllerSpec.js +++ b/platform/commonUI/general/test/controllers/ViewSwitcherControllerSpec.js @@ -33,9 +33,11 @@ define( controller; beforeEach(function () { - mockScope = jasmine.createSpyObj("$scope", [ "$watch" ]); + mockScope = jasmine.createSpyObj("$scope", ["$watch"]); mockTimeout = jasmine.createSpy("$timeout"); - mockTimeout.andCallFake(function (cb) { cb(); }); + mockTimeout.andCallFake(function (cb) { + cb(); + }); mockScope.ngModel = {}; controller = new ViewSwitcherController(mockScope, mockTimeout); }); @@ -108,4 +110,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/test/directives/MCTClickElsewhereSpec.js b/platform/commonUI/general/test/directives/MCTClickElsewhereSpec.js index 2feb490a9b..2e782a1a01 100644 --- a/platform/commonUI/general/test/directives/MCTClickElsewhereSpec.js +++ b/platform/commonUI/general/test/directives/MCTClickElsewhereSpec.js @@ -24,7 +24,7 @@ define( ["../../src/directives/MCTClickElsewhere"], function (MCTClickElsewhere) { - var JQLITE_METHODS = [ "on", "off", "find", "parent" ]; + var JQLITE_METHODS = ["on", "off", "find", "parent"]; describe("The mct-click-elsewhere directive", function () { var mockDocument, @@ -48,7 +48,7 @@ define( mockDocument = jasmine.createSpyObj("$document", JQLITE_METHODS); mockScope = - jasmine.createSpyObj("$scope", [ "$eval", "$apply", "$on" ]); + jasmine.createSpyObj("$scope", ["$eval", "$apply", "$on"]); mockElement = jasmine.createSpyObj("element", JQLITE_METHODS); mockBody = diff --git a/platform/commonUI/general/test/directives/MCTContainerSpec.js b/platform/commonUI/general/test/directives/MCTContainerSpec.js index 1247a84e49..745131c30c 100644 --- a/platform/commonUI/general/test/directives/MCTContainerSpec.js +++ b/platform/commonUI/general/test/directives/MCTContainerSpec.js @@ -35,7 +35,7 @@ define( bundle: { path: "x", resources: "y" }, template: "bar", key: "xyz", - attributes: [ "someAttr", "someOtherAttr" ] + attributes: ["someAttr", "someOtherAttr"] } ], mctContainer; @@ -85,4 +85,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/test/directives/MCTDragSpec.js b/platform/commonUI/general/test/directives/MCTDragSpec.js index e5236c79c5..3160660906 100644 --- a/platform/commonUI/general/test/directives/MCTDragSpec.js +++ b/platform/commonUI/general/test/directives/MCTDragSpec.js @@ -24,7 +24,7 @@ define( ["../../src/directives/MCTDrag"], function (MCTDrag) { - var JQLITE_METHODS = [ "on", "off", "find" ]; + var JQLITE_METHODS = ["on", "off", "find"]; describe("The mct-drag directive", function () { var mockDocument, @@ -46,7 +46,7 @@ define( mockDocument = jasmine.createSpyObj("$document", JQLITE_METHODS); mockScope = - jasmine.createSpyObj("$scope", [ "$eval", "$apply" ]); + jasmine.createSpyObj("$scope", ["$eval", "$apply"]); mockElement = jasmine.createSpyObj("element", JQLITE_METHODS); mockBody = diff --git a/platform/commonUI/general/test/directives/MCTPopupSpec.js b/platform/commonUI/general/test/directives/MCTPopupSpec.js index bfe6b469cb..372dd4b042 100644 --- a/platform/commonUI/general/test/directives/MCTPopupSpec.js +++ b/platform/commonUI/general/test/directives/MCTPopupSpec.js @@ -24,7 +24,7 @@ define( ["../../src/directives/MCTPopup"], function (MCTPopup) { - var JQLITE_METHODS = [ "on", "off", "find", "parent", "css", "append" ]; + var JQLITE_METHODS = ["on", "off", "find", "parent", "css", "append"]; describe("The mct-popup directive", function () { var mockCompile, @@ -48,7 +48,7 @@ define( mockPopup = jasmine.createSpyObj("popup", ["dismiss"]); mockScope = - jasmine.createSpyObj("$scope", [ "$eval", "$apply", "$on" ]); + jasmine.createSpyObj("$scope", ["$eval", "$apply", "$on"]); mockElement = jasmine.createSpyObj("element", JQLITE_METHODS); mockBody = @@ -98,7 +98,7 @@ define( it("displays as a popup", function () { expect(mockPopupService.display).toHaveBeenCalledWith( mockNewElement, - [ testRect.left, testRect.top ] + [testRect.left, testRect.top] ); }); diff --git a/platform/commonUI/general/test/directives/MCTScrollSpec.js b/platform/commonUI/general/test/directives/MCTScrollSpec.js index e1b22965c7..4f59681696 100644 --- a/platform/commonUI/general/test/directives/MCTScrollSpec.js +++ b/platform/commonUI/general/test/directives/MCTScrollSpec.js @@ -112,4 +112,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/test/directives/MCTSplitPaneSpec.js b/platform/commonUI/general/test/directives/MCTSplitPaneSpec.js index 75495a195b..6a4fc18634 100644 --- a/platform/commonUI/general/test/directives/MCTSplitPaneSpec.js +++ b/platform/commonUI/general/test/directives/MCTSplitPaneSpec.js @@ -203,4 +203,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/test/directives/MCTSplitterSpec.js b/platform/commonUI/general/test/directives/MCTSplitterSpec.js index c2465b957a..a6f4cd92ab 100644 --- a/platform/commonUI/general/test/directives/MCTSplitterSpec.js +++ b/platform/commonUI/general/test/directives/MCTSplitterSpec.js @@ -48,16 +48,16 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( '$scope', - [ '$on', '$watch' ] + ['$on', '$watch'] ); mockElement = jasmine.createSpyObj( 'element', - [ 'addClass' ] + ['addClass'] ); testAttrs = {}; mockSplitPane = jasmine.createSpyObj( 'mctSplitPane', - [ 'position', 'toggleClass', 'anchor' ] + ['position', 'toggleClass', 'anchor'] ); mctSplitter.link( @@ -92,7 +92,7 @@ define( }); it("repositions during drag", function () { - mockScope.splitter.move([ 10, 0 ]); + mockScope.splitter.move([10, 0]); expect(mockSplitPane.position) .toHaveBeenCalledWith(testPosition + 10); }); diff --git a/platform/commonUI/general/test/directives/MCTTreeSpec.js b/platform/commonUI/general/test/directives/MCTTreeSpec.js index 80854685e6..76f1fb9b02 100644 --- a/platform/commonUI/general/test/directives/MCTTreeSpec.js +++ b/platform/commonUI/general/test/directives/MCTTreeSpec.js @@ -32,7 +32,7 @@ define([ beforeEach(function () { mockGestureService = jasmine.createSpyObj( 'gestureService', - [ 'attachGestures' ] + ['attachGestures'] ); mockParse = jasmine.createSpy('$parse'); mockExpr = jasmine.createSpy('expr'); diff --git a/platform/commonUI/general/test/services/PopupServiceSpec.js b/platform/commonUI/general/test/services/PopupServiceSpec.js index e4819ced64..79c920a164 100644 --- a/platform/commonUI/general/test/services/PopupServiceSpec.js +++ b/platform/commonUI/general/test/services/PopupServiceSpec.js @@ -33,9 +33,9 @@ define( popupService; beforeEach(function () { - mockDocument = jasmine.createSpyObj('$document', [ 'find' ]); + mockDocument = jasmine.createSpyObj('$document', ['find']); testWindow = { innerWidth: 1000, innerHeight: 800 }; - mockBody = jasmine.createSpyObj('body', [ 'append' ]); + mockBody = jasmine.createSpyObj('body', ['append']); mockElement = jasmine.createSpyObj('element', [ 'css', 'remove' @@ -49,13 +49,13 @@ define( }); it("adds elements to the body of the document", function () { - popupService.display(mockElement, [ 0, 0 ]); + popupService.display(mockElement, [0, 0]); expect(mockBody.append).toHaveBeenCalledWith(mockElement); }); describe("when positioned in appropriate quadrants", function () { it("orients elements relative to the top-left", function () { - popupService.display(mockElement, [ 25, 50 ]); + popupService.display(mockElement, [25, 50]); expect(mockElement.css).toHaveBeenCalledWith({ position: 'absolute', left: '25px', @@ -64,7 +64,7 @@ define( }); it("orients elements relative to the top-right", function () { - popupService.display(mockElement, [ 800, 50 ]); + popupService.display(mockElement, [800, 50]); expect(mockElement.css).toHaveBeenCalledWith({ position: 'absolute', right: '200px', @@ -73,7 +73,7 @@ define( }); it("orients elements relative to the bottom-right", function () { - popupService.display(mockElement, [ 800, 650 ]); + popupService.display(mockElement, [800, 650]); expect(mockElement.css).toHaveBeenCalledWith({ position: 'absolute', right: '200px', @@ -82,7 +82,7 @@ define( }); it("orients elements relative to the bottom-left", function () { - popupService.display(mockElement, [ 120, 650 ]); + popupService.display(mockElement, [120, 650]); expect(mockElement.css).toHaveBeenCalledWith({ position: 'absolute', left: '120px', diff --git a/platform/commonUI/general/test/services/PopupSpec.js b/platform/commonUI/general/test/services/PopupSpec.js index ca36bb8a4a..3f3e4c7e4e 100644 --- a/platform/commonUI/general/test/services/PopupSpec.js +++ b/platform/commonUI/general/test/services/PopupSpec.js @@ -32,7 +32,7 @@ define( beforeEach(function () { mockElement = - jasmine.createSpyObj('element', [ 'css', 'remove' ]); + jasmine.createSpyObj('element', ['css', 'remove']); testStyles = { left: '12px', top: '14px' }; popup = new Popup(mockElement, testStyles); }); diff --git a/platform/commonUI/general/test/services/UrlServiceSpec.js b/platform/commonUI/general/test/services/UrlServiceSpec.js index 38e9de8886..e956fb657d 100644 --- a/platform/commonUI/general/test/services/UrlServiceSpec.js +++ b/platform/commonUI/general/test/services/UrlServiceSpec.js @@ -36,19 +36,19 @@ define( testViews; beforeEach(function () { - // Creates a mockLocation, used to + // Creates a mockLocation, used to // do the view search mockLocation = jasmine.createSpyObj( "$location", - [ "path", "search" ] + ["path", "search"] ); - - // The mockDomainObject is initialized as a + + // The mockDomainObject is initialized as a // spy object to ultimately be passed into the // urlService urlFor function mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability", "getModel", "useCapability" ] + ["getId", "getCapability", "getModel", "useCapability"] ); mockContext = jasmine.createSpyObj('context', ['getPath']); testViews = [ @@ -57,39 +57,39 @@ define( { key: 'xyz' } ]; mockMode = "browse"; - + // The mockContext is set a path // for the mockDomainObject mockContext.getPath.andReturn( [mockDomainObject] ); - + // view capability used with the testviews made mockDomainObject.useCapability.andCallFake(function (c) { return (c === 'view') && testViews; }); - + // context capability used with the mockContext created // so the variables including context in the urlFor are // initialized and reached mockDomainObject.getCapability.andCallFake(function (c) { return c === 'context' && mockContext; }); - + // Uses the mockLocation to get the current // "mock" website's view mockLocation.search.andReturn({ view: 'def' }); - + urlService = new UrlService(mockLocation); }); - + it("get url for a location using domainObject and mode", function () { urlService.urlForLocation(mockMode, mockDomainObject); }); - + it("get url for a new tab using domainObject and mode", function () { urlService.urlForNewTab(mockMode, mockDomainObject); }); }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/test/ui/TreeViewSpec.js b/platform/commonUI/general/test/ui/TreeViewSpec.js index 821d5489a9..1e492d4bfd 100644 --- a/platform/commonUI/general/test/ui/TreeViewSpec.js +++ b/platform/commonUI/general/test/ui/TreeViewSpec.js @@ -63,7 +63,7 @@ define([ beforeEach(function () { mockGestureService = jasmine.createSpyObj( 'gestureService', - [ 'attachGestures' ] + ['attachGestures'] ); mockGestureHandle = jasmine.createSpyObj('gestures', ['destroy']); @@ -100,15 +100,15 @@ define([ function makeGenericCapabilities() { var mockContext = - jasmine.createSpyObj('context', [ 'getPath' ]), + jasmine.createSpyObj('context', ['getPath']), mockType = - jasmine.createSpyObj('type', [ 'getGlyph' ]), + jasmine.createSpyObj('type', ['getGlyph']), mockLocation = - jasmine.createSpyObj('location', [ 'isLink' ]), + jasmine.createSpyObj('location', ['isLink']), mockMutation = - jasmine.createSpyObj('mutation', [ 'listen' ]), + jasmine.createSpyObj('mutation', ['listen']), mockStatus = - jasmine.createSpyObj('status', [ 'listen', 'list' ]); + jasmine.createSpyObj('status', ['listen', 'list']); mockStatus.list.andReturn([]); @@ -231,7 +231,7 @@ define([ calledBackInner = false; newCapabilities.composition = - jasmine.createSpyObj('composition', [ 'invoke' ]); + jasmine.createSpyObj('composition', ['invoke']); newCapabilities.composition.invoke .andReturn(Promise.resolve([mockGrandchild])); mockComposition.push(mockNewChild); @@ -274,7 +274,7 @@ define([ beforeEach(function () { var mockStatus = mockComposition[1].getCapability('status'); - testStatuses = [ 'foo' ]; + testStatuses = ['foo']; mockStatus.list.andReturn(testStatuses); mockStatus.listen.mostRecentCall.args[0](testStatuses); diff --git a/platform/commonUI/inspect/src/InfoConstants.js b/platform/commonUI/inspect/src/InfoConstants.js index c50a735998..93fa863ed6 100644 --- a/platform/commonUI/inspect/src/InfoConstants.js +++ b/platform/commonUI/inspect/src/InfoConstants.js @@ -40,7 +40,7 @@ define({ offsetX: 0, offsetY: -26 }, - BUBBLE_MOBILE_POSITION: [ 0, -25 ], + BUBBLE_MOBILE_POSITION: [0, -25], // Max width and margins allowed for bubbles; // defined in /platform/commonUI/general/res/sass/_constants.scss BUBBLE_MARGIN_LR: 10, diff --git a/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js b/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js index c8804fa10d..5dbee8177d 100644 --- a/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js +++ b/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js @@ -45,7 +45,7 @@ define( // Record touch position, so bubble can be shown at latest // touch position, also offset by 22px to left (accounts for // a finger-sized touch on the info button) - touchPosition = [ event.clientX - 22, event.clientY ]; + touchPosition = [event.clientX - 22, event.clientY]; } // Hides the bubble and detaches the diff --git a/platform/commonUI/inspect/src/gestures/InfoGesture.js b/platform/commonUI/inspect/src/gestures/InfoGesture.js index 7cc8826706..de5324d490 100644 --- a/platform/commonUI/inspect/src/gestures/InfoGesture.js +++ b/platform/commonUI/inspect/src/gestures/InfoGesture.js @@ -71,7 +71,7 @@ define( InfoGesture.prototype.trackPosition = function (event) { // Record mouse position, so bubble can be shown at latest // mouse position (not just where the mouse entered) - this.mousePosition = [ event.clientX, event.clientY ]; + this.mousePosition = [event.clientX, event.clientY]; }; InfoGesture.prototype.hideBubble = function () { diff --git a/platform/commonUI/inspect/test/gestures/InfoButtonGestureSpec.js b/platform/commonUI/inspect/test/gestures/InfoButtonGestureSpec.js index e9737223a7..781bfd3769 100644 --- a/platform/commonUI/inspect/test/gestures/InfoButtonGestureSpec.js +++ b/platform/commonUI/inspect/test/gestures/InfoButtonGestureSpec.js @@ -44,28 +44,28 @@ define( beforeEach(function () { mockTimeout = jasmine.createSpy('$timeout'); mockDocument = jasmine.createSpyObj('$document', ['find']); - mockBody = jasmine.createSpyObj('body', [ 'on', 'off', 'scope', 'css', 'unbind' ]); + mockBody = jasmine.createSpyObj('body', ['on', 'off', 'scope', 'css', 'unbind']); mockDocument.find.andReturn(mockBody); mockAgentService = jasmine.createSpyObj('agentService', ['isMobile', 'isPhone']); mockInfoService = jasmine.createSpyObj( 'infoService', - [ 'display' ] + ['display'] ); mockElement = jasmine.createSpyObj( 'element', - [ 'on', 'off', 'scope', 'css' ] + ['on', 'off', 'scope', 'css'] ); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getCapability', 'useCapability', 'getModel' ] + ['getId', 'getCapability', 'useCapability', 'getModel'] ); mockEvent = jasmine.createSpyObj("event", ["preventDefault", "stopPropagation"]); mockEvent.pageX = 0; mockEvent.pageY = 0; - mockScope = jasmine.createSpyObj('$scope', [ '$on' ]); + mockScope = jasmine.createSpyObj('$scope', ['$on']); mockOff = jasmine.createSpy('$off'); - testMetadata = [ { name: "Test name", value: "Test value" } ]; + testMetadata = [{ name: "Test name", value: "Test value" }]; mockHide = jasmine.createSpy('hide'); mockDomainObject.getModel.andReturn({ name: "Test Object" }); diff --git a/platform/commonUI/inspect/test/gestures/InfoGestureSpec.js b/platform/commonUI/inspect/test/gestures/InfoGestureSpec.js index f1ed589fe0..e135a24adb 100644 --- a/platform/commonUI/inspect/test/gestures/InfoGestureSpec.js +++ b/platform/commonUI/inspect/test/gestures/InfoGestureSpec.js @@ -52,19 +52,19 @@ define( mockAgentService = jasmine.createSpyObj('agentService', ['isMobile']); mockInfoService = jasmine.createSpyObj( 'infoService', - [ 'display' ] + ['display'] ); mockElement = jasmine.createSpyObj( 'element', - [ 'on', 'off', 'scope', 'css' ] + ['on', 'off', 'scope', 'css'] ); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getCapability', 'useCapability', 'getModel' ] + ['getId', 'getCapability', 'useCapability', 'getModel'] ); - mockScope = jasmine.createSpyObj('$scope', [ '$on' ]); + mockScope = jasmine.createSpyObj('$scope', ['$on']); mockOff = jasmine.createSpy('$off'); - testMetadata = [ { name: "Test name", value: "Test value" } ]; + testMetadata = [{ name: "Test name", value: "Test value" }]; mockPromise = jasmine.createSpyObj('promise', ['then']); mockHide = jasmine.createSpy('hide'); @@ -101,7 +101,7 @@ define( jasmine.any(String), "Test Object", testMetadata, - [ 1977, 42 ] + [1977, 42] ); }); @@ -130,7 +130,7 @@ define( jasmine.any(String), "Test Object", testMetadata, - [ 1984, 11 ] + [1984, 11] ); }); diff --git a/platform/commonUI/inspect/test/services/InfoServiceSpec.js b/platform/commonUI/inspect/test/services/InfoServiceSpec.js index 4be6201257..de81f943e0 100644 --- a/platform/commonUI/inspect/test/services/InfoServiceSpec.js +++ b/platform/commonUI/inspect/test/services/InfoServiceSpec.js @@ -79,7 +79,7 @@ define( service.display('', '', {}, [123, 456]); expect(mockPopupService.display).toHaveBeenCalledWith( mockElements[0], - [ 123, 456 ], + [123, 456], jasmine.any(Object) ); }); @@ -102,16 +102,16 @@ define( service.display('', '', {}, [123, 456]); expect(mockPopupService.display).toHaveBeenCalledWith( mockElements[0], - [ 0, -25 ], + [0, -25], jasmine.any(Object) ); }); - [ false, true ].forEach(function (goesLeft) { - [ false, true].forEach(function (goesUp) { + [false, true].forEach(function (goesLeft) { + [false, true].forEach(function (goesUp) { var vertical = goesUp ? "up" : "down", horizontal = goesLeft ? "left" : "right", - location = [ vertical, horizontal].join('-'); + location = [vertical, horizontal].join('-'); describe("when bubble goes " + location, function () { var expectedLocation = [ goesUp ? "bottom" : "top", @@ -123,7 +123,7 @@ define( mockPopup.goesDown.andReturn(!goesUp); mockPopup.goesLeft.andReturn(goesLeft); mockPopup.goesRight.andReturn(!goesLeft); - service.display('', '', {}, [ 10, 10 ]); + service.display('', '', {}, [10, 10]); }); it("positions the arrow in the " + expectedLocation, function () { diff --git a/platform/commonUI/mobile/src/DeviceClassifier.js b/platform/commonUI/mobile/src/DeviceClassifier.js index ce34425ab8..6801c00d02 100644 --- a/platform/commonUI/mobile/src/DeviceClassifier.js +++ b/platform/commonUI/mobile/src/DeviceClassifier.js @@ -54,4 +54,4 @@ define( return MobileClassifier; } -); \ No newline at end of file +); diff --git a/platform/commonUI/mobile/src/DeviceMatchers.js b/platform/commonUI/mobile/src/DeviceMatchers.js index bfd1e80ad0..5b6452641c 100644 --- a/platform/commonUI/mobile/src/DeviceMatchers.js +++ b/platform/commonUI/mobile/src/DeviceMatchers.js @@ -55,4 +55,4 @@ define(function () { return agentService.isTouch(); } }; -}); \ No newline at end of file +}); diff --git a/platform/commonUI/mobile/test/DeviceClassifierSpec.js b/platform/commonUI/mobile/test/DeviceClassifierSpec.js index 4513b0d926..ab6ca51433 100644 --- a/platform/commonUI/mobile/test/DeviceClassifierSpec.js +++ b/platform/commonUI/mobile/test/DeviceClassifierSpec.js @@ -34,11 +34,11 @@ define( 'isTouch' ], TEST_PERMUTATIONS = [ - [ 'isMobile', 'isPhone', 'isTouch', 'isPortrait' ], - [ 'isMobile', 'isPhone', 'isTouch', 'isLandscape' ], - [ 'isMobile', 'isTablet', 'isTouch', 'isPortrait' ], - [ 'isMobile', 'isTablet', 'isTouch', 'isLandscape' ], - [ 'isTouch' ], + ['isMobile', 'isPhone', 'isTouch', 'isPortrait'], + ['isMobile', 'isPhone', 'isTouch', 'isLandscape'], + ['isMobile', 'isTablet', 'isTouch', 'isPortrait'], + ['isMobile', 'isTablet', 'isTouch', 'isLandscape'], + ['isTouch'], [] ]; @@ -54,11 +54,11 @@ define( ); mockDocument = jasmine.createSpyObj( '$document', - [ 'find' ] + ['find'] ); mockBody = jasmine.createSpyObj( 'body', - [ 'addClass' ] + ['addClass'] ); mockDocument.find.andCallFake(function (sel) { return sel === 'body' && mockBody; diff --git a/platform/commonUI/mobile/test/DeviceMatchersSpec.js b/platform/commonUI/mobile/test/DeviceMatchersSpec.js index 387c1c8f9b..cbdce4bf91 100644 --- a/platform/commonUI/mobile/test/DeviceMatchersSpec.js +++ b/platform/commonUI/mobile/test/DeviceMatchersSpec.js @@ -76,4 +76,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/commonUI/mobile/test/MCTDeviceSpec.js b/platform/commonUI/mobile/test/MCTDeviceSpec.js index b38d91138a..aef828cf54 100644 --- a/platform/commonUI/mobile/test/MCTDeviceSpec.js +++ b/platform/commonUI/mobile/test/MCTDeviceSpec.js @@ -24,7 +24,7 @@ define( ['../src/MCTDevice'], function (MCTDevice) { - var JQLITE_METHODS = [ 'replaceWith' ]; + var JQLITE_METHODS = ['replaceWith']; describe("The mct-device directive", function () { var mockAgentService, @@ -41,7 +41,7 @@ define( beforeEach(function () { mockAgentService = jasmine.createSpyObj( "agentService", - [ "isMobile", "isPhone", "isTablet", "isPortrait", "isLandscape" ] + ["isMobile", "isPhone", "isTablet", "isPortrait", "isLandscape"] ); mockTransclude = jasmine.createSpy("$transclude"); mockElement = jasmine.createSpyObj(name, JQLITE_METHODS); diff --git a/platform/commonUI/notification/src/NotificationIndicatorController.js b/platform/commonUI/notification/src/NotificationIndicatorController.js index b6e5559196..8a1bdbca2a 100644 --- a/platform/commonUI/notification/src/NotificationIndicatorController.js +++ b/platform/commonUI/notification/src/NotificationIndicatorController.js @@ -42,7 +42,7 @@ define( /** * Launch a dialog showing a list of current notifications. */ - $scope.showNotificationsList = function(){ + $scope.showNotificationsList = function () { dialogService.getDialogResponse('overlay-message-list', { dialog: { title: "Messages", @@ -50,11 +50,11 @@ define( // from the notifications messages: notificationService.notifications }, - cancel: function(){ + cancel: function () { dialogService.dismiss(); } }); - + }; } return NotificationIndicatorController; diff --git a/platform/commonUI/notification/src/NotificationService.js b/platform/commonUI/notification/src/NotificationService.js index 868ccf6f08..8643139f39 100644 --- a/platform/commonUI/notification/src/NotificationService.js +++ b/platform/commonUI/notification/src/NotificationService.js @@ -118,7 +118,7 @@ define( function NotificationService($timeout, topic, DEFAULT_AUTO_DISMISS, MINIMIZE_TIMEOUT) { this.notifications = []; this.$timeout = $timeout; - this.highest ={ severity: "info" }; + this.highest = { severity: "info" }; this.DEFAULT_AUTO_DISMISS = DEFAULT_AUTO_DISMISS; this.MINIMIZE_TIMEOUT = MINIMIZE_TIMEOUT; this.topic = topic; @@ -143,7 +143,7 @@ define( //Check this is a known notification var index = service.notifications.indexOf(notification); - if (service.active.timeout){ + if (service.active.timeout) { /* Method can be called manually (clicking dismiss) or automatically from an auto-timeout. this.active.timeout @@ -157,10 +157,10 @@ define( } if (index >= 0) { - notification.model.minimized=true; + notification.model.minimized = true; //Add a brief timeout before showing the next notification // in order to allow the minimize animation to run through. - service.$timeout(function() { + service.$timeout(function () { service.setActiveNotification(service.selectNextNotification()); }, service.MINIMIZE_TIMEOUT); } @@ -180,7 +180,7 @@ define( //Check this is a known notification var index = service.notifications.indexOf(notification); - if (service.active.timeout){ + if (service.active.timeout) { /* Method can be called manually (clicking dismiss) or * automatically from an auto-timeout. this.active.timeout * acts as a semaphore to prevent race conditions. Cancel any @@ -219,7 +219,7 @@ define( * Returns the notification that is currently visible in the banner area * @returns {Notification} */ - NotificationService.prototype.getActiveNotification = function (){ + NotificationService.prototype.getActiveNotification = function () { return this.active.notification; }; @@ -281,8 +281,8 @@ define( "alert": 2, "error": 3 }; - this.highest.severity = this.notifications.reduce(function(previous, notification){ - if (severity[notification.model.severity] > severity[previous]){ + this.highest.severity = this.notifications.reduce(function (previous, notification) { + if (severity[notification.model.severity] > severity[previous]) { return notification.model.severity; } else { return previous; @@ -308,23 +308,23 @@ define( notification = { model: notificationModel, - minimize: function() { + minimize: function () { self.minimize(self, notification); }, - dismiss: function(){ + dismiss: function () { self.dismiss(self, notification); topic.notify(); }, - dismissOrMinimize: function(){ + dismissOrMinimize: function () { self.dismissOrMinimize(notification); }, - onDismiss: function(callback) { + onDismiss: function (callback) { topic.listen(callback); } }; notificationModel.severity = notificationModel.severity || "info"; - if (notificationModel.autoDismiss === true){ + if (notificationModel.autoDismiss === true) { notificationModel.autoDismiss = this.DEFAULT_AUTO_DISMISS; } @@ -337,7 +337,7 @@ define( notificationModel.options = notificationModel.options || []; notificationModel.options.unshift({ label: "Dismiss", - callback: function() { + callback: function () { notification.dismiss(); } }); @@ -350,10 +350,10 @@ define( /* Check if there is already an active (ie. visible) notification */ - if (!this.active.notification){ + if (!this.active.notification) { this.setActiveNotification(notification); - } else if (!this.active.timeout){ + } else if (!this.active.timeout) { /* If there is already an active notification, time it out. If it's already got a timeout in progress (either because it has had @@ -397,7 +397,7 @@ define( } else { delete this.active.timeout; } - }; + }; /** * Used internally by the NotificationService @@ -406,17 +406,17 @@ define( */ NotificationService.prototype.selectNextNotification = function () { var notification, - i=0; + i = 0; /* Loop through the notifications queue and find the first one that has not already been minimized (manually or otherwise). */ - for (; i< this.notifications.length; i++) { + for (; i < this.notifications.length; i++) { notification = this.notifications[i]; if (!notification.model.minimized && - notification!== this.active.notification) { + notification !== this.active.notification) { return notification; } @@ -425,4 +425,4 @@ define( return NotificationService; } -); \ No newline at end of file +); diff --git a/platform/commonUI/notification/test/NotificationIndicatorControllerSpec.js b/platform/commonUI/notification/test/NotificationIndicatorControllerSpec.js index a6acd28417..222c2fc87b 100644 --- a/platform/commonUI/notification/test/NotificationIndicatorControllerSpec.js +++ b/platform/commonUI/notification/test/NotificationIndicatorControllerSpec.js @@ -30,7 +30,7 @@ define( mockDialogService, controller; - beforeEach(function(){ + beforeEach(function () { mockNotificationService = jasmine.createSpy("notificationService"); mockScope = jasmine.createSpy("$scope"); mockDialogService = jasmine.createSpyObj( @@ -43,12 +43,12 @@ define( controller = new NotificationIndicatorController(mockScope, mockNotificationService, mockDialogService); }); - it("exposes the highest notification severity to the template", function() { + it("exposes the highest notification severity to the template", function () { expect(mockScope.highest).toBeTruthy(); expect(mockScope.highest.severity).toBe("error"); }); - it("invokes the dialog service to show list of messages", function() { + it("invokes the dialog service to show list of messages", function () { expect(mockScope.showNotificationsList).toBeDefined(); mockScope.showNotificationsList(); expect(mockDialogService.getDialogResponse).toHaveBeenCalled(); @@ -60,7 +60,7 @@ define( expect(mockDialogService.dismiss).toHaveBeenCalled(); }); - it("provides a means of dismissing the message list", function() { + it("provides a means of dismissing the message list", function () { expect(mockScope.showNotificationsList).toBeDefined(); mockScope.showNotificationsList(); expect(mockDialogService.getDialogResponse).toHaveBeenCalled(); diff --git a/platform/commonUI/notification/test/NotificationServiceSpec.js b/platform/commonUI/notification/test/NotificationServiceSpec.js index 7590589f0b..ebc02445c8 100644 --- a/platform/commonUI/notification/test/NotificationServiceSpec.js +++ b/platform/commonUI/notification/test/NotificationServiceSpec.js @@ -34,7 +34,7 @@ define( mockTopicObject, errorModel; - beforeEach(function(){ + beforeEach(function () { mockTimeout = jasmine.createSpy("$timeout"); mockTopicFunction = jasmine.createSpy("topic"); mockTopicObject = jasmine.createSpyObj("topicObject", ["listen", "notify"]); @@ -54,14 +54,14 @@ define( }); it("gets a new success notification, making" + - " the notification active", function() { + " the notification active", function () { var activeNotification; notificationService.notify(successModel); activeNotification = notificationService.getActiveNotification(); expect(activeNotification.model).toBe(successModel); }); - it("notifies listeners on dismissal of notification", function() { + it("notifies listeners on dismissal of notification", function () { var notification, dismissListener = jasmine.createSpy("ondismiss"); notification = notificationService.notify(successModel); @@ -75,7 +75,7 @@ define( }); it("allows specification of an info notification given just a" + - " title, making the notification active", function() { + " title, making the notification active", function () { var activeNotification, notificationTitle = "Test info notification"; notificationService.info(notificationTitle); @@ -85,7 +85,7 @@ define( }); it("gets a new success notification with" + - " numerical auto-dismiss specified. ", function() { + " numerical auto-dismiss specified. ", function () { var activeNotification; successModel.autoDismiss = 1000; notificationService.notify(successModel); @@ -99,7 +99,7 @@ define( }); it("gets a new notification with" + - " boolean auto-dismiss specified. ", function() { + " boolean auto-dismiss specified. ", function () { var activeNotification; successModel.autoDismiss = true; notificationService.notify(successModel); @@ -112,7 +112,7 @@ define( expect(activeNotification).toBeUndefined(); }); - it("allows minimization of notifications", function() { + it("allows minimization of notifications", function () { var notification, activeNotification; @@ -128,7 +128,7 @@ define( expect(notificationService.notifications.length).toBe(1); }); - it("allows dismissal of notifications", function() { + it("allows dismissal of notifications", function () { var notification, activeNotification; @@ -143,9 +143,9 @@ define( expect(notificationService.notifications.length).toBe(0); }); - describe(" gets called with multiple notifications", function(){ + describe(" gets called with multiple notifications", function () { it("auto-dismisses the previously active notification, making" + - " the new notification active", function() { + " the new notification active", function () { var activeNotification; //First pre-load with a info message notificationService.notify(successModel); @@ -165,7 +165,7 @@ define( activeNotification = notificationService.getActiveNotification(); expect(activeNotification.model).toBe(errorModel); }); - it("auto-minimizes an active error notification", function() { + it("auto-minimizes an active error notification", function () { var activeNotification; //First pre-load with an error message notificationService.notify(errorModel); @@ -187,7 +187,7 @@ define( expect(errorModel.minimized).toEqual(true); }); it("auto-minimizes errors when a number of them arrive in" + - " short succession ", function() { + " short succession ", function () { var activeNotification, error2 = { title: "Second Mock Error Notification", diff --git a/platform/commonUI/regions/src/EditableRegionPolicy.js b/platform/commonUI/regions/src/EditableRegionPolicy.js index a63bed65b1..f538a5459b 100644 --- a/platform/commonUI/regions/src/EditableRegionPolicy.js +++ b/platform/commonUI/regions/src/EditableRegionPolicy.js @@ -36,10 +36,10 @@ define( } EditableRegionPolicy.prototype.allow = function (regionPart, domainObject) { - if (!regionPart.modes){ + if (!regionPart.modes) { return true; } - if (domainObject.hasCapability('editor') && domainObject.getCapability('editor').inEditContext()){ + if (domainObject.hasCapability('editor') && domainObject.getCapability('editor').inEditContext()) { //If the domain object is in edit mode, only include a part // if it is marked editable return regionPart.modes.indexOf('edit') !== -1; @@ -52,4 +52,4 @@ define( return EditableRegionPolicy; } -); \ No newline at end of file +); diff --git a/platform/commonUI/regions/src/InspectorController.js b/platform/commonUI/regions/src/InspectorController.js index 32b0e1903d..a2e513d7b7 100644 --- a/platform/commonUI/regions/src/InspectorController.js +++ b/platform/commonUI/regions/src/InspectorController.js @@ -41,7 +41,7 @@ define( */ function filterRegions(inspector) { //Dupe so we're not modifying the type definition. - return inspector.regions && inspector.regions.filter(function(region) { + return inspector.regions && inspector.regions.filter(function (region) { return policyService.allow('region', region, domainObject); }); } @@ -55,4 +55,4 @@ define( return InspectorController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/regions/src/Region.js b/platform/commonUI/regions/src/Region.js index 3b300b28e1..4d38f1eb8d 100644 --- a/platform/commonUI/regions/src/Region.js +++ b/platform/commonUI/regions/src/Region.js @@ -67,7 +67,7 @@ define( * @param {number} [index] the position to insert the region. By default * will add to the end */ - Region.prototype.addRegion = function (region, index){ + Region.prototype.addRegion = function (region, index) { if (index) { this.regions.splice(index, 0, region); } else { @@ -82,11 +82,11 @@ define( * string, will remove the region with the matching name. If an * object, will attempt to remove that object from the Region */ - Region.prototype.removeRegion = function (region){ + Region.prototype.removeRegion = function (region) { if (typeof region === 'number') { this.regions.splice(region, 1); - } else if (typeof region === 'string'){ - this.regions = this.regions.filter(function(thisRegion) { + } else if (typeof region === 'string') { + this.regions = this.regions.filter(function (thisRegion) { return thisRegion.name !== region; }); } else { diff --git a/platform/commonUI/regions/test/EditableRegionPolicySpec.js b/platform/commonUI/regions/test/EditableRegionPolicySpec.js index e9a6a97404..ed3b9fffd3 100644 --- a/platform/commonUI/regions/test/EditableRegionPolicySpec.js +++ b/platform/commonUI/regions/test/EditableRegionPolicySpec.js @@ -37,7 +37,7 @@ define( }, mockAllModesRegionPart = {}; - beforeEach(function(){ + beforeEach(function () { editableRegionPolicy = new EditableRegionPolicy(); mockEditorCapability = jasmine.createSpyObj("editorCapability", [ @@ -50,19 +50,19 @@ define( mockDomainObject.getCapability.andReturn(mockEditorCapability); }); - it("includes only browse region parts for object not in edit mode", function() { + it("includes only browse region parts for object not in edit mode", function () { mockEditorCapability.inEditContext.andReturn(false); expect(editableRegionPolicy.allow(mockBrowseRegionPart, mockDomainObject)).toBe(true); expect(editableRegionPolicy.allow(mockEditRegionPart, mockDomainObject)).toBe(false); }); - it("includes only edit region parts for object in edit mode", function() { + it("includes only edit region parts for object in edit mode", function () { mockEditorCapability.inEditContext.andReturn(true); expect(editableRegionPolicy.allow(mockBrowseRegionPart, mockDomainObject)).toBe(false); expect(editableRegionPolicy.allow(mockEditRegionPart, mockDomainObject)).toBe(true); }); - it("includes region parts with no mode specification", function() { + it("includes region parts with no mode specification", function () { mockEditorCapability.inEditContext.andReturn(false); expect(editableRegionPolicy.allow(mockAllModesRegionPart, mockDomainObject)).toBe(true); mockEditorCapability.inEditContext.andReturn(true); diff --git a/platform/commonUI/regions/test/InspectorControllerSpec.js b/platform/commonUI/regions/test/InspectorControllerSpec.js index ad3243c348..d3fdb7384a 100644 --- a/platform/commonUI/regions/test/InspectorControllerSpec.js +++ b/platform/commonUI/regions/test/InspectorControllerSpec.js @@ -32,7 +32,7 @@ define( mockPolicyService, controller; - beforeEach(function(){ + beforeEach(function () { mockTypeDefinition = { inspector: { @@ -62,13 +62,13 @@ define( }; }); - it("filters out regions disallowed by region policy", function() { + it("filters out regions disallowed by region policy", function () { mockPolicyService.allow.andReturn(false); controller = new InspectorController(mockScope, mockPolicyService); expect(mockScope.regions.length).toBe(0); }); - it("does not filter out regions allowed by region policy", function() { + it("does not filter out regions allowed by region policy", function () { mockPolicyService.allow.andReturn(true); controller = new InspectorController(mockScope, mockPolicyService); expect(mockScope.regions.length).toBe(2); diff --git a/platform/commonUI/regions/test/RegionSpec.js b/platform/commonUI/regions/test/RegionSpec.js index ed7581b44b..9c2ecc296e 100644 --- a/platform/commonUI/regions/test/RegionSpec.js +++ b/platform/commonUI/regions/test/RegionSpec.js @@ -29,7 +29,7 @@ define( var region, part2 = new Region({'name': 'part2'}); - beforeEach(function(){ + beforeEach(function () { region = new Region(); region.regions = [ new Region({name: 'part1'}), @@ -39,27 +39,27 @@ define( }); it("adding a region at a specified index adds it in that" + - " position", function() { + " position", function () { - region.addRegion(part2, 1); + region.addRegion(part2, 1); - expect(region.regions.length).toBe(4); - expect(region.regions[1]).toBe(part2); - }); + expect(region.regions.length).toBe(4); + expect(region.regions[1]).toBe(part2); + }); - it("adding a region without an index adds it at the end", function() { + it("adding a region without an index adds it at the end", function () { var partN = new Region({'name': 'partN'}); region.addRegion(partN); expect(region.regions.length).toBe(4); - expect(region.regions[region.regions.length-1]).toBe(partN); + expect(region.regions[region.regions.length - 1]).toBe(partN); }); - describe("removing a region", function(){ + describe("removing a region", function () { var partName = "part2"; - beforeEach(function(){ + beforeEach(function () { region.regions = [ new Region({name: 'part1'}), part2, @@ -68,7 +68,7 @@ define( ]; }); - it("with a string matches on region name", function() { + it("with a string matches on region name", function () { expect(region.regions.length).toBe(4); expect(region.regions.indexOf(part2)).toBe(1); @@ -78,7 +78,7 @@ define( expect(region.regions.indexOf(part2)).toBe(-1); }); - it("with a number removes by index", function() { + it("with a number removes by index", function () { expect(region.regions.length).toBe(4); expect(region.regions.indexOf(part2)).toBe(1); @@ -89,7 +89,7 @@ define( }); - it("with object matches that object", function() { + it("with object matches that object", function () { expect(region.regions.length).toBe(4); expect(region.regions.indexOf(part2)).toBe(1); diff --git a/platform/commonUI/themes/espresso/bundle.js b/platform/commonUI/themes/espresso/bundle.js index b1df3f1ea5..d583481fa9 100644 --- a/platform/commonUI/themes/espresso/bundle.js +++ b/platform/commonUI/themes/espresso/bundle.js @@ -21,10 +21,10 @@ *****************************************************************************/ define([ - + 'legacyRegistry' ], function ( - + legacyRegistry ) { diff --git a/platform/commonUI/themes/snow/bundle.js b/platform/commonUI/themes/snow/bundle.js index d36b961e74..6dc8b5acc0 100644 --- a/platform/commonUI/themes/snow/bundle.js +++ b/platform/commonUI/themes/snow/bundle.js @@ -21,10 +21,10 @@ *****************************************************************************/ define([ - + 'legacyRegistry' ], function ( - + legacyRegistry ) { diff --git a/platform/containment/test/CapabilityTableSpec.js b/platform/containment/test/CapabilityTableSpec.js index 76fbd6ffcd..fe5a833f53 100644 --- a/platform/containment/test/CapabilityTableSpec.js +++ b/platform/containment/test/CapabilityTableSpec.js @@ -32,11 +32,11 @@ define( beforeEach(function () { mockTypeService = jasmine.createSpyObj( 'typeService', - [ 'listTypes' ] + ['listTypes'] ); mockCapabilityService = jasmine.createSpyObj( 'capabilityService', - [ 'getCapabilities' ] + ['getCapabilities'] ); // Both types can only contain b, let's say mockTypes = ['a', 'b'].map(function (type) { @@ -82,4 +82,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/containment/test/ComposeActionPolicySpec.js b/platform/containment/test/ComposeActionPolicySpec.js index 3678baac57..a6cf3cd3d4 100644 --- a/platform/containment/test/ComposeActionPolicySpec.js +++ b/platform/containment/test/ComposeActionPolicySpec.js @@ -36,7 +36,7 @@ define( mockInjector = jasmine.createSpyObj('$injector', ['get']); mockPolicyService = jasmine.createSpyObj( 'policyService', - [ 'allow' ] + ['allow'] ); mockTypes = ['a', 'b'].map(function (type) { var mockType = jasmine.createSpyObj('type-' + type, ['getKey']); @@ -90,4 +90,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/containment/test/CompositionMutabilityPolicySpec.js b/platform/containment/test/CompositionMutabilityPolicySpec.js index 06819c4043..18d26d2386 100644 --- a/platform/containment/test/CompositionMutabilityPolicySpec.js +++ b/platform/containment/test/CompositionMutabilityPolicySpec.js @@ -42,4 +42,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/containment/test/CompositionPolicySpec.js b/platform/containment/test/CompositionPolicySpec.js index 94997623ab..bd2d25ba58 100644 --- a/platform/containment/test/CompositionPolicySpec.js +++ b/platform/containment/test/CompositionPolicySpec.js @@ -34,11 +34,11 @@ define( mockInjector = jasmine.createSpyObj('$injector', ['get']); mockTypeService = jasmine.createSpyObj( 'typeService', - [ 'listTypes' ] + ['listTypes'] ); mockCapabilityService = jasmine.createSpyObj( 'capabilityService', - [ 'getCapabilities' ] + ['getCapabilities'] ); // Both types can only contain b, let's say mockTypes = ['a', 'b'].map(function (type) { @@ -82,4 +82,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/containment/test/ContainmentTableSpec.js b/platform/containment/test/ContainmentTableSpec.js index 64551c9439..ac45b75804 100644 --- a/platform/containment/test/ContainmentTableSpec.js +++ b/platform/containment/test/ContainmentTableSpec.js @@ -32,11 +32,11 @@ define( beforeEach(function () { mockTypeService = jasmine.createSpyObj( 'typeService', - [ 'listTypes' ] + ['listTypes'] ); mockCapabilityService = jasmine.createSpyObj( 'capabilityService', - [ 'getCapabilities' ] + ['getCapabilities'] ); // Both types can only contain b, let's say mockTypes = ['a', 'b', 'c'].map(function (type, index) { @@ -48,7 +48,7 @@ define( mockType.getDefinition.andReturn({ // First two contain objects with capability 'b'; // third one defines no containership rules - contains: (index < 2) ? [ { has: 'b' } ] : undefined + contains: (index < 2) ? [{ has: 'b' }] : undefined }); // Return a model to drive apparant capabilities mockType.getInitialModel.andReturn({ id: type }); @@ -93,4 +93,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/src/capabilities/ContextCapability.js b/platform/core/src/capabilities/ContextCapability.js index aaa298f093..72bfb56218 100644 --- a/platform/core/src/capabilities/ContextCapability.js +++ b/platform/core/src/capabilities/ContextCapability.js @@ -82,7 +82,7 @@ define( parentContext = parentObject && parentObject.getCapability('context'), parentPath = parentContext ? - parentContext.getPath() : [ this.parentObject ]; + parentContext.getPath() : [this.parentObject]; return parentPath.concat([this.domainObject]); }; diff --git a/platform/core/src/capabilities/PersistenceCapability.js b/platform/core/src/capabilities/PersistenceCapability.js index 2f4f3cd53b..204cd7de35 100644 --- a/platform/core/src/capabilities/PersistenceCapability.js +++ b/platform/core/src/capabilities/PersistenceCapability.js @@ -69,18 +69,18 @@ define( * Checks if the value returned is falsey, and if so returns a * rejected promise */ - function rejectIfFalsey(value, $q){ - if (!value){ + function rejectIfFalsey(value, $q) { + if (!value) { return $q.reject("Error persisting object"); } else { return value; } } - function formatError(error){ + function formatError(error) { if (error && error.message) { return error.message; - } else if (error && typeof error === "string"){ + } else if (error && typeof error === "string") { return error; } else { return "unknown error"; @@ -91,7 +91,7 @@ define( * Display a notification message if an error has occurred during * persistence. */ - function notifyOnError(error, domainObject, notificationService, $q){ + function notifyOnError(error, domainObject, notificationService, $q) { var errorMessage = "Unable to persist " + domainObject.getModel().name; if (error) { errorMessage += ": " + formatError(error); @@ -133,9 +133,9 @@ define( this.getSpace(), getKey(domainObject.getId()), domainObject.getModel() - ]).then(function(result){ + ]).then(function (result) { return rejectIfFalsey(result, self.$q); - }).catch(function(error){ + }).catch(function (error) { return notifyOnError(error, domainObject, self.notificationService, self.$q); }); }; diff --git a/platform/core/src/models/RootModelProvider.js b/platform/core/src/models/RootModelProvider.js index 9c19726922..83c9636e37 100644 --- a/platform/core/src/models/RootModelProvider.js +++ b/platform/core/src/models/RootModelProvider.js @@ -46,7 +46,9 @@ define( */ function RootModelProvider(roots, $q, $log) { // Pull out identifiers to used as ROOT's - var ids = roots.map(function (root) { return root.id; }); + var ids = roots.map(function (root) { + return root.id; + }); // Assign an initial location to root models roots.forEach(function (root) { diff --git a/platform/core/src/types/TypePropertyConversion.js b/platform/core/src/types/TypePropertyConversion.js index 3608b0ed5f..e2d1cea984 100644 --- a/platform/core/src/types/TypePropertyConversion.js +++ b/platform/core/src/types/TypePropertyConversion.js @@ -33,8 +33,12 @@ define( } }, identity: { - toModelValue: function (v) { return v; }, - toFormValue: function (v) { return v; } + toModelValue: function (v) { + return v; + }, + toFormValue: function (v) { + return v; + } } }, ARRAY_SUFFIX = '[]'; diff --git a/platform/core/src/types/TypeProvider.js b/platform/core/src/types/TypeProvider.js index d45852bb68..f2ae2655b6 100644 --- a/platform/core/src/types/TypeProvider.js +++ b/platform/core/src/types/TypeProvider.js @@ -179,7 +179,7 @@ define( return def; } - + return (self.typeMap[typeKey] = self.typeMap[typeKey] || buildTypeDef(typeKey)); } diff --git a/platform/core/test/actions/ActionAggregatorSpec.js b/platform/core/test/actions/ActionAggregatorSpec.js index 2b1e4adb81..09dddff5af 100644 --- a/platform/core/test/actions/ActionAggregatorSpec.js +++ b/platform/core/test/actions/ActionAggregatorSpec.js @@ -32,7 +32,7 @@ define( aggregator; function createMockActionProvider(actions, i) { - var spy = jasmine.createSpyObj("agg" + i, [ "getActions" ]); + var spy = jasmine.createSpyObj("agg" + i, ["getActions"]); spy.getActions.andReturn(actions); return spy; } @@ -69,4 +69,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/core/test/actions/ActionCapabilitySpec.js b/platform/core/test/actions/ActionCapabilitySpec.js index 0c564b0710..dd83a88082 100644 --- a/platform/core/test/actions/ActionCapabilitySpec.js +++ b/platform/core/test/actions/ActionCapabilitySpec.js @@ -37,19 +37,19 @@ define( beforeEach(function () { mockAction = jasmine.createSpyObj( "action", - [ "perform", "getMetadata" ] + ["perform", "getMetadata"] ); mockActionService = jasmine.createSpyObj( "actionService", - [ "getActions" ] + ["getActions"] ); mockQ = jasmine.createSpyObj( "$q", - [ "when" ] + ["when"] ); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability", "hasCapability", "useCapability" ] + ["getId", "getModel", "getCapability", "hasCapability", "useCapability"] ); mockActionService.getActions.andReturn([mockAction, {}]); @@ -76,7 +76,7 @@ define( }); it("promises the result of performed actions", function () { - var mockPromise = jasmine.createSpyObj("promise", [ "then" ]); + var mockPromise = jasmine.createSpyObj("promise", ["then"]); mockQ.when.andReturn(mockPromise); mockAction.perform.andReturn("the action's result"); diff --git a/platform/core/test/actions/ActionProviderSpec.js b/platform/core/test/actions/ActionProviderSpec.js index 5740196b98..dce95dd1e5 100644 --- a/platform/core/test/actions/ActionProviderSpec.js +++ b/platform/core/test/actions/ActionProviderSpec.js @@ -33,29 +33,41 @@ define( actionProvider; function SimpleAction() { - return { perform: function () { return "simple"; } }; + return { perform: function () { + return "simple"; + } }; } function CategorizedAction() { - return { perform: function () { return "categorized"; } }; + return { perform: function () { + return "categorized"; + } }; } CategorizedAction.category = "someCategory"; function KeyedAction() { - return { perform: function () { return "keyed"; } }; + return { perform: function () { + return "keyed"; + } }; } KeyedAction.key = "someKey"; function CategorizedKeyedAction() { - return { perform: function () { return "both"; } }; + return { perform: function () { + return "both"; + } }; } CategorizedKeyedAction.key = "someKey"; CategorizedKeyedAction.category = "someCategory"; function MetadataAction() { return { - perform: function () { return "metadata"; }, - getMetadata: function () { return "custom metadata"; } + perform: function () { + return "metadata"; + }, + getMetadata: function () { + return "custom metadata"; + } }; } MetadataAction.key = "metadata"; @@ -152,7 +164,7 @@ define( } provided = new ActionProvider( - [ SimpleAction, BadAction ], + [SimpleAction, BadAction], mockLog ).getActions(); }); diff --git a/platform/core/test/actions/LoggingActionDecoratorSpec.js b/platform/core/test/actions/LoggingActionDecoratorSpec.js index e46b6aecdc..3e0e9b98e9 100644 --- a/platform/core/test/actions/LoggingActionDecoratorSpec.js +++ b/platform/core/test/actions/LoggingActionDecoratorSpec.js @@ -36,15 +36,15 @@ define( beforeEach(function () { mockAction = jasmine.createSpyObj( "action", - [ "perform", "getMetadata" ] + ["perform", "getMetadata"] ); mockActionService = jasmine.createSpyObj( "actionService", - [ "getActions" ] + ["getActions"] ); mockLog = jasmine.createSpyObj( "$log", - [ "error", "warn", "info", "debug" ] + ["error", "warn", "info", "debug"] ); mockActionService.getActions.andReturn([mockAction]); @@ -70,4 +70,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/capabilities/CompositionCapabilitySpec.js b/platform/core/test/capabilities/CompositionCapabilitySpec.js index 0b6d184ffd..ca0410123e 100644 --- a/platform/core/test/capabilities/CompositionCapabilitySpec.js +++ b/platform/core/test/capabilities/CompositionCapabilitySpec.js @@ -64,7 +64,7 @@ define( mockObjectService = jasmine.createSpyObj( "objectService", - [ "getObjects" ] + ["getObjects"] ); mockInjector = { @@ -97,7 +97,7 @@ define( }); it("requests ids found in model's composition from the object service", function () { - var ids = [ "a", "b", "c", "xyz" ]; + var ids = ["a", "b", "c", "xyz"]; mockDomainObject.getModel.andReturn({ composition: ids }); @@ -114,7 +114,9 @@ define( mockObjectService.getObjects.andReturn(mockPromise({x: mockChild})); mockChild.getCapability.andReturn(undefined); - composition.invoke().then(function (c) { result = c; }); + composition.invoke().then(function (c) { + result = c; + }); // Should have been added by a wrapper expect(result[0].getCapability('context')).toBeDefined(); @@ -153,7 +155,7 @@ define( it("does not re-add IDs which are already present", function () { var result, - testModel = { composition: [ 'a' ] }, + testModel = { composition: ['a'] }, mockChild = jasmine.createSpyObj("child", DOMAIN_OBJECT_METHODS); mockDomainObject.getModel.andReturn(testModel); @@ -184,7 +186,7 @@ define( it("can add objects at a specified index", function () { var result, - testModel = { composition: [ 'a', 'b', 'c' ] }, + testModel = { composition: ['a', 'b', 'c'] }, mockChild = jasmine.createSpyObj("child", DOMAIN_OBJECT_METHODS); mockDomainObject.getModel.andReturn(testModel); diff --git a/platform/core/test/capabilities/ContextCapabilitySpec.js b/platform/core/test/capabilities/ContextCapabilitySpec.js index 21a71e37f0..08e5ff952b 100644 --- a/platform/core/test/capabilities/ContextCapabilitySpec.js +++ b/platform/core/test/capabilities/ContextCapabilitySpec.js @@ -46,7 +46,7 @@ define( mockDomainObject = jasmine.createSpyObj("domainObject", DOMAIN_OBJECT_METHODS); mockParent = jasmine.createSpyObj("parent", DOMAIN_OBJECT_METHODS); mockGrandparent = jasmine.createSpyObj("grandparent", DOMAIN_OBJECT_METHODS); - mockContext = jasmine.createSpyObj("context", [ "getParent", "getRoot", "getPath" ]); + mockContext = jasmine.createSpyObj("context", ["getParent", "getRoot", "getPath"]); mockParent.getCapability.andReturn(mockContext); mockContext.getParent.andReturn(mockGrandparent); @@ -77,4 +77,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/capabilities/ContextualDomainObjectSpec.js b/platform/core/test/capabilities/ContextualDomainObjectSpec.js index 99b1f2a615..00b9e63746 100644 --- a/platform/core/test/capabilities/ContextualDomainObjectSpec.js +++ b/platform/core/test/capabilities/ContextualDomainObjectSpec.js @@ -79,4 +79,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/capabilities/CoreCapabilityProviderSpec.js b/platform/core/test/capabilities/CoreCapabilityProviderSpec.js index 6f904fa73b..55ec9ca303 100644 --- a/platform/core/test/capabilities/CoreCapabilityProviderSpec.js +++ b/platform/core/test/capabilities/CoreCapabilityProviderSpec.js @@ -31,16 +31,22 @@ define( var mockLog, provider; - function BasicCapability() { return; } + function BasicCapability() { + return; + } BasicCapability.key = "basic"; - function ApplicableCapability() { return; } + function ApplicableCapability() { + return; + } ApplicableCapability.key = "applicable"; ApplicableCapability.appliesTo = function (model) { return !model.isNotApplicable; }; - function KeylessCapability() { return; } + function KeylessCapability() { + return; + } beforeEach(function () { mockLog = jasmine.createSpyObj( diff --git a/platform/core/test/capabilities/DelegationCapabilitySpec.js b/platform/core/test/capabilities/DelegationCapabilitySpec.js index a529a54491..b803b64861 100644 --- a/platform/core/test/capabilities/DelegationCapabilitySpec.js +++ b/platform/core/test/capabilities/DelegationCapabilitySpec.js @@ -36,7 +36,11 @@ define( object = {}, delegation; - function capture(k) { return function (v) { captured[k] = v; }; } + function capture(k) { + return function (v) { + captured[k] = v; + }; + } function TestDomainObject(caps, id) { return { getId: function () { @@ -67,12 +71,16 @@ define( beforeEach(function () { captured = {}; typeDef = {}; - typeDef.delegates = [ "foo" ]; - type = { getDefinition: function () { return typeDef; } }; + typeDef.delegates = ["foo"]; + type = { getDefinition: function () { + return typeDef; + } }; children = []; capabilities = { type: type, - composition: { invoke: function () { return mockPromise(children); } } + composition: { invoke: function () { + return mockPromise(children); + } } }; object = new TestDomainObject(capabilities); @@ -95,4 +103,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/core/test/capabilities/InstantiationCapabilitySpec.js b/platform/core/test/capabilities/InstantiationCapabilitySpec.js index ec8cd88d3a..4a798a567d 100644 --- a/platform/core/test/capabilities/InstantiationCapabilitySpec.js +++ b/platform/core/test/capabilities/InstantiationCapabilitySpec.js @@ -38,15 +38,15 @@ define( mockInstantiate = jasmine.createSpy("instantiate"); mockIdentifierService = jasmine.createSpyObj( 'identifierService', - [ 'parse', 'generate' ] + ['parse', 'generate'] ); mockIdentifier = jasmine.createSpyObj( 'identifier', - [ 'getSpace', 'getKey', 'getDefinedSpace' ] + ['getSpace', 'getKey', 'getDefinedSpace'] ); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getCapability', 'getModel' ] + ['getId', 'getCapability', 'getModel'] ); mockInjector.get.andCallFake(function (key) { diff --git a/platform/core/test/capabilities/MutationCapabilitySpec.js b/platform/core/test/capabilities/MutationCapabilitySpec.js index bb6070b154..d84a2edec1 100644 --- a/platform/core/test/capabilities/MutationCapabilitySpec.js +++ b/platform/core/test/capabilities/MutationCapabilitySpec.js @@ -35,8 +35,12 @@ define( topic, mockNow, domainObject = { - getId: function () { return "test-id"; }, - getModel: function () { return testModel; } + getId: function () { + return "test-id"; + }, + getModel: function () { + return testModel; + } }, mutation; diff --git a/platform/core/test/capabilities/PersistenceCapabilitySpec.js b/platform/core/test/capabilities/PersistenceCapabilitySpec.js index d2bafd26e6..ca37936735 100644 --- a/platform/core/test/capabilities/PersistenceCapabilitySpec.js +++ b/platform/core/test/capabilities/PersistenceCapabilitySpec.js @@ -46,10 +46,10 @@ define( then: function (callback) { return asPromise(callback(value)); }, - catch: function(callback) { + catch: function (callback) { //Define a default 'happy' catch, that skips over the // catch callback - return doCatch ? asPromise(callback(value)): asPromise(value); + return doCatch ? asPromise(callback(value)) : asPromise(value); } }; } @@ -60,16 +60,16 @@ define( mockPersistenceService = jasmine.createSpyObj( "persistenceService", - [ "updateObject", "readObject", "createObject", "deleteObject" ] + ["updateObject", "readObject", "createObject", "deleteObject"] ); mockIdentifierService = jasmine.createSpyObj( 'identifierService', - [ 'parse', 'generate' ] + ['parse', 'generate'] ); mockIdentifier = jasmine.createSpyObj( 'identifier', - [ 'getSpace', 'getKey', 'getDefinedSpace' ] + ['getSpace', 'getKey', 'getDefinedSpace'] ); mockQ = jasmine.createSpyObj( "$q", @@ -81,12 +81,16 @@ define( ); mockCacheService = jasmine.createSpyObj( "cacheService", - [ "get", "put", "remove", "all" ] + ["get", "put", "remove", "all"] ); mockDomainObject = { - getId: function () { return id; }, - getModel: function () { return model; }, + getId: function () { + return id; + }, + getModel: function () { + return model; + }, useCapability: jasmine.createSpy() }; // Simulate mutation capability @@ -107,7 +111,7 @@ define( ); }); - describe("successful persistence", function() { + describe("successful persistence", function () { beforeEach(function () { mockPersistenceService.updateObject.andReturn(happyPromise); mockPersistenceService.createObject.andReturn(happyPromise); @@ -163,9 +167,9 @@ define( }); }); - describe("unsuccessful persistence", function() { + describe("unsuccessful persistence", function () { var sadPromise = { - then: function(callback){ + then: function (callback) { return asPromise(callback(0), true); } }; diff --git a/platform/core/test/capabilities/RelationshipCapabilitySpec.js b/platform/core/test/capabilities/RelationshipCapabilitySpec.js index 6b69a9b615..4e2b8f9cc8 100644 --- a/platform/core/test/capabilities/RelationshipCapabilitySpec.js +++ b/platform/core/test/capabilities/RelationshipCapabilitySpec.js @@ -60,7 +60,7 @@ define( mockObjectService = jasmine.createSpyObj( "objectService", - [ "getObjects" ] + ["getObjects"] ); mockInjector = { @@ -85,7 +85,7 @@ define( }); it("requests ids found in model's composition from the object service", function () { - var ids = [ "a", "b", "c", "xyz" ]; + var ids = ["a", "b", "c", "xyz"]; mockDomainObject.getModel.andReturn({ relationships: { xyz: ids } }); @@ -96,7 +96,7 @@ define( it("provides a list of relationship types", function () { mockDomainObject.getModel.andReturn({ relationships: { - abc: [ 'a', 'b' ], + abc: ['a', 'b'], def: "not an array, should be ignored", xyz: [] } }); @@ -139,4 +139,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/models/MissingModelDecoratorSpec.js b/platform/core/test/models/MissingModelDecoratorSpec.js index df18bd0c49..20d64f40ae 100644 --- a/platform/core/test/models/MissingModelDecoratorSpec.js +++ b/platform/core/test/models/MissingModelDecoratorSpec.js @@ -40,7 +40,7 @@ define( beforeEach(function () { mockModelService = jasmine.createSpyObj( "modelService", - [ "getModels" ] + ["getModels"] ); testModels = { @@ -61,14 +61,18 @@ define( it("provides models for any IDs which are missing", function () { var models; decorator.getModels(['testId', 'otherId']) - .then(function (m) { models = m; }); + .then(function (m) { + models = m; + }); expect(models.otherId).toBeDefined(); }); it("does not overwrite existing models", function () { var models; decorator.getModels(['testId', 'otherId']) - .then(function (m) { models = m; }); + .then(function (m) { + models = m; + }); expect(models.testId).toEqual({ someKey: "some value" }); }); diff --git a/platform/core/test/models/ModelAggregatorSpec.js b/platform/core/test/models/ModelAggregatorSpec.js index 3fc816d6db..2f5f13c053 100644 --- a/platform/core/test/models/ModelAggregatorSpec.js +++ b/platform/core/test/models/ModelAggregatorSpec.js @@ -37,18 +37,20 @@ define( aggregator; beforeEach(function () { - mockQ = jasmine.createSpyObj("$q", [ "all" ]); + mockQ = jasmine.createSpyObj("$q", ["all"]); mockProviders = modelList.map(function (models, i) { var mockProvider = jasmine.createSpyObj( "mockProvider" + i, - [ "getModels" ] + ["getModels"] ); mockProvider.getModels.andReturn(models); return mockProvider; }); mockQ.all.andReturn({ - then: function (c) { return c(modelList); } + then: function (c) { + return c(modelList); + } }); aggregator = new ModelAggregator(mockQ, mockProviders); @@ -72,4 +74,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/models/ModelCacheServiceSpec.js b/platform/core/test/models/ModelCacheServiceSpec.js index 23d1a0ce0d..97e84fa918 100644 --- a/platform/core/test/models/ModelCacheServiceSpec.js +++ b/platform/core/test/models/ModelCacheServiceSpec.js @@ -27,7 +27,7 @@ define(['../../src/models/ModelCacheService'], function (ModelCacheService) { cacheService; beforeEach(function () { - testIds = [ 'a', 'b', 'c', 'd' ]; + testIds = ['a', 'b', 'c', 'd']; testModels = testIds.reduce(function (models, id) { models[id] = { someKey: "some value for " + id }; return models; diff --git a/platform/core/test/models/RootModelProviderSpec.js b/platform/core/test/models/RootModelProviderSpec.js index aab4477b61..a3b667b963 100644 --- a/platform/core/test/models/RootModelProviderSpec.js +++ b/platform/core/test/models/RootModelProviderSpec.js @@ -57,7 +57,9 @@ define( }; } - function capture(value) { captured = value; } + function capture(value) { + captured = value; + } beforeEach(function () { diff --git a/platform/core/test/models/StaticModelProviderSpec.js b/platform/core/test/models/StaticModelProviderSpec.js index 7d7f518eff..c4073c8d55 100644 --- a/platform/core/test/models/StaticModelProviderSpec.js +++ b/platform/core/test/models/StaticModelProviderSpec.js @@ -55,7 +55,9 @@ define( }); it("provides models from extension declarations", function () { - var mockPromise = { then: function () { return; } }; + var mockPromise = { then: function () { + return; + } }; mockQ.when.andReturn(mockPromise); // Verify that we got the promise as the return value @@ -97,4 +99,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/objects/DomainObjectProviderSpec.js b/platform/core/test/objects/DomainObjectProviderSpec.js index 6da0d122b5..c8450551f4 100644 --- a/platform/core/test/objects/DomainObjectProviderSpec.js +++ b/platform/core/test/objects/DomainObjectProviderSpec.js @@ -49,7 +49,7 @@ define( beforeEach(function () { mockModelService = jasmine.createSpyObj( "modelService", - [ "getModels" ] + ["getModels"] ); mockInstantiate = jasmine.createSpy("instantiate"); @@ -64,7 +64,7 @@ define( }); it("requests models from the model service", function () { - var ids = [ "a", "b", "c" ]; + var ids = ["a", "b", "c"]; mockModelService.getModels.andReturn(mockPromise({})); provider.getObjects(ids); expect(mockModelService.getModels).toHaveBeenCalledWith(ids); @@ -72,7 +72,7 @@ define( it("instantiates objects with provided models", function () { - var ids = [ "a", "b", "c"], + var ids = ["a", "b", "c"], model = { someKey: "some value"}, result; mockModelService.getModels.andReturn(mockPromise({ a: model })); diff --git a/platform/core/test/objects/DomainObjectSpec.js b/platform/core/test/objects/DomainObjectSpec.js index 47dda4537d..de5f9a8841 100644 --- a/platform/core/test/objects/DomainObjectSpec.js +++ b/platform/core/test/objects/DomainObjectSpec.js @@ -84,4 +84,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/services/ContextualizeSpec.js b/platform/core/test/services/ContextualizeSpec.js index 583c812a30..e814033f9f 100644 --- a/platform/core/test/services/ContextualizeSpec.js +++ b/platform/core/test/services/ContextualizeSpec.js @@ -44,7 +44,7 @@ define( mockLog = jasmine.createSpyObj( "$log", - [ "error", "warn", "info", "debug" ] + ["error", "warn", "info", "debug"] ); mockDomainObject = diff --git a/platform/core/test/services/InstantiateSpec.js b/platform/core/test/services/InstantiateSpec.js index a9529c94b6..e1993060f3 100644 --- a/platform/core/test/services/InstantiateSpec.js +++ b/platform/core/test/services/InstantiateSpec.js @@ -45,7 +45,7 @@ define( ); mockIdentifierService = jasmine.createSpyObj( 'identifierService', - [ 'parse', 'generate' ] + ['parse', 'generate'] ); mockCapabilityConstructor = jasmine.createSpy('capability'); mockCapabilityInstance = {}; @@ -61,7 +61,7 @@ define( mockCacheService = jasmine.createSpyObj( 'cacheService', - [ 'get', 'put', 'remove', 'all' ] + ['get', 'put', 'remove', 'all'] ); testModel = { someKey: "some value" }; diff --git a/platform/core/test/services/NowSpec.js b/platform/core/test/services/NowSpec.js index e0da8a60f6..cb122acf78 100644 --- a/platform/core/test/services/NowSpec.js +++ b/platform/core/test/services/NowSpec.js @@ -44,4 +44,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/services/TopicSpec.js b/platform/core/test/services/TopicSpec.js index cf0b2d42b2..d683f36c6c 100644 --- a/platform/core/test/services/TopicSpec.js +++ b/platform/core/test/services/TopicSpec.js @@ -34,7 +34,7 @@ define( testMessage = { someKey: "some value"}; mockLog = jasmine.createSpyObj( '$log', - [ 'error', 'warn', 'info', 'debug' ] + ['error', 'warn', 'info', 'debug'] ); mockCallback = jasmine.createSpy('callback'); topic = new Topic(mockLog); diff --git a/platform/core/test/types/MergeModelsSpec.js b/platform/core/test/types/MergeModelsSpec.js index 3633848f68..026c263c9a 100644 --- a/platform/core/test/types/MergeModelsSpec.js +++ b/platform/core/test/types/MergeModelsSpec.js @@ -32,32 +32,32 @@ define( expect(mergeModels( { "a": "property a", - "b": [ 1, 2, 3 ], + "b": [1, 2, 3], "c": { x: 42, - z: [ 0 ] + z: [0] }, "d": "should be ignored" }, { - "b": [ 4 ], + "b": [4], "c": { y: "property y", - z: [ "h" ] + z: ["h"] }, "d": "property d" } )).toEqual({ "a": "property a", - "b": [ 1, 2, 3, 4 ], + "b": [1, 2, 3, 4], "c": { x: 42, y: "property y", - z: [ 0, "h" ] + z: [0, "h"] }, "d": "property d" }); }); }); } -); \ No newline at end of file +); diff --git a/platform/core/test/types/TypeCapabilitySpec.js b/platform/core/test/types/TypeCapabilitySpec.js index 2b5281fb3f..03a7ac4adb 100644 --- a/platform/core/test/types/TypeCapabilitySpec.js +++ b/platform/core/test/types/TypeCapabilitySpec.js @@ -36,11 +36,11 @@ define( beforeEach(function () { mockTypeService = jasmine.createSpyObj( "typeService", - [ "getType" ] + ["getType"] ); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability" ] + ["getId", "getModel", "getCapability"] ); mockType = { someKey: "some value" }; @@ -57,4 +57,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/types/TypeImplSpec.js b/platform/core/test/types/TypeImplSpec.js index 3f95b5a8eb..9f911de157 100644 --- a/platform/core/test/types/TypeImplSpec.js +++ b/platform/core/test/types/TypeImplSpec.js @@ -36,7 +36,7 @@ define( glyph: 't', inherits: ['test-parent-1', 'test-parent-2'], features: ['test-feature-1'], - properties: [ {} ], + properties: [{}], model: {someKey: "some value"} }; type = new TypeImpl(testTypeDef); @@ -74,10 +74,14 @@ define( it("supports instance-of checks by type object", function () { expect(type.instanceOf({ - getKey: function () { return 'test-parent-1'; } + getKey: function () { + return 'test-parent-1'; + } })).toBeTruthy(); expect(type.instanceOf({ - getKey: function () { return 'some-other-type'; } + getKey: function () { + return 'some-other-type'; + } })).toBeFalsy(); }); @@ -110,4 +114,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/core/test/types/TypePropertyConversionSpec.js b/platform/core/test/types/TypePropertyConversionSpec.js index b888d25552..280134dd86 100644 --- a/platform/core/test/types/TypePropertyConversionSpec.js +++ b/platform/core/test/types/TypePropertyConversionSpec.js @@ -28,7 +28,7 @@ define( it("allows non-conversion when parameter is 'identity'", function () { var conversion = new TypePropertyConversion("identity"); - [ 42, "42", { a: 42 } ].forEach(function (v) { + [42, "42", { a: 42 }].forEach(function (v) { expect(conversion.toFormValue(v)).toBe(v); expect(conversion.toModelValue(v)).toBe(v); }); @@ -61,4 +61,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/types/TypePropertySpec.js b/platform/core/test/types/TypePropertySpec.js index 57b77c90d6..c4cdedeb42 100644 --- a/platform/core/test/types/TypePropertySpec.js +++ b/platform/core/test/types/TypePropertySpec.js @@ -57,7 +57,7 @@ define( it("sets properties by path", function () { var definition = { key: "someKey", - property: [ "some", "property" ] + property: ["some", "property"] }, model = {}, property = new TypeProperty(definition); @@ -68,7 +68,7 @@ define( it("gets properties by path", function () { var definition = { key: "someKey", - property: [ "some", "property" ] + property: ["some", "property"] }, model = { some: { property: "some value" } }, property = new TypeProperty(definition); @@ -78,7 +78,7 @@ define( it("stops looking for properties when a path is invalid", function () { var definition = { key: "someKey", - property: [ "some", "property" ] + property: ["some", "property"] }, property = new TypeProperty(definition); expect(property.getValue(undefined)).toBeUndefined(); @@ -97,7 +97,7 @@ define( it("provides empty arrays for values that are array-like", function () { var definition = { property: "someProperty", - items: [ {}, {}, {} ] + items: [{}, {}, {}] }, model = {}, property = new TypeProperty(definition); @@ -108,7 +108,7 @@ define( it("detects and ignores empty arrays on setValue", function () { var definition = { property: "someProperty", - items: [ {}, {}, {} ] + items: [{}, {}, {}] }, model = {}, property = new TypeProperty(definition); @@ -123,4 +123,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/types/TypeProviderSpec.js b/platform/core/test/types/TypeProviderSpec.js index d876c9fa08..4d2a359e33 100644 --- a/platform/core/test/types/TypeProviderSpec.js +++ b/platform/core/test/types/TypeProviderSpec.js @@ -146,4 +146,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/views/ViewCapabilitySpec.js b/platform/core/test/views/ViewCapabilitySpec.js index ec59a5bf17..b4e3b64c2a 100644 --- a/platform/core/test/views/ViewCapabilitySpec.js +++ b/platform/core/test/views/ViewCapabilitySpec.js @@ -30,17 +30,17 @@ define( describe("A view capability", function () { var mockViewService, mockDomainObject, - views = [ {key: "someView"} ], + views = [{key: "someView"}], view; beforeEach(function () { mockViewService = jasmine.createSpyObj( "viewService", - [ "getViews" ] + ["getViews"] ); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability" ] + ["getId", "getModel", "getCapability"] ); mockViewService.getViews.andReturn(views); view = new ViewCapability(mockViewService, mockDomainObject); @@ -55,4 +55,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/core/test/views/ViewProviderSpec.js b/platform/core/test/views/ViewProviderSpec.js index 0029527bbb..ddeff3e158 100644 --- a/platform/core/test/views/ViewProviderSpec.js +++ b/platform/core/test/views/ViewProviderSpec.js @@ -33,11 +33,11 @@ define( }, viewB = { key: "b", - needs: [ "someCapability" ] + needs: ["someCapability"] }, viewC = { key: "c", - needs: [ "someCapability" ], + needs: ["someCapability"], delegation: true }, capabilities = {}, @@ -158,4 +158,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/entanglement/src/actions/CopyAction.js b/platform/entanglement/src/actions/CopyAction.js index bfc97cf451..2ed9725c41 100644 --- a/platform/entanglement/src/actions/CopyAction.js +++ b/platform/entanglement/src/actions/CopyAction.js @@ -69,7 +69,7 @@ define( * @param totalObjects * @param processed */ - CopyAction.prototype.progress = function(phase, totalObjects, processed){ + CopyAction.prototype.progress = function (phase, totalObjects, processed) { /* Copy has two distinct phases. In the first phase a copy plan is made in memory. During this phase of execution, the user is @@ -78,7 +78,7 @@ define( In the second phase, the copying is taking place, and the user is shown non-invasive banner notifications at the bottom of the screen. */ - if (phase.toLowerCase() === 'preparing' && !this.dialog){ + if (phase.toLowerCase() === 'preparing' && !this.dialog) { this.dialog = this.dialogService.showBlockingMessage({ title: "Preparing to copy objects", unknownProgress: true, @@ -105,15 +105,15 @@ define( * the AbstractComposeAction, but extends it to support notification * updates of progress on copy. */ - CopyAction.prototype.perform = function() { + CopyAction.prototype.perform = function () { var self = this; - function success(){ + function success() { self.notification.dismiss(); self.notificationService.info("Copying complete."); } - function error(errorDetails){ + function error(errorDetails) { var errorMessage = { title: "Error copying objects.", severity: "error", @@ -121,7 +121,7 @@ define( minimized: true, // want the notification to be minimized initially (don't show banner) options: [{ label: "OK", - callback: function() { + callback: function () { self.dialogService.dismiss(); } }] @@ -138,7 +138,7 @@ define( self.dialogService.showBlockingMessage(errorMessage); } - function notification(details){ + function notification(details) { self.progress(details.phase, details.totalObjects, details.processed); } diff --git a/platform/entanglement/src/services/CopyService.js b/platform/entanglement/src/services/CopyService.js index df284f3e20..3bff772ef5 100644 --- a/platform/entanglement/src/services/CopyService.js +++ b/platform/entanglement/src/services/CopyService.js @@ -22,7 +22,7 @@ define( - [ "./CopyTask" ], + ["./CopyTask"], function (CopyTask) { /** diff --git a/platform/entanglement/src/services/CopyTask.js b/platform/entanglement/src/services/CopyTask.js index 0f8f421adf..0fe97d99d5 100644 --- a/platform/entanglement/src/services/CopyTask.js +++ b/platform/entanglement/src/services/CopyTask.js @@ -37,7 +37,7 @@ define( * @param $q Angular's $q, for promises * @constructor */ - function CopyTask (domainObject, parent, filter, $q){ + function CopyTask(domainObject, parent, filter, $q) { this.domainObject = domainObject; this.parent = parent; this.firstClone = undefined; @@ -89,11 +89,11 @@ define( * result in automatic request batching by the browser. */ function persistObjects(self) { - return self.$q.all(self.clones.map(function(clone){ - return clone.getCapability("persistence").persist().then(function(){ + return self.$q.all(self.clones.map(function (clone) { + return clone.getCapability("persistence").persist().then(function () { self.deferred.notify({phase: "copying", totalObjects: self.clones.length, processed: ++self.persisted}); }); - })).then(function(){ + })).then(function () { return self; }); } @@ -147,16 +147,16 @@ define( * @private * @returns {*} */ - CopyTask.prototype.copyComposees = function(composees, clonedParent, originalParent){ + CopyTask.prototype.copyComposees = function (composees, clonedParent, originalParent) { var self = this, idMap = {}; - return (composees || []).reduce(function(promise, originalComposee){ + return (composees || []).reduce(function (promise, originalComposee) { //If the composee is composed of other // objects, chain a promise.. - return promise.then(function(){ + return promise.then(function () { // ...to recursively copy it (and its children) - return self.copy(originalComposee, originalParent).then(function(clonedComposee){ + return self.copy(originalComposee, originalParent).then(function (clonedComposee) { //Map the original composee's ID to that of its // clone so that we can replace any references to it // in the parent @@ -167,17 +167,18 @@ define( // set, however linked objects will not. return composeChild(clonedComposee, clonedParent, clonedComposee !== originalComposee); }); - });}, self.$q.when(undefined) - ).then(function(){ - //Replace any references in the cloned parent to - // contained objects that have been composed with the - // Ids of the clones - self.rewriteIdentifiers(clonedParent.getModel(), idMap); + }); + }, self.$q.when(undefined) + ).then(function () { + //Replace any references in the cloned parent to + // contained objects that have been composed with the + // Ids of the clones + self.rewriteIdentifiers(clonedParent.getModel(), idMap); - //Add the clone to the list of clones that will - //be returned by this function - self.clones.push(clonedParent); - return clonedParent; + //Add the clone to the list of clones that will + //be returned by this function + self.clones.push(clonedParent); + return clonedParent; }); }; @@ -192,7 +193,7 @@ define( * duplication, then a duplicate of the object, otherwise the object * itself (to allow linking to non duplicatable objects). */ - CopyTask.prototype.copy = function(originalObject) { + CopyTask.prototype.copy = function (originalObject) { var self = this, clone; @@ -207,7 +208,7 @@ define( clone = this.parent.useCapability("instantiation", cloneObjectModel(originalObject.getModel())); //Iterate through child tree - return this.$q.when(originalObject.useCapability('composition')).then(function(composees){ + return this.$q.when(originalObject.useCapability('composition')).then(function (composees) { self.deferred.notify({phase: "preparing"}); //Duplicate the object's children, and their children, and // so on down to the leaf nodes of the tree. @@ -234,10 +235,10 @@ define( * object being copied. The clones are all full composed with * references to their own children. */ - CopyTask.prototype.buildCopyPlan = function() { + CopyTask.prototype.buildCopyPlan = function () { var self = this; - return this.copy(self.domainObject, self.parent).then(function(domainObjectClone){ + return this.copy(self.domainObject, self.parent).then(function (domainObjectClone) { if (domainObjectClone !== self.domainObject) { domainObjectClone.getModel().location = self.parent.getId(); } @@ -251,7 +252,7 @@ define( * @returns {promise} Which will resolve with a clone of the object * once complete. */ - CopyTask.prototype.perform = function(){ + CopyTask.prototype.perform = function () { this.deferred = this.$q.defer(); this.buildCopyPlan() @@ -264,4 +265,4 @@ define( return CopyTask; } -); \ No newline at end of file +); diff --git a/platform/entanglement/src/services/LinkService.js b/platform/entanglement/src/services/LinkService.js index 2a99407cdb..a8b2da4401 100644 --- a/platform/entanglement/src/services/LinkService.js +++ b/platform/entanglement/src/services/LinkService.js @@ -67,7 +67,9 @@ define( .then(function (objectInNewContext) { return parentObject.getCapability('persistence') .persist() - .then(function () { return objectInNewContext; }); + .then(function () { + return objectInNewContext; + }); }); }; diff --git a/platform/entanglement/test/ControlledPromise.js b/platform/entanglement/test/ControlledPromise.js index 0b3fcd6cf6..94e32c7f7e 100644 --- a/platform/entanglement/test/ControlledPromise.js +++ b/platform/entanglement/test/ControlledPromise.js @@ -39,8 +39,8 @@ define( * Resolve the promise, passing the supplied value to all resolve * handlers. */ - ControlledPromise.prototype.resolve = function(value) { - this.resolveHandlers.forEach(function(handler) { + ControlledPromise.prototype.resolve = function (value) { + this.resolveHandlers.forEach(function (handler) { handler(value); }); }; @@ -49,8 +49,8 @@ define( * Reject the promise, passing the supplied value to all rejection * handlers. */ - ControlledPromise.prototype.reject = function(value) { - this.rejectHandlers.forEach(function(handler) { + ControlledPromise.prototype.reject = function (value) { + this.rejectHandlers.forEach(function (handler) { handler(value); }); }; @@ -63,11 +63,11 @@ define( var returnPromise = new ControlledPromise(); if (onResolve) { - this.resolveHandlers.push(function(resolveWith) { + this.resolveHandlers.push(function (resolveWith) { var chainResult = onResolve(resolveWith); if (chainResult && chainResult.then) { // chainResult is a promise, resolve when it resolves. - chainResult.then(function(pipedResult) { + chainResult.then(function (pipedResult) { return returnPromise.resolve(pipedResult); }); } else { @@ -77,10 +77,10 @@ define( } if (onReject) { - this.rejectHandlers.push(function(rejectWith) { + this.rejectHandlers.push(function (rejectWith) { var chainResult = onReject(rejectWith); if (chainResult && chainResult.then) { - chainResult.then(function(pipedResult) { + chainResult.then(function (pipedResult) { returnPromise.reject(pipedResult); }); } else { diff --git a/platform/entanglement/test/DomainObjectFactory.js b/platform/entanglement/test/DomainObjectFactory.js index 4a11667084..f3fbe28e87 100644 --- a/platform/entanglement/test/DomainObjectFactory.js +++ b/platform/entanglement/test/DomainObjectFactory.js @@ -153,4 +153,4 @@ define( return domainObjectFactory; } -); \ No newline at end of file +); diff --git a/platform/entanglement/test/actions/AbstractComposeActionSpec.js b/platform/entanglement/test/actions/AbstractComposeActionSpec.js index 18cf0b5560..cfa49cb758 100644 --- a/platform/entanglement/test/actions/AbstractComposeActionSpec.js +++ b/platform/entanglement/test/actions/AbstractComposeActionSpec.js @@ -45,7 +45,7 @@ define( beforeEach(function () { policyService = jasmine.createSpyObj( 'policyService', - [ 'allow' ] + ['allow'] ); selectedObjectContextCapability = jasmine.createSpyObj( diff --git a/platform/entanglement/test/actions/CopyActionSpec.js b/platform/entanglement/test/actions/CopyActionSpec.js index 30a9a18938..176b5baef8 100644 --- a/platform/entanglement/test/actions/CopyActionSpec.js +++ b/platform/entanglement/test/actions/CopyActionSpec.js @@ -51,7 +51,7 @@ define( beforeEach(function () { policyService = jasmine.createSpyObj( 'policyService', - [ 'allow' ] + ['allow'] ); policyService.allow.andReturn(true); @@ -105,12 +105,12 @@ define( ] ); - abstractComposePromise.then.andCallFake(function(success, error, notify){ + abstractComposePromise.then.andCallFake(function (success, error, notify) { notify(progress); success(); }); - locationServicePromise.then.andCallFake(function(callback){ + locationServicePromise.then.andCallFake(function (callback) { callback(newParent); return abstractComposePromise; }); @@ -191,7 +191,7 @@ define( .toHaveBeenCalledWith(selectedObject, newParent); }); - it("notifies the user of progress", function(){ + it("notifies the user of progress", function () { expect(notificationService.info).toHaveBeenCalled(); }); diff --git a/platform/entanglement/test/actions/GoToOriginalActionSpec.js b/platform/entanglement/test/actions/GoToOriginalActionSpec.js index 5c54018157..a05928239c 100644 --- a/platform/entanglement/test/actions/GoToOriginalActionSpec.js +++ b/platform/entanglement/test/actions/GoToOriginalActionSpec.js @@ -40,11 +40,11 @@ define( beforeEach(function () { mockLocationCapability = jasmine.createSpyObj( 'location', - [ 'isLink', 'isOriginal', 'getOriginal' ] + ['isLink', 'isOriginal', 'getOriginal'] ); mockOriginalActionCapability = jasmine.createSpyObj( 'action', - [ 'perform', 'getActions' ] + ['perform', 'getActions'] ); originalPromise = new ControlledPromise(); mockLocationCapability.getOriginal.andReturn(originalPromise); diff --git a/platform/entanglement/test/actions/LinkActionSpec.js b/platform/entanglement/test/actions/LinkActionSpec.js index 563aba0012..fa220831fc 100644 --- a/platform/entanglement/test/actions/LinkActionSpec.js +++ b/platform/entanglement/test/actions/LinkActionSpec.js @@ -45,7 +45,7 @@ define( beforeEach(function () { policyService = jasmine.createSpyObj( 'policyService', - [ 'allow' ] + ['allow'] ); policyService.allow.andReturn(true); diff --git a/platform/entanglement/test/actions/MoveActionSpec.js b/platform/entanglement/test/actions/MoveActionSpec.js index 25957cad2a..10c509ea54 100644 --- a/platform/entanglement/test/actions/MoveActionSpec.js +++ b/platform/entanglement/test/actions/MoveActionSpec.js @@ -45,7 +45,7 @@ define( beforeEach(function () { policyService = jasmine.createSpyObj( 'policyService', - [ 'allow' ] + ['allow'] ); policyService.allow.andReturn(true); diff --git a/platform/entanglement/test/actions/SetPrimaryLocationActionSpec.js b/platform/entanglement/test/actions/SetPrimaryLocationActionSpec.js index ca4c1671ec..fb1d8fa6ef 100644 --- a/platform/entanglement/test/actions/SetPrimaryLocationActionSpec.js +++ b/platform/entanglement/test/actions/SetPrimaryLocationActionSpec.js @@ -40,7 +40,7 @@ define( mockLocationCapability = jasmine.createSpyObj( 'location', - [ 'setPrimaryLocation', 'getContextualLocation' ] + ['setPrimaryLocation', 'getContextualLocation'] ); mockLocationCapability.getContextualLocation.andReturn(testId); diff --git a/platform/entanglement/test/policies/CrossSpacePolicySpec.js b/platform/entanglement/test/policies/CrossSpacePolicySpec.js index 603a956756..ef09a47619 100644 --- a/platform/entanglement/test/policies/CrossSpacePolicySpec.js +++ b/platform/entanglement/test/policies/CrossSpacePolicySpec.js @@ -54,7 +54,7 @@ define( // only define those in mocks. mockAction = jasmine.createSpyObj( 'action', - [ 'getMetadata' ] + ['getMetadata'] ); mockAction.getMetadata.andReturn(testActionMetadata); diff --git a/platform/entanglement/test/services/CopyServiceSpec.js b/platform/entanglement/test/services/CopyServiceSpec.js index c036de1ec6..a392b59b03 100644 --- a/platform/entanglement/test/services/CopyServiceSpec.js +++ b/platform/entanglement/test/services/CopyServiceSpec.js @@ -145,12 +145,12 @@ define( instantiationCapability = jasmine.createSpyObj( "instantiation", - [ "invoke" ] + ["invoke"] ); persistenceCapability = jasmine.createSpyObj( "persistenceCapability", - [ "persist", "getSpace" ] + ["persist", "getSpace"] ); persistenceCapability.persist.andReturn(persistObjectPromise); @@ -170,10 +170,12 @@ define( 'mockDeferred', ['notify', 'resolve', 'reject'] ); - mockDeferred.notify.andCallFake(function(){}); - mockDeferred.resolve.andCallFake(function(value){resolvedValue = value;}); + mockDeferred.notify.andCallFake(function () {}); + mockDeferred.resolve.andCallFake(function (value) { + resolvedValue = value; + }); mockDeferred.promise = { - then: function(callback){ + then: function (callback) { return synchronousPromise(callback(resolvedValue)); } }; @@ -187,12 +189,14 @@ define( mockQ.all.andCallFake(function (promises) { var result = {}; Object.keys(promises).forEach(function (k) { - promises[k].then(function (v) { result[k] = v; }); + promises[k].then(function (v) { + result[k] = v; + }); }); return synchronousPromise(result); }); mockQ.defer.andReturn(mockDeferred); - + }); describe("on domain object without composition", function () { @@ -238,7 +242,7 @@ define( }); instantiationCapability.invoke.andCallFake( - function(model){ + function (model) { objectCopy.model = model; return objectCopy; } @@ -254,7 +258,7 @@ define( expect(persistenceCapability.persist) .toHaveBeenCalled(); }); - + it("deep clones object model", function () { var newModel = copyFinished.calls[0].args[0].getModel(); expect(newModel).toEqual(object.model); @@ -279,7 +283,7 @@ define( objectClones; instantiationCapability.invoke.andCallFake( - function(model){ + function (model) { var cloneToReturn = objectClones[invocationCount++]; cloneToReturn.model = model; return cloneToReturn; @@ -362,8 +366,8 @@ define( copyService = new CopyService(mockQ, policyService); }); - describe("the cloning process", function(){ - beforeEach(function() { + describe("the cloning process", function () { + beforeEach(function () { copyResult = copyService.perform(object, newParent); copyFinished = jasmine.createSpy('copyFinished'); copyResult.then(copyFinished); @@ -379,23 +383,23 @@ define( expect(copyFinished).toHaveBeenCalled(); }); - it ("correctly locates cloned objects", function() { + it ("correctly locates cloned objects", function () { expect(childObjectClone.getModel().location).toEqual(objectClone.getId()); }); }); - describe("when cloning non-creatable objects", function() { + describe("when cloning non-creatable objects", function () { beforeEach(function () { - policyService.allow.andCallFake(function(category){ + policyService.allow.andCallFake(function (category) { //Return false for 'creation' policy - return category !== 'creation'; + return category !== 'creation'; }); copyResult = copyService.perform(object, newParent); copyFinished = jasmine.createSpy('copyFinished'); copyResult.then(copyFinished); }); - it ("creates link instead of clone", function() { + it ("creates link instead of clone", function () { var copiedObject = copyFinished.calls[0].args[0]; expect(copiedObject).toBe(object); expect(compositionCapability.add) @@ -412,7 +416,7 @@ define( } it("does not create new instances of objects " + - "rejected by the filter", function() { + "rejected by the filter", function () { copyService.perform(object, newParent, reject) .then(copyFinished); expect(copyFinished.mostRecentCall.args[0]) @@ -420,7 +424,7 @@ define( }); it("does create new instances of objects " + - "accepted by the filter", function() { + "accepted by the filter", function () { copyService.perform(object, newParent, accept) .then(copyFinished); expect(copyFinished.mostRecentCall.args[0]) diff --git a/platform/entanglement/test/services/CopyTaskSpec.js b/platform/entanglement/test/services/CopyTaskSpec.js index 32302edb04..9111b08c4c 100644 --- a/platform/entanglement/test/services/CopyTaskSpec.js +++ b/platform/entanglement/test/services/CopyTaskSpec.js @@ -100,11 +100,11 @@ define( cloneIds = {}; testModel = { - composition: [ ID_A, ID_B ], + composition: [ID_A, ID_B], someObj: {}, - someArr: [ ID_A, ID_B ], + someArr: [ID_A, ID_B], objArr: [{"id": ID_A}, {"id": ID_B}], - singleElementArr: [ ID_A ] + singleElementArr: [ID_A] }; testModel.someObj[ID_A] = "some value"; testModel.someObj.someProperty = ID_B; @@ -120,7 +120,7 @@ define( mockQ = jasmine.createSpyObj('$q', ['when', 'defer', 'all']); mockDeferred = jasmine.createSpyObj( 'deferred', - [ 'notify', 'resolve', 'reject' ] + ['notify', 'resolve', 'reject'] ); mockFilter.andReturn(true); @@ -130,7 +130,9 @@ define( mockQ.all.andCallFake(function (promises) { return synchronousPromise(promises.map(function (promise) { var value; - promise.then(function (v) { value = v; }); + promise.then(function (v) { + value = v; + }); return value; })); }); diff --git a/platform/entanglement/test/services/LocatingObjectDecoratorSpec.js b/platform/entanglement/test/services/LocatingObjectDecoratorSpec.js index 8a66be5134..35412510c7 100644 --- a/platform/entanglement/test/services/LocatingObjectDecoratorSpec.js +++ b/platform/entanglement/test/services/LocatingObjectDecoratorSpec.js @@ -76,7 +76,9 @@ define( mockQ.all.andCallFake(function (promises) { var result = {}; Object.keys(promises).forEach(function (k) { - promises[k].then(function (v) { result[k] = v; }); + promises[k].then(function (v) { + result[k] = v; + }); }); return testPromise(result); }); @@ -88,7 +90,7 @@ define( Object.keys(testModels).forEach(function (id) { testObjects[id] = jasmine.createSpyObj( "domainObject-" + id, - [ "getId", "getModel", "getCapability" ] + ["getId", "getModel", "getCapability"] ); testObjects[id].getId.andReturn(id); testObjects[id].getModel.andReturn(testModels[id]); diff --git a/platform/entanglement/test/services/LocationServiceSpec.js b/platform/entanglement/test/services/LocationServiceSpec.js index 03c551fd2e..951baa71ac 100644 --- a/platform/entanglement/test/services/LocationServiceSpec.js +++ b/platform/entanglement/test/services/LocationServiceSpec.js @@ -63,7 +63,9 @@ define( beforeEach(function () { title = "Get a location to do something"; label = "a location"; - validate = function () { return true; }; + validate = function () { + return true; + }; initialLocation = { key: "a key" }; locationResult = locationService.getLocationFromUser( title, diff --git a/platform/exporters/ExportService.js b/platform/exporters/ExportService.js index cebe2b7116..05263eba9f 100644 --- a/platform/exporters/ExportService.js +++ b/platform/exporters/ExportService.js @@ -61,7 +61,7 @@ define(['csv'], function (CSV) { (Object.keys((rows[0] || {})).sort()), filename = (options && options.filename) || "export.csv", csvText = new CSV(rows, { header: headers }).encode(), - blob = new Blob([ csvText ] , { type: "text/csv" }); + blob = new Blob([csvText], { type: "text/csv" }); this.saveAs(blob, filename); }; diff --git a/platform/exporters/ExportServiceSpec.js b/platform/exporters/ExportServiceSpec.js index a984ebf818..f70a408274 100644 --- a/platform/exporters/ExportServiceSpec.js +++ b/platform/exporters/ExportServiceSpec.js @@ -45,7 +45,7 @@ define( mockSaveAs.andCallFake(function (blob) { var reader = new FileReader(); reader.onloadend = function () { - csvContents = new CSV(reader.result).parse(); + csvContents = new CSV(reader.result).parse(); }; reader.readAsText(blob); }); @@ -86,7 +86,7 @@ define( var testHeaders; beforeEach(function () { - testHeaders = [ 'a', 'b' ]; + testHeaders = ['a', 'b']; exportService .exportCSV(testRows, { headers: testHeaders }); waitsFor(finishedReadingCSV); @@ -139,4 +139,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/clock/src/actions/RestartTimerAction.js b/platform/features/clock/src/actions/RestartTimerAction.js index 30b785b332..5ddcd002c7 100644 --- a/platform/features/clock/src/actions/RestartTimerAction.js +++ b/platform/features/clock/src/actions/RestartTimerAction.js @@ -39,7 +39,7 @@ define( * @param {ActionContext} context the context for this action */ function RestartTimerAction(now, context) { - AbstractStartTimerAction.apply(this, [ now, context ]); + AbstractStartTimerAction.apply(this, [now, context]); } RestartTimerAction.prototype = diff --git a/platform/features/clock/src/actions/StartTimerAction.js b/platform/features/clock/src/actions/StartTimerAction.js index 25aff8ac2a..d683ec190b 100644 --- a/platform/features/clock/src/actions/StartTimerAction.js +++ b/platform/features/clock/src/actions/StartTimerAction.js @@ -39,7 +39,7 @@ define( * @param {ActionContext} context the context for this action */ function StartTimerAction(now, context) { - AbstractStartTimerAction.apply(this, [ now, context ]); + AbstractStartTimerAction.apply(this, [now, context]); } StartTimerAction.prototype = diff --git a/platform/features/clock/test/actions/AbstractStartTimerActionSpec.js b/platform/features/clock/test/actions/AbstractStartTimerActionSpec.js index 546c348786..bc72a00f46 100644 --- a/platform/features/clock/test/actions/AbstractStartTimerActionSpec.js +++ b/platform/features/clock/test/actions/AbstractStartTimerActionSpec.js @@ -43,7 +43,7 @@ define( mockNow = jasmine.createSpy('now'); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getCapability', 'useCapability' ] + ['getCapability', 'useCapability'] ); mockPersistence = jasmine.createSpyObj( 'persistence', diff --git a/platform/features/clock/test/actions/RestartTimerActionSpec.js b/platform/features/clock/test/actions/RestartTimerActionSpec.js index 72d955b79a..1c98037380 100644 --- a/platform/features/clock/test/actions/RestartTimerActionSpec.js +++ b/platform/features/clock/test/actions/RestartTimerActionSpec.js @@ -44,7 +44,7 @@ define( mockNow = jasmine.createSpy('now'); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getCapability', 'useCapability', 'getModel' ] + ['getCapability', 'useCapability', 'getModel'] ); mockPersistence = jasmine.createSpyObj( 'persistence', diff --git a/platform/features/clock/test/actions/StartTimerActionSpec.js b/platform/features/clock/test/actions/StartTimerActionSpec.js index 25e0fdfac7..67d6438eb2 100644 --- a/platform/features/clock/test/actions/StartTimerActionSpec.js +++ b/platform/features/clock/test/actions/StartTimerActionSpec.js @@ -44,7 +44,7 @@ define( mockNow = jasmine.createSpy('now'); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getCapability', 'useCapability', 'getModel' ] + ['getCapability', 'useCapability', 'getModel'] ); mockPersistence = jasmine.createSpyObj( 'persistence', diff --git a/platform/features/clock/test/controllers/RefreshingControllerSpec.js b/platform/features/clock/test/controllers/RefreshingControllerSpec.js index cf34b46e68..c343575c55 100644 --- a/platform/features/clock/test/controllers/RefreshingControllerSpec.js +++ b/platform/features/clock/test/controllers/RefreshingControllerSpec.js @@ -45,11 +45,11 @@ define( it("refreshes the represented object on every tick", function () { var mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getCapability' ] + ['getCapability'] ), mockPersistence = jasmine.createSpyObj( 'persistence', - [ 'persist', 'refresh' ] + ['persist', 'refresh'] ); mockDomainObject.getCapability.andCallFake(function (c) { diff --git a/platform/features/clock/test/controllers/TimerControllerSpec.js b/platform/features/clock/test/controllers/TimerControllerSpec.js index 00766f9f95..79c64f941d 100644 --- a/platform/features/clock/test/controllers/TimerControllerSpec.js +++ b/platform/features/clock/test/controllers/TimerControllerSpec.js @@ -57,7 +57,7 @@ define( ); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getCapability', 'useCapability', 'getModel' ] + ['getCapability', 'useCapability', 'getModel'] ); mockActionCapability = jasmine.createSpyObj( 'action', diff --git a/platform/features/conductor/test/ConductorRepresenterSpec.js b/platform/features/conductor/test/ConductorRepresenterSpec.js index 20647e91e8..83d37fb8a6 100644 --- a/platform/features/conductor/test/ConductorRepresenterSpec.js +++ b/platform/features/conductor/test/ConductorRepresenterSpec.js @@ -70,7 +70,7 @@ define( ['getConductor'] ); mockCompile = jasmine.createSpy('$compile'); - testViews = [ { someKey: "some value" } ]; + testViews = [{ someKey: "some value" }]; mockScope = jasmine.createSpyObj('scope', SCOPE_METHODS); mockElement = jasmine.createSpyObj('element', ELEMENT_METHODS); mockElement.parent.andReturn(mockElement); diff --git a/platform/features/conductor/test/ConductorTelemetryDecoratorSpec.js b/platform/features/conductor/test/ConductorTelemetryDecoratorSpec.js index aa7757423b..e31ec32080 100644 --- a/platform/features/conductor/test/ConductorTelemetryDecoratorSpec.js +++ b/platform/features/conductor/test/ConductorTelemetryDecoratorSpec.js @@ -36,7 +36,7 @@ define( beforeEach(function () { mockTelemetryService = jasmine.createSpyObj( 'telemetryService', - [ 'requestTelemetry', 'subscribe' ] + ['requestTelemetry', 'subscribe'] ); mockConductorService = jasmine.createSpyObj( 'conductorService', @@ -49,7 +49,7 @@ define( ); mockSeries = jasmine.createSpyObj( 'series', - [ 'getPointCount', 'getDomainValue', 'getRangeValue' ] + ['getPointCount', 'getDomainValue', 'getRangeValue'] ); mockTelemetryService.requestTelemetry.andReturn(mockPromise); diff --git a/platform/features/imagery/test/directives/MCTBackgroundImageSpec.js b/platform/features/imagery/test/directives/MCTBackgroundImageSpec.js index 75458b39e3..172708bcdf 100644 --- a/platform/features/imagery/test/directives/MCTBackgroundImageSpec.js +++ b/platform/features/imagery/test/directives/MCTBackgroundImageSpec.js @@ -36,7 +36,7 @@ define( jasmine.createSpyObj('document', ['createElement']) ]; mockScope = jasmine.createSpyObj('scope', ['$watch']); - mockElement = jasmine.createSpyObj('element', [ 'css' ]); + mockElement = jasmine.createSpyObj('element', ['css']); testImage = {}; mockDocument[0].createElement.andReturn(testImage); diff --git a/platform/features/imagery/test/policies/ImageryViewPolicySpec.js b/platform/features/imagery/test/policies/ImageryViewPolicySpec.js index bec634fee6..e4eaddb842 100644 --- a/platform/features/imagery/test/policies/ImageryViewPolicySpec.js +++ b/platform/features/imagery/test/policies/ImageryViewPolicySpec.js @@ -51,24 +51,24 @@ define( }); it("allows the imagery view for domain objects with image telemetry", function () { - testMetadata.ranges = [ { key: "foo", format: "imageUrl" } ]; + testMetadata.ranges = [{ key: "foo", format: "imageUrl" }]; expect(policy.allow(testView, mockDomainObject)).toBeTruthy(); }); it("disallows the imagery view for domain objects without image telemetry", function () { - testMetadata.ranges = [ { key: "foo", format: "somethingElse" } ]; + testMetadata.ranges = [{ key: "foo", format: "somethingElse" }]; expect(policy.allow(testView, mockDomainObject)).toBeFalsy(); }); it("disallows the imagery view for domain objects without telemetry", function () { - testMetadata.ranges = [ { key: "foo", format: "imageUrl" } ]; + testMetadata.ranges = [{ key: "foo", format: "imageUrl" }]; mockDomainObject.getCapability.andReturn(undefined); expect(policy.allow(testView, mockDomainObject)).toBeFalsy(); }); it("allows other views", function () { testView.key = "somethingElse"; - testMetadata.ranges = [ { key: "foo", format: "somethingElse" } ]; + testMetadata.ranges = [{ key: "foo", format: "somethingElse" }]; expect(policy.allow(testView, mockDomainObject)).toBeTruthy(); }); diff --git a/platform/features/layout/src/FixedController.js b/platform/features/layout/src/FixedController.js index 8a3bfd9d7e..b154f5f161 100644 --- a/platform/features/layout/src/FixedController.js +++ b/platform/features/layout/src/FixedController.js @@ -24,7 +24,7 @@ define( ['./FixedProxy', './elements/ElementProxies', './FixedDragHandle'], function (FixedProxy, ElementProxies, FixedDragHandle) { - var DEFAULT_DIMENSIONS = [ 2, 1 ], + var DEFAULT_DIMENSIONS = [2, 1], DEFAULT_GRID_SIZE = [64, 16]; /** @@ -277,7 +277,7 @@ define( if (e.defaultPrevented) { return; } - if (editableDomainObject){ + if (editableDomainObject) { $scope.setEditable(editableDomainObject); } e.preventDefault(); diff --git a/platform/features/layout/src/FixedDragHandle.js b/platform/features/layout/src/FixedDragHandle.js index 96516e9cc8..3b4e14663a 100644 --- a/platform/features/layout/src/FixedDragHandle.js +++ b/platform/features/layout/src/FixedDragHandle.js @@ -26,7 +26,7 @@ define( // Drag handle dimensions - var DRAG_HANDLE_SIZE = [ 6, 6 ]; + var DRAG_HANDLE_SIZE = [6, 6]; /** * Template-displayable drag handle for an element in fixed diff --git a/platform/features/layout/src/LayoutController.js b/platform/features/layout/src/LayoutController.js index a7e3900696..496ee9d1a6 100644 --- a/platform/features/layout/src/LayoutController.js +++ b/platform/features/layout/src/LayoutController.js @@ -29,9 +29,9 @@ define( ['./LayoutDrag'], function (LayoutDrag) { - var DEFAULT_DIMENSIONS = [ 12, 8 ], - DEFAULT_GRID_SIZE = [ 32, 32 ], - MINIMUM_FRAME_SIZE = [ 320, 180 ]; + var DEFAULT_DIMENSIONS = [12, 8], + DEFAULT_GRID_SIZE = [32, 32], + MINIMUM_FRAME_SIZE = [320, 180]; /** * The LayoutController is responsible for supporting the @@ -66,7 +66,7 @@ define( if (e.defaultPrevented) { return; } - if (editableDomainObject){ + if (editableDomainObject) { $scope.setEditable(editableDomainObject); } // Ensure that configuration field is populated @@ -103,12 +103,12 @@ define( //Keep a track of how many composition callbacks have been made var thisCount = ++callbackCount; - $scope.domainObject.useCapability('composition').then(function(composition){ + $scope.domainObject.useCapability('composition').then(function (composition) { var ids; //Is this callback for the most recent composition // request? If not, discard it. Prevents race condition - if (thisCount === callbackCount){ + if (thisCount === callbackCount) { ids = composition.map(function (object) { return object.getId(); }) || []; diff --git a/platform/features/layout/src/elements/ElementProxy.js b/platform/features/layout/src/elements/ElementProxy.js index 66f3f35985..75ed061085 100644 --- a/platform/features/layout/src/elements/ElementProxy.js +++ b/platform/features/layout/src/elements/ElementProxy.js @@ -54,7 +54,7 @@ define( * @param {Array} elements the full array of elements */ function ElementProxy(element, index, elements) { - this.resizeHandles = [ new ResizeHandle(element, 1, 1) ]; + this.resizeHandles = [new ResizeHandle(element, 1, 1)]; /** * The element as stored in the view configuration. diff --git a/platform/features/layout/test/FixedControllerSpec.js b/platform/features/layout/test/FixedControllerSpec.js index 10f723a81e..ff939a21c9 100644 --- a/platform/features/layout/test/FixedControllerSpec.js +++ b/platform/features/layout/test/FixedControllerSpec.js @@ -64,7 +64,7 @@ define( function makeMockDomainObject(id) { var mockObject = jasmine.createSpyObj( 'domainObject-' + id, - [ 'getId', 'getModel', 'getCapability' ] + ['getId', 'getModel', 'getCapability'] ); mockObject.getId.andReturn(id); mockObject.getModel.andReturn({ name: "Point " + id}); @@ -74,11 +74,11 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( '$scope', - [ "$on", "$watch", "commit" ] + ["$on", "$watch", "commit"] ); mockHandler = jasmine.createSpyObj( 'telemetryHandler', - [ 'handle' ] + ['handle'] ); mockQ = jasmine.createSpyObj('$q', ['when']); mockDialogService = jasmine.createSpyObj( @@ -87,11 +87,11 @@ define( ); mockFormatter = jasmine.createSpyObj( 'telemetryFormatter', - [ 'formatDomainValue', 'formatRangeValue' ] + ['formatDomainValue', 'formatRangeValue'] ); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getModel', 'getCapability' ] + ['getId', 'getModel', 'getCapability'] ); mockHandle = jasmine.createSpyObj( 'subscription', @@ -106,10 +106,10 @@ define( ); mockEvent = jasmine.createSpyObj( 'event', - [ 'preventDefault' ] + ['preventDefault'] ); - testGrid = [ 123, 456 ]; + testGrid = [123, 456]; testModel = { composition: ['a', 'b', 'c'], layoutGrid: testGrid @@ -136,7 +136,7 @@ define( mockScope.configuration = testConfiguration; mockScope.selection = jasmine.createSpyObj( 'selection', - [ 'select', 'get', 'selected', 'deselect', 'proxy' ] + ['select', 'get', 'selected', 'deselect', 'proxy'] ); controller = new FixedController( @@ -418,7 +418,7 @@ define( expect(controller.selected().style).toEqual(oldStyle); // Drag a little - controller.moveHandle().continueDrag([ 1000, 100 ]); + controller.moveHandle().continueDrag([1000, 100]); // Style should have been updated expect(controller.selected().style).not.toEqual(oldStyle); diff --git a/platform/features/layout/test/FixedDragHandleSpec.js b/platform/features/layout/test/FixedDragHandleSpec.js index 974494ee1c..2cbaca1746 100644 --- a/platform/features/layout/test/FixedDragHandleSpec.js +++ b/platform/features/layout/test/FixedDragHandleSpec.js @@ -24,7 +24,7 @@ define( ['../src/FixedDragHandle'], function (FixedDragHandle) { - var TEST_GRID_SIZE = [ 13, 33 ]; + var TEST_GRID_SIZE = [13, 33]; describe("A fixed position drag handle", function () { var mockElementHandle, @@ -35,7 +35,7 @@ define( beforeEach(function () { mockElementHandle = jasmine.createSpyObj( 'elementHandle', - [ 'x', 'y' ] + ['x', 'y'] ); mockUpdate = jasmine.createSpy('update'); mockCommit = jasmine.createSpy('commit'); @@ -61,13 +61,13 @@ define( it("allows handles to be dragged", function () { handle.startDrag(); - handle.continueDrag([ 16, 8 ]); + handle.continueDrag([16, 8]); // Should update x/y, snapped to grid expect(mockElementHandle.x).toHaveBeenCalledWith(7); expect(mockElementHandle.y).toHaveBeenCalledWith(8); - handle.continueDrag([ -16, -35 ]); + handle.continueDrag([-16, -35]); // Should have interpreted relative to initial state expect(mockElementHandle.x).toHaveBeenCalledWith(5); @@ -84,4 +84,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/layout/test/LayoutControllerSpec.js b/platform/features/layout/test/LayoutControllerSpec.js index ebd778cb7e..06ff8b80f0 100644 --- a/platform/features/layout/test/LayoutControllerSpec.js +++ b/platform/features/layout/test/LayoutControllerSpec.js @@ -34,7 +34,7 @@ define( mockComposition, mockCompositionObjects; - function mockPromise(value){ + function mockPromise(value) { return { then: function (thenFunc) { return mockPromise(thenFunc(value)); @@ -42,12 +42,12 @@ define( }; } - function mockDomainObject(id){ + function mockDomainObject(id) { return { - getId: function() { + getId: function () { return id; }, - useCapability: function() { + useCapability: function () { return mockCompositionCapability; } }; @@ -56,11 +56,11 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( "$scope", - [ "$watch", "$watchCollection", "$on", "commit" ] + ["$watch", "$watchCollection", "$on", "commit"] ); mockEvent = jasmine.createSpyObj( 'event', - [ 'preventDefault' ] + ['preventDefault'] ); testModel = {}; @@ -238,7 +238,7 @@ define( var styleB; // Start with a very small frame size - testModel.layoutGrid = [ 1, 1 ]; + testModel.layoutGrid = [1, 1]; // White-boxy; we know which watch is which mockScope.$watch.calls[0].args[1](testModel.layoutGrid); @@ -255,7 +255,7 @@ define( var style; // Start with a very small frame size - testModel.layoutGrid = [ 1, 1 ]; + testModel.layoutGrid = [1, 1]; mockScope.$watch.calls[0].args[1](testModel.layoutGrid); // Notify that a drop occurred diff --git a/platform/features/layout/test/LayoutDragSpec.js b/platform/features/layout/test/LayoutDragSpec.js index 6309fbc13c..23503bd16d 100644 --- a/platform/features/layout/test/LayoutDragSpec.js +++ b/platform/features/layout/test/LayoutDragSpec.js @@ -26,56 +26,56 @@ define( describe("A Layout drag handler", function () { var testPosition = { - position: [ 8, 11 ], - dimensions: [ 3, 2 ] + position: [8, 11], + dimensions: [3, 2] }; it("changes position by a supplied factor, rounding by grid size", function () { var handler = new LayoutDrag( testPosition, - [ 1, 1 ], - [ 0, 0 ], - [ 10, 20 ] + [1, 1], + [0, 0], + [10, 20] ); - expect(handler.getAdjustedPosition([ 37, 84 ])).toEqual({ - position: [ 12, 15 ], - dimensions: [ 3, 2 ] + expect(handler.getAdjustedPosition([37, 84])).toEqual({ + position: [12, 15], + dimensions: [3, 2] }); - expect(handler.getAdjustedPosition([ -37, 84 ])).toEqual({ - position: [ 4, 15 ], - dimensions: [ 3, 2 ] + expect(handler.getAdjustedPosition([-37, 84])).toEqual({ + position: [4, 15], + dimensions: [3, 2] }); }); it("changes dimensions by a supplied factor, rounding by grid size", function () { var handler = new LayoutDrag( testPosition, - [ 0, 0 ], - [ 1, 1 ], - [ 10, 20 ] + [0, 0], + [1, 1], + [10, 20] ); - expect(handler.getAdjustedPosition([ 37, 84 ])).toEqual({ - position: [ 8, 11 ], - dimensions: [ 7, 6 ] + expect(handler.getAdjustedPosition([37, 84])).toEqual({ + position: [8, 11], + dimensions: [7, 6] }); }); it("allows mixing dimension and position factors", function () { var handler = new LayoutDrag( testPosition, - [ 0, 1 ], - [ -1, 0 ], - [ 10, 20 ] + [0, 1], + [-1, 0], + [10, 20] ); - expect(handler.getAdjustedPosition([ 11, 84 ])).toEqual({ - position: [ 8, 15 ], - dimensions: [ 2, 2 ] + expect(handler.getAdjustedPosition([11, 84])).toEqual({ + position: [8, 15], + dimensions: [2, 2] }); }); }); } -); \ No newline at end of file +); diff --git a/platform/features/layout/test/elements/BoxProxySpec.js b/platform/features/layout/test/elements/BoxProxySpec.js index a0d2ac0ab7..620095619a 100644 --- a/platform/features/layout/test/elements/BoxProxySpec.js +++ b/platform/features/layout/test/elements/BoxProxySpec.js @@ -37,7 +37,7 @@ define( height: 24, fill: "transparent" }; - testElements = [ {}, {}, testElement, {} ]; + testElements = [{}, {}, testElement, {}]; proxy = new BoxProxy( testElement, testElements.indexOf(testElement), diff --git a/platform/features/layout/test/elements/ElementFactorySpec.js b/platform/features/layout/test/elements/ElementFactorySpec.js index bcd9768cea..36c9fa9b7a 100644 --- a/platform/features/layout/test/elements/ElementFactorySpec.js +++ b/platform/features/layout/test/elements/ElementFactorySpec.js @@ -24,8 +24,8 @@ define( ['../../src/elements/ElementFactory'], function (ElementFactory) { - var DIALOG_ELEMENTS = [ 'image', 'text' ], - NON_DIALOG_ELEMENTS = [ 'box', 'line' ]; + var DIALOG_ELEMENTS = ['image', 'text'], + NON_DIALOG_ELEMENTS = ['box', 'line']; describe("The fixed position element factory", function () { var mockDialogService, @@ -35,11 +35,11 @@ define( beforeEach(function () { mockDialogService = jasmine.createSpyObj( 'dialogService', - [ 'getUserInput' ] + ['getUserInput'] ); mockPromise = jasmine.createSpyObj( 'promise', - [ 'then' ] + ['then'] ); mockDialogService.getUserInput.andReturn(mockPromise); @@ -66,4 +66,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/layout/test/elements/ElementProxySpec.js b/platform/features/layout/test/elements/ElementProxySpec.js index acbaf3f4cf..5c7a5e5183 100644 --- a/platform/features/layout/test/elements/ElementProxySpec.js +++ b/platform/features/layout/test/elements/ElementProxySpec.js @@ -37,7 +37,7 @@ define( width: 42, height: 24 }; - testElements = [ {}, {}, testElement, {} ]; + testElements = [{}, {}, testElement, {}]; proxy = new ElementProxy( testElement, testElements.indexOf(testElement), diff --git a/platform/features/layout/test/elements/ImageProxySpec.js b/platform/features/layout/test/elements/ImageProxySpec.js index 81f1a3f3ab..2e77cfe543 100644 --- a/platform/features/layout/test/elements/ImageProxySpec.js +++ b/platform/features/layout/test/elements/ImageProxySpec.js @@ -37,7 +37,7 @@ define( height: 24, url: "http://www.nasa.gov" }; - testElements = [ {}, {}, testElement, {} ]; + testElements = [{}, {}, testElement, {}]; proxy = new ImageProxy( testElement, testElements.indexOf(testElement), diff --git a/platform/features/layout/test/elements/LineHandleSpec.js b/platform/features/layout/test/elements/LineHandleSpec.js index a113cdef55..5f682029d7 100644 --- a/platform/features/layout/test/elements/LineHandleSpec.js +++ b/platform/features/layout/test/elements/LineHandleSpec.js @@ -70,4 +70,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/layout/test/elements/LineProxySpec.js b/platform/features/layout/test/elements/LineProxySpec.js index 15d604ae25..14ba0a790e 100644 --- a/platform/features/layout/test/elements/LineProxySpec.js +++ b/platform/features/layout/test/elements/LineProxySpec.js @@ -92,4 +92,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/layout/test/elements/ResizeHandleSpec.js b/platform/features/layout/test/elements/ResizeHandleSpec.js index c48218a667..48ffed0ae3 100644 --- a/platform/features/layout/test/elements/ResizeHandleSpec.js +++ b/platform/features/layout/test/elements/ResizeHandleSpec.js @@ -75,4 +75,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/layout/test/elements/TelemetryProxySpec.js b/platform/features/layout/test/elements/TelemetryProxySpec.js index 1044dc36b3..e68c6bf173 100644 --- a/platform/features/layout/test/elements/TelemetryProxySpec.js +++ b/platform/features/layout/test/elements/TelemetryProxySpec.js @@ -38,7 +38,7 @@ define( height: 24, id: "test-id" }; - testElements = [ {}, {}, testElement, {} ]; + testElements = [{}, {}, testElement, {}]; proxy = new TelemetryProxy( testElement, testElements.indexOf(testElement), diff --git a/platform/features/layout/test/elements/TextProxySpec.js b/platform/features/layout/test/elements/TextProxySpec.js index dbabc568cf..eb808d5867 100644 --- a/platform/features/layout/test/elements/TextProxySpec.js +++ b/platform/features/layout/test/elements/TextProxySpec.js @@ -37,7 +37,7 @@ define( height: 24, fill: "transparent" }; - testElements = [ {}, {}, testElement, {} ]; + testElements = [{}, {}, testElement, {}]; proxy = new TextProxy( testElement, testElements.indexOf(testElement), diff --git a/platform/features/plot/src/Canvas2DChart.js b/platform/features/plot/src/Canvas2DChart.js index 8fdca3a9c2..7ed9e0982b 100644 --- a/platform/features/plot/src/Canvas2DChart.js +++ b/platform/features/plot/src/Canvas2DChart.js @@ -38,8 +38,8 @@ define( this.c2d = canvas.getContext('2d'); this.width = canvas.width; this.height = canvas.height; - this.dimensions = [ this.width, this.height ]; - this.origin = [ 0, 0 ]; + this.dimensions = [this.width, this.height]; + this.origin = [0, 0]; if (!this.c2d) { throw new Error("Canvas 2d API unavailable."); diff --git a/platform/features/plot/src/PlotOptionsController.js b/platform/features/plot/src/PlotOptionsController.js index d12fcae762..4ab0ee2aa7 100644 --- a/platform/features/plot/src/PlotOptionsController.js +++ b/platform/features/plot/src/PlotOptionsController.js @@ -57,7 +57,7 @@ define( Listen for changes to the domain object and update the object's children. */ - this.mutationListener = this.domainObject.getCapability('mutation').listen(function(model) { + this.mutationListener = this.domainObject.getCapability('mutation').listen(function (model) { if (self.hasCompositionChanged(self.composition, model.composition)) { self.updateChildren(); } @@ -70,7 +70,7 @@ define( $scope.xAxisForm = this.plotOptionsForm.xAxisForm; $scope.yAxisForm = this.plotOptionsForm.yAxisForm; - $scope.$on("$destroy", function() { + $scope.$on("$destroy", function () { //Clean up any listeners on destruction of controller self.mutationListener(); }); @@ -82,10 +82,10 @@ define( * Setup a number of watches for changes to form values. On * change, update the model configuration via mutation */ - $scope.$watchCollection('configuration.plot.yAxis', function(newValue, oldValue){ + $scope.$watchCollection('configuration.plot.yAxis', function (newValue, oldValue) { self.updateConfiguration(newValue, oldValue); }); - $scope.$watchCollection('configuration.plot.xAxis', function(newValue, oldValue){ + $scope.$watchCollection('configuration.plot.xAxis', function (newValue, oldValue) { self.updateConfiguration(newValue, oldValue); }); @@ -98,8 +98,8 @@ define( * child objects) * @private */ - PlotOptionsController.prototype.clearSeriesWatches = function() { - this.watches.forEach(function(watch) { + PlotOptionsController.prototype.clearSeriesWatches = function () { + this.watches.forEach(function (watch) { watch(); }); this.watches = []; @@ -109,16 +109,16 @@ define( * Attach watches for each object in the plot's composition * @private */ - PlotOptionsController.prototype.watchSeries = function() { + PlotOptionsController.prototype.watchSeries = function () { var self = this; this.clearSeriesWatches(); - (self.$scope.children || []).forEach(function(child, index){ + (self.$scope.children || []).forEach(function (child, index) { self.watches.push( self.$scope.$watchCollection( 'configuration.plot.series[' + index + ']', - function(newValue, oldValue){ + function (newValue, oldValue) { self.updateConfiguration(newValue, oldValue); } ) @@ -132,13 +132,13 @@ define( * * @private */ - PlotOptionsController.prototype.hasCompositionChanged = function(oldComposition, newComposition){ + PlotOptionsController.prototype.hasCompositionChanged = function (oldComposition, newComposition) { // Framed slightly strangely, but the boolean logic is // easier to follow for the unchanged case. var isUnchanged = oldComposition === newComposition || ( oldComposition.length === newComposition.length && - oldComposition.every( function (currentValue, index) { + oldComposition.every(function (currentValue, index) { return newComposition[index] && currentValue === newComposition[index]; }) ); @@ -163,12 +163,12 @@ define( * plot options model * @private */ - PlotOptionsController.prototype.updateChildren = function() { + PlotOptionsController.prototype.updateChildren = function () { var self = this; - this.domainObject.useCapability('composition').then(function(children){ + this.domainObject.useCapability('composition').then(function (children) { self.$scope.children = children; self.composition = self.domainObject.getModel().composition; - children.forEach(function(child, index){ + children.forEach(function (child, index) { self.configuration.plot.series[index] = self.configuration.plot.series[index] || {'id': child.getId()}; }); @@ -181,9 +181,9 @@ define( * object * @private */ - PlotOptionsController.prototype.updateConfiguration = function() { + PlotOptionsController.prototype.updateConfiguration = function () { var self = this; - this.domainObject.useCapability('mutation', function(model){ + this.domainObject.useCapability('mutation', function (model) { model.configuration = model.configuration || {}; model.configuration.plot = self.configuration.plot; }); diff --git a/platform/features/plot/src/PlotOptionsForm.js b/platform/features/plot/src/PlotOptionsForm.js index 21f1593071..3d8e534811 100644 --- a/platform/features/plot/src/PlotOptionsForm.js +++ b/platform/features/plot/src/PlotOptionsForm.js @@ -37,7 +37,7 @@ define( Defined below are the form structures for the plot options. */ this.xAxisForm = { - 'name':'x-axis', + 'name': 'x-axis', 'sections': [{ 'name': 'x-axis', 'rows': [ @@ -46,30 +46,30 @@ define( 'control': 'select', 'key': 'key', 'options': [ - {'name':'SCET', 'value': 'scet'}, - {'name':'SCLK', 'value': 'sclk'}, - {'name':'LST', 'value': 'lst'} + {'name': 'SCET', 'value': 'scet'}, + {'name': 'SCLK', 'value': 'sclk'}, + {'name': 'LST', 'value': 'lst'} ] } ] - }]}; + }]}; this.yAxisForm = { - 'name':'y-axis', - 'sections': [{ - // Will need to be repeated for each y-axis, with a - // distinct name for each. Ideally the name of the axis - // itself. 'name': 'y-axis', - 'rows': [ + 'sections': [{ + // Will need to be repeated for each y-axis, with a + // distinct name for each. Ideally the name of the axis + // itself. + 'name': 'y-axis', + 'rows': [ { 'name': 'Range', 'control': 'select', 'key': 'key', 'options': [ - {'name':'EU', 'value': 'eu'}, - {'name':'DN', 'value': 'dn'}, - {'name':'Status', 'value': 'status'} + {'name': 'EU', 'value': 'eu'}, + {'name': 'DN', 'value': 'dn'}, + {'name': 'Status', 'value': 'status'} ] }, { @@ -95,7 +95,7 @@ define( }] }; this.plotSeriesForm = { - 'name':'Series Options', + 'name': 'Series Options', 'sections': [ { rows: [ @@ -106,7 +106,7 @@ define( }] }, { - 'rows':[ + 'rows': [ { 'name': 'Markers', 'control': 'checkbox', @@ -116,7 +116,7 @@ define( ] }, { - 'rows':[ + 'rows': [ { 'name': 'No Line', 'control': 'radio', diff --git a/platform/features/plot/src/SubPlot.js b/platform/features/plot/src/SubPlot.js index d016d4730d..b0a003de38 100644 --- a/platform/features/plot/src/SubPlot.js +++ b/platform/features/plot/src/SubPlot.js @@ -67,7 +67,7 @@ define( * implies that there is no range data displayed either * @returns {boolean} true if domain data exists for the current pan/zoom level */ - SubPlot.prototype.hasDomainData = function() { + SubPlot.prototype.hasDomainData = function () { return this.panZoomStack && this.panZoomStack.getDimensions()[0] > 0; }; @@ -109,7 +109,7 @@ define( // associated with conversion to a 32-bit floating point // format (which is needed in the chart area itself, by WebGL.) SubPlot.prototype.toDisplayable = function (position) { - return [ position[0] - this.domainOffset, position[1] ]; + return [position[0] - this.domainOffset, position[1]]; }; // Update the current hover coordinates @@ -145,7 +145,7 @@ define( end: this.toDisplayable( this.mousePositionToDomainRange(this.mousePosition) ), - color: [1, 1, 1, 0.5 ] + color: [1, 1, 1, 0.5] }] : undefined; }; @@ -189,7 +189,7 @@ define( this.panZoomStack ); - delta = [ current[0] - start[0], current[1] - start[1] ]; + delta = [current[0] - start[0], current[1] - start[1]]; nextOrigin = [ this.panStartBounds.origin[0] - delta[0], this.panStartBounds.origin[1] - delta[1] diff --git a/platform/features/plot/src/elements/PlotLineBuffer.js b/platform/features/plot/src/elements/PlotLineBuffer.js index a878500dcb..5687f854ee 100644 --- a/platform/features/plot/src/elements/PlotLineBuffer.js +++ b/platform/features/plot/src/elements/PlotLineBuffer.js @@ -35,7 +35,7 @@ define( function PlotLineBuffer(domainOffset, initialSize, maxSize) { this.buffer = new Float32Array(initialSize * 2); this.rangeExtrema = - [ Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY ]; + [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY]; this.length = 0; this.domainOffset = domainOffset; this.initialSize = initialSize; diff --git a/platform/features/plot/src/elements/PlotPalette.js b/platform/features/plot/src/elements/PlotPalette.js index ae41d85fe1..cea1aefeae 100644 --- a/platform/features/plot/src/elements/PlotPalette.js +++ b/platform/features/plot/src/elements/PlotPalette.js @@ -30,36 +30,36 @@ define( // describe colors in several ways (as RGB 0-255, as // RGB 0.0-1.0, or as stylesheet-appropriate #-prefixed colors). var integerPalette = [ - [ 0x20, 0xB2, 0xAA ], - [ 0x9A, 0xCD, 0x32 ], - [ 0xFF, 0x8C, 0x00 ], - [ 0xD2, 0xB4, 0x8C ], - [ 0x40, 0xE0, 0xD0 ], - [ 0x41, 0x69, 0xFF ], - [ 0xFF, 0xD7, 0x00 ], - [ 0x6A, 0x5A, 0xCD ], - [ 0xEE, 0x82, 0xEE ], - [ 0xCC, 0x99, 0x66 ], - [ 0x99, 0xCC, 0xCC ], - [ 0x66, 0xCC, 0x33 ], - [ 0xFF, 0xCC, 0x00 ], - [ 0xFF, 0x66, 0x33 ], - [ 0xCC, 0x66, 0xFF ], - [ 0xFF, 0x00, 0x66 ], - [ 0xFF, 0xFF, 0x00 ], - [ 0x80, 0x00, 0x80 ], - [ 0x00, 0x86, 0x8B ], - [ 0x00, 0x8A, 0x00 ], - [ 0xFF, 0x00, 0x00 ], - [ 0x00, 0x00, 0xFF ], - [ 0xF5, 0xDE, 0xB3 ], - [ 0xBC, 0x8F, 0x8F ], - [ 0x46, 0x82, 0xB4 ], - [ 0xFF, 0xAF, 0xAF ], - [ 0x43, 0xCD, 0x80 ], - [ 0xCD, 0xC1, 0xC5 ], - [ 0xA0, 0x52, 0x2D ], - [ 0x64, 0x95, 0xED ] + [0x20, 0xB2, 0xAA], + [0x9A, 0xCD, 0x32], + [0xFF, 0x8C, 0x00], + [0xD2, 0xB4, 0x8C], + [0x40, 0xE0, 0xD0], + [0x41, 0x69, 0xFF], + [0xFF, 0xD7, 0x00], + [0x6A, 0x5A, 0xCD], + [0xEE, 0x82, 0xEE], + [0xCC, 0x99, 0x66], + [0x99, 0xCC, 0xCC], + [0x66, 0xCC, 0x33], + [0xFF, 0xCC, 0x00], + [0xFF, 0x66, 0x33], + [0xCC, 0x66, 0xFF], + [0xFF, 0x00, 0x66], + [0xFF, 0xFF, 0x00], + [0x80, 0x00, 0x80], + [0x00, 0x86, 0x8B], + [0x00, 0x8A, 0x00], + [0xFF, 0x00, 0x00], + [0x00, 0x00, 0xFF], + [0xF5, 0xDE, 0xB3], + [0xBC, 0x8F, 0x8F], + [0x46, 0x82, 0xB4], + [0xFF, 0xAF, 0xAF], + [0x43, 0xCD, 0x80], + [0xCD, 0xC1, 0xC5], + [0xA0, 0x52, 0x2D], + [0x64, 0x95, 0xED] ], stringPalette = integerPalette.map(function (arr) { // Convert to # notation for use in styles return '#' + arr.map(function (c) { diff --git a/platform/features/plot/src/elements/PlotPanZoomStackGroup.js b/platform/features/plot/src/elements/PlotPanZoomStackGroup.js index 862eaf8cea..52565b524a 100644 --- a/platform/features/plot/src/elements/PlotPanZoomStackGroup.js +++ b/platform/features/plot/src/elements/PlotPanZoomStackGroup.js @@ -50,8 +50,8 @@ define( // For other stacks, do a push, but repeat // their current range axis bounds. stack.pushPanZoom( - [ origin[0], stack.getOrigin()[1] ], - [ dimensions[0], stack.getDimensions()[1] ] + [origin[0], stack.getOrigin()[1]], + [dimensions[0], stack.getDimensions()[1]] ); } }); diff --git a/platform/features/plot/src/elements/PlotPosition.js b/platform/features/plot/src/elements/PlotPosition.js index e2b598114b..76282c5bbb 100644 --- a/platform/features/plot/src/elements/PlotPosition.js +++ b/platform/features/plot/src/elements/PlotPosition.js @@ -60,7 +60,7 @@ define( // Note that range is reversed from the y-axis in pixel space //(positive range points up, positive pixel-y points down) this.position = - [ x / width, (height - y) / height ].map(convert); + [x / width, (height - y) / height].map(convert); } } diff --git a/platform/features/plot/src/elements/PlotPreparer.js b/platform/features/plot/src/elements/PlotPreparer.js index af0f0eacae..5d6b1f001c 100644 --- a/platform/features/plot/src/elements/PlotPreparer.js +++ b/platform/features/plot/src/elements/PlotPreparer.js @@ -27,7 +27,9 @@ define( function () { - function identity(x) { return x; } + function identity(x) { + return x; + } /** * The PlotPreparer is responsible for handling data sets and diff --git a/platform/features/plot/src/elements/PlotUpdater.js b/platform/features/plot/src/elements/PlotUpdater.js index b1696c2413..9c4e7a8a92 100644 --- a/platform/features/plot/src/elements/PlotUpdater.js +++ b/platform/features/plot/src/elements/PlotUpdater.js @@ -71,7 +71,7 @@ define( // Used in the reduce step of updateExtrema function reduceExtrema(a, b) { - return [ Math.min(a[0], b[0]), Math.max(a[1], b[1]) ]; + return [Math.min(a[0], b[0]), Math.max(a[1], b[1])]; } // Convert a domain/range extrema to plot dimensions @@ -173,9 +173,9 @@ define( }).reduce(reduceExtrema); // Calculate best-fit dimensions - this.dimensions = [ this.domainExtrema, this.rangeExtrema ] + this.dimensions = [this.domainExtrema, this.rangeExtrema] .map(dimensionsOf); - this.origin = [ this.domainExtrema, this.rangeExtrema ] + this.origin = [this.domainExtrema, this.rangeExtrema] .map(originOf); // Enforce some minimum visible area diff --git a/platform/features/plot/src/modes/PlotModeOptions.js b/platform/features/plot/src/modes/PlotModeOptions.js index b876130b91..a1056ebfc4 100644 --- a/platform/features/plot/src/modes/PlotModeOptions.js +++ b/platform/features/plot/src/modes/PlotModeOptions.js @@ -89,7 +89,7 @@ define( */ function PlotModeOptions(telemetryObjects, subPlotFactory) { this.options = telemetryObjects.length > 1 ? - [ OVERLAID, STACKED ] : [ OVERLAID ]; + [OVERLAID, STACKED] : [OVERLAID]; this.mode = this.options[0]; // Initial selection (overlaid) this.telemetryObjects = telemetryObjects; this.subPlotFactory = subPlotFactory; diff --git a/platform/features/plot/src/modes/PlotOverlayMode.js b/platform/features/plot/src/modes/PlotOverlayMode.js index 2e16a972cf..d8e5c906ae 100644 --- a/platform/features/plot/src/modes/PlotOverlayMode.js +++ b/platform/features/plot/src/modes/PlotOverlayMode.js @@ -38,7 +38,7 @@ define( telemetryObjects, this.panZoomStack ); - this.subplots = [ this.subplot ]; + this.subplots = [this.subplot]; } PlotOverlayMode.prototype.plotTelemetry = function (updater) { diff --git a/platform/features/plot/test/Canvas2DChartSpec.js b/platform/features/plot/test/Canvas2DChartSpec.js index 4ab50afbee..102bdbb127 100644 --- a/platform/features/plot/test/Canvas2DChartSpec.js +++ b/platform/features/plot/test/Canvas2DChartSpec.js @@ -33,7 +33,7 @@ define( chart; beforeEach(function () { - mockCanvas = jasmine.createSpyObj("canvas", [ "getContext" ]); + mockCanvas = jasmine.createSpyObj("canvas", ["getContext"]); mock2d = jasmine.createSpyObj( "2d", [ @@ -72,8 +72,8 @@ define( }); it("allows lines to be drawn", function () { - var testBuffer = [ 0, 1, 3, 8 ], - testColor = [ 0.25, 0.33, 0.66, 1.0 ], + var testBuffer = [0, 1, 3, 8], + testColor = [0.25, 0.33, 0.66, 1.0], testPoints = 2; chart.drawLine(testBuffer, testColor, testPoints); expect(mock2d.beginPath).toHaveBeenCalled(); @@ -84,7 +84,7 @@ define( it("allows squares to be drawn", function () { var testMin = [0, 1], testMax = [10, 10], - testColor = [ 0.25, 0.33, 0.66, 1.0 ]; + testColor = [0.25, 0.33, 0.66, 1.0]; chart.drawSquare(testMin, testMax, testColor); expect(mock2d.fillRect).toHaveBeenCalled(); @@ -92,4 +92,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/GLChartSpec.js b/platform/features/plot/test/GLChartSpec.js index 0dacf0532c..3501e60191 100644 --- a/platform/features/plot/test/GLChartSpec.js +++ b/platform/features/plot/test/GLChartSpec.js @@ -33,7 +33,7 @@ define( glChart; beforeEach(function () { - mockCanvas = jasmine.createSpyObj("canvas", [ "getContext" ]); + mockCanvas = jasmine.createSpyObj("canvas", ["getContext"]); mockGL = jasmine.createSpyObj( "gl", [ @@ -98,8 +98,8 @@ define( }); it("allows lines to be drawn", function () { - var testBuffer = [ 0, 1, 3, 8 ], - testColor = [ 0.25, 0.33, 0.66, 1.0 ], + var testBuffer = [0, 1, 3, 8], + testColor = [0.25, 0.33, 0.66, 1.0], testPoints = 2; glChart.drawLine(testBuffer, testColor, testPoints); expect(mockGL.bufferData).toHaveBeenCalledWith( @@ -116,7 +116,7 @@ define( it("allows squares to be drawn", function () { var testMin = [0, 1], testMax = [10, 10], - testColor = [ 0.25, 0.33, 0.66, 1.0 ]; + testColor = [0.25, 0.33, 0.66, 1.0]; glChart.drawSquare(testMin, testMax, testColor); @@ -140,4 +140,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/MCTChartSpec.js b/platform/features/plot/test/MCTChartSpec.js index db557ff8ac..3fdd4924af 100644 --- a/platform/features/plot/test/MCTChartSpec.js +++ b/platform/features/plot/test/MCTChartSpec.js @@ -55,7 +55,7 @@ define( // mct-chart uses GLChart, so it needs WebGL API mockCanvas = - jasmine.createSpyObj("canvas", [ "getContext", "addEventListener" ]); + jasmine.createSpyObj("canvas", ["getContext", "addEventListener"]); mockGL = jasmine.createSpyObj( "gl", [ @@ -122,7 +122,7 @@ define( it("issues one draw call per line", function () { mctChart.link(mockScope, mockElement); mockScope.$watchCollection.mostRecentCall.args[1]({ - lines: [ {}, {}, {} ] + lines: [{}, {}, {}] }); expect(mockGL.drawArrays.calls.length).toEqual(3); }); diff --git a/platform/features/plot/test/PlotControllerSpec.js b/platform/features/plot/test/PlotControllerSpec.js index c189286eec..4213041387 100644 --- a/platform/features/plot/test/PlotControllerSpec.js +++ b/platform/features/plot/test/PlotControllerSpec.js @@ -63,15 +63,15 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( "$scope", - [ "$watch", "$on", "$emit" ] + ["$watch", "$on", "$emit"] ); mockFormatter = jasmine.createSpyObj( "formatter", - [ "formatDomainValue", "formatRangeValue" ] + ["formatDomainValue", "formatRangeValue"] ); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability" ] + ["getId", "getModel", "getCapability"] ); mockHandler = jasmine.createSpyObj( "telemetrySubscriber", @@ -96,7 +96,9 @@ define( ); mockHandler.handle.andReturn(mockHandle); - mockThrottle.andCallFake(function (fn) { return fn; }); + mockThrottle.andCallFake(function (fn) { + return fn; + }); mockHandle.getTelemetryObjects.andReturn([mockDomainObject]); mockHandle.getMetadata.andReturn([{}]); mockHandle.getDomainValue.andReturn(123); diff --git a/platform/features/plot/test/PlotOptionsControllerSpec.js b/platform/features/plot/test/PlotOptionsControllerSpec.js index caaf66182a..f48aa517e1 100644 --- a/platform/features/plot/test/PlotOptionsControllerSpec.js +++ b/platform/features/plot/test/PlotOptionsControllerSpec.js @@ -58,7 +58,7 @@ define( mockComposition = [ mockChildOne ]; - mockCompositionCapability.then.andCallFake(function (callback){ + mockCompositionCapability.then.andCallFake(function (callback) { callback(mockComposition); }); @@ -79,7 +79,7 @@ define( 'useCapability', 'getCapability' ]); - mockDomainObject.useCapability.andCallFake(function(capability){ + mockDomainObject.useCapability.andCallFake(function (capability) { return mockUseCapabilities[capability](); }); mockDomainObject.getCapability.andReturn(mockMutationCapability); diff --git a/platform/features/plot/test/SubPlotFactorySpec.js b/platform/features/plot/test/SubPlotFactorySpec.js index e3bb8a9b8f..5e8e3affcc 100644 --- a/platform/features/plot/test/SubPlotFactorySpec.js +++ b/platform/features/plot/test/SubPlotFactorySpec.js @@ -36,20 +36,20 @@ define( beforeEach(function () { mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability" ] + ["getId", "getModel", "getCapability"] ); mockPanZoomStack = jasmine.createSpyObj( "panZoomStack", - [ "getPanZoom" ] + ["getPanZoom"] ); mockFormatter = jasmine.createSpyObj( "formatter", - [ "formatDomainValue", "formatRangeValue" ] + ["formatDomainValue", "formatRangeValue"] ); mockPanZoomStack.getPanZoom.andReturn({ - origin: [ 0, 0 ], - dimensions: [ 100, 100 ] + origin: [0, 0], + dimensions: [100, 100] }); factory = new SubPlotFactory(mockFormatter); @@ -63,4 +63,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/SubPlotSpec.js b/platform/features/plot/test/SubPlotSpec.js index 4247eddb3c..8d3fc16f67 100644 --- a/platform/features/plot/test/SubPlotSpec.js +++ b/platform/features/plot/test/SubPlotSpec.js @@ -40,7 +40,7 @@ define( beforeEach(function () { mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability" ] + ["getId", "getModel", "getCapability"] ); mockPanZoomStack = jasmine.createSpyObj( "panZoomStack", @@ -57,16 +57,16 @@ define( ); mockFormatter = jasmine.createSpyObj( "formatter", - [ "formatDomainValue", "formatRangeValue" ] + ["formatDomainValue", "formatRangeValue"] ); mockElement = jasmine.createSpyObj( "element", - [ "getBoundingClientRect" ] + ["getBoundingClientRect"] ); - testOrigin = [ 5, 10 ]; - testDimensions = [ 3000, 1000 ]; - testDomainObjects = [ mockDomainObject, mockDomainObject ]; + testOrigin = [5, 10]; + testDimensions = [3000, 1000]; + testDomainObjects = [mockDomainObject, mockDomainObject]; mockPanZoomStack.getOrigin.andReturn(testOrigin); mockPanZoomStack.getDimensions.andReturn(testDimensions); @@ -163,7 +163,7 @@ define( mockPanZoomStack.getDimensions.andReturn([0,0]); expect(subplot.hasDomainData()).toEqual(false); }); - + it("disallows marquee zoom when start and end Marquee is at the same position", function () { expect(mockPanZoomStack.pushPanZoom).not.toHaveBeenCalled(); diff --git a/platform/features/plot/test/elements/PlotAxisSpec.js b/platform/features/plot/test/elements/PlotAxisSpec.js index 0218e0b14f..922d20d1a8 100644 --- a/platform/features/plot/test/elements/PlotAxisSpec.js +++ b/platform/features/plot/test/elements/PlotAxisSpec.js @@ -88,7 +88,7 @@ define( }); it("reflects changes to applicable metadata", function () { - axis.updateMetadata([ testMetadatas[1] ]); + axis.updateMetadata([testMetadatas[1]]); expect(axis.options).toEqual([ { key: "t0", name: "T0" }, { key: "t2", name: "T2" } diff --git a/platform/features/plot/test/elements/PlotLimitTrackerSpec.js b/platform/features/plot/test/elements/PlotLimitTrackerSpec.js index d37507c628..4212f57c49 100644 --- a/platform/features/plot/test/elements/PlotLimitTrackerSpec.js +++ b/platform/features/plot/test/elements/PlotLimitTrackerSpec.js @@ -41,11 +41,11 @@ define( mockTelemetryObjects = ['a', 'b', 'c'].map(function (id, i) { var mockTelemetryObject = jasmine.createSpyObj( 'object-' + id, - [ 'getId', 'getCapability', 'getModel' ] + ['getId', 'getCapability', 'getModel'] ), mockLimitCapability = jasmine.createSpyObj( 'limit-' + id, - [ 'evaluate' ] + ['evaluate'] ); testData[id] = { id: id, value: i }; mockTelemetryObject.getId.andReturn(id); diff --git a/platform/features/plot/test/elements/PlotLineBufferSpec.js b/platform/features/plot/test/elements/PlotLineBufferSpec.js index 5b8f7a94e7..405dd4df10 100644 --- a/platform/features/plot/test/elements/PlotLineBufferSpec.js +++ b/platform/features/plot/test/elements/PlotLineBufferSpec.js @@ -38,8 +38,8 @@ define( buffer; beforeEach(function () { - testDomainValues = [ 1, 3, 7, 9, 14, 15 ]; - testRangeValues = [ 8, 0, 3, 9, 8, 11 ]; + testDomainValues = [1, 3, 7, 9, 14, 15]; + testRangeValues = [8, 0, 3, 9, 8, 11]; mockSeries = jasmine.createSpyObj( "series", ['getPointCount', 'getDomainValue', 'getRangeValue'] @@ -70,7 +70,7 @@ define( // that domain offset was adjusted for. expect( Array.prototype.slice.call(buffer.getBuffer()).slice(0, 12) - ).toEqual([ -41, 8, -39, 0, -35, 3, -33, 9, -28, 8, -27, 11]); + ).toEqual([-41, 8, -39, 0, -35, 3, -33, 9, -28, 8, -27, 11]); expect(buffer.getLength()).toEqual(6); }); @@ -84,8 +84,8 @@ define( }); it("allows insertion in the middle", function () { - var head = [ -41, 8, -39, 0, -35, 3 ], - tail = [ -33, 9, -28, 8, -27, 11]; + var head = [-41, 8, -39, 0, -35, 3], + tail = [-33, 9, -28, 8, -27, 11]; buffer.insert(mockSeries, 3); expect( Array.prototype.slice.call(buffer.getBuffer()).slice(0, 24) @@ -98,7 +98,7 @@ define( expect(buffer.getLength()).toEqual(4); expect( Array.prototype.slice.call(buffer.getBuffer()).slice(0, 8) - ).toEqual([ -35, 3, -33, 9, -28, 8, -27, 11]); + ).toEqual([-35, 3, -33, 9, -28, 8, -27, 11]); }); it("expands buffer when needed to accommodate more data", function () { diff --git a/platform/features/plot/test/elements/PlotLineSpec.js b/platform/features/plot/test/elements/PlotLineSpec.js index d0a24440d1..a6a3ed7800 100644 --- a/platform/features/plot/test/elements/PlotLineSpec.js +++ b/platform/features/plot/test/elements/PlotLineSpec.js @@ -101,7 +101,7 @@ define( }); it("allows series insertion", function () { - testSeries = [ [ 50, 42 ], [ 100, 200 ], [ 150, 12321 ] ]; + testSeries = [[50, 42], [100, 200], [150, 12321]]; line.addSeries(mockSeries); // Should have managed insertion index choices to get to... expect(testDomainBuffer).toEqual([50, 100, 150]); @@ -109,7 +109,7 @@ define( }); it("splits series insertion when necessary", function () { - testSeries = [ [ 50, 42 ], [ 100, 200 ], [ 150, 12321 ] ]; + testSeries = [[50, 42], [100, 200], [150, 12321]]; line.addPoint(75, 1); line.addSeries(mockSeries); // Should have managed insertion index choices to get to... @@ -130,4 +130,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/elements/PlotPaletteSpec.js b/platform/features/plot/test/elements/PlotPaletteSpec.js index 4a3cf66f2d..134cf41e9b 100644 --- a/platform/features/plot/test/elements/PlotPaletteSpec.js +++ b/platform/features/plot/test/elements/PlotPaletteSpec.js @@ -120,4 +120,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/elements/PlotPanZoomStackGroupSpec.js b/platform/features/plot/test/elements/PlotPanZoomStackGroupSpec.js index e236111c5b..52a47a8b10 100644 --- a/platform/features/plot/test/elements/PlotPanZoomStackGroupSpec.js +++ b/platform/features/plot/test/elements/PlotPanZoomStackGroupSpec.js @@ -49,7 +49,7 @@ define( it("synchronizes pan-zoom stack depth", function () { expect(group.getDepth()).toEqual(1); - group.getPanZoomStack(1).pushPanZoom([ 10, 20 ], [ 30, 40 ]); + group.getPanZoomStack(1).pushPanZoom([10, 20], [30, 40]); stacks.forEach(function (stack) { expect(stack.getDepth()).toEqual(2); }); @@ -58,11 +58,11 @@ define( it("synchronizes domain but not range", function () { // Set up different initial states stacks.forEach(function (stack, i) { - stack.pushPanZoom([ i, i ], [ i, i ]); + stack.pushPanZoom([i, i], [i, i]); }); // Push a new pan-zoom state onto one of the stacks - group.getPanZoomStack(1).pushPanZoom([ 99, 99 ], [ 42, 42 ]); + group.getPanZoomStack(1).pushPanZoom([99, 99], [42, 42]); // Should changed domain values for all stacks, but // only changed range values for stack 1 @@ -85,7 +85,7 @@ define( it("clears pan-zoom on request", function () { // Set up different initial states stacks.forEach(function (stack, i) { - stack.pushPanZoom([ i, i ], [ i, i ]); + stack.pushPanZoom([i, i], [i, i]); }); // Verify that we have a greater depth @@ -104,7 +104,7 @@ define( it("pops pan-zoom on request", function () { // Set up different initial states stacks.forEach(function (stack, i) { - stack.pushPanZoom([ i, i ], [ i, i ]); + stack.pushPanZoom([i, i], [i, i]); }); // Verify that we have a greater depth @@ -123,4 +123,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/elements/PlotPanZoomStackSpec.js b/platform/features/plot/test/elements/PlotPanZoomStackSpec.js index 0e1fa320e6..7f2760cdef 100644 --- a/platform/features/plot/test/elements/PlotPanZoomStackSpec.js +++ b/platform/features/plot/test/elements/PlotPanZoomStackSpec.js @@ -46,10 +46,10 @@ define( } beforeEach(function () { - initialOrigin = [ 4, 2 ]; - initialDimensions = [ 600, 400 ]; - otherOrigins = [ [8, 6], [12, 9] ]; - otherDimensions = [ [400, 300], [200, 300] ]; + initialOrigin = [4, 2]; + initialDimensions = [600, 400]; + otherOrigins = [[8, 6], [12, 9]]; + otherDimensions = [[400, 300], [200, 300]]; panZoomStack = new PlotPanZoomStack(initialOrigin, initialDimensions); }); @@ -96,4 +96,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/elements/PlotPositionSpec.js b/platform/features/plot/test/elements/PlotPositionSpec.js index 03382b61e0..61f6e2b965 100644 --- a/platform/features/plot/test/elements/PlotPositionSpec.js +++ b/platform/features/plot/test/elements/PlotPositionSpec.js @@ -29,13 +29,13 @@ define( describe("A plot position", function () { var mockPanZoom, - testOrigin = [ 10, 20 ], - testDimensions = [ 800, 10 ]; + testOrigin = [10, 20], + testDimensions = [800, 10]; beforeEach(function () { mockPanZoom = jasmine.createSpyObj( "panZoomStack", - [ "getPanZoom" ] + ["getPanZoom"] ); mockPanZoom.getPanZoom.andReturn({ origin: testOrigin, @@ -64,4 +64,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/elements/PlotPreparerSpec.js b/platform/features/plot/test/elements/PlotPreparerSpec.js index 414c3b56e1..ded5c5454d 100644 --- a/platform/features/plot/test/elements/PlotPreparerSpec.js +++ b/platform/features/plot/test/elements/PlotPreparerSpec.js @@ -34,7 +34,7 @@ define( function makeMockData(scale) { var mockData = jasmine.createSpyObj( "data" + scale, - [ "getPointCount", "getDomainValue", "getRangeValue" ] + ["getPointCount", "getDomainValue", "getRangeValue"] ); mockData.getPointCount.andReturn(1000); mockData.getDomainValue.andCallFake(function (i) { @@ -90,4 +90,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/elements/PlotSeriesWindowSpec.js b/platform/features/plot/test/elements/PlotSeriesWindowSpec.js index a3ba8646ea..eaf619751f 100644 --- a/platform/features/plot/test/elements/PlotSeriesWindowSpec.js +++ b/platform/features/plot/test/elements/PlotSeriesWindowSpec.js @@ -31,11 +31,11 @@ define( beforeEach(function () { testSeries = [ - [ 0, 42 ], - [ 10, 1 ], - [ 20, 4 ], - [ 30, 9 ], - [ 40, 3 ] + [0, 42], + [10, 1], + [20, 4], + [30, 9], + [40, 3] ]; mockSeries = jasmine.createSpyObj( @@ -90,4 +90,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/elements/PlotTickGeneratorSpec.js b/platform/features/plot/test/elements/PlotTickGeneratorSpec.js index ae4e39c88d..b26a6a0051 100644 --- a/platform/features/plot/test/elements/PlotTickGeneratorSpec.js +++ b/platform/features/plot/test/elements/PlotTickGeneratorSpec.js @@ -35,16 +35,16 @@ define( beforeEach(function () { mockPanZoomStack = jasmine.createSpyObj( "panZoomStack", - [ "getPanZoom" ] + ["getPanZoom"] ); mockFormatter = jasmine.createSpyObj( "formatter", - [ "formatDomainValue", "formatRangeValue" ] + ["formatDomainValue", "formatRangeValue"] ); mockPanZoomStack.getPanZoom.andReturn({ - origin: [ 0, 0 ], - dimensions: [ 100, 100 ] + origin: [0, 0], + dimensions: [100, 100] }); generator = @@ -70,4 +70,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/elements/PlotUpdaterSpec.js b/platform/features/plot/test/elements/PlotUpdaterSpec.js index 158090892c..e91da5f19a 100644 --- a/platform/features/plot/test/elements/PlotUpdaterSpec.js +++ b/platform/features/plot/test/elements/PlotUpdaterSpec.js @@ -39,19 +39,19 @@ define( function makeMockDomainObject(id) { var mockDomainObject = jasmine.createSpyObj( "object-" + id, - [ "getId", "getCapability", "getModel" ] + ["getId", "getCapability", "getModel"] ); mockDomainObject.getId.andReturn(id); return mockDomainObject; } beforeEach(function () { - var ids = [ 'a', 'b', 'c' ], + var ids = ['a', 'b', 'c'], mockObjects = ids.map(makeMockDomainObject); mockSubscription = jasmine.createSpyObj( "subscription", - [ "getDomainValue", "getRangeValue", "getTelemetryObjects" ] + ["getDomainValue", "getRangeValue", "getTelemetryObjects"] ); mockSeries = jasmine.createSpyObj( 'series', diff --git a/platform/features/plot/test/modes/PlotModeOptionsSpec.js b/platform/features/plot/test/modes/PlotModeOptionsSpec.js index 5d382d08d4..37c74cdf8f 100644 --- a/platform/features/plot/test/modes/PlotModeOptionsSpec.js +++ b/platform/features/plot/test/modes/PlotModeOptionsSpec.js @@ -34,11 +34,11 @@ define( beforeEach(function () { mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability" ] + ["getId", "getModel", "getCapability"] ); mockSubPlotFactory = jasmine.createSpyObj( "subPlotFactory", - [ "createSubPlot" ] + ["createSubPlot"] ); }); @@ -84,4 +84,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/modes/PlotOverlayModeSpec.js b/platform/features/plot/test/modes/PlotOverlayModeSpec.js index 0560d428f7..877820750c 100644 --- a/platform/features/plot/test/modes/PlotOverlayModeSpec.js +++ b/platform/features/plot/test/modes/PlotOverlayModeSpec.js @@ -58,11 +58,11 @@ define( beforeEach(function () { mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability" ] + ["getId", "getModel", "getCapability"] ); mockSubPlotFactory = jasmine.createSpyObj( "subPlotFactory", - [ "createSubPlot" ] + ["createSubPlot"] ); // Prepared telemetry data mockPrepared = jasmine.createSpyObj( @@ -181,4 +181,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/modes/PlotStackModeSpec.js b/platform/features/plot/test/modes/PlotStackModeSpec.js index cf4407e7e0..65e6962591 100644 --- a/platform/features/plot/test/modes/PlotStackModeSpec.js +++ b/platform/features/plot/test/modes/PlotStackModeSpec.js @@ -58,16 +58,16 @@ define( beforeEach(function () { mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "getCapability" ] + ["getId", "getModel", "getCapability"] ); mockSubPlotFactory = jasmine.createSpyObj( "subPlotFactory", - [ "createSubPlot" ] + ["createSubPlot"] ); // Prepared telemetry data mockPrepared = jasmine.createSpyObj( "prepared", - [ "getDomainOffset", "getOrigin", "getDimensions", "getLineBuffers" ] + ["getDomainOffset", "getOrigin", "getDimensions", "getLineBuffers"] ); mockSubPlotFactory.createSubPlot.andCallFake(createMockSubPlot); @@ -176,4 +176,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/plot/test/policies/PlotViewPolicySpec.js b/platform/features/plot/test/policies/PlotViewPolicySpec.js index ec01ec05bc..008d4275da 100644 --- a/platform/features/plot/test/policies/PlotViewPolicySpec.js +++ b/platform/features/plot/test/policies/PlotViewPolicySpec.js @@ -51,23 +51,23 @@ define( }); it("allows the imagery view for domain objects with numeric telemetry", function () { - testMetadata.ranges = [ { key: "foo", format: "number" } ]; + testMetadata.ranges = [{ key: "foo", format: "number" }]; expect(policy.allow(testView, mockDomainObject)).toBeTruthy(); }); it("allows the imagery view for domain objects with unspecified telemetry", function () { - testMetadata.ranges = [ { key: "foo" } ]; + testMetadata.ranges = [{ key: "foo" }]; expect(policy.allow(testView, mockDomainObject)).toBeTruthy(); }); it("disallows the imagery view for domain objects without image telemetry", function () { - testMetadata.ranges = [ { key: "foo", format: "somethingElse" } ]; + testMetadata.ranges = [{ key: "foo", format: "somethingElse" }]; expect(policy.allow(testView, mockDomainObject)).toBeFalsy(); }); it("allows other views", function () { testView.key = "somethingElse"; - testMetadata.ranges = [ { key: "foo", format: "somethingElse" } ]; + testMetadata.ranges = [{ key: "foo", format: "somethingElse" }]; expect(policy.allow(testView, mockDomainObject)).toBeTruthy(); }); diff --git a/platform/features/static-markup/bundle.js b/platform/features/static-markup/bundle.js index 5e05263619..59376ff957 100644 --- a/platform/features/static-markup/bundle.js +++ b/platform/features/static-markup/bundle.js @@ -21,11 +21,11 @@ *****************************************************************************/ define([ - + "text!./res/markup.html", 'legacyRegistry' ], function ( - + markupTemplate, legacyRegistry ) { diff --git a/platform/features/table/src/RangeColumn.js b/platform/features/table/src/RangeColumn.js index f4c5df8c76..0b0636ac16 100644 --- a/platform/features/table/src/RangeColumn.js +++ b/platform/features/table/src/RangeColumn.js @@ -56,7 +56,7 @@ define( return { cssClass: alarm && alarm.cssClass, - text: typeof(value) === 'undefined' ? undefined : this.telemetryFormatter.formatRangeValue(value) + text: typeof (value) === 'undefined' ? undefined : this.telemetryFormatter.formatRangeValue(value) }; }; diff --git a/platform/features/table/src/TableConfiguration.js b/platform/features/table/src/TableConfiguration.js index 697a4a2699..8b9363f66f 100644 --- a/platform/features/table/src/TableConfiguration.js +++ b/platform/features/table/src/TableConfiguration.js @@ -64,7 +64,7 @@ define( }); }); - if (this.columns.length > 0){ + if (this.columns.length > 0) { self.addColumn(new NameColumn(), 0); } } @@ -91,7 +91,7 @@ define( * @returns {*|string} */ TableConfiguration.prototype.getColumnTitle = function (column) { - return column.getTitle(); + return column.getTitle(); }; /** @@ -100,7 +100,7 @@ define( */ TableConfiguration.prototype.getHeaders = function () { var self = this; - return this.columns.map(function (column, i){ + return this.columns.map(function (column, i) { return self.getColumnTitle(column) || 'Column ' + (i + 1); }); }; @@ -115,11 +115,11 @@ define( */ TableConfiguration.prototype.getRowValues = function (telemetryObject, datum) { var self = this; - return this.columns.reduce(function (rowObject, column, i){ + return this.columns.reduce(function (rowObject, column, i) { var columnTitle = self.getColumnTitle(column) || 'Column ' + (i + 1), columnValue = column.getValue(telemetryObject, datum); - if (columnValue !== undefined && columnValue.text === undefined){ + if (columnValue !== undefined && columnValue.text === undefined) { columnValue.text = ''; } // Don't replace something with nothing. @@ -158,7 +158,7 @@ define( config2Keys = Object.keys(config2); return (config1Keys.length !== config2Keys.length) || - config1Keys.some(function(key){ + config1Keys.some(function (key) { return config1[key] !== config2[key]; }); } diff --git a/platform/features/table/src/controllers/HistoricalTableController.js b/platform/features/table/src/controllers/HistoricalTableController.js index 259b000e46..69446f58f4 100644 --- a/platform/features/table/src/controllers/HistoricalTableController.js +++ b/platform/features/table/src/controllers/HistoricalTableController.js @@ -49,7 +49,7 @@ define( var rowData = [], self = this; - this.handle.getTelemetryObjects().forEach(function (telemetryObject){ + this.handle.getTelemetryObjects().forEach(function (telemetryObject) { var series = self.handle.getSeries(telemetryObject) || {}, pointCount = series.getPointCount ? series.getPointCount() : 0, i = 0; diff --git a/platform/features/table/src/controllers/MCTTableController.js b/platform/features/table/src/controllers/MCTTableController.js index 0ccdfbe583..79496a14db 100644 --- a/platform/features/table/src/controllers/MCTTableController.js +++ b/platform/features/table/src/controllers/MCTTableController.js @@ -89,8 +89,8 @@ define( //Use timeout to defer execution until next digest when any // pending UI changes have completed, eg. a new row in the table. if (this.$scope.autoScroll) { - this.$timeout(function (){ - self.scrollable[0].scrollTop = self.scrollable[0].scrollHeight; + this.$timeout(function () { + self.scrollable[0].scrollTop = self.scrollable[0].scrollHeight; }); } }; @@ -125,10 +125,10 @@ define( // Do a sequential search here. Only way of finding row is by // object equality, so array is in effect unsorted. indexInDisplayRows = this.$scope.displayRows.indexOf(row); - if (indexInDisplayRows !== -1) { - this.$scope.displayRows.splice(indexInDisplayRows, 1); - this.setVisibleRows(); - } + if (indexInDisplayRows !== -1) { + this.$scope.displayRows.splice(indexInDisplayRows, 1); + this.setVisibleRows(); + } }; /** @@ -222,7 +222,7 @@ define( * sorting. */ MCTTableController.prototype.setHeaders = function (newHeaders) { - if (!newHeaders){ + if (!newHeaders) { return; } @@ -234,8 +234,8 @@ define( // contain the column currently sorted on. if (this.$scope.enableSort && newHeaders.indexOf(this.$scope.sortColumn) === -1) { - this.$scope.sortColumn = undefined; - this.$scope.sortDirection = undefined; + this.$scope.sortColumn = undefined; + this.$scope.sortDirection = undefined; } this.setRows(this.$scope.rows); }; @@ -283,14 +283,14 @@ define( self = this, sortKey = this.$scope.sortColumn; - function binarySearch(searchArray, searchElement, min, max){ + function binarySearch(searchArray, searchElement, min, max) { var sampleAt = Math.floor((max - min) / 2) + min; if (max < min) { return min; // Element is not in array, min gives direction } - switch(self.sortComparator(searchElement[sortKey].text, + switch (self.sortComparator(searchElement[sortKey].text, searchArray[sampleAt][sortKey].text)) { case -1: return binarySearch(searchArray, searchElement, min, @@ -310,9 +310,9 @@ define( //Sort is enabled, perform binary search to find insertion point index = binarySearch(array, element, 0, array.length - 1); } - if (index === -1){ + if (index === -1) { array.unshift(element); - } else if (index === array.length){ + } else if (index === array.length) { array.push(element); } else { array.splice(index, 0, element); @@ -342,7 +342,7 @@ define( * @returns {*} The value cast to a Number, or the original value if * a Number representation is not possible. */ - function toNumber (value){ + function toNumber(value) { var val = !isNaN(Number(value)) && !isNaN(parseFloat(value)) ? Number(value) : value; return val; } @@ -410,7 +410,7 @@ define( currentColumnLength, largestColumn, largestColumnLength; - if (row[key]){ + if (row[key]) { currentColumn = (row[key]).text; currentColumnLength = (currentColumn && currentColumn.length) ? diff --git a/platform/features/table/src/controllers/RealtimeTableController.js b/platform/features/table/src/controllers/RealtimeTableController.js index 042ece6e61..d9a3efd559 100644 --- a/platform/features/table/src/controllers/RealtimeTableController.js +++ b/platform/features/table/src/controllers/RealtimeTableController.js @@ -58,7 +58,7 @@ define( $scope.$watch('domainObject', function (domainObject) { //When a domain object becomes available, check whether the // view should auto-scroll to the bottom. - if (domainObject && hasStringTelemetry(domainObject)){ + if (domainObject && hasStringTelemetry(domainObject)) { $scope.autoScroll = true; } }); @@ -70,11 +70,11 @@ define( * Overrides method on TelemetryTableController providing handling * for realtime data. */ - RealtimeTableController.prototype.addRealtimeData = function() { + RealtimeTableController.prototype.addRealtimeData = function () { var self = this, datum, row; - this.handle.getTelemetryObjects().forEach(function (telemetryObject){ + this.handle.getTelemetryObjects().forEach(function (telemetryObject) { datum = self.handle.getDatum(telemetryObject); if (datum) { //Populate row values from telemetry datum diff --git a/platform/features/table/src/controllers/TableOptionsController.js b/platform/features/table/src/controllers/TableOptionsController.js index 96b9eb91c1..0ca83b088c 100644 --- a/platform/features/table/src/controllers/TableOptionsController.js +++ b/platform/features/table/src/controllers/TableOptionsController.js @@ -59,7 +59,7 @@ define( }); } - $scope.$watch('domainObject', function(domainObject) { + $scope.$watch('domainObject', function (domainObject) { unlisten(); self.populateForm(domainObject.getModel()); @@ -72,10 +72,10 @@ define( * Maintain a configuration object on scope that stores column * configuration. On change, synchronize with object model. */ - $scope.$watchCollection('configuration.table.columns', function (columns){ - if (columns){ + $scope.$watchCollection('configuration.table.columns', function (columns) { + if (columns) { self.domainObject.useCapability('mutation', function (model) { - model.configuration.table.columns = columns; + model.configuration.table.columns = columns; }); self.domainObject.getCapability('persistence').persist(); } @@ -92,13 +92,13 @@ define( var columnsDefinition = (((model.configuration || {}).table || {}).columns || {}), rows = []; this.$scope.columnsForm = { - 'name':'Columns', + 'name': 'Columns', 'sections': [{ 'name': 'Columns', 'rows': rows }]}; - Object.keys(columnsDefinition).forEach(function (key){ + Object.keys(columnsDefinition).forEach(function (key) { rows.push({ 'name': key, 'control': 'checkbox', diff --git a/platform/features/table/src/controllers/TelemetryTableController.js b/platform/features/table/src/controllers/TelemetryTableController.js index 38d1551038..3f4e69db12 100644 --- a/platform/features/table/src/controllers/TelemetryTableController.js +++ b/platform/features/table/src/controllers/TelemetryTableController.js @@ -58,7 +58,7 @@ define( $scope.rows = []; // Subscribe to telemetry when a domain object becomes available - this.$scope.$watch('domainObject', function(){ + this.$scope.$watch('domainObject', function () { self.subscribe(); self.registerChangeListeners(); }); diff --git a/platform/features/table/src/directives/MCTTable.js b/platform/features/table/src/directives/MCTTable.js index 2eeb167f08..5dd8f9f03f 100644 --- a/platform/features/table/src/directives/MCTTable.js +++ b/platform/features/table/src/directives/MCTTable.js @@ -88,7 +88,7 @@ define( enableFilter: "=?", enableSort: "=?", autoScroll: "=?" - }, + } }; } diff --git a/platform/features/table/test/DomainColumnSpec.js b/platform/features/table/test/DomainColumnSpec.js index bb6debd9a3..e707c8dd0b 100644 --- a/platform/features/table/test/DomainColumnSpec.js +++ b/platform/features/table/test/DomainColumnSpec.js @@ -38,11 +38,11 @@ define( beforeEach(function () { mockDataSet = jasmine.createSpyObj( "data", - [ "getDomainValue" ] + ["getDomainValue"] ); mockFormatter = jasmine.createSpyObj( "formatter", - [ "formatDomainValue", "formatRangeValue" ] + ["formatDomainValue", "formatRangeValue"] ); testMetadata = { key: "testKey", diff --git a/platform/features/table/test/NameColumnSpec.js b/platform/features/table/test/NameColumnSpec.js index 0072b4492c..d381758330 100644 --- a/platform/features/table/test/NameColumnSpec.js +++ b/platform/features/table/test/NameColumnSpec.js @@ -34,7 +34,7 @@ define( beforeEach(function () { mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getModel" ] + ["getModel"] ); mockDomainObject.getModel.andReturn({ name: "Test object name" diff --git a/platform/features/table/test/RangeColumnSpec.js b/platform/features/table/test/RangeColumnSpec.js index 304a8a1b4b..45383fcdf7 100644 --- a/platform/features/table/test/RangeColumnSpec.js +++ b/platform/features/table/test/RangeColumnSpec.js @@ -40,7 +40,7 @@ define( testDatum = { testKey: 123, otherKey: 456 }; mockFormatter = jasmine.createSpyObj( "formatter", - [ "formatDomainValue", "formatRangeValue" ] + ["formatDomainValue", "formatRangeValue"] ); testMetadata = { key: "testKey", @@ -48,7 +48,7 @@ define( }; mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getModel", "getCapability" ] + ["getModel", "getCapability"] ); mockFormatter.formatRangeValue.andReturn(TEST_RANGE_VALUE); diff --git a/platform/features/table/test/TableConfigurationSpec.js b/platform/features/table/test/TableConfigurationSpec.js index 83dc122055..2f59fb173f 100644 --- a/platform/features/table/test/TableConfigurationSpec.js +++ b/platform/features/table/test/TableConfigurationSpec.js @@ -44,10 +44,10 @@ define( 'formatDomainValue', 'formatRangeValue' ]); - mockTelemetryFormatter.formatDomainValue.andCallFake(function(valueIn){ + mockTelemetryFormatter.formatDomainValue.andCallFake(function (valueIn) { return valueIn; }); - mockTelemetryFormatter.formatRangeValue.andCallFake(function(valueIn){ + mockTelemetryFormatter.formatRangeValue.andCallFake(function (valueIn) { return valueIn; }); @@ -87,7 +87,7 @@ define( expect(table.columns[2]).toBe(thirdColumn); }); - describe("Building columns from telemetry metadata", function() { + describe("Building columns from telemetry metadata", function () { var metadata = [{ ranges: [ { @@ -113,21 +113,21 @@ define( ] }]; - beforeEach(function() { + beforeEach(function () { table.populateColumns(metadata); }); - it("populates columns", function() { + it("populates columns", function () { expect(table.columns.length).toBe(5); }); - it("Build columns populates columns with domains to the left", function() { + it("Build columns populates columns with domains to the left", function () { expect(table.columns[1] instanceof DomainColumn).toBeTruthy(); expect(table.columns[2] instanceof DomainColumn).toBeTruthy(); expect(table.columns[3] instanceof DomainColumn).toBeFalsy(); }); - it("Produces headers for each column based on title", function() { + it("Produces headers for each column based on title", function () { var headers, firstColumn = table.columns[0]; @@ -138,16 +138,16 @@ define( }); it("Provides a default configuration with all columns" + - " visible", function() { + " visible", function () { var configuration = table.buildColumnConfiguration(); expect(configuration).toBeDefined(); - expect(Object.keys(configuration).every(function(key){ + expect(Object.keys(configuration).every(function (key) { return configuration[key]; })); }); - it("Column configuration exposes persisted configuration", function() { + it("Column configuration exposes persisted configuration", function () { var tableConfig, modelConfig = { table: { @@ -168,7 +168,7 @@ define( var datum, rowValues; - beforeEach(function() { + beforeEach(function () { datum = { 'range1': 'range 1 value', 'range2': 'range 2 value', @@ -178,14 +178,14 @@ define( rowValues = table.getRowValues(mockDomainObject, datum); }); - it("Returns a value for every column", function() { + it("Returns a value for every column", function () { expect(rowValues['Range 1'].text).toBeDefined(); expect(rowValues['Range 1'].text).toEqual('range 1' + ' value'); }); it("Uses the telemetry formatter to appropriately format" + - " telemetry values", function() { + " telemetry values", function () { expect(mockTelemetryFormatter.formatRangeValue).toHaveBeenCalled(); }); }); diff --git a/platform/features/table/test/controllers/HistoricalTableControllerSpec.js b/platform/features/table/test/controllers/HistoricalTableControllerSpec.js index a38681681c..54c213d5a6 100644 --- a/platform/features/table/test/controllers/HistoricalTableControllerSpec.js +++ b/platform/features/table/test/controllers/HistoricalTableControllerSpec.js @@ -39,7 +39,7 @@ define( function promise(value) { return { - then: function (callback){ + then: function (callback) { return promise(callback(value)); } }; @@ -53,13 +53,13 @@ define( '$watchCollection' ]); - mockScope.$on.andCallFake(function (expression, callback){ + mockScope.$on.andCallFake(function (expression, callback) { watches[expression] = callback; }); - mockScope.$watch.andCallFake(function (expression, callback){ - watches[expression] = callback; + mockScope.$watch.andCallFake(function (expression, callback) { + watches[expression] = callback; }); - mockScope.$watchCollection.andCallFake(function (expression, callback){ + mockScope.$watchCollection.andCallFake(function (expression, callback) { watches[expression] = callback; }); @@ -80,7 +80,7 @@ define( mockTable.columns = []; mockTable.buildColumnConfiguration.andReturn(mockConfiguration); - mockDomainObject= jasmine.createSpyObj('domainObject', [ + mockDomainObject = jasmine.createSpyObj('domainObject', [ 'getCapability', 'useCapability', 'getModel' @@ -118,7 +118,7 @@ define( expect(mockTelemetryHandle.request).toHaveBeenCalled(); }); - it('Unsubscribes from telemetry when scope is destroyed',function () { + it('Unsubscribes from telemetry when scope is destroyed', function () { controller.handle = mockTelemetryHandle; watches.$destroy(); expect(mockTelemetryHandle.unsubscribe).toHaveBeenCalled(); @@ -139,7 +139,7 @@ define( }); }); - it('updates the rows on scope when historical telemetry is received', function (){ + it('updates the rows on scope when historical telemetry is received', function () { var mockSeries = { getPointCount: function () { return 5; @@ -154,7 +154,7 @@ define( mockRow = {'domain': 'Domain Value', 'range': 'Range' + ' Value'}; - mockTelemetryHandle.makeDatum.andCallFake(function (){ + mockTelemetryHandle.makeDatum.andCallFake(function () { return mockRow; }); mockTable.getRowValues.andReturn(mockRow); @@ -167,7 +167,7 @@ define( expect(controller.$scope.rows[0]).toBe(mockRow); }); - it('filters the visible columns based on configuration', function (){ + it('filters the visible columns based on configuration', function () { controller.filterColumns(); expect(controller.$scope.headers.length).toBe(3); expect(controller.$scope.headers[2]).toEqual('domain1'); @@ -178,9 +178,9 @@ define( expect(controller.$scope.headers[2]).toBeUndefined(); }); - describe('creates event listeners', function (){ + describe('creates event listeners', function () { beforeEach(function () { - spyOn(controller,'subscribe'); + spyOn(controller, 'subscribe'); spyOn(controller, 'filterColumns'); }); diff --git a/platform/features/table/test/controllers/MCTTableControllerSpec.js b/platform/features/table/test/controllers/MCTTableControllerSpec.js index 84cf154abf..26578ba244 100644 --- a/platform/features/table/test/controllers/MCTTableControllerSpec.js +++ b/platform/features/table/test/controllers/MCTTableControllerSpec.js @@ -26,7 +26,7 @@ define( ], function (MCTTableController) { - describe('The MCTTable Controller', function() { + describe('The MCTTable Controller', function () { var controller, mockScope, @@ -42,7 +42,7 @@ define( }; } - beforeEach(function() { + beforeEach(function () { watches = {}; mockScope = jasmine.createSpyObj('scope', [ @@ -50,7 +50,7 @@ define( '$on', '$watchCollection' ]); - mockScope.$watchCollection.andCallFake(function(event, callback) { + mockScope.$watchCollection.andCallFake(function (event, callback) { watches[event] = callback; }); @@ -75,15 +75,15 @@ define( spyOn(controller, 'setVisibleRows').andCallThrough(); }); - it('Reacts to changes to filters, headers, and rows', function() { + it('Reacts to changes to filters, headers, and rows', function () { expect(mockScope.$watchCollection).toHaveBeenCalledWith('filters', jasmine.any(Function)); expect(mockScope.$watch).toHaveBeenCalledWith('headers', jasmine.any(Function)); expect(mockScope.$watch).toHaveBeenCalledWith('rows', jasmine.any(Function)); }); - describe('rows', function() { + describe('rows', function () { var testRows = []; - beforeEach(function() { + beforeEach(function () { testRows = [ { 'col1': {'text': 'row1 col1 match'}, @@ -104,30 +104,30 @@ define( mockScope.rows = testRows; }); - it('Filters results based on filter input', function() { - var filters = {}, - filteredRows; + it('Filters results based on filter input', function () { + var filters = {}, + filteredRows; - mockScope.filters = filters; + mockScope.filters = filters; - filteredRows = controller.filterRows(testRows); - expect(filteredRows.length).toBe(3); - filters.col1 = 'row1'; - filteredRows = controller.filterRows(testRows); - expect(filteredRows.length).toBe(1); - filters.col1 = 'match'; - filteredRows = controller.filterRows(testRows); - expect(filteredRows.length).toBe(2); + filteredRows = controller.filterRows(testRows); + expect(filteredRows.length).toBe(3); + filters.col1 = 'row1'; + filteredRows = controller.filterRows(testRows); + expect(filteredRows.length).toBe(1); + filters.col1 = 'match'; + filteredRows = controller.filterRows(testRows); + expect(filteredRows.length).toBe(2); }); - it('Sets rows on scope when rows change', function() { + it('Sets rows on scope when rows change', function () { controller.setRows(testRows); expect(mockScope.displayRows.length).toBe(3); expect(mockScope.displayRows).toEqual(testRows); }); - it('Supports adding rows individually', function() { - var addRowFunc = mockScope.$on.calls[mockScope.$on.calls.length-2].args[1], + it('Supports adding rows individually', function () { + var addRowFunc = mockScope.$on.calls[mockScope.$on.calls.length - 2].args[1], row4 = { 'col1': {'text': 'row3 col1'}, 'col2': {'text': 'ghi'}, @@ -140,8 +140,8 @@ define( expect(mockScope.displayRows.length).toBe(4); }); - it('Supports removing rows individually', function() { - var removeRowFunc = mockScope.$on.calls[mockScope.$on.calls.length-1].args[1]; + it('Supports removing rows individually', function () { + var removeRowFunc = mockScope.$on.calls[mockScope.$on.calls.length - 1].args[1]; controller.setRows(testRows); expect(mockScope.displayRows.length).toBe(3); removeRowFunc(undefined, 2); @@ -149,10 +149,10 @@ define( expect(controller.setVisibleRows).toHaveBeenCalled(); }); - describe('sorting', function() { + describe('sorting', function () { var sortedRows; - it('Sorts rows ascending', function() { + it('Sorts rows ascending', function () { mockScope.sortColumn = 'col1'; mockScope.sortDirection = 'asc'; @@ -164,7 +164,7 @@ define( }); - it('Sorts rows descending', function() { + it('Sorts rows descending', function () { mockScope.sortColumn = 'col1'; mockScope.sortDirection = 'desc'; @@ -173,7 +173,7 @@ define( expect(sortedRows[1].col1.text).toEqual('row2 col1 match'); expect(sortedRows[2].col1.text).toEqual('row1 col1 match'); }); - it('Sorts rows descending based on selected sort column', function() { + it('Sorts rows descending based on selected sort column', function () { mockScope.sortColumn = 'col2'; mockScope.sortDirection = 'desc'; @@ -218,9 +218,9 @@ define( expect(sortedRows[1].col2.text).toEqual('def'); expect(sortedRows[2].col2.text).toEqual('abc'); - expect(sortedRows[sortedRows.length-3].col2.text).toEqual('456'); - expect(sortedRows[sortedRows.length-2].col2.text).toEqual('123'); - expect(sortedRows[sortedRows.length-1].col2.text).toEqual(''); + expect(sortedRows[sortedRows.length - 3].col2.text).toEqual('456'); + expect(sortedRows[sortedRows.length - 2].col2.text).toEqual('123'); + expect(sortedRows[sortedRows.length - 1].col2.text).toEqual(''); }); describe('The sort comparator', function () { @@ -245,7 +245,7 @@ define( row5, row6; - beforeEach(function() { + beforeEach(function () { row4 = { 'col1': {'text': 'row5 col1'}, 'col2': {'text': 'xyz'}, @@ -264,33 +264,33 @@ define( }); it('Adds new rows at the correct sort position when' + - ' sorted ', function() { + ' sorted ', function () { mockScope.sortColumn = 'col2'; mockScope.sortDirection = 'desc'; mockScope.displayRows = controller.sortRows(testRows.slice(0)); mockScope.rows.push(row4); - controller.addRow(undefined, mockScope.rows.length-1); + controller.addRow(undefined, mockScope.rows.length - 1); expect(mockScope.displayRows[0].col2.text).toEqual('xyz'); mockScope.rows.push(row5); - controller.addRow(undefined, mockScope.rows.length-1); + controller.addRow(undefined, mockScope.rows.length - 1); expect(mockScope.displayRows[4].col2.text).toEqual('aaa'); mockScope.rows.push(row6); - controller.addRow(undefined, mockScope.rows.length-1); + controller.addRow(undefined, mockScope.rows.length - 1); expect(mockScope.displayRows[2].col2.text).toEqual('ggg'); //Add a duplicate row mockScope.rows.push(row6); - controller.addRow(undefined, mockScope.rows.length-1); + controller.addRow(undefined, mockScope.rows.length - 1); expect(mockScope.displayRows[2].col2.text).toEqual('ggg'); expect(mockScope.displayRows[3].col2.text).toEqual('ggg'); }); it('Adds new rows at the correct sort position when' + - ' sorted and filtered', function() { + ' sorted and filtered', function () { mockScope.sortColumn = 'col2'; mockScope.sortDirection = 'desc'; mockScope.filters = {'col2': 'a'};//Include only @@ -300,12 +300,12 @@ define( mockScope.displayRows = controller.filterRows(testRows); mockScope.rows.push(row5); - controller.addRow(undefined, mockScope.rows.length-1); + controller.addRow(undefined, mockScope.rows.length - 1); expect(mockScope.displayRows.length).toBe(2); expect(mockScope.displayRows[1].col2.text).toEqual('aaa'); mockScope.rows.push(row6); - controller.addRow(undefined, mockScope.rows.length-1); + controller.addRow(undefined, mockScope.rows.length - 1); expect(mockScope.displayRows.length).toBe(2); //Row was not added because does not match filter }); @@ -319,16 +319,16 @@ define( mockScope.displayRows = testRows.slice(0); mockScope.rows.push(row5); - controller.addRow(undefined, mockScope.rows.length-1); + controller.addRow(undefined, mockScope.rows.length - 1); expect(mockScope.displayRows[3].col2.text).toEqual('aaa'); mockScope.rows.push(row6); - controller.addRow(undefined, mockScope.rows.length-1); + controller.addRow(undefined, mockScope.rows.length - 1); expect(mockScope.displayRows[4].col2.text).toEqual('ggg'); }); it('Resizes columns if length of any columns in new' + - ' row exceeds corresponding existing column', function() { + ' row exceeds corresponding existing column', function () { var row7 = { 'col1': {'text': 'row6 col1'}, 'col2': {'text': 'some longer string'}, @@ -342,7 +342,7 @@ define( mockScope.displayRows = testRows.slice(0); mockScope.rows.push(row7); - controller.addRow(undefined, mockScope.rows.length-1); + controller.addRow(undefined, mockScope.rows.length - 1); expect(controller.$scope.sizingRow.col2).toEqual({text: 'some longer string'}); }); diff --git a/platform/features/table/test/controllers/RealtimeTableControllerSpec.js b/platform/features/table/test/controllers/RealtimeTableControllerSpec.js index ea1bb870a3..ada85baa3c 100644 --- a/platform/features/table/test/controllers/RealtimeTableControllerSpec.js +++ b/platform/features/table/test/controllers/RealtimeTableControllerSpec.js @@ -40,7 +40,7 @@ define( function promise(value) { return { - then: function (callback){ + then: function (callback) { return promise(callback(value)); } }; @@ -57,13 +57,13 @@ define( '$digest', '$broadcast' ]); - mockScope.$on.andCallFake(function (expression, callback){ + mockScope.$on.andCallFake(function (expression, callback) { watches[expression] = callback; }); - mockScope.$watch.andCallFake(function (expression, callback){ - watches[expression] = callback; + mockScope.$watch.andCallFake(function (expression, callback) { + watches[expression] = callback; }); - mockScope.$watchCollection.andCallFake(function (expression, callback){ + mockScope.$watchCollection.andCallFake(function (expression, callback) { watches[expression] = callback; }); @@ -85,7 +85,7 @@ define( mockTable.buildColumnConfiguration.andReturn(mockConfiguration); mockTable.getRowValues.andReturn(mockTableRow); - mockDomainObject= jasmine.createSpyObj('domainObject', [ + mockDomainObject = jasmine.createSpyObj('domainObject', [ 'getCapability', 'useCapability', 'getModel' @@ -93,7 +93,7 @@ define( mockDomainObject.getModel.andReturn({}); mockDomainObject.getCapability.andReturn( { - getMetadata: function (){ + getMetadata: function () { return {ranges: [{format: 'string'}]}; } }); @@ -132,7 +132,7 @@ define( }); describe('receives new telemetry', function () { - beforeEach(function() { + beforeEach(function () { controller.subscribe(); mockScope.rows = []; }); @@ -151,7 +151,7 @@ define( } mockTelemetryHandler.handle.mostRecentCall.args[1](); expect(mockScope.rows.length).toBe(controller.maxRows); - expect(mockScope.rows[mockScope.rows.length-1]).toBe(mockTableRow); + expect(mockScope.rows[mockScope.rows.length - 1]).toBe(mockTableRow); expect(mockScope.rows[0].row).toBe(1); }); }); diff --git a/platform/features/table/test/controllers/TableOptionsControllerSpec.js b/platform/features/table/test/controllers/TableOptionsControllerSpec.js index db918c9788..9ea1967b36 100644 --- a/platform/features/table/test/controllers/TableOptionsControllerSpec.js +++ b/platform/features/table/test/controllers/TableOptionsControllerSpec.js @@ -26,13 +26,13 @@ define( ], function (TableOptionsController) { - describe('The Table Options Controller', function() { + describe('The Table Options Controller', function () { var mockDomainObject, mockCapability, controller, mockScope; - beforeEach(function() { + beforeEach(function () { mockCapability = jasmine.createSpyObj('mutationCapability', [ 'listen' ]); @@ -53,11 +53,11 @@ define( controller = new TableOptionsController(mockScope); }); - it('Listens for changing domain object', function() { + it('Listens for changing domain object', function () { expect(mockScope.$watch).toHaveBeenCalledWith('domainObject', jasmine.any(Function)); }); - it('On destruction of controller, destroys listeners', function() { + it('On destruction of controller, destroys listeners', function () { var unlistenFunc = jasmine.createSpy("unlisten"); controller.listeners.push(unlistenFunc); expect(mockScope.$on).toHaveBeenCalledWith('$destroy', jasmine.any(Function)); @@ -65,21 +65,21 @@ define( expect(unlistenFunc).toHaveBeenCalled(); }); - it('Registers a listener for mutation events on the object', function() { + it('Registers a listener for mutation events on the object', function () { mockScope.$watch.mostRecentCall.args[1](mockDomainObject); expect(mockCapability.listen).toHaveBeenCalled(); }); it('Listens for changes to object composition and updates' + - ' options accordingly', function() { + ' options accordingly', function () { expect(mockScope.$watchCollection).toHaveBeenCalledWith('configuration.table.columns', jasmine.any(Function)); }); describe('Populates scope with a form definition based on provided' + - ' column configuration', function() { + ' column configuration', function () { var mockModel; - beforeEach(function() { + beforeEach(function () { mockModel = { configuration: { table: { @@ -87,7 +87,7 @@ define( 'column1': true, 'column2': true, 'column3': false, - 'column4': true, + 'column4': true } } } @@ -95,19 +95,19 @@ define( controller.populateForm(mockModel); }); - it('creates form on scope', function() { + it('creates form on scope', function () { expect(mockScope.columnsForm).toBeDefined(); expect(mockScope.columnsForm.sections[0]).toBeDefined(); expect(mockScope.columnsForm.sections[0].rows).toBeDefined(); expect(mockScope.columnsForm.sections[0].rows.length).toBe(4); }); - it('presents columns as checkboxes', function() { - expect(mockScope.columnsForm.sections[0].rows.every(function(row){ + it('presents columns as checkboxes', function () { + expect(mockScope.columnsForm.sections[0].rows.every(function (row) { return row.control === 'checkbox'; })).toBe(true); }); }); }); - }); \ No newline at end of file + }); diff --git a/platform/features/timeline/bundle.js b/platform/features/timeline/bundle.js index dda2080c71..a6c0931f4e 100644 --- a/platform/features/timeline/bundle.js +++ b/platform/features/timeline/bundle.js @@ -91,7 +91,7 @@ define([ "name": "Export Timeline as CSV", "category": "contextual", "implementation": ExportTimelineAsCSVAction, - "depends": [ "exportService", "notificationService" ] + "depends": ["exportService", "notificationService"] } ], "constants": [ diff --git a/platform/features/timeline/src/TimelineConstants.js b/platform/features/timeline/src/TimelineConstants.js index c931925946..74fd7392b4 100644 --- a/platform/features/timeline/src/TimelineConstants.js +++ b/platform/features/timeline/src/TimelineConstants.js @@ -28,4 +28,4 @@ define({ HANDLE_WIDTH: 32, // Pixel tolerance for snapping behavior SNAP_WIDTH: 16 -}); \ No newline at end of file +}); diff --git a/platform/features/timeline/src/TimelineFormatter.js b/platform/features/timeline/src/TimelineFormatter.js index da1e09adf7..447361decb 100644 --- a/platform/features/timeline/src/TimelineFormatter.js +++ b/platform/features/timeline/src/TimelineFormatter.js @@ -73,4 +73,4 @@ define( return TimelineFormatter; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js b/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js index 7b7754e720..f71422358c 100644 --- a/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js +++ b/platform/features/timeline/src/actions/ExportTimelineAsCSVAction.js @@ -65,4 +65,4 @@ define(["./ExportTimelineAsCSVTask"], function (ExportTimelineAsCSVTask) { }; return ExportTimelineAsCSVAction; -}); \ No newline at end of file +}); diff --git a/platform/features/timeline/src/actions/TimelineTraverser.js b/platform/features/timeline/src/actions/TimelineTraverser.js index f38d0e3489..089f51cb35 100644 --- a/platform/features/timeline/src/actions/TimelineTraverser.js +++ b/platform/features/timeline/src/actions/TimelineTraverser.js @@ -80,4 +80,4 @@ define([], function () { return TimelineTraverser; -}); \ No newline at end of file +}); diff --git a/platform/features/timeline/src/capabilities/ActivityTimespan.js b/platform/features/timeline/src/capabilities/ActivityTimespan.js index 96073160bc..405fbec50b 100644 --- a/platform/features/timeline/src/capabilities/ActivityTimespan.js +++ b/platform/features/timeline/src/capabilities/ActivityTimespan.js @@ -116,4 +116,4 @@ define( return ActivityTimespan; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/capabilities/ActivityUtilization.js b/platform/features/timeline/src/capabilities/ActivityUtilization.js index 9034d09939..6e7895d34d 100644 --- a/platform/features/timeline/src/capabilities/ActivityUtilization.js +++ b/platform/features/timeline/src/capabilities/ActivityUtilization.js @@ -47,4 +47,4 @@ define( return ActivityUtilization; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/capabilities/CumulativeGraph.js b/platform/features/timeline/src/capabilities/CumulativeGraph.js index a9cf5c7cad..f9ffcb4b66 100644 --- a/platform/features/timeline/src/capabilities/CumulativeGraph.js +++ b/platform/features/timeline/src/capabilities/CumulativeGraph.js @@ -149,4 +149,4 @@ define( return CumulativeGraph; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/capabilities/ResourceGraph.js b/platform/features/timeline/src/capabilities/ResourceGraph.js index d62a7cf07f..2e0bec8497 100644 --- a/platform/features/timeline/src/capabilities/ResourceGraph.js +++ b/platform/features/timeline/src/capabilities/ResourceGraph.js @@ -144,4 +144,4 @@ define( return ResourceGraph; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/capabilities/TimelineTimespan.js b/platform/features/timeline/src/capabilities/TimelineTimespan.js index ac07ef7071..3224d42ab5 100644 --- a/platform/features/timeline/src/capabilities/TimelineTimespan.js +++ b/platform/features/timeline/src/capabilities/TimelineTimespan.js @@ -121,4 +121,4 @@ define( return TimelineTimespan; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/capabilities/TimelineUtilization.js b/platform/features/timeline/src/capabilities/TimelineUtilization.js index 7459ae7220..a4fc885734 100644 --- a/platform/features/timeline/src/capabilities/TimelineUtilization.js +++ b/platform/features/timeline/src/capabilities/TimelineUtilization.js @@ -47,4 +47,4 @@ define( return TimelineUtilization; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/TimelineController.js b/platform/features/timeline/src/controllers/TimelineController.js index 483abb7c06..796807c76a 100644 --- a/platform/features/timeline/src/controllers/TimelineController.js +++ b/platform/features/timeline/src/controllers/TimelineController.js @@ -96,7 +96,7 @@ define( }); } } - + // Recalculate swimlane state on changes $scope.$watch("domainObject", swimlanePopulator.populate); diff --git a/platform/features/timeline/src/controllers/TimelineDateTimeController.js b/platform/features/timeline/src/controllers/TimelineDateTimeController.js index 249cd4d7de..01ec6cebe3 100644 --- a/platform/features/timeline/src/controllers/TimelineDateTimeController.js +++ b/platform/features/timeline/src/controllers/TimelineDateTimeController.js @@ -88,4 +88,4 @@ define( return DateTimeController; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/TimelineGanttController.js b/platform/features/timeline/src/controllers/TimelineGanttController.js index 40431e00c4..a435ac49ad 100644 --- a/platform/features/timeline/src/controllers/TimelineGanttController.js +++ b/platform/features/timeline/src/controllers/TimelineGanttController.js @@ -83,4 +83,4 @@ define( return TimelineGanttController; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/TimelineGraphController.js b/platform/features/timeline/src/controllers/TimelineGraphController.js index b069f9693d..5710e1a1c5 100644 --- a/platform/features/timeline/src/controllers/TimelineGraphController.js +++ b/platform/features/timeline/src/controllers/TimelineGraphController.js @@ -92,4 +92,4 @@ define( return TimelineGraphController; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/TimelineTickController.js b/platform/features/timeline/src/controllers/TimelineTickController.js index f49ff73d45..611828241a 100644 --- a/platform/features/timeline/src/controllers/TimelineTickController.js +++ b/platform/features/timeline/src/controllers/TimelineTickController.js @@ -113,4 +113,4 @@ define( return TimelineTickController; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/TimelineZoomController.js b/platform/features/timeline/src/controllers/TimelineZoomController.js index 43abb8419c..4c8acd0061 100644 --- a/platform/features/timeline/src/controllers/TimelineZoomController.js +++ b/platform/features/timeline/src/controllers/TimelineZoomController.js @@ -29,7 +29,7 @@ define( */ function TimelineZoomController($scope, ZOOM_CONFIGURATION) { // Prefer to start with the middle index - var zoomLevels = ZOOM_CONFIGURATION.levels || [ 1000 ], + var zoomLevels = ZOOM_CONFIGURATION.levels || [1000], zoomIndex = Math.floor(zoomLevels.length / 2), tickWidth = ZOOM_CONFIGURATION.width || 200, duration = 86400000; // Default duration in view diff --git a/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js b/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js index 6e3272ff59..cd699dc647 100644 --- a/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js +++ b/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js @@ -253,4 +253,4 @@ define( return TimelineDragHandler; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/drag/TimelineDragPopulator.js b/platform/features/timeline/src/controllers/drag/TimelineDragPopulator.js index 985aee275e..67f26d0144 100644 --- a/platform/features/timeline/src/controllers/drag/TimelineDragPopulator.js +++ b/platform/features/timeline/src/controllers/drag/TimelineDragPopulator.js @@ -92,4 +92,4 @@ define( return TimelineDragPopulator; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/drag/TimelineEndHandle.js b/platform/features/timeline/src/controllers/drag/TimelineEndHandle.js index 317d3512f4..facbedc889 100644 --- a/platform/features/timeline/src/controllers/drag/TimelineEndHandle.js +++ b/platform/features/timeline/src/controllers/drag/TimelineEndHandle.js @@ -93,4 +93,4 @@ define( return TimelineEndHandle; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/drag/TimelineMoveHandle.js b/platform/features/timeline/src/controllers/drag/TimelineMoveHandle.js index a05ce117e5..f6b9868656 100644 --- a/platform/features/timeline/src/controllers/drag/TimelineMoveHandle.js +++ b/platform/features/timeline/src/controllers/drag/TimelineMoveHandle.js @@ -128,4 +128,4 @@ define( return TimelineMoveHandle; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/drag/TimelineSnapHandler.js b/platform/features/timeline/src/controllers/drag/TimelineSnapHandler.js index c9752a72e7..cc60e0d8f4 100644 --- a/platform/features/timeline/src/controllers/drag/TimelineSnapHandler.js +++ b/platform/features/timeline/src/controllers/drag/TimelineSnapHandler.js @@ -42,7 +42,9 @@ define( candidates; // Filter an id for inclustion - function include(id) { return id !== exclude; } + function include(id) { + return id !== exclude; + } // Evaluate a candidate timestamp as a snap-to location function evaluate(candidate) { @@ -101,4 +103,4 @@ define( return TimelineSnapHandler; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/drag/TimelineStartHandle.js b/platform/features/timeline/src/controllers/drag/TimelineStartHandle.js index e04dbada47..ce7907eeed 100644 --- a/platform/features/timeline/src/controllers/drag/TimelineStartHandle.js +++ b/platform/features/timeline/src/controllers/drag/TimelineStartHandle.js @@ -93,4 +93,4 @@ define( return TimelineStartHandle; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/graph/TimelineGraph.js b/platform/features/timeline/src/controllers/graph/TimelineGraph.js index c5e84ddaa0..5cb5ccd491 100644 --- a/platform/features/timeline/src/controllers/graph/TimelineGraph.js +++ b/platform/features/timeline/src/controllers/graph/TimelineGraph.js @@ -168,8 +168,8 @@ define( setBounds: function (offset, duration) { // We don't update in-place, because we need the change // to trigger a watch in mct-chart. - drawingObject.origin = [ offset, drawingObject.origin[1] ]; - drawingObject.dimensions = [ duration, drawingObject.dimensions[1] ]; + drawingObject.origin = [offset, drawingObject.origin[1]]; + drawingObject.dimensions = [duration, drawingObject.dimensions[1]]; }, /** * Redraw lines in this graph. @@ -186,4 +186,4 @@ define( return TimelineGraph; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/graph/TimelineGraphPopulator.js b/platform/features/timeline/src/controllers/graph/TimelineGraphPopulator.js index 91c478310f..0032b8cbe8 100644 --- a/platform/features/timeline/src/controllers/graph/TimelineGraphPopulator.js +++ b/platform/features/timeline/src/controllers/graph/TimelineGraphPopulator.js @@ -152,4 +152,4 @@ define( return TimelineGraphPopulator; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/graph/TimelineGraphRenderer.js b/platform/features/timeline/src/controllers/graph/TimelineGraphRenderer.js index 825947599d..bd0546ab03 100644 --- a/platform/features/timeline/src/controllers/graph/TimelineGraphRenderer.js +++ b/platform/features/timeline/src/controllers/graph/TimelineGraphRenderer.js @@ -78,4 +78,4 @@ define( return TimelineGraphRenderer; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineColorAssigner.js b/platform/features/timeline/src/controllers/swimlane/TimelineColorAssigner.js index 4e7a72a510..26d4fd7a9f 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineColorAssigner.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineColorAssigner.js @@ -117,4 +117,4 @@ define( return TimelineColorAssigner; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineProxy.js b/platform/features/timeline/src/controllers/swimlane/TimelineProxy.js index ecff296b64..ee470edc77 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineProxy.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineProxy.js @@ -74,4 +74,4 @@ define( return TimelineProxy; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlane.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlane.js index a25448c85a..44d7b65aa2 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlane.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlane.js @@ -172,4 +172,4 @@ define( return TimelineSwimlane; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js index d4b1151817..f7a77fe2df 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js @@ -194,4 +194,4 @@ define( return TimelineSwimlanePopulator; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/src/services/ObjectLoader.js b/platform/features/timeline/src/services/ObjectLoader.js index f7c9743c87..377709592f 100644 --- a/platform/features/timeline/src/services/ObjectLoader.js +++ b/platform/features/timeline/src/services/ObjectLoader.js @@ -130,4 +130,4 @@ define( return ObjectLoader; } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/TimelineFormatterSpec.js b/platform/features/timeline/test/TimelineFormatterSpec.js index 052730bd41..d883fa5c3f 100644 --- a/platform/features/timeline/test/TimelineFormatterSpec.js +++ b/platform/features/timeline/test/TimelineFormatterSpec.js @@ -57,4 +57,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/actions/CompositionColumnSpec.js b/platform/features/timeline/test/actions/CompositionColumnSpec.js index 87377a856f..8cf566a080 100644 --- a/platform/features/timeline/test/actions/CompositionColumnSpec.js +++ b/platform/features/timeline/test/actions/CompositionColumnSpec.js @@ -44,10 +44,10 @@ define( beforeEach(function () { mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getModel', 'getCapability' ] + ['getId', 'getModel', 'getCapability'] ); testModel = { - composition: [ 'a', 'b', 'c', 'd', 'e', 'f' ] + composition: ['a', 'b', 'c', 'd', 'e', 'f'] }; mockDomainObject.getModel.andReturn(testModel); }); @@ -58,7 +58,7 @@ define( }); it("returns nothing when composition is exceeded", function () { - testModel.composition = [ 'foo' ]; + testModel.composition = ['foo']; expect(column.value(mockDomainObject)).toEqual(""); }); @@ -70,4 +70,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/actions/ExportTimelineAsCSVActionSpec.js b/platform/features/timeline/test/actions/ExportTimelineAsCSVActionSpec.js index 7250fd2621..e0f09c3ae6 100644 --- a/platform/features/timeline/test/actions/ExportTimelineAsCSVActionSpec.js +++ b/platform/features/timeline/test/actions/ExportTimelineAsCSVActionSpec.js @@ -36,20 +36,20 @@ define( beforeEach(function () { mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getModel', 'getCapability', 'hasCapability' ] + ['getId', 'getModel', 'getCapability', 'hasCapability'] ); - mockType = jasmine.createSpyObj('type', [ 'instanceOf' ]); + mockType = jasmine.createSpyObj('type', ['instanceOf']); mockExportService = jasmine.createSpyObj( 'exportService', - [ 'exportCSV' ] + ['exportCSV'] ); mockNotificationService = jasmine.createSpyObj( 'notificationService', - [ 'notify', 'error' ] + ['notify', 'error'] ); mockNotification = jasmine.createSpyObj( 'notification', - [ 'dismiss' ] + ['dismiss'] ); mockNotificationService.notify.andReturn(mockNotification); @@ -149,4 +149,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/actions/ExportTimelineAsCSVTaskSpec.js b/platform/features/timeline/test/actions/ExportTimelineAsCSVTaskSpec.js index d9c6ca3c6e..0330e86397 100644 --- a/platform/features/timeline/test/actions/ExportTimelineAsCSVTaskSpec.js +++ b/platform/features/timeline/test/actions/ExportTimelineAsCSVTaskSpec.js @@ -34,7 +34,7 @@ define( beforeEach(function () { mockExportService = jasmine.createSpyObj( 'exportService', - [ 'exportCSV' ] + ['exportCSV'] ); mockDomainObject = jasmine.createSpyObj( 'domainObject', diff --git a/platform/features/timeline/test/actions/IdColumnSpec.js b/platform/features/timeline/test/actions/IdColumnSpec.js index 5aab82d11f..f44d255255 100644 --- a/platform/features/timeline/test/actions/IdColumnSpec.js +++ b/platform/features/timeline/test/actions/IdColumnSpec.js @@ -42,7 +42,7 @@ define( testId = "foo"; mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getModel', 'getCapability' ] + ['getId', 'getModel', 'getCapability'] ); mockDomainObject.getId.andReturn(testId); }); @@ -55,4 +55,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/actions/MetadataColumnSpec.js b/platform/features/timeline/test/actions/MetadataColumnSpec.js index f9ff3f3d35..da98df5040 100644 --- a/platform/features/timeline/test/actions/MetadataColumnSpec.js +++ b/platform/features/timeline/test/actions/MetadataColumnSpec.js @@ -44,7 +44,7 @@ define( beforeEach(function () { mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getModel', 'getCapability', 'useCapability' ] + ['getId', 'getModel', 'getCapability', 'useCapability'] ); testMetadata = [ { name: "Something else", value: 123 }, @@ -72,4 +72,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/actions/ModeColumnSpec.js b/platform/features/timeline/test/actions/ModeColumnSpec.js index 1189b30ca6..446e3b1030 100644 --- a/platform/features/timeline/test/actions/ModeColumnSpec.js +++ b/platform/features/timeline/test/actions/ModeColumnSpec.js @@ -44,11 +44,11 @@ define( beforeEach(function () { mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getModel', 'getCapability' ] + ['getId', 'getModel', 'getCapability'] ); testModel = { relationships: { - modes: [ 'a', 'b', 'c', 'd', 'e', 'f' ] + modes: ['a', 'b', 'c', 'd', 'e', 'f'] } }; mockDomainObject.getModel.andReturn(testModel); @@ -60,7 +60,7 @@ define( }); it("returns nothing when relationships are exceeded", function () { - testModel.relationships.modes = [ 'foo' ]; + testModel.relationships.modes = ['foo']; expect(column.value(mockDomainObject)).toEqual(""); }); @@ -72,4 +72,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/actions/TimelineColumnizerSpec.js b/platform/features/timeline/test/actions/TimelineColumnizerSpec.js index d47d493ca9..d29bb14278 100644 --- a/platform/features/timeline/test/actions/TimelineColumnizerSpec.js +++ b/platform/features/timeline/test/actions/TimelineColumnizerSpec.js @@ -50,7 +50,7 @@ define( beforeEach(function () { var mockTimespan = jasmine.createSpyObj( 'timespan', - [ 'getStart', 'getEnd' ] + ['getStart', 'getEnd'] ); testMetadata = [ @@ -59,8 +59,8 @@ define( ]; mockDomainObjects = [ - { composition: [ 'a', 'b', 'c' ] }, - { relationships: { modes: [ 'x', 'y' ] } }, + { composition: ['a', 'b', 'c'] }, + { relationships: { modes: ['x', 'y'] } }, { } ].map(makeMockDomainObject); diff --git a/platform/features/timeline/test/actions/TimelineTraverserSpec.js b/platform/features/timeline/test/actions/TimelineTraverserSpec.js index 3cec488b0d..48fb584162 100644 --- a/platform/features/timeline/test/actions/TimelineTraverserSpec.js +++ b/platform/features/timeline/test/actions/TimelineTraverserSpec.js @@ -82,9 +82,9 @@ define([ beforeEach(function () { testModels = { - a: { composition: [ 'b', 'c' ]}, - b: { composition: [ 'c' ] }, - c: { relationships: { modes: [ 'd' ] } }, + a: { composition: ['b', 'c']}, + b: { composition: ['c'] }, + c: { relationships: { modes: ['d'] } }, d: {}, unreachable: {} }; @@ -132,4 +132,4 @@ define([ }); }); -}); \ No newline at end of file +}); diff --git a/platform/features/timeline/test/actions/TimespanColumnSpec.js b/platform/features/timeline/test/actions/TimespanColumnSpec.js index 5eea2a9281..efe8df8bff 100644 --- a/platform/features/timeline/test/actions/TimespanColumnSpec.js +++ b/platform/features/timeline/test/actions/TimespanColumnSpec.js @@ -36,11 +36,11 @@ define( }; mockTimespan = jasmine.createSpyObj( 'timespan', - [ 'getStart', 'getEnd' ] + ['getStart', 'getEnd'] ); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'useCapability', 'hasCapability' ] + ['useCapability', 'hasCapability'] ); mockTimespan.getStart.andReturn(testTimes.start); mockTimespan.getEnd.andReturn(testTimes.end); @@ -52,7 +52,7 @@ define( }); }); - [ "start", "end" ].forEach(function (bound) { + ["start", "end"].forEach(function (bound) { describe("when referring to " + bound + " times", function () { var name = bound.charAt(0).toUpperCase() + bound.slice(1); @@ -90,4 +90,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/capabilities/ActivityTimespanCapabilitySpec.js b/platform/features/timeline/test/capabilities/ActivityTimespanCapabilitySpec.js index 88fb6e9418..dcd2170bb6 100644 --- a/platform/features/timeline/test/capabilities/ActivityTimespanCapabilitySpec.js +++ b/platform/features/timeline/test/capabilities/ActivityTimespanCapabilitySpec.js @@ -41,7 +41,7 @@ define( mockQ = jasmine.createSpyObj('$q', ['when']); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getModel', 'getCapability' ] + ['getModel', 'getCapability'] ); mockQ.when.andCallFake(asPromise); diff --git a/platform/features/timeline/test/capabilities/ActivityTimespanSpec.js b/platform/features/timeline/test/capabilities/ActivityTimespanSpec.js index 34e3946ea7..837f0fd726 100644 --- a/platform/features/timeline/test/capabilities/ActivityTimespanSpec.js +++ b/platform/features/timeline/test/capabilities/ActivityTimespanSpec.js @@ -96,4 +96,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/capabilities/ActivityUtilizationSpec.js b/platform/features/timeline/test/capabilities/ActivityUtilizationSpec.js index 06cbe11aac..74ab27fb50 100644 --- a/platform/features/timeline/test/capabilities/ActivityUtilizationSpec.js +++ b/platform/features/timeline/test/capabilities/ActivityUtilizationSpec.js @@ -36,4 +36,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/capabilities/CostCapabilitySpec.js b/platform/features/timeline/test/capabilities/CostCapabilitySpec.js index 49aabfff65..3134d1ea58 100644 --- a/platform/features/timeline/test/capabilities/CostCapabilitySpec.js +++ b/platform/features/timeline/test/capabilities/CostCapabilitySpec.js @@ -31,7 +31,7 @@ define( beforeEach(function () { var mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getModel', 'getId' ] + ['getModel', 'getId'] ); testModel = { diff --git a/platform/features/timeline/test/capabilities/CumulativeGraphSpec.js b/platform/features/timeline/test/capabilities/CumulativeGraphSpec.js index bb03a896b2..0dacf2436c 100644 --- a/platform/features/timeline/test/capabilities/CumulativeGraphSpec.js +++ b/platform/features/timeline/test/capabilities/CumulativeGraphSpec.js @@ -30,11 +30,11 @@ define( graph; beforeEach(function () { - points = [ 0, 10, -10, -100, 20, 100, 0 ]; + points = [0, 10, -10, -100, 20, 100, 0]; mockGraph = jasmine.createSpyObj( 'graph', - [ 'getPointCount', 'getDomainValue', 'getRangeValue' ] + ['getPointCount', 'getDomainValue', 'getRangeValue'] ); mockGraph.getPointCount.andReturn(points.length * 2); @@ -83,4 +83,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/capabilities/GraphCapabilitySpec.js b/platform/features/timeline/test/capabilities/GraphCapabilitySpec.js index 3a4761fda2..bffbe21bad 100644 --- a/platform/features/timeline/test/capabilities/GraphCapabilitySpec.js +++ b/platform/features/timeline/test/capabilities/GraphCapabilitySpec.js @@ -42,7 +42,7 @@ define( mockQ = jasmine.createSpyObj('$q', ['when']); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getModel', 'useCapability' ] + ['getId', 'getModel', 'useCapability'] ); testModel = { diff --git a/platform/features/timeline/test/capabilities/ResourceGraphSpec.js b/platform/features/timeline/test/capabilities/ResourceGraphSpec.js index b124af9343..ed4acbc0fc 100644 --- a/platform/features/timeline/test/capabilities/ResourceGraphSpec.js +++ b/platform/features/timeline/test/capabilities/ResourceGraphSpec.js @@ -43,14 +43,14 @@ define( expect(graph.getPointCount()).toEqual(16); // Should get two values at every time stamp, for step-like appearance - [ 5, 15, 40, 50, 100, 120, 150, 180].forEach(function (v, i) { + [5, 15, 40, 50, 100, 120, 150, 180].forEach(function (v, i) { expect(graph.getDomainValue(i * 2)).toEqual(v); expect(graph.getDomainValue(i * 2 + 1)).toEqual(v); }); // Should also repeat values at subsequent indexes, but offset differently, // for horizontal spans between steps - [ 0, 42, 72, 42, 20, -22, 0, -10].forEach(function (v, i) { + [0, 42, 72, 42, 20, -22, 0, -10].forEach(function (v, i) { expect(graph.getRangeValue(i * 2)).toEqual(v); // Offset backwards; wrap around end of the series expect(graph.getRangeValue((16 + i * 2 - 1) % 16)).toEqual(v); @@ -72,4 +72,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/capabilities/TimelineTimespanCapabilitySpec.js b/platform/features/timeline/test/capabilities/TimelineTimespanCapabilitySpec.js index dc11dba72f..27b8bb2436 100644 --- a/platform/features/timeline/test/capabilities/TimelineTimespanCapabilitySpec.js +++ b/platform/features/timeline/test/capabilities/TimelineTimespanCapabilitySpec.js @@ -45,30 +45,34 @@ define( mockQ = jasmine.createSpyObj('$q', ['when', 'all']); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getModel', 'getCapability', 'useCapability' ] + ['getModel', 'getCapability', 'useCapability'] ); mockChildA = jasmine.createSpyObj( 'childA', - [ 'getModel', 'useCapability', 'hasCapability' ] + ['getModel', 'useCapability', 'hasCapability'] ); mockChildB = jasmine.createSpyObj( 'childA', - [ 'getModel', 'useCapability', 'hasCapability' ] + ['getModel', 'useCapability', 'hasCapability'] ); mockTimespanA = jasmine.createSpyObj( 'timespanA', - [ 'getEnd' ] + ['getEnd'] ); mockTimespanB = jasmine.createSpyObj( 'timespanB', - [ 'getEnd' ] + ['getEnd'] ); mockQ.when.andCallFake(asPromise); mockQ.all.andCallFake(function (values) { var result = []; - function addResult(v) { result.push(v); } - function promiseResult(v) { asPromise(v).then(addResult); } + function addResult(v) { + result.push(v); + } + function promiseResult(v) { + asPromise(v).then(addResult); + } values.forEach(promiseResult); return asPromise(result); }); @@ -83,7 +87,7 @@ define( }); mockDomainObject.useCapability.andCallFake(function (c) { if (c === 'composition') { - return asPromise([ mockChildA, mockChildB ]); + return asPromise([mockChildA, mockChildB]); } }); mockChildA.hasCapability.andReturn(true); diff --git a/platform/features/timeline/test/capabilities/TimelineTimespanSpec.js b/platform/features/timeline/test/capabilities/TimelineTimespanSpec.js index 7cde0ec5fa..2d33035913 100644 --- a/platform/features/timeline/test/capabilities/TimelineTimespanSpec.js +++ b/platform/features/timeline/test/capabilities/TimelineTimespanSpec.js @@ -51,7 +51,7 @@ define( mutationModel = JSON.parse(JSON.stringify(testModel)); mockMutation = jasmine.createSpyObj("mutation", ["mutate"]); - mockTimespans = [ 44000, 65000, 1100 ].map(makeMockTimespan); + mockTimespans = [44000, 65000, 1100].map(makeMockTimespan); mockMutation.mutate.andCallFake(function (mutator) { mutator(mutationModel); @@ -107,4 +107,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/capabilities/TimelineUtilizationSpec.js b/platform/features/timeline/test/capabilities/TimelineUtilizationSpec.js index e229251900..0fd44795b4 100644 --- a/platform/features/timeline/test/capabilities/TimelineUtilizationSpec.js +++ b/platform/features/timeline/test/capabilities/TimelineUtilizationSpec.js @@ -36,4 +36,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/capabilities/UtilizationCapabilitySpec.js b/platform/features/timeline/test/capabilities/UtilizationCapabilitySpec.js index 71a474e4c7..3899ce8120 100644 --- a/platform/features/timeline/test/capabilities/UtilizationCapabilitySpec.js +++ b/platform/features/timeline/test/capabilities/UtilizationCapabilitySpec.js @@ -84,15 +84,15 @@ define( mockQ = jasmine.createSpyObj('$q', ['when', 'all']); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getModel', 'getCapability', 'useCapability' ] + ['getId', 'getModel', 'getCapability', 'useCapability'] ); mockRelationship = jasmine.createSpyObj( 'relationship', - [ 'getRelatedObjects' ] + ['getRelatedObjects'] ); mockComposition = jasmine.createSpyObj( 'composition', - [ 'invoke' ] + ['invoke'] ); mockCallback = jasmine.createSpy('callback'); diff --git a/platform/features/timeline/test/controllers/ActivityModeValuesControllerSpec.js b/platform/features/timeline/test/controllers/ActivityModeValuesControllerSpec.js index fdef2e9f09..d6eb96d81b 100644 --- a/platform/features/timeline/test/controllers/ActivityModeValuesControllerSpec.js +++ b/platform/features/timeline/test/controllers/ActivityModeValuesControllerSpec.js @@ -48,4 +48,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/TimelineControllerSpec.js b/platform/features/timeline/test/controllers/TimelineControllerSpec.js index f740c7e59b..9e777b0d8e 100644 --- a/platform/features/timeline/test/controllers/TimelineControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineControllerSpec.js @@ -99,7 +99,7 @@ define( mockScope = jasmine.createSpyObj( "$scope", - [ '$watch', '$on' ] + ['$watch', '$on'] ); mockLoader = jasmine.createSpyObj('objectLoader', ['load']); mockDomainObject = mockA; @@ -245,4 +245,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/TimelineGanttControllerSpec.js b/platform/features/timeline/test/controllers/TimelineGanttControllerSpec.js index 2eb15a08ff..c7f16077fa 100644 --- a/platform/features/timeline/test/controllers/TimelineGanttControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineGanttControllerSpec.js @@ -61,7 +61,9 @@ define( mockTimespan.getDuration.andReturn(50); mockTimespan.getEnd.andReturn(150); - mockToPixels.andCallFake(function (t) { return t * 10; }); + mockToPixels.andCallFake(function (t) { + return t * 10; + }); controller = new TimelineGanttController(TEST_MAX_OFFSCREEN); }); @@ -96,4 +98,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/TimelineGraphControllerSpec.js b/platform/features/timeline/test/controllers/TimelineGraphControllerSpec.js index 0fb6082a5d..51e9de94a4 100644 --- a/platform/features/timeline/test/controllers/TimelineGraphControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineGraphControllerSpec.js @@ -32,7 +32,7 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( '$scope', - [ '$watchCollection' ] + ['$watchCollection'] ); testResources = [ { key: 'abc', name: "Some name" }, @@ -58,7 +58,7 @@ define( // Supply new parameters mockScope.$watchCollection.mostRecentCall.args[1]({ - graphs: [ mockGraphA, mockGraphB ], + graphs: [mockGraphA, mockGraphB], origin: 9, duration: 144 }); diff --git a/platform/features/timeline/test/controllers/TimelineTableControllerSpec.js b/platform/features/timeline/test/controllers/TimelineTableControllerSpec.js index 1012476cb5..bb66becf27 100644 --- a/platform/features/timeline/test/controllers/TimelineTableControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineTableControllerSpec.js @@ -38,7 +38,7 @@ define( // This controller's job is just to expose the formatter // in scope, so simply verify that the two agree. it("formats durations", function () { - [ 0, 100, 4123, 93600, 748801230012].forEach(function (n) { + [0, 100, 4123, 93600, 748801230012].forEach(function (n) { expect(controller.niceTime(n)) .toEqual(formatter.format(n)); }); diff --git a/platform/features/timeline/test/controllers/TimelineTickControllerSpec.js b/platform/features/timeline/test/controllers/TimelineTickControllerSpec.js index 7475061cd7..ddb53204a5 100644 --- a/platform/features/timeline/test/controllers/TimelineTickControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineTickControllerSpec.js @@ -83,4 +83,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js b/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js index d7322512d5..1365fca7d6 100644 --- a/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js @@ -90,7 +90,9 @@ define( mockScope.domainObject.getCapability.andCallFake(function (c) { if (c === 'editor') { return { - inEditContext: function () {return true;} + inEditContext: function () { + return true; + } }; } }); diff --git a/platform/features/timeline/test/controllers/drag/TimelineDragHandleFactorySpec.js b/platform/features/timeline/test/controllers/drag/TimelineDragHandleFactorySpec.js index 982380ab5e..1ef3fe6733 100644 --- a/platform/features/timeline/test/controllers/drag/TimelineDragHandleFactorySpec.js +++ b/platform/features/timeline/test/controllers/drag/TimelineDragHandleFactorySpec.js @@ -35,19 +35,19 @@ define( beforeEach(function () { mockDragHandler = jasmine.createSpyObj( 'dragHandler', - [ 'start' ] + ['start'] ); mockSnapHandler = jasmine.createSpyObj( 'snapHandler', - [ 'snap' ] + ['snap'] ); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getCapability', 'getId' ] + ['getCapability', 'getId'] ); mockType = jasmine.createSpyObj( 'type', - [ 'instanceOf' ] + ['instanceOf'] ); mockDomainObject.getId.andReturn('test-id'); diff --git a/platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js b/platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js index 98e610f68b..502d2e7642 100644 --- a/platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js +++ b/platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js @@ -81,15 +81,15 @@ define( ['a', 'b', 'c', 'd', 'e', 'f'].forEach(function (id, index) { mockTimespans[id] = jasmine.createSpyObj( 'timespan-' + id, - [ 'getStart', 'getEnd', 'getDuration', 'setStart', 'setEnd', 'setDuration' ] + ['getStart', 'getEnd', 'getDuration', 'setStart', 'setEnd', 'setDuration'] ); mockPersists[id] = jasmine.createSpyObj( 'persistence-' + id, - [ 'persist' ] + ['persist'] ); mockMutations[id] = jasmine.createSpyObj( 'mutation-' + id, - [ 'mutate' ] + ['mutate'] ); mockTimespans[id].getStart.andReturn(index * 1000); mockTimespans[id].getDuration.andReturn(4000 + index); @@ -225,4 +225,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/drag/TimelineDragPopulatorSpec.js b/platform/features/timeline/test/controllers/drag/TimelineDragPopulatorSpec.js index c37c34f8b0..bfb2176e18 100644 --- a/platform/features/timeline/test/controllers/drag/TimelineDragPopulatorSpec.js +++ b/platform/features/timeline/test/controllers/drag/TimelineDragPopulatorSpec.js @@ -69,4 +69,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/drag/TimelineEndHandleSpec.js b/platform/features/timeline/test/controllers/drag/TimelineEndHandleSpec.js index a48e8ea8f5..aa87903c48 100644 --- a/platform/features/timeline/test/controllers/drag/TimelineEndHandleSpec.js +++ b/platform/features/timeline/test/controllers/drag/TimelineEndHandleSpec.js @@ -33,15 +33,15 @@ define( beforeEach(function () { mockDragHandler = jasmine.createSpyObj( 'dragHandler', - [ 'end', 'persist' ] + ['end', 'persist'] ); mockSnapHandler = jasmine.createSpyObj( 'snapHandler', - [ 'snap' ] + ['snap'] ); mockZoomController = jasmine.createSpyObj( 'zoom', - [ 'toMillis', 'toPixels' ] + ['toMillis', 'toPixels'] ); mockDragHandler.end.andReturn(12321); @@ -112,4 +112,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/drag/TimelineMoveHandleSpec.js b/platform/features/timeline/test/controllers/drag/TimelineMoveHandleSpec.js index 0ce25cc13f..fbce2d8212 100644 --- a/platform/features/timeline/test/controllers/drag/TimelineMoveHandleSpec.js +++ b/platform/features/timeline/test/controllers/drag/TimelineMoveHandleSpec.js @@ -33,15 +33,15 @@ define( beforeEach(function () { mockDragHandler = jasmine.createSpyObj( 'dragHandler', - [ 'start', 'duration', 'end', 'move', 'persist' ] + ['start', 'duration', 'end', 'move', 'persist'] ); mockSnapHandler = jasmine.createSpyObj( 'snapHandler', - [ 'snap' ] + ['snap'] ); mockZoomController = jasmine.createSpyObj( 'zoom', - [ 'toMillis', 'toPixels' ] + ['toMillis', 'toPixels'] ); mockDragHandler.start.andReturn(12321); @@ -179,4 +179,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/drag/TimelineSnapHandlerSpec.js b/platform/features/timeline/test/controllers/drag/TimelineSnapHandlerSpec.js index 2314d08cc2..36fb30188b 100644 --- a/platform/features/timeline/test/controllers/drag/TimelineSnapHandlerSpec.js +++ b/platform/features/timeline/test/controllers/drag/TimelineSnapHandlerSpec.js @@ -34,7 +34,7 @@ define( mockDragHandler = jasmine.createSpyObj( 'dragHandler', - [ 'start', 'end', 'ids' ] + ['start', 'end', 'ids'] ); mockDragHandler.ids.andReturn(['a', 'b', 'c', 'd']); @@ -76,4 +76,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/drag/TimelineStartHandleSpec.js b/platform/features/timeline/test/controllers/drag/TimelineStartHandleSpec.js index 2869a48148..de7d3cb643 100644 --- a/platform/features/timeline/test/controllers/drag/TimelineStartHandleSpec.js +++ b/platform/features/timeline/test/controllers/drag/TimelineStartHandleSpec.js @@ -33,15 +33,15 @@ define( beforeEach(function () { mockDragHandler = jasmine.createSpyObj( 'dragHandler', - [ 'start', 'persist' ] + ['start', 'persist'] ); mockSnapHandler = jasmine.createSpyObj( 'snapHandler', - [ 'snap' ] + ['snap'] ); mockZoomController = jasmine.createSpyObj( 'zoom', - [ 'toMillis', 'toPixels' ] + ['toMillis', 'toPixels'] ); mockDragHandler.start.andReturn(12321); @@ -111,4 +111,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/graph/TimelineGraphPopulatorSpec.js b/platform/features/timeline/test/controllers/graph/TimelineGraphPopulatorSpec.js index 08cddf1b24..69a5148b59 100644 --- a/platform/features/timeline/test/controllers/graph/TimelineGraphPopulatorSpec.js +++ b/platform/features/timeline/test/controllers/graph/TimelineGraphPopulatorSpec.js @@ -48,9 +48,9 @@ define( beforeEach(function () { testResources = { - a: [ 'xyz', 'abc' ], - b: [ 'xyz' ], - c: [ 'xyz', 'abc', 'def', 'ghi' ] + a: ['xyz', 'abc'], + b: ['xyz'], + c: ['xyz', 'abc', 'def', 'ghi'] }; mockQ = jasmine.createSpyObj('$q', ['when', 'all']); @@ -58,16 +58,16 @@ define( mockSwimlanes = ['a', 'b', 'c'].map(function (k) { var mockSwimlane = jasmine.createSpyObj( 'swimlane-' + k, - [ 'graph', 'color' ] + ['graph', 'color'] ), mockGraph = jasmine.createSpyObj( 'graph-' + k, - [ 'getPointCount', 'getDomainValue', 'getRangeValue' ] + ['getPointCount', 'getDomainValue', 'getRangeValue'] ); mockSwimlane.graph.andReturn(true); mockSwimlane.domainObject = jasmine.createSpyObj( 'domainObject-' + k, - [ 'getCapability', 'hasCapability', 'useCapability', 'getId' ] + ['getCapability', 'hasCapability', 'useCapability', 'getId'] ); mockSwimlane.color.andReturn('#' + k); // Provide just enough information about graphs to support @@ -148,4 +148,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/graph/TimelineGraphRendererSpec.js b/platform/features/timeline/test/controllers/graph/TimelineGraphRendererSpec.js index e4137e0807..74e9e18e79 100644 --- a/platform/features/timeline/test/controllers/graph/TimelineGraphRendererSpec.js +++ b/platform/features/timeline/test/controllers/graph/TimelineGraphRendererSpec.js @@ -72,4 +72,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/graph/TimelineGraphSpec.js b/platform/features/timeline/test/controllers/graph/TimelineGraphSpec.js index cfaeba677c..305da86334 100644 --- a/platform/features/timeline/test/controllers/graph/TimelineGraphSpec.js +++ b/platform/features/timeline/test/controllers/graph/TimelineGraphSpec.js @@ -42,9 +42,9 @@ define( beforeEach(function () { testColors = { - a: [ 0, 1, 0 ], - b: [ 1, 0, 1 ], - c: [ 1, 0, 0 ] + a: [0, 1, 0], + b: [1, 0, 1], + c: [1, 0, 0] }; mockGraphs = []; @@ -53,11 +53,11 @@ define( ['a', 'b', 'c'].forEach(function (k, i) { var mockGraph = jasmine.createSpyObj( 'utilization-' + k, - [ 'getPointCount', 'getDomainValue', 'getRangeValue' ] + ['getPointCount', 'getDomainValue', 'getRangeValue'] ); mockDomainObjects[k] = jasmine.createSpyObj( 'domainObject-' + k, - [ 'getCapability', 'useCapability' ] + ['getCapability', 'useCapability'] ); mockDomainObjects[k].useCapability.andReturn(asPromise({ testResource: mockGraph @@ -72,7 +72,7 @@ define( mockRenderer = jasmine.createSpyObj( 'renderer', - [ 'render', 'decode' ] + ['render', 'decode'] ); mockRenderer.render.andCallFake(function (utilization) { @@ -167,4 +167,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/swimlane/TimelineColorAssignerSpec.js b/platform/features/timeline/test/controllers/swimlane/TimelineColorAssignerSpec.js index 989f8153ee..5848c25deb 100644 --- a/platform/features/timeline/test/controllers/swimlane/TimelineColorAssignerSpec.js +++ b/platform/features/timeline/test/controllers/swimlane/TimelineColorAssignerSpec.js @@ -49,10 +49,14 @@ define( var colors = {}, i, ids = []; // Add item to set - function set(c) { colors[c] = true; } + function set(c) { + colors[c] = true; + } // Generate ids - for (i = 0; i < 30; i += 1) { ids.push("id" + i); } + for (i = 0; i < 30; i += 1) { + ids.push("id" + i); + } // Assign colors to each id, then retrieve colors, // storing into the set diff --git a/platform/features/timeline/test/controllers/swimlane/TimelineProxySpec.js b/platform/features/timeline/test/controllers/swimlane/TimelineProxySpec.js index 1de3a7d9e1..7490d61346 100644 --- a/platform/features/timeline/test/controllers/swimlane/TimelineProxySpec.js +++ b/platform/features/timeline/test/controllers/swimlane/TimelineProxySpec.js @@ -38,16 +38,16 @@ define( ); mockSelection = jasmine.createSpyObj( 'selection', - [ 'get' ] + ['get'] ); mockActionCapability = jasmine.createSpyObj( 'action', - [ 'getActions' ] + ['getActions'] ); mockActions = ['a', 'b', 'c'].map(function (type) { var mockAction = jasmine.createSpyObj( 'action-' + type, - [ 'perform', 'getMetadata' ] + ['perform', 'getMetadata'] ); mockAction.getMetadata.andReturn({ type: type }); return mockAction; diff --git a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDecoratorSpec.js b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDecoratorSpec.js index c4a059f7f7..56fb532f27 100644 --- a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDecoratorSpec.js +++ b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDecoratorSpec.js @@ -43,7 +43,7 @@ define( mockSwimlane.domainObject = jasmine.createSpyObj( 'domainObject', - [ 'getCapability', 'getModel' ] + ['getCapability', 'getModel'] ); mockCapabilities.mutation = jasmine.createSpyObj( @@ -158,11 +158,11 @@ define( it("fires the 'remove' action when remove is called", function () { var mockChild = jasmine.createSpyObj( 'childObject', - [ 'getCapability', 'getModel' ] + ['getCapability', 'getModel'] ), mockAction = jasmine.createSpyObj( 'action', - [ 'perform' ] + ['perform'] ); mockChild.getCapability.andCallFake(function (c) { diff --git a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDropHandlerSpec.js b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDropHandlerSpec.js index 3eed051f45..ebb01159c9 100644 --- a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDropHandlerSpec.js +++ b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDropHandlerSpec.js @@ -41,28 +41,28 @@ define( mockSwimlane = jasmine.createSpyObj( "swimlane", - [ "highlight", "highlightBottom" ] + ["highlight", "highlightBottom"] ); // domainObject, idPath, children, expanded mockSwimlane.domainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability", "useCapability", "hasCapability" ] + ["getId", "getCapability", "useCapability", "hasCapability"] ); - mockSwimlane.idPath = [ 'a', 'b' ]; - mockSwimlane.children = [ {} ]; + mockSwimlane.idPath = ['a', 'b']; + mockSwimlane.children = [{}]; mockSwimlane.expanded = true; mockSwimlane.parent = {}; mockSwimlane.parent.idPath = ['a']; mockSwimlane.parent.domainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability", "useCapability", "hasCapability" ] + ["getId", "getCapability", "useCapability", "hasCapability"] ); - mockSwimlane.parent.children = [ mockSwimlane ]; + mockSwimlane.parent.children = [mockSwimlane]; mockSwimlane.children[0].domainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability", "useCapability", "hasCapability" ] + ["getId", "getCapability", "useCapability", "hasCapability"] ); mockAction = jasmine.createSpyObj('action', ['perform']); @@ -73,11 +73,11 @@ define( mockOtherObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability", "useCapability", "hasCapability" ] + ["getId", "getCapability", "useCapability", "hasCapability"] ); mockActionCapability = jasmine.createSpyObj("action", ["perform", "getActions"]); mockPersistence = jasmine.createSpyObj("persistence", ["persist"]); - mockContext = jasmine.createSpyObj('context', [ 'getParent' ]); + mockContext = jasmine.createSpyObj('context', ['getParent']); mockActionCapability.getActions.andReturn([mockAction]); mockSwimlane.parent.domainObject.getId.andReturn('a'); @@ -152,7 +152,7 @@ define( }); it("inserts into when highlighted", function () { - var testModel = { composition: [ 'c' ] }; + var testModel = { composition: ['c'] }; mockSwimlane.highlight.andReturn(true); handler.drop('d', mockOtherObject); // Should have mutated @@ -167,7 +167,7 @@ define( }); it("inserts after as a peer when highlighted at the bottom", function () { - var testModel = { composition: [ 'x', 'b', 'y' ] }; + var testModel = { composition: ['x', 'b', 'y'] }; mockSwimlane.highlightBottom.andReturn(true); mockSwimlane.expanded = false; handler.drop('d', mockOtherObject); @@ -177,11 +177,11 @@ define( // Run the mutator mockSwimlane.parent.domainObject.useCapability.mostRecentCall .args[1](testModel); - expect(testModel.composition).toEqual([ 'x', 'b', 'd', 'y']); + expect(testModel.composition).toEqual(['x', 'b', 'd', 'y']); }); it("inserts into when highlighted at the bottom and expanded", function () { - var testModel = { composition: [ 'c' ] }; + var testModel = { composition: ['c'] }; mockSwimlane.highlightBottom.andReturn(true); mockSwimlane.expanded = true; handler.drop('d', mockOtherObject); @@ -191,11 +191,11 @@ define( // Run the mutator mockSwimlane.domainObject.useCapability.mostRecentCall .args[1](testModel); - expect(testModel.composition).toEqual([ 'd', 'c' ]); + expect(testModel.composition).toEqual(['d', 'c']); }); it("inserts after as a peer when highlighted at the bottom and childless", function () { - var testModel = { composition: [ 'x', 'b', 'y' ] }; + var testModel = { composition: ['x', 'b', 'y'] }; mockSwimlane.highlightBottom.andReturn(true); mockSwimlane.expanded = true; mockSwimlane.children = []; @@ -206,11 +206,11 @@ define( // Run the mutator mockSwimlane.parent.domainObject.useCapability.mostRecentCall .args[1](testModel); - expect(testModel.composition).toEqual([ 'x', 'b', 'd', 'y']); + expect(testModel.composition).toEqual(['x', 'b', 'd', 'y']); }); it("allows reordering within a parent", function () { - var testModel = { composition: [ 'x', 'b', 'y', 'd' ] }; + var testModel = { composition: ['x', 'b', 'y', 'd'] }; mockSwimlane.highlightBottom.andReturn(true); mockSwimlane.expanded = true; @@ -227,7 +227,7 @@ define( runs(function () { mockSwimlane.parent.domainObject.useCapability.mostRecentCall .args[1](testModel); - expect(testModel.composition).toEqual([ 'x', 'b', 'd', 'y']); + expect(testModel.composition).toEqual(['x', 'b', 'd', 'y']); }); }); diff --git a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js index d3eceaa27e..4fd374a412 100644 --- a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js +++ b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js @@ -160,4 +160,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneSpec.js b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneSpec.js index 0a047859f2..615b6f7501 100644 --- a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneSpec.js +++ b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneSpec.js @@ -36,7 +36,9 @@ define( testConfiguration; function asPromise(v) { - return { then: function (cb) { cb(v); } }; + return { then: function (cb) { + cb(v); + } }; } beforeEach(function () { @@ -218,4 +220,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/features/timeline/test/directives/MCTSwimlaneDropSpec.js b/platform/features/timeline/test/directives/MCTSwimlaneDropSpec.js index 315db101db..4f7b914db3 100644 --- a/platform/features/timeline/test/directives/MCTSwimlaneDropSpec.js +++ b/platform/features/timeline/test/directives/MCTSwimlaneDropSpec.js @@ -57,11 +57,11 @@ define( testAttrs = { mctSwimlaneDrop: "mockSwimlane" }; mockSwimlane = jasmine.createSpyObj( "swimlane", - [ "allowDropIn", "allowDropAfter", "drop", "highlight", "highlightBottom" ] + ["allowDropIn", "allowDropAfter", "drop", "highlight", "highlightBottom"] ); mockElement[0] = jasmine.createSpyObj( "realElement", - [ "getBoundingClientRect" ] + ["getBoundingClientRect"] ); mockElement[0].offsetHeight = TEST_HEIGHT; mockElement[0].getBoundingClientRect.andReturn({ top: TEST_TOP }); diff --git a/platform/features/timeline/test/services/ObjectLoaderSpec.js b/platform/features/timeline/test/services/ObjectLoaderSpec.js index cc7ee70b88..8828d92a06 100644 --- a/platform/features/timeline/test/services/ObjectLoaderSpec.js +++ b/platform/features/timeline/test/services/ObjectLoaderSpec.js @@ -54,7 +54,7 @@ define( function addDomainObject(id, children, capabilities) { var mockDomainObject = jasmine.createSpyObj( 'object-' + id, - [ 'useCapability', 'hasCapability', 'getId' ] + ['useCapability', 'hasCapability', 'getId'] ); mockDomainObject.getId.andReturn(id); @@ -72,7 +72,7 @@ define( } beforeEach(function () { - mockQ = jasmine.createSpyObj('$q', [ 'when', 'all' ]); + mockQ = jasmine.createSpyObj('$q', ['when', 'all']); mockCallback = jasmine.createSpy('callback'); mockDomainObjects = {}; testCompositions = {}; @@ -82,8 +82,12 @@ define( mockQ.when.andCallFake(asPromise); mockQ.all.andCallFake(function (values) { var result = []; - function addResult(v) { result.push(v); } - function promiseResult(v) { asPromise(v).then(addResult); } + function addResult(v) { + result.push(v); + } + function promiseResult(v) { + asPromise(v).then(addResult); + } values.forEach(promiseResult); return asPromise(result); }); @@ -152,4 +156,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/forms/src/MCTForm.js b/platform/forms/src/MCTForm.js index 4e422b1c45..13c859f0e6 100644 --- a/platform/forms/src/MCTForm.js +++ b/platform/forms/src/MCTForm.js @@ -58,7 +58,7 @@ define( template: formTemplate, // Use FormController to populate/respond to changes in scope - controller: [ '$scope', FormController ], + controller: ['$scope', FormController], // Initial an isolate scope scope: { diff --git a/platform/forms/src/controllers/ColorController.js b/platform/forms/src/controllers/ColorController.js index 2bf38e0c63..f91397be82 100644 --- a/platform/forms/src/controllers/ColorController.js +++ b/platform/forms/src/controllers/ColorController.js @@ -25,16 +25,16 @@ define( function () { var BASE_COLORS = [ - [ 136, 32, 32 ], - [ 224, 64, 64 ], - [ 240, 160, 72 ], - [ 255, 248, 96 ], - [ 128, 240, 72 ], - [ 128, 248, 248 ], - [ 88, 144, 224 ], - [ 0, 72, 240 ], - [ 136, 80, 240 ], - [ 224, 96, 248 ] + [136, 32, 32], + [224, 64, 64], + [240, 160, 72], + [255, 248, 96], + [128, 240, 72], + [128, 248, 248], + [88, 144, 224], + [0, 72, 240], + [136, 80, 240], + [224, 96, 248] ], GRADIENTS = [0.75, 0.50, 0.25, -0.25, -0.50, -0.75], GROUPS = []; diff --git a/platform/forms/src/controllers/DialogButtonController.js b/platform/forms/src/controllers/DialogButtonController.js index 0e6804bccb..f6431221a4 100644 --- a/platform/forms/src/controllers/DialogButtonController.js +++ b/platform/forms/src/controllers/DialogButtonController.js @@ -71,7 +71,7 @@ define( // Prepare the form; a single row buttonForm = { name: structure.title, - sections: [ { rows: [ row ] } ] + sections: [{ rows: [row] }] }; } diff --git a/platform/forms/test/MCTControlSpec.js b/platform/forms/test/MCTControlSpec.js index 3fcdc8d5e5..a588381ddc 100644 --- a/platform/forms/test/MCTControlSpec.js +++ b/platform/forms/test/MCTControlSpec.js @@ -45,7 +45,7 @@ define( } ]; - mockScope = jasmine.createSpyObj("$scope", [ "$watch" ]); + mockScope = jasmine.createSpyObj("$scope", ["$watch"]); mockLinker = jasmine.createSpyObj("templateLinker", ["link"]); mockChangeTemplate = jasmine.createSpy('changeTemplate'); mockLinker.link.andReturn(mockChangeTemplate); @@ -83,4 +83,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/forms/test/MCTFormSpec.js b/platform/forms/test/MCTFormSpec.js index 0be985212e..d2f5fc5c09 100644 --- a/platform/forms/test/MCTFormSpec.js +++ b/platform/forms/test/MCTFormSpec.js @@ -34,7 +34,7 @@ define( } beforeEach(function () { - mockScope = jasmine.createSpyObj("$scope", [ "$watch" ]); + mockScope = jasmine.createSpyObj("$scope", ["$watch"]); mockScope.$parent = {}; mctForm = new MCTForm(); }); @@ -111,4 +111,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/forms/test/MCTToolbarSpec.js b/platform/forms/test/MCTToolbarSpec.js index 10bc0ec3a3..61f0dae01c 100644 --- a/platform/forms/test/MCTToolbarSpec.js +++ b/platform/forms/test/MCTToolbarSpec.js @@ -34,7 +34,7 @@ define( } beforeEach(function () { - mockScope = jasmine.createSpyObj("$scope", [ "$watch" ]); + mockScope = jasmine.createSpyObj("$scope", ["$watch"]); mockScope.$parent = {}; mctToolbar = new MCTToolbar(); }); @@ -111,4 +111,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/forms/test/controllers/ColorControllerSpec.js b/platform/forms/test/controllers/ColorControllerSpec.js index ba76b4a26d..3f8bce3e05 100644 --- a/platform/forms/test/controllers/ColorControllerSpec.js +++ b/platform/forms/test/controllers/ColorControllerSpec.js @@ -67,4 +67,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/forms/test/controllers/CompositeControllerSpec.js b/platform/forms/test/controllers/CompositeControllerSpec.js index bf705bfac8..bec1d3a96e 100644 --- a/platform/forms/test/controllers/CompositeControllerSpec.js +++ b/platform/forms/test/controllers/CompositeControllerSpec.js @@ -52,4 +52,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/forms/test/controllers/DateTimeControllerSpec.js b/platform/forms/test/controllers/DateTimeControllerSpec.js index e2935365af..079cd0b80f 100644 --- a/platform/forms/test/controllers/DateTimeControllerSpec.js +++ b/platform/forms/test/controllers/DateTimeControllerSpec.js @@ -29,7 +29,7 @@ define( controller; beforeEach(function () { - mockScope = jasmine.createSpyObj("$scope", [ "$watch" ]); + mockScope = jasmine.createSpyObj("$scope", ["$watch"]); controller = new DateTimeController(mockScope); }); diff --git a/platform/forms/test/controllers/DialogButtonControllerSpec.js b/platform/forms/test/controllers/DialogButtonControllerSpec.js index 68803d2768..1aecb5d941 100644 --- a/platform/forms/test/controllers/DialogButtonControllerSpec.js +++ b/platform/forms/test/controllers/DialogButtonControllerSpec.js @@ -34,15 +34,15 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( '$scope', - [ '$watch' ] + ['$watch'] ); mockDialogService = jasmine.createSpyObj( 'dialogService', - [ 'getUserInput' ] + ['getUserInput'] ); mockPromise = jasmine.createSpyObj( 'promise', - [ 'then' ] + ['then'] ); testStructure = { name: "A Test", @@ -132,4 +132,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/forms/test/controllers/FormControllerSpec.js b/platform/forms/test/controllers/FormControllerSpec.js index 9e37388e32..06f3ea93bd 100644 --- a/platform/forms/test/controllers/FormControllerSpec.js +++ b/platform/forms/test/controllers/FormControllerSpec.js @@ -29,7 +29,7 @@ define( controller; beforeEach(function () { - mockScope = jasmine.createSpyObj("$scope", [ "$watch" ]); + mockScope = jasmine.createSpyObj("$scope", ["$watch"]); mockScope.$parent = {}; controller = new FormController(mockScope); }); @@ -85,4 +85,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/framework/bundle.js b/platform/framework/bundle.js index bcc0dbb867..89c44feade 100644 --- a/platform/framework/bundle.js +++ b/platform/framework/bundle.js @@ -21,10 +21,10 @@ *****************************************************************************/ define([ - + 'legacyRegistry' ], function ( - + legacyRegistry ) { diff --git a/platform/framework/src/FrameworkLayer.js b/platform/framework/src/FrameworkLayer.js index 1f8910fe15..d1888085f0 100644 --- a/platform/framework/src/FrameworkLayer.js +++ b/platform/framework/src/FrameworkLayer.js @@ -102,4 +102,4 @@ define([ }; return FrameworkLayer; -}); \ No newline at end of file +}); diff --git a/platform/framework/src/load/Bundle.js b/platform/framework/src/load/Bundle.js index 44849568e5..3f05e23ae3 100644 --- a/platform/framework/src/load/Bundle.js +++ b/platform/framework/src/load/Bundle.js @@ -106,8 +106,8 @@ define( */ Bundle.prototype.getSourcePath = function (sourceFile) { var subpath = sourceFile ? - [ this.definition.sources, sourceFile ] : - [ this.definition.sources ]; + [this.definition.sources, sourceFile] : + [this.definition.sources]; return this.resolvePath(subpath); }; @@ -124,8 +124,8 @@ define( */ Bundle.prototype.getResourcePath = function (resourceFile) { var subpath = resourceFile ? - [ this.definition.resources, resourceFile ] : - [ this.definition.resources ]; + [this.definition.resources, resourceFile] : + [this.definition.resources]; return this.resolvePath(subpath); }; @@ -142,8 +142,8 @@ define( */ Bundle.prototype.getLibraryPath = function (libraryFile) { var subpath = libraryFile ? - [ this.definition.libraries, libraryFile ] : - [ this.definition.libraries ]; + [this.definition.libraries, libraryFile] : + [this.definition.libraries]; return this.resolvePath(subpath); }; diff --git a/platform/framework/src/load/BundleLoader.js b/platform/framework/src/load/BundleLoader.js index b40b8998ba..e8cbe5252e 100644 --- a/platform/framework/src/load/BundleLoader.js +++ b/platform/framework/src/load/BundleLoader.js @@ -73,7 +73,9 @@ define( // loadBundleDefinition, so at this point they are safe // to discard. function filterBundles(array) { - return array.filter(function (x) { return x !== undefined; }); + return array.filter(function (x) { + return x !== undefined; + }); } // Load a definition for a bundle diff --git a/platform/framework/src/register/ExtensionRegistrar.js b/platform/framework/src/register/ExtensionRegistrar.js index 4f15a2344a..0dcd86ea4c 100644 --- a/platform/framework/src/register/ExtensionRegistrar.js +++ b/platform/framework/src/register/ExtensionRegistrar.js @@ -92,7 +92,9 @@ define( // Always return a static value; used to represent plain // metadata as a single dependency in Angular. function staticFunction(value) { - return function () { return value; }; + return function () { + return value; + }; } // Utility function; create the second argument for Angular's diff --git a/platform/framework/test/FrameworkInitializerSpec.js b/platform/framework/test/FrameworkInitializerSpec.js index a8c2a6135d..f91c7dbc93 100644 --- a/platform/framework/test/FrameworkInitializerSpec.js +++ b/platform/framework/test/FrameworkInitializerSpec.js @@ -50,13 +50,17 @@ define( it("calls injected stages in order", function () { var result; - initializer.runApplication([]).then(function (v) { result = v; }); + initializer.runApplication([]).then(function (v) { + result = v; + }); waitsFor( - function () { return result !== undefined; }, - "promise resolution", - 250 - ); + function () { + return result !== undefined; + }, + "promise resolution", + 250 + ); runs(function () { expect(result).toEqual( @@ -67,4 +71,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/framework/test/LogLevelSpec.js b/platform/framework/test/LogLevelSpec.js index ccbba5a911..00a49077c5 100644 --- a/platform/framework/test/LogLevelSpec.js +++ b/platform/framework/test/LogLevelSpec.js @@ -95,4 +95,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/framework/test/bootstrap/ApplicationBootstrapperSpec.js b/platform/framework/test/bootstrap/ApplicationBootstrapperSpec.js index 740cf3d4aa..b4a64d62b8 100644 --- a/platform/framework/test/bootstrap/ApplicationBootstrapperSpec.js +++ b/platform/framework/test/bootstrap/ApplicationBootstrapperSpec.js @@ -104,4 +104,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/framework/test/load/BundleLoaderSpec.js b/platform/framework/test/load/BundleLoaderSpec.js index 89643bdd34..914f139ea2 100644 --- a/platform/framework/test/load/BundleLoaderSpec.js +++ b/platform/framework/test/load/BundleLoaderSpec.js @@ -44,7 +44,7 @@ define( beforeEach(function () { testBundles = { - "bundles.json": [ "bundle/a", "bundle/b"], + "bundles.json": ["bundle/a", "bundle/b"], "bundle/a/bundle.json": {"someValue": 6}, "bundle/b/bundle.json": {"someValue": 7} }; @@ -54,7 +54,7 @@ define( mockLog = jasmine.createSpyObj("$log", ["error", "warn", "info", "debug"]); mockRegistry = jasmine.createSpyObj( 'legacyRegistry', - [ 'list', 'contains', 'get' ] + ['list', 'contains', 'get'] ); mockRegistry.list.andReturn([]); mockRegistry.contains.andReturn(false); @@ -145,4 +145,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/framework/test/load/BundleSpec.js b/platform/framework/test/load/BundleSpec.js index 4362393d70..ced5e91069 100644 --- a/platform/framework/test/load/BundleSpec.js +++ b/platform/framework/test/load/BundleSpec.js @@ -78,17 +78,17 @@ define( it("reports all extensions that have been declared", function () { var bundle = new Bundle(PATH, { - extensions: { things: [ {}, {}, {} ] } + extensions: { things: [{}, {}, {}] } }); expect(bundle.getExtensions("things").length).toEqual(3); }); it("reports an empty list for extensions that have not been declared", function () { var bundle = new Bundle(PATH, { - extensions: { things: [ {}, {}, {} ] } + extensions: { things: [{}, {}, {}] } }); expect(bundle.getExtensions("stuffs").length).toEqual(0); }); }); } -); \ No newline at end of file +); diff --git a/platform/framework/test/load/ExtensionSpec.js b/platform/framework/test/load/ExtensionSpec.js index b3d62bfe0b..989864bb78 100644 --- a/platform/framework/test/load/ExtensionSpec.js +++ b/platform/framework/test/load/ExtensionSpec.js @@ -104,4 +104,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/framework/test/register/ExtensionRegistrarSpec.js b/platform/framework/test/register/ExtensionRegistrarSpec.js index 36f2280f14..be8d0fa5df 100644 --- a/platform/framework/test/register/ExtensionRegistrarSpec.js +++ b/platform/framework/test/register/ExtensionRegistrarSpec.js @@ -40,7 +40,9 @@ define( mockSorter = jasmine.createSpyObj("sorter", ["sort"]); customRegistrars = {}; - mockSorter.sort.andCallFake(function (v) { return v; }); + mockSorter.sort.andCallFake(function (v) { + return v; + }); registrar = new ExtensionRegistrar( mockApp, @@ -51,7 +53,7 @@ define( }); it("registers extensions using the factory", function () { - registrar.registerExtensions({ things: [ {} ] }); + registrar.registerExtensions({ things: [{}] }); expect(mockApp.factory).toHaveBeenCalled(); }); @@ -60,7 +62,7 @@ define( mockApp.factory.andCallFake(function (name, value) { callbacks[name] = value[value.length - 1]; }); - registrar.registerExtensions({ things: [ {} ] }); + registrar.registerExtensions({ things: [{}] }); expect(callbacks["things[]"]).toBeDefined(); // Verify dependency echo behavior @@ -68,9 +70,9 @@ define( }); it("warns if multiple registrations are made for the same category of extension", function () { - registrar.registerExtensions({ things: [ {} ] }); + registrar.registerExtensions({ things: [{}] }); expect(mockLog.warn).not.toHaveBeenCalled(); - registrar.registerExtensions({ things: [ {} ] }); + registrar.registerExtensions({ things: [{}] }); expect(mockLog.warn).toHaveBeenCalled(); }); @@ -81,14 +83,14 @@ define( }); // Nobody has registered tests[], but it looks like an extension dependency, // so register it as an empty array. - registrar.registerExtensions({ things: [ { depends: [ "tests[]", "other" ] } ] }); + registrar.registerExtensions({ things: [{ depends: ["tests[]", "other"] }] }); expect(lengths["tests[]"]).toEqual(1); expect(lengths.other).toBeUndefined(); }); it("invokes custom registrars (not app.factory) when available", function () { customRegistrars.things = jasmine.createSpy("things"); - registrar.registerExtensions({ things: [ {} ] }); + registrar.registerExtensions({ things: [{}] }); expect(mockApp.factory).not.toHaveBeenCalled(); expect(customRegistrars.things).toHaveBeenCalled(); }); @@ -98,13 +100,15 @@ define( var a = { a: 'a' }, b = { b: 'b' }, c = { c: 'c' }; // Fake sorting; just reverse the array - mockSorter.sort.andCallFake(function (v) { return v.reverse(); }); + mockSorter.sort.andCallFake(function (v) { + return v.reverse(); + }); // Register the extensions - registrar.registerExtensions({ things: [ a, b, c ] }); + registrar.registerExtensions({ things: [a, b, c] }); // Verify registration interactions occurred in reverse-order - [ c, b, a ].forEach(function (extension, index) { + [c, b, a].forEach(function (extension, index) { expect(mockApp.factory.calls[index].args[1][0]()) .toEqual(extension); }); @@ -112,4 +116,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/framework/test/register/PartialConstructorSpec.js b/platform/framework/test/register/PartialConstructorSpec.js index f31105a333..6aea16adf7 100644 --- a/platform/framework/test/register/PartialConstructorSpec.js +++ b/platform/framework/test/register/PartialConstructorSpec.js @@ -93,4 +93,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/framework/test/register/ServiceCompositorSpec.js b/platform/framework/test/register/ServiceCompositorSpec.js index 7a3e872a67..0c10b87afe 100644 --- a/platform/framework/test/register/ServiceCompositorSpec.js +++ b/platform/framework/test/register/ServiceCompositorSpec.js @@ -37,8 +37,8 @@ define( beforeEach(function () { registered = {}; - mockApp = jasmine.createSpyObj("app", [ "service" ]); - mockLog = jasmine.createSpyObj("$log", [ "error", "warn", "info", "debug" ]); + mockApp = jasmine.createSpyObj("app", ["service"]); + mockLog = jasmine.createSpyObj("$log", ["error", "warn", "info", "debug"]); mockApp.service.andCallFake(function (name, value) { var factory = value[value.length - 1]; @@ -66,11 +66,21 @@ define( it("allows composite services to be registered", function () { // Prepare components that look like resolved extensions var components, name; - function MyDecorator() { return {}; } - function MyOtherDecorator() { return {}; } - function MyProvider() { return {}; } - function MyOtherProvider() { return {}; } - function MyAggregator() { return {}; } + function MyDecorator() { + return {}; + } + function MyOtherDecorator() { + return {}; + } + function MyProvider() { + return {}; + } + function MyOtherProvider() { + return {}; + } + function MyAggregator() { + return {}; + } components = [ MyDecorator, @@ -85,11 +95,13 @@ define( MyProvider.type = "provider"; MyOtherProvider.type = "provider"; MyAggregator.type = "aggregator"; - components.forEach(function (c) { c.provides = "testService"; }); + components.forEach(function (c) { + c.provides = "testService"; + }); // Add some test dependencies, to check prepending - MyOtherDecorator.depends = [ "someOtherService" ]; - MyAggregator.depends = [ "tests[]" ]; + MyOtherDecorator.depends = ["someOtherService"]; + MyAggregator.depends = ["tests[]"]; // Register! compositor.registerCompositeServices(components); @@ -117,16 +129,24 @@ define( it("allows registered composite services to be instantiated", function () { // Prepare components that look like resolved extensions var components, name; - function MyProvider() { return {}; } - function MyOtherProvider() { return {}; } - function MyAggregator() { return {}; } + function MyProvider() { + return {}; + } + function MyOtherProvider() { + return {}; + } + function MyAggregator() { + return {}; + } - components = [ MyProvider, MyAggregator, MyOtherProvider ]; + components = [MyProvider, MyAggregator, MyOtherProvider]; MyProvider.type = "provider"; MyOtherProvider.type = "provider"; MyAggregator.type = "aggregator"; - components.forEach(function (c) { c.provides = "testService"; }); + components.forEach(function (c) { + c.provides = "testService"; + }); // Register! compositor.registerCompositeServices(components); @@ -149,11 +169,17 @@ define( it("warns and skips components with no service type", function () { // Prepare components that look like resolved extensions var components; - function MyProvider() { return {}; } - function MyDecorator() { return {}; } - function MyAggregator() { return {}; } + function MyProvider() { + return {}; + } + function MyDecorator() { + return {}; + } + function MyAggregator() { + return {}; + } - components = [ MyProvider, MyAggregator, MyDecorator ]; + components = [MyProvider, MyAggregator, MyDecorator]; MyProvider.type = "provider"; MyDecorator.type = "decorator"; @@ -175,9 +201,11 @@ define( it("warns about and skips aggregators with zero providers", function () { // Prepare components that look like resolved extensions var components; - function MyAggregator() { return {}; } + function MyAggregator() { + return {}; + } - components = [ MyAggregator ]; + components = [MyAggregator]; MyAggregator.type = "aggregator"; MyAggregator.provides = "testService"; @@ -195,9 +223,11 @@ define( it("warns about and skips decorators with nothing to decorate", function () { // Prepare components that look like resolved extensions var components; - function MyDecorator() { return {}; } + function MyDecorator() { + return {}; + } - components = [ MyDecorator ]; + components = [MyDecorator]; MyDecorator.type = "decorator"; MyDecorator.provides = "testService"; @@ -214,4 +244,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/framework/test/resolve/BundleResolverSpec.js b/platform/framework/test/resolve/BundleResolverSpec.js index bad4c434db..70c12f327e 100644 --- a/platform/framework/test/resolve/BundleResolverSpec.js +++ b/platform/framework/test/resolve/BundleResolverSpec.js @@ -60,16 +60,20 @@ define( var result; resolver.resolveBundles([ - new Bundle("x", { extensions: { tests: [ {}, {}, {} ] } }), - new Bundle("y", { extensions: { tests: [ {}, {} ], others: [ {}, {} ] } }), - new Bundle("z", { extensions: { others: [ {} ] } }) - ]).then(function (v) { result = v; }); + new Bundle("x", { extensions: { tests: [{}, {}, {}] } }), + new Bundle("y", { extensions: { tests: [{}, {}], others: [{}, {}] } }), + new Bundle("z", { extensions: { others: [{}] } }) + ]).then(function (v) { + result = v; + }); waitsFor( - function () { return result !== undefined; }, - "promise resolution", - 250 - ); + function () { + return result !== undefined; + }, + "promise resolution", + 250 + ); // Should get back the result from the resolver, and // should be binned by extension category. @@ -81,9 +85,9 @@ define( it("configures require before loading implementations", function () { var bundles = [ - new Bundle("x", { extensions: { tests: [ {}, {}, {} ] } }), - new Bundle("y", { extensions: { tests: [ {}, {} ], others: [ {}, {} ] } }), - new Bundle("z", { extensions: { others: [ {} ] } }) + new Bundle("x", { extensions: { tests: [{}, {}, {}] } }), + new Bundle("y", { extensions: { tests: [{}, {}], others: [{}, {}] } }), + new Bundle("z", { extensions: { others: [{}] } }) ]; resolver.resolveBundles(bundles); @@ -93,4 +97,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/framework/test/resolve/ExtensionResolverSpec.js b/platform/framework/test/resolve/ExtensionResolverSpec.js index fdc48afe77..f635ba7972 100644 --- a/platform/framework/test/resolve/ExtensionResolverSpec.js +++ b/platform/framework/test/resolve/ExtensionResolverSpec.js @@ -33,7 +33,9 @@ define( resolver; // Test implementation, to load from the mock loader - function Constructor() { return { someKey: "some value" }; } + function Constructor() { + return { someKey: "some value" }; + } Constructor.someProperty = "some static value"; beforeEach(function () { @@ -52,18 +54,22 @@ define( it("requests implementations from the implementation loader", function () { var bundle = new Bundle("w", { sources: "x", - extensions: { tests: [ { implementation: "y/z.js" } ] } + extensions: { tests: [{ implementation: "y/z.js" }] } }), extension = bundle.getExtensions("tests")[0], result; - resolver.resolve(extension).then(function (v) { result = v; }); + resolver.resolve(extension).then(function (v) { + result = v; + }); waitsFor( - function () { return result !== undefined; }, - "promise resolution", - 250 - ); + function () { + return result !== undefined; + }, + "promise resolution", + 250 + ); runs(function () { // Verify that the right file was requested @@ -79,22 +85,26 @@ define( it("issues a warning and defaults to plain definition if load fails", function () { var bundle = new Bundle("w", { sources: "x", - extensions: { tests: [ { + extensions: { tests: [{ someOtherKey: "some other value", implementation: "y/z.js" - } ] } + }] } }), extension = bundle.getExtensions("tests")[0], result; mockLoader.load.andReturn(Promise.reject(new Error("test error"))); - resolver.resolve(extension).then(function (v) { result = v; }); + resolver.resolve(extension).then(function (v) { + result = v; + }); waitsFor( - function () { return result !== undefined; }, - "promise resolution", - 250 - ); + function () { + return result !== undefined; + }, + "promise resolution", + 250 + ); runs(function () { // Should have gotten a warning @@ -109,18 +119,22 @@ define( it("ensures implementation properties are exposed", function () { var bundle = new Bundle("w", { sources: "x", - extensions: { tests: [ { implementation: "y/z.js" } ] } + extensions: { tests: [{ implementation: "y/z.js" }] } }), extension = bundle.getExtensions("tests")[0], result; - resolver.resolve(extension).then(function (v) { result = v; }); + resolver.resolve(extension).then(function (v) { + result = v; + }); waitsFor( - function () { return result !== undefined; }, - "promise resolution", - 250 - ); + function () { + return result !== undefined; + }, + "promise resolution", + 250 + ); runs(function () { // Verify that the right file was requested @@ -136,4 +150,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/framework/test/resolve/ImplementationLoaderSpec.js b/platform/framework/test/resolve/ImplementationLoaderSpec.js index 908d180e3c..56201dfc9d 100644 --- a/platform/framework/test/resolve/ImplementationLoaderSpec.js +++ b/platform/framework/test/resolve/ImplementationLoaderSpec.js @@ -53,17 +53,21 @@ define( var result; // Load and get the result - loader.load("xyz.js").then(function (v) { result = v; }); + loader.load("xyz.js").then(function (v) { + result = v; + }); expect(result).toBeUndefined(); required.fulfill("test result"); waitsFor( - function () { return result !== undefined; }, - "promise resolution", - 250 - ); + function () { + return result !== undefined; + }, + "promise resolution", + 250 + ); runs(function () { expect(result).toEqual("test result"); @@ -76,19 +80,25 @@ define( // Load and get the result loader.load("xyz.js").then( - function (v) { result = v; }, - function (v) { rejection = v; } - ); + function (v) { + result = v; + }, + function (v) { + rejection = v; + } + ); expect(result).toBeUndefined(); required.reject("test result"); waitsFor( - function () { return rejection !== undefined; }, - "promise resolution", - 250 - ); + function () { + return rejection !== undefined; + }, + "promise resolution", + 250 + ); runs(function () { expect(result).toBeUndefined(); @@ -98,4 +108,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/framework/test/resolve/RequireConfiguratorSpec.js b/platform/framework/test/resolve/RequireConfiguratorSpec.js index 976ac9245a..6a50044a3b 100644 --- a/platform/framework/test/resolve/RequireConfiguratorSpec.js +++ b/platform/framework/test/resolve/RequireConfiguratorSpec.js @@ -31,7 +31,7 @@ define( beforeEach(function () { mockRequire = jasmine.createSpyObj( "requirejs", - [ "config" ] + ["config"] ); configurator = new RequireConfigurator(mockRequire); }); @@ -79,4 +79,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/identity/test/IdentityAggregatorSpec.js b/platform/identity/test/IdentityAggregatorSpec.js index c61e8b805b..3f34cce2e0 100644 --- a/platform/identity/test/IdentityAggregatorSpec.js +++ b/platform/identity/test/IdentityAggregatorSpec.js @@ -54,7 +54,7 @@ define( mockProviders = ['a', 'b', 'c'].map(function (id) { var mockProvider = jasmine.createSpyObj( 'provider-' + id, - [ 'getUser' ] + ['getUser'] ); mockProvider.getUser.andReturn(new Promise(function (r) { @@ -115,7 +115,7 @@ define( }); it("returns undefined when no providers expose users", function () { - testUsers = [ undefined, undefined, undefined ]; + testUsers = [undefined, undefined, undefined]; aggregator.getUser().then(mockCallback); diff --git a/platform/persistence/aggregator/src/PersistenceAggregator.js b/platform/persistence/aggregator/src/PersistenceAggregator.js index 89fe521275..bc988099a7 100644 --- a/platform/persistence/aggregator/src/PersistenceAggregator.js +++ b/platform/persistence/aggregator/src/PersistenceAggregator.js @@ -61,7 +61,9 @@ define( } this.providerMapPromise = $q.all(providers.map(addToMap)) - .then(function () { return providerMap; }); + .then(function () { + return providerMap; + }); } PersistenceAggregator.prototype.listSpaces = function () { diff --git a/platform/persistence/aggregator/test/PersistenceAggregatorSpec.js b/platform/persistence/aggregator/test/PersistenceAggregatorSpec.js index 06b29c7a0e..f7db0530ad 100644 --- a/platform/persistence/aggregator/test/PersistenceAggregatorSpec.js +++ b/platform/persistence/aggregator/test/PersistenceAggregatorSpec.js @@ -70,7 +70,9 @@ define( mockQ.all.andCallFake(function (fakePromises) { var result = []; fakePromises.forEach(function (p) { - p.then(function (v) { result.push(v); }); + p.then(function (v) { + result.push(v); + }); }); return fakePromise(result); }); diff --git a/platform/persistence/couch/src/CouchPersistenceProvider.js b/platform/persistence/couch/src/CouchPersistenceProvider.js index ac0aaca304..583d62e379 100644 --- a/platform/persistence/couch/src/CouchPersistenceProvider.js +++ b/platform/persistence/couch/src/CouchPersistenceProvider.js @@ -47,7 +47,7 @@ define( * @param {string} path the path to the CouchDB instance */ function CouchPersistenceProvider($http, $q, space, path) { - this.spaces = [ space ]; + this.spaces = [space]; this.revs = {}; this.$q = $q; this.$http = $http; @@ -57,7 +57,9 @@ define( // Pull out a list of document IDs from CouchDB's // _all_docs response function getIdsFromAllDocs(allDocs) { - return allDocs.rows.map(function (r) { return r.id; }); + return allDocs.rows.map(function (r) { + return r.id; + }); } // Check the response to a create/update/delete request; diff --git a/platform/persistence/couch/test/CouchDocumentSpec.js b/platform/persistence/couch/test/CouchDocumentSpec.js index 79e004a7c1..90f9de41ec 100644 --- a/platform/persistence/couch/test/CouchDocumentSpec.js +++ b/platform/persistence/couch/test/CouchDocumentSpec.js @@ -60,4 +60,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/persistence/couch/test/CouchIndicatorSpec.js b/platform/persistence/couch/test/CouchIndicatorSpec.js index 3c5af49300..5d056a42cf 100644 --- a/platform/persistence/couch/test/CouchIndicatorSpec.js +++ b/platform/persistence/couch/test/CouchIndicatorSpec.js @@ -33,9 +33,9 @@ define( indicator; beforeEach(function () { - mockHttp = jasmine.createSpyObj("$http", [ "get" ]); + mockHttp = jasmine.createSpyObj("$http", ["get"]); mockInterval = jasmine.createSpy("$interval"); - mockPromise = jasmine.createSpyObj("promise", [ "then" ]); + mockPromise = jasmine.createSpyObj("promise", ["then"]); testPath = "/test/path"; testInterval = 12321; // Some number @@ -127,4 +127,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/persistence/couch/test/CouchPersistenceProviderSpec.js b/platform/persistence/couch/test/CouchPersistenceProviderSpec.js index 84601c50c8..36c1a04317 100644 --- a/platform/persistence/couch/test/CouchPersistenceProviderSpec.js +++ b/platform/persistence/couch/test/CouchPersistenceProviderSpec.js @@ -71,7 +71,7 @@ define( // return values match what is expected. it("lists all available documents", function () { mockHttp.andReturn(mockPromise({ - data: { rows: [ { id: "a" }, { id: "b" }, { id: "c" } ] } + data: { rows: [{ id: "a" }, { id: "b" }, { id: "c" }] } })); provider.listObjects().then(capture); expect(mockHttp).toHaveBeenCalledWith({ @@ -187,4 +187,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/persistence/elastic/src/ElasticPersistenceProvider.js b/platform/persistence/elastic/src/ElasticPersistenceProvider.js index 970f5cca26..1b421b527f 100644 --- a/platform/persistence/elastic/src/ElasticPersistenceProvider.js +++ b/platform/persistence/elastic/src/ElasticPersistenceProvider.js @@ -50,7 +50,7 @@ define( * @param {stirng} path the path to domain objects within ElasticSearch */ function ElasticPersistenceProvider($http, $q, space, root, path) { - this.spaces = [ space ]; + this.spaces = [space]; this.revs = {}; this.$http = $http; this.$q = $q; diff --git a/platform/persistence/elastic/test/ElasticIndicatorSpec.js b/platform/persistence/elastic/test/ElasticIndicatorSpec.js index 0876439062..9f675c5f00 100644 --- a/platform/persistence/elastic/test/ElasticIndicatorSpec.js +++ b/platform/persistence/elastic/test/ElasticIndicatorSpec.js @@ -33,9 +33,9 @@ define( indicator; beforeEach(function () { - mockHttp = jasmine.createSpyObj("$http", [ "get" ]); + mockHttp = jasmine.createSpyObj("$http", ["get"]); mockInterval = jasmine.createSpy("$interval"); - mockPromise = jasmine.createSpyObj("promise", [ "then" ]); + mockPromise = jasmine.createSpyObj("promise", ["then"]); testPath = "/test/path"; testInterval = 12321; // Some number @@ -107,4 +107,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/persistence/elastic/test/ElasticPersistenceProviderSpec.js b/platform/persistence/elastic/test/ElasticPersistenceProviderSpec.js index b6072311c1..0961e63d74 100644 --- a/platform/persistence/elastic/test/ElasticPersistenceProviderSpec.js +++ b/platform/persistence/elastic/test/ElasticPersistenceProviderSpec.js @@ -211,4 +211,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/src/PersistenceFailureDialog.js b/platform/persistence/queue/src/PersistenceFailureDialog.js index 6d5df92dbe..9ded808644 100644 --- a/platform/persistence/queue/src/PersistenceFailureDialog.js +++ b/platform/persistence/queue/src/PersistenceFailureDialog.js @@ -34,7 +34,7 @@ define( key: "cancel" } ], - OK_OPTIONS = [ { name: "OK", key: "ok" } ]; + OK_OPTIONS = [{ name: "OK", key: "ok" }]; /** * Populates a `dialogModel` to pass to `dialogService.getUserChoise` diff --git a/platform/persistence/queue/src/PersistenceFailureHandler.js b/platform/persistence/queue/src/PersistenceFailureHandler.js index f3420baf04..c449ed5f7b 100644 --- a/platform/persistence/queue/src/PersistenceFailureHandler.js +++ b/platform/persistence/queue/src/PersistenceFailureHandler.js @@ -84,9 +84,11 @@ define( var model = models[failure.id]; return failure.domainObject.useCapability( "mutation", - function () { return model; }, - model.modified - ); + function () { + return model; + }, + model.modified + ); } // Cache the object models we might want to save diff --git a/platform/persistence/queue/test/PersistenceFailureConstantsSpec.js b/platform/persistence/queue/test/PersistenceFailureConstantsSpec.js index 51fd456626..4eec1ea5e7 100644 --- a/platform/persistence/queue/test/PersistenceFailureConstantsSpec.js +++ b/platform/persistence/queue/test/PersistenceFailureConstantsSpec.js @@ -32,4 +32,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/test/PersistenceFailureControllerSpec.js b/platform/persistence/queue/test/PersistenceFailureControllerSpec.js index 6f42eea183..d8053daebb 100644 --- a/platform/persistence/queue/test/PersistenceFailureControllerSpec.js +++ b/platform/persistence/queue/test/PersistenceFailureControllerSpec.js @@ -43,4 +43,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/test/PersistenceFailureDialogSpec.js b/platform/persistence/queue/test/PersistenceFailureDialogSpec.js index 1933d0ee94..ab66997748 100644 --- a/platform/persistence/queue/test/PersistenceFailureDialogSpec.js +++ b/platform/persistence/queue/test/PersistenceFailureDialogSpec.js @@ -54,4 +54,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/test/PersistenceFailureHandlerSpec.js b/platform/persistence/queue/test/PersistenceFailureHandlerSpec.js index 7bb0fe8a04..4157476fb9 100644 --- a/platform/persistence/queue/test/PersistenceFailureHandlerSpec.js +++ b/platform/persistence/queue/test/PersistenceFailureHandlerSpec.js @@ -113,4 +113,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/test/PersistenceQueueHandlerSpec.js b/platform/persistence/queue/test/PersistenceQueueHandlerSpec.js index c9461ba726..e85fb7f34c 100644 --- a/platform/persistence/queue/test/PersistenceQueueHandlerSpec.js +++ b/platform/persistence/queue/test/PersistenceQueueHandlerSpec.js @@ -47,7 +47,7 @@ define( function makeMockPersistence(id) { var mockPersistence = jasmine.createSpyObj( 'persistence-' + id, - [ 'persist', 'refresh' ] + ['persist', 'refresh'] ); mockPersistence.persist.andReturn(asPromise(true)); return mockPersistence; @@ -56,7 +56,7 @@ define( function makeMockDomainObject(id) { var mockDomainObject = jasmine.createSpyObj( 'domainObject-' + id, - [ 'getId' ] + ['getId'] ); mockDomainObject.getId.andReturn(id); return mockDomainObject; @@ -132,4 +132,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/test/PersistenceQueueImplSpec.js b/platform/persistence/queue/test/PersistenceQueueImplSpec.js index 1608e9a14d..6281f2d5ac 100644 --- a/platform/persistence/queue/test/PersistenceQueueImplSpec.js +++ b/platform/persistence/queue/test/PersistenceQueueImplSpec.js @@ -38,7 +38,7 @@ define( function makeMockDomainObject(id) { var mockDomainObject = jasmine.createSpyObj( 'domainObject-' + id, - [ 'getId' ] + ['getId'] ); mockDomainObject.getId.andReturn(id); return mockDomainObject; @@ -47,7 +47,7 @@ define( function makeMockPersistence(id) { var mockPersistence = jasmine.createSpyObj( 'persistence-' + id, - [ 'persist' ] + ['persist'] ); return mockPersistence; } @@ -149,4 +149,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/test/PersistenceQueueSpec.js b/platform/persistence/queue/test/PersistenceQueueSpec.js index e9d7bb2392..fae0009835 100644 --- a/platform/persistence/queue/test/PersistenceQueueSpec.js +++ b/platform/persistence/queue/test/PersistenceQueueSpec.js @@ -51,4 +51,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/test/QueuingPersistenceCapabilityDecoratorSpec.js b/platform/persistence/queue/test/QueuingPersistenceCapabilityDecoratorSpec.js index 5df12fbd67..2e1a04d611 100644 --- a/platform/persistence/queue/test/QueuingPersistenceCapabilityDecoratorSpec.js +++ b/platform/persistence/queue/test/QueuingPersistenceCapabilityDecoratorSpec.js @@ -79,4 +79,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/test/QueuingPersistenceCapabilitySpec.js b/platform/persistence/queue/test/QueuingPersistenceCapabilitySpec.js index c8ce43e895..e542fe2100 100644 --- a/platform/persistence/queue/test/QueuingPersistenceCapabilitySpec.js +++ b/platform/persistence/queue/test/QueuingPersistenceCapabilitySpec.js @@ -62,4 +62,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/policy/src/PolicyActionDecorator.js b/platform/policy/src/PolicyActionDecorator.js index cc2a302b47..a8cec1442c 100644 --- a/platform/policy/src/PolicyActionDecorator.js +++ b/platform/policy/src/PolicyActionDecorator.js @@ -40,7 +40,7 @@ define( PolicyActionDecorator.prototype.getActions = function (context) { var policyService = this.policyService; - + // Check if an action is allowed by policy. function allow(action) { return policyService.allow('action', action, context); diff --git a/platform/policy/test/PolicyActionDecoratorSpec.js b/platform/policy/test/PolicyActionDecoratorSpec.js index fb9c7b6724..ed7cc8af7d 100644 --- a/platform/policy/test/PolicyActionDecoratorSpec.js +++ b/platform/policy/test/PolicyActionDecoratorSpec.js @@ -90,9 +90,9 @@ define( return candidate.someKey !== 'b'; }); expect(decorator.getActions(testContext)) - .toEqual([ testActions[0], testActions[2] ]); + .toEqual([testActions[0], testActions[2]]); }); }); } -); \ No newline at end of file +); diff --git a/platform/policy/test/PolicyProviderSpec.js b/platform/policy/test/PolicyProviderSpec.js index c228e5cdce..ac827cb0f6 100644 --- a/platform/policy/test/PolicyProviderSpec.js +++ b/platform/policy/test/PolicyProviderSpec.js @@ -43,7 +43,9 @@ define( ]; mockPolicies = testPolicies.map(function (p) { var mockPolicy = jasmine.createSpyObj("policy", ['allow']); - mockPolicy.allow.andCallFake(function () { return p.result; }); + mockPolicy.allow.andCallFake(function () { + return p.result; + }); return mockPolicy; }); mockPolicyConstructors = testPolicies.map(function (p, i) { @@ -101,4 +103,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/policy/test/PolicyViewDecoratorSpec.js b/platform/policy/test/PolicyViewDecoratorSpec.js index 91e86e9bd1..f7f698cb22 100644 --- a/platform/policy/test/PolicyViewDecoratorSpec.js +++ b/platform/policy/test/PolicyViewDecoratorSpec.js @@ -94,9 +94,9 @@ define( return candidate.someKey !== 'b'; }); expect(decorator.getViews(mockDomainObject)) - .toEqual([ testViews[0], testViews[2] ]); + .toEqual([testViews[0], testViews[2]]); }); }); } -); \ No newline at end of file +); diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index bcaa90e4e7..2ef47ad3a0 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -251,7 +251,7 @@ define( * Add a listener to the object for status changes. */ $scope.$watch("domainObject", function (domainObject, oldDomainObject) { - if (domainObject !== oldDomainObject){ + if (domainObject !== oldDomainObject) { listenForStatusChange(domainObject); } }); diff --git a/platform/representation/src/actions/ContextMenuAction.js b/platform/representation/src/actions/ContextMenuAction.js index d1d1b1b5b1..11acd0ed51 100644 --- a/platform/representation/src/actions/ContextMenuAction.js +++ b/platform/representation/src/actions/ContextMenuAction.js @@ -59,8 +59,12 @@ define( this.agentService = agentService; this.actionContext = actionContext; this.popupService = popupService; - this.getDocument = function () { return $document; }; - this.getRootScope = function () { return $rootScope; }; + this.getDocument = function () { + return $document; + }; + this.getRootScope = function () { + return $rootScope; + }; } ContextMenuAction.prototype.perform = function () { diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index f2d64024a3..75b73b7739 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -42,7 +42,7 @@ define( var actionCapability = domainObject.getCapability('action'), scope = element.scope && element.scope(), action; // Action for the drop, when it occurs - + function broadcastDrop(id, event) { // Find the relevant scope... var rect; diff --git a/platform/representation/src/gestures/GestureConstants.js b/platform/representation/src/gestures/GestureConstants.js index bffa8b218d..45b998d630 100644 --- a/platform/representation/src/gestures/GestureConstants.js +++ b/platform/representation/src/gestures/GestureConstants.js @@ -44,7 +44,7 @@ define({ * positioning. * @memberof platform/representation.GestureConstants */ - MCT_MENU_DIMENSIONS: [ 170, 200 ], + MCT_MENU_DIMENSIONS: [170, 200], /** * Identifier for drop events. * @memberof platform/representation.GestureConstants diff --git a/platform/representation/test/MCTRepresentationSpec.js b/platform/representation/test/MCTRepresentationSpec.js index 52d6c70d55..d3fdaa201d 100644 --- a/platform/representation/test/MCTRepresentationSpec.js +++ b/platform/representation/test/MCTRepresentationSpec.js @@ -27,9 +27,9 @@ define( ["../src/MCTRepresentation"], function (MCTRepresentation) { - var JQLITE_FUNCTIONS = [ "on", "off", "attr", "removeAttr" ], - LOG_FUNCTIONS = [ "error", "warn", "info", "debug"], - DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability"]; + var JQLITE_FUNCTIONS = ["on", "off", "attr", "removeAttr"], + LOG_FUNCTIONS = ["error", "warn", "info", "debug"], + DOMAIN_OBJECT_METHODS = ["getId", "getModel", "getCapability", "hasCapability", "useCapability"]; describe("The mct-representation directive", function () { var testRepresentations, @@ -76,7 +76,7 @@ define( key: "def", bundle: { path: "d", resources: "e" }, templateUrl: "f/template.html", - uses: [ "testCapability", "otherTestCapability" ] + uses: ["testCapability", "otherTestCapability"] } ]; @@ -85,7 +85,7 @@ define( key: "uvw", bundle: { path: "u", resources: "v" }, templateUrl: "w/template.html", - gestures: [ "testGesture", "otherTestGesture" ] + gestures: ["testGesture", "otherTestGesture"] }, { key: "xyz", @@ -105,7 +105,7 @@ define( var constructor = jasmine.createSpy("Representer" + name), representer = jasmine.createSpyObj( "representer" + name, - [ "represent", "destroy" ] + ["represent", "destroy"] ); constructor.andReturn(representer); return constructor; @@ -121,7 +121,7 @@ define( mockStatusCapability = jasmine.createSpyObj("statusCapability", ["listen"]); - mockScope = jasmine.createSpyObj("scope", [ "$watch", "$on" ]); + mockScope = jasmine.createSpyObj("scope", ["$watch", "$on"]); mockElement = jasmine.createSpyObj("element", JQLITE_FUNCTIONS); mockDomainObject = jasmine.createSpyObj("domainObject", DOMAIN_OBJECT_METHODS); diff --git a/platform/representation/test/TemplateLinkerSpec.js b/platform/representation/test/TemplateLinkerSpec.js index d078cd00ac..c91e82e6a7 100644 --- a/platform/representation/test/TemplateLinkerSpec.js +++ b/platform/representation/test/TemplateLinkerSpec.js @@ -25,8 +25,8 @@ define( ["../src/TemplateLinker"], function (TemplateLinker) { - var JQLITE_METHODS = [ 'replaceWith', 'empty', 'html', 'contents' ], - SCOPE_METHODS = [ '$on', '$new', '$destroy' ]; + var JQLITE_METHODS = ['replaceWith', 'empty', 'html', 'contents'], + SCOPE_METHODS = ['$on', '$new', '$destroy']; describe("TemplateLinker", function () { var mockTemplateRequest, diff --git a/platform/representation/test/TemplatePrefetcherSpec.js b/platform/representation/test/TemplatePrefetcherSpec.js index 6a0ae73a42..99eda9efa7 100644 --- a/platform/representation/test/TemplatePrefetcherSpec.js +++ b/platform/representation/test/TemplatePrefetcherSpec.js @@ -36,7 +36,7 @@ define( mockTemplateLinker = jasmine.createSpyObj( 'templateLinker', - [ 'getPath', 'load' ] + ['getPath', 'load'] ); mockTemplateLinker.getPath.andCallFake(function (ext) { diff --git a/platform/representation/test/actions/ContextMenuActionSpec.js b/platform/representation/test/actions/ContextMenuActionSpec.js index bab5a311f5..4efb48d76b 100644 --- a/platform/representation/test/actions/ContextMenuActionSpec.js +++ b/platform/representation/test/actions/ContextMenuActionSpec.js @@ -28,8 +28,8 @@ define( ["../../src/actions/ContextMenuAction"], function (ContextMenuAction) { - var JQLITE_FUNCTIONS = [ "on", "off", "find", "append", "remove" ], - DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability" ]; + var JQLITE_FUNCTIONS = ["on", "off", "find", "append", "remove"], + DOMAIN_OBJECT_METHODS = ["getId", "getModel", "getCapability", "hasCapability", "useCapability"]; describe("The 'context menu' action", function () { @@ -93,7 +93,7 @@ define( action.perform(); expect(mockPopupService.display).toHaveBeenCalledWith( mockMenu, - [ mockEvent.pageX, mockEvent.pageY ], + [mockEvent.pageX, mockEvent.pageY], jasmine.any(Object) ); }); @@ -104,7 +104,7 @@ define( }); it("adds classes to menus based on position", function () { - var booleans = [ false, true ]; + var booleans = [false, true]; booleans.forEach(function (goLeft) { booleans.forEach(function (goUp) { diff --git a/platform/representation/test/gestures/ContextMenuGestureSpec.js b/platform/representation/test/gestures/ContextMenuGestureSpec.js index efcc107cc5..20e15bcbbb 100644 --- a/platform/representation/test/gestures/ContextMenuGestureSpec.js +++ b/platform/representation/test/gestures/ContextMenuGestureSpec.js @@ -28,8 +28,8 @@ define( ["../../src/gestures/ContextMenuGesture"], function (ContextMenuGesture) { - var JQLITE_FUNCTIONS = [ "on", "off", "find", "append", "remove" ], - DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability"]; + var JQLITE_FUNCTIONS = ["on", "off", "find", "append", "remove"], + DOMAIN_OBJECT_METHODS = ["getId", "getModel", "getCapability", "hasCapability", "useCapability"]; describe("The 'context menu' gesture", function () { @@ -55,15 +55,15 @@ define( mockEvent = jasmine.createSpyObj("event", ["preventDefault"]); mockContextMenuAction = jasmine.createSpyObj( "action", - [ "perform", "getActions" ] + ["perform", "getActions"] ); - + mockActionContext = {domainObject: mockDomainObject, event: mockEvent}; mockDomainObject.getCapability.andReturn(mockContextMenuAction); mockContextMenuAction.perform.andReturn(jasmine.any(Function)); mockAgentService.isMobile.andReturn(false); - - + + gesture = new ContextMenuGesture(mockTimeout, mockAgentService, mockElement, mockDomainObject); // Capture the contextmenu callback @@ -90,7 +90,7 @@ define( mockDomainObject.calls ); }); - + it("attaches a callback for context menu events on mobile", function () { // Mock touch event and set to mobile device mockTouchEvent = jasmine.createSpyObj("event", ["preventDefault", "touches"]); @@ -98,21 +98,21 @@ define( mockTouch.length = 1; mockTouchEvent.touches.andReturn(mockTouch); mockAgentService.isMobile.andReturn(true); - + // Then create new (mobile) gesture gesture = new ContextMenuGesture(mockTimeout, mockAgentService, mockElement, mockDomainObject); - + // Set calls for the touchstart and touchend gestures fireTouchStartGesture = mockElement.on.calls[1].args[1]; fireTouchEndGesture = mockElement.on.mostRecentCall.args[1]; - + // Fire touchstart and expect touch start to begin fireTouchStartGesture(mockTouchEvent); expect(mockElement.on).toHaveBeenCalledWith( "touchstart", jasmine.any(Function) ); - + // Expect timeout to begin and then fireTouchEnd expect(mockTimeout).toHaveBeenCalled(); mockTimeout.mostRecentCall.args[0](); @@ -120,4 +120,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/representation/test/gestures/DragGestureSpec.js b/platform/representation/test/gestures/DragGestureSpec.js index c756296428..6ae71754fa 100644 --- a/platform/representation/test/gestures/DragGestureSpec.js +++ b/platform/representation/test/gestures/DragGestureSpec.js @@ -27,10 +27,10 @@ define( ["../../src/gestures/DragGesture", "../../src/gestures/GestureConstants"], function (DragGesture, GestureConstants) { - var JQLITE_FUNCTIONS = [ "on", "off", "attr", "removeAttr" ], - LOG_FUNCTIONS = [ "error", "warn", "info", "debug"], - DND_FUNCTIONS = [ "setData", "getData", "removeData" ], - DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability"], + var JQLITE_FUNCTIONS = ["on", "off", "attr", "removeAttr"], + LOG_FUNCTIONS = ["error", "warn", "info", "debug"], + DND_FUNCTIONS = ["setData", "getData", "removeData"], + DOMAIN_OBJECT_METHODS = ["getId", "getModel", "getCapability", "hasCapability", "useCapability"], TEST_ID = "test-id"; @@ -135,4 +135,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/representation/test/gestures/DropGestureSpec.js b/platform/representation/test/gestures/DropGestureSpec.js index b3f043cfa9..79ed9d1139 100644 --- a/platform/representation/test/gestures/DropGestureSpec.js +++ b/platform/representation/test/gestures/DropGestureSpec.js @@ -29,8 +29,8 @@ define( // Methods to mock - var JQLITE_FUNCTIONS = [ "on", "off", "attr", "removeAttr", "scope" ], - DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability"], + var JQLITE_FUNCTIONS = ["on", "off", "attr", "removeAttr", "scope"], + DOMAIN_OBJECT_METHODS = ["getId", "getModel", "getCapability", "hasCapability", "useCapability"], TEST_ID = "test-id", DROP_ID = "drop-id"; @@ -69,9 +69,9 @@ define( mockElement = jasmine.createSpyObj("element", JQLITE_FUNCTIONS); mockDomainObject = jasmine.createSpyObj("domainObject", DOMAIN_OBJECT_METHODS); mockDraggedObject = jasmine.createSpyObj("draggedObject", DOMAIN_OBJECT_METHODS); - mockPersistence = jasmine.createSpyObj("persistence", [ "persist" ]); + mockPersistence = jasmine.createSpyObj("persistence", ["persist"]); mockEvent = jasmine.createSpyObj("event", ["preventDefault"]); - mockEvent.dataTransfer = jasmine.createSpyObj("dataTransfer", [ "getData" ]); + mockEvent.dataTransfer = jasmine.createSpyObj("dataTransfer", ["getData"]); mockScope = jasmine.createSpyObj("$scope", ["$broadcast"]); mockUnwrappedElement = jasmine.createSpyObj("unwrapped", ["getBoundingClientRect"]); mockAction = jasmine.createSpyObj('action', ['getActions']); @@ -130,11 +130,11 @@ define( expect(mockEvent.preventDefault).toHaveBeenCalled(); expect(mockEvent.dataTransfer.dropEffect).toBeDefined(); }); - + it("invokes compose on drop in edit mode", function () { // Set the mockDomainObject to have the editor capability mockDomainObject.hasCapability.andReturn(true); - + callbacks.dragover(mockEvent); expect(mockAction.getActions).toHaveBeenCalledWith({ key: 'compose', @@ -143,14 +143,14 @@ define( callbacks.drop(mockEvent); expect(mockCompose.perform).toHaveBeenCalled(); }); - - + + it("does not invoke compose on drop in browse mode for non-folders", function () { // Set the mockDomainObject to not have the editor capability mockDomainObject.hasCapability.andReturn(false); // Set the mockDomainObject to not have a type of folder mockDomainObject.getModel.andReturn({type: 'notAFolder'}); - + callbacks.dragover(mockEvent); expect(mockAction.getActions).toHaveBeenCalledWith({ key: 'compose', @@ -159,8 +159,8 @@ define( callbacks.drop(mockEvent); expect(mockCompose.perform).not.toHaveBeenCalled(); }); - - + + it("invokes compose on drop in browse mode for folders", function () { // Set the mockDomainObject to not have the editor capability mockDomainObject.hasCapability.andReturn(false); @@ -175,11 +175,11 @@ define( callbacks.drop(mockEvent); expect(mockCompose.perform).toHaveBeenCalled(); }); - + it("broadcasts drop position (in edit mode)", function () { // Set the mockDomainObject to have the editor capability mockDomainObject.hasCapability.andReturn(true); - + testRect.left = 42; testRect.top = 36; mockEvent.pageX = 52; diff --git a/platform/representation/test/gestures/GestureProviderSpec.js b/platform/representation/test/gestures/GestureProviderSpec.js index 2aa2a6551f..f4e29b66d9 100644 --- a/platform/representation/test/gestures/GestureProviderSpec.js +++ b/platform/representation/test/gestures/GestureProviderSpec.js @@ -27,9 +27,9 @@ define( ["../../src/gestures/GestureProvider"], function (GestureProvider) { - var JQLITE_FUNCTIONS = [ "on", "off", "attr", "removeAttr" ], + var JQLITE_FUNCTIONS = ["on", "off", "attr", "removeAttr"], GESTURE_KEYS = ["a", "b", "c", "d", "e"], - DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability"]; + DOMAIN_OBJECT_METHODS = ["getId", "getModel", "getCapability", "hasCapability", "useCapability"]; describe("The gesture provider", function () { var mockGestures, @@ -86,4 +86,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/representation/test/gestures/GestureRepresenterSpec.js b/platform/representation/test/gestures/GestureRepresenterSpec.js index f66696ed99..24ce81e0d0 100644 --- a/platform/representation/test/gestures/GestureRepresenterSpec.js +++ b/platform/representation/test/gestures/GestureRepresenterSpec.js @@ -33,11 +33,11 @@ define( beforeEach(function () { mockGestureService = jasmine.createSpyObj( "gestureService", - [ "attachGestures" ] + ["attachGestures"] ); mockGestureHandle = jasmine.createSpyObj( "gestureHandle", - [ "destroy" ] + ["destroy"] ); mockElement = { someKey: "some value" }; @@ -62,7 +62,7 @@ define( expect(mockGestureService.attachGestures).toHaveBeenCalledWith( mockElement, domainObject, - [ "a", "b", "c" ] + ["a", "b", "c"] ); // Should not have been destroyed yet... @@ -77,4 +77,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/representation/test/services/DndServiceSpec.js b/platform/representation/test/services/DndServiceSpec.js index 73aea175c5..ecadcc0f69 100644 --- a/platform/representation/test/services/DndServiceSpec.js +++ b/platform/representation/test/services/DndServiceSpec.js @@ -35,7 +35,9 @@ define( it("allows setting of arbitrary objects", function () { var foo = { - bar: function () { return 42; } + bar: function () { + return 42; + } }; service.setData('xyz', foo); @@ -61,4 +63,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/search/src/controllers/SearchMenuController.js b/platform/search/src/controllers/SearchMenuController.js index 2f369929ab..c46fb0657c 100644 --- a/platform/search/src/controllers/SearchMenuController.js +++ b/platform/search/src/controllers/SearchMenuController.js @@ -24,31 +24,31 @@ * Module defining SearchMenuController. Created by shale on 08/17/2015. */ define(function () { - + function SearchMenuController($scope, types) { - - // Model variables are: - // ngModel.filter, the function filter defined in SearchController + + // Model variables are: + // ngModel.filter, the function filter defined in SearchController // ngModel.types, an array of type objects - // ngModel.checked, a dictionary of which type filter options are checked - // ngModel.checkAll, a boolean of whether all of the types in ngModel.checked are checked + // ngModel.checked, a dictionary of which type filter options are checked + // ngModel.checkAll, a boolean of whether all of the types in ngModel.checked are checked // ngModel.filtersString, a string list of what filters on the results are active $scope.ngModel.types = []; $scope.ngModel.checked = {}; $scope.ngModel.checkAll = true; $scope.ngModel.filtersString = ''; - + // On initialization, fill the model's types with type keys types.forEach(function (type) { // We only want some types, the ones that are probably human readable - // Manually remove 'root', but not 'unknown' + // Manually remove 'root', but not 'unknown' if (type.key && type.name && type.key !== 'root') { $scope.ngModel.types.push(type); $scope.ngModel.checked[type.key] = false; } }); - - + + // For documentation, see updateOptions below function updateOptions() { var type, @@ -62,7 +62,7 @@ define(function () { } } } - + // Update the current filters string $scope.ngModel.filtersString = ''; if (!$scope.ngModel.checkAll) { @@ -77,7 +77,7 @@ define(function () { } } } - // If there's still nothing in the filters string, there are no + // If there's still nothing in the filters string, there are no // filters selected if ($scope.ngModel.filtersString === '') { $scope.ngModel.filtersString = 'NONE'; @@ -87,14 +87,14 @@ define(function () { // Re-filter results $scope.ngModel.filter(); } - + // For documentation, see checkAll below function checkAll() { // Reset all the other options to original/default position Object.keys($scope.ngModel.checked).forEach(function (type) { $scope.ngModel.checked[type] = false; }); - + // Change the filters string depending on checkAll status if ($scope.ngModel.checkAll) { // This setting will make the filters display hidden @@ -102,23 +102,23 @@ define(function () { } else { $scope.ngModel.filtersString = 'NONE'; } - + // Re-filter results $scope.ngModel.filter(); } - + return { /** - * Updates the status of the checked options. Updates the filtersString + * Updates the status of the checked options. Updates the filtersString * with which options are checked. Re-filters the search results after. - * Not intended to be called by checkAll when it is toggled. + * Not intended to be called by checkAll when it is toggled. */ updateOptions: updateOptions, - + /** - * Handles the search and filter options for when checkAll has been - * toggled. This is a special case, compared to the other search - * menu options, so is intended to be called instead of updateOptions. + * Handles the search and filter options for when checkAll has been + * toggled. This is a special case, compared to the other search + * menu options, so is intended to be called instead of updateOptions. */ checkAll: checkAll }; diff --git a/platform/search/src/services/GenericSearchWorker.js b/platform/search/src/services/GenericSearchWorker.js index a3cd34c2e2..3b6962e55a 100644 --- a/platform/search/src/services/GenericSearchWorker.js +++ b/platform/search/src/services/GenericSearchWorker.js @@ -118,7 +118,7 @@ match.matchCount += 100; } else if (match.item.vector.lowerCaseName === query.inputLowerCase) { - match.matchCount += 50; + match.matchCount += 50; } return match; }) diff --git a/platform/search/test/controllers/SearchControllerSpec.js b/platform/search/test/controllers/SearchControllerSpec.js index 9df96ab831..7f9095ebe3 100644 --- a/platform/search/test/controllers/SearchControllerSpec.js +++ b/platform/search/test/controllers/SearchControllerSpec.js @@ -51,7 +51,7 @@ define([ beforeEach(function () { mockScope = jasmine.createSpyObj( '$scope', - [ '$watch' ] + ['$watch'] ); mockScope.ngModel = {}; mockScope.ngModel.input = 'test input'; @@ -61,11 +61,11 @@ define([ mockSearchService = jasmine.createSpyObj( 'searchService', - [ 'query' ] + ['query'] ); mockPromise = jasmine.createSpyObj( 'promise', - [ 'then' ] + ['then'] ); mockSearchService.query.andReturn(mockPromise); @@ -73,11 +73,11 @@ define([ mockSearchResult = jasmine.createSpyObj( 'searchResult', - [ '' ] + [''] ); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getModel' ] + ['getModel'] ); mockSearchResult.object = mockDomainObject; mockDomainObject.getModel.andReturn({name: 'Mock Object', type: 'mock.type'}); diff --git a/platform/search/test/controllers/SearchMenuControllerSpec.js b/platform/search/test/controllers/SearchMenuControllerSpec.js index 68f8930431..dda5f491bd 100644 --- a/platform/search/test/controllers/SearchMenuControllerSpec.js +++ b/platform/search/test/controllers/SearchMenuControllerSpec.js @@ -31,18 +31,18 @@ define( var mockScope, mockTypes, controller; - + beforeEach(function () { mockScope = jasmine.createSpyObj( "$scope", - [ "" ] + [""] ); - + mockTypes = [ {key: 'mock.type.1', name: 'Mock Type 1', glyph: 'a'}, {key: 'mock.type.2', name: 'Mock Type 2', glyph: 'b'} ]; - + mockScope.ngModel = {}; mockScope.ngModel.checked = {}; mockScope.ngModel.checked['mock.type.1'] = false; @@ -50,75 +50,75 @@ define( mockScope.ngModel.checkAll = true; mockScope.ngModel.filter = jasmine.createSpy('$scope.ngModel.filter'); mockScope.ngModel.filtersString = ''; - + controller = new SearchMenuController(mockScope, mockTypes); }); - + it("gets types on initiliztion", function () { expect(mockScope.ngModel.types).toBeDefined(); }); - + it("refilters results when options are updated", function () { controller.updateOptions(); expect(mockScope.ngModel.filter).toHaveBeenCalled(); - + controller.checkAll(); expect(mockScope.ngModel.filter).toHaveBeenCalled(); }); - + it("updates the filters string when options are updated", function () { controller.updateOptions(); expect(mockScope.ngModel.filtersString).toEqual(''); - + mockScope.ngModel.checked['mock.type.1'] = true; - + controller.updateOptions(); expect(mockScope.ngModel.filtersString).not.toEqual(''); }); - + it("changing checkAll status updates the filter string", function () { controller.checkAll(); expect(mockScope.ngModel.filtersString).toEqual(''); - + mockScope.ngModel.checkAll = false; - + controller.checkAll(); expect(mockScope.ngModel.filtersString).toEqual('NONE'); }); - + it("checking checkAll option resets other options", function () { mockScope.ngModel.checked['mock.type.1'] = true; mockScope.ngModel.checked['mock.type.2'] = true; - + controller.checkAll(); Object.keys(mockScope.ngModel.checked).forEach(function (type) { expect(mockScope.ngModel.checked[type]).toBeFalsy(); }); }); - + it("tells the user when no options are checked", function () { Object.keys(mockScope.ngModel.checked).forEach(function (type) { mockScope.ngModel.checked[type] = false; }); mockScope.ngModel.checkAll = false; - + controller.updateOptions(); - + expect(mockScope.ngModel.filtersString).toEqual('NONE'); }); - + it("tells the user when options are checked", function () { mockScope.ngModel.checkAll = false; Object.keys(mockScope.ngModel.checked).forEach(function (type) { mockScope.ngModel.checked[type] = true; }); - + controller.updateOptions(); - + expect(mockScope.ngModel.filtersString).not.toEqual('NONE'); expect(mockScope.ngModel.filtersString).not.toEqual(''); }); }); } -); \ No newline at end of file +); diff --git a/platform/search/test/services/GenericSearchProviderSpec.js b/platform/search/test/services/GenericSearchProviderSpec.js index abfe3d011d..5df794819c 100644 --- a/platform/search/test/services/GenericSearchProviderSpec.js +++ b/platform/search/test/services/GenericSearchProviderSpec.js @@ -333,7 +333,7 @@ define([ }] }); - expect(provider.pendingQueries[143]).not.toBeDefined(); + expect(provider.pendingQueries[143]).not.toBeDefined(); }); diff --git a/platform/status/test/StatusCapabilitySpec.js b/platform/status/test/StatusCapabilitySpec.js index 631c9aedb3..7da9ce259e 100644 --- a/platform/status/test/StatusCapabilitySpec.js +++ b/platform/status/test/StatusCapabilitySpec.js @@ -34,15 +34,15 @@ define( beforeEach(function () { testId = "some-id"; - testStatusFlags = [ 'a', 'b', 'c' ]; + testStatusFlags = ['a', 'b', 'c']; mockStatusService = jasmine.createSpyObj( 'statusService', - [ 'listen', 'setStatus', 'listStatuses' ] + ['listen', 'setStatus', 'listStatuses'] ); mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getId', 'getCapability', 'getModel' ] + ['getId', 'getCapability', 'getModel'] ); mockUnlisten = jasmine.createSpy('unlisten'); diff --git a/platform/status/test/StatusRepresenterSpec.js b/platform/status/test/StatusRepresenterSpec.js index cc815be963..b9c048e511 100644 --- a/platform/status/test/StatusRepresenterSpec.js +++ b/platform/status/test/StatusRepresenterSpec.js @@ -50,7 +50,7 @@ define( } beforeEach(function () { - testStatusFlags = [ 'x', 'y', 'z' ]; + testStatusFlags = ['x', 'y', 'z']; mockScope = {}; mockElement = jasmine.createSpyObj('element', [ @@ -60,11 +60,11 @@ define( testRepresentation = { key: "someKey" }; mockDomainObject = jasmine.createSpyObj( 'domainObject', - [ 'getModel', 'getId', 'getCapability' ] + ['getModel', 'getId', 'getCapability'] ); mockStatusCapability = jasmine.createSpyObj( 'status', - [ 'list', 'get', 'set', 'listen' ] + ['list', 'get', 'set', 'listen'] ); mockUnlisten = jasmine.createSpy(); diff --git a/platform/status/test/StatusServiceSpec.js b/platform/status/test/StatusServiceSpec.js index d0490057f8..e530fd53d8 100644 --- a/platform/status/test/StatusServiceSpec.js +++ b/platform/status/test/StatusServiceSpec.js @@ -40,7 +40,7 @@ define( mockTopic = jasmine.createSpy('topic'); mockTopicInstance = jasmine.createSpyObj( 'topicInstance', - [ 'notify', 'listen' ] + ['notify', 'listen'] ); mockUnlisten = jasmine.createSpy('unlisten'); mockCallback = jasmine.createSpy('callback'); @@ -75,7 +75,7 @@ define( it("notifies listeners of changes", function () { statusService.setStatus(testId, testStatus, true); expect(mockTopicInstance.notify) - .toHaveBeenCalledWith([ testStatus ]); + .toHaveBeenCalledWith([testStatus]); statusService.setStatus(testId, testStatus, false); expect(mockTopicInstance.notify) .toHaveBeenCalledWith([ ]); diff --git a/platform/telemetry/src/TelemetryCapability.js b/platform/telemetry/src/TelemetryCapability.js index 57fc603afd..02b74806e8 100644 --- a/platform/telemetry/src/TelemetryCapability.js +++ b/platform/telemetry/src/TelemetryCapability.js @@ -27,7 +27,9 @@ define( [], function () { - var ZERO = function () { return 0; }, + var ZERO = function () { + return 0; + }, EMPTY_SERIES = { getPointCount: ZERO, getDomainValue: ZERO, diff --git a/platform/telemetry/src/TelemetryController.js b/platform/telemetry/src/TelemetryController.js index 69ff357a7a..73f474d11e 100644 --- a/platform/telemetry/src/TelemetryController.js +++ b/platform/telemetry/src/TelemetryController.js @@ -176,7 +176,7 @@ define( "telemetry" )).then(function (result) { var head = domainObject.hasCapability("telemetry") ? - [ domainObject ] : [], + [domainObject] : [], tail = result || []; return head.concat(tail); }); diff --git a/platform/telemetry/src/TelemetryDelegator.js b/platform/telemetry/src/TelemetryDelegator.js index d0ccb9575f..594b98397d 100644 --- a/platform/telemetry/src/TelemetryDelegator.js +++ b/platform/telemetry/src/TelemetryDelegator.js @@ -45,7 +45,7 @@ define( */ TelemetryDelegator.prototype.promiseTelemetryObjects = function (domainObject) { var $q = this.$q; - + // If object has been cleared, there are no relevant // telemetry-providing domain objects. if (!domainObject) { @@ -59,7 +59,7 @@ define( "telemetry" )).then(function (result) { var head = domainObject.hasCapability("telemetry") ? - [ domainObject ] : [], + [domainObject] : [], tail = result || []; return head.concat(tail); }); diff --git a/platform/telemetry/src/TelemetryQueue.js b/platform/telemetry/src/TelemetryQueue.js index c6092cc603..3017906802 100644 --- a/platform/telemetry/src/TelemetryQueue.js +++ b/platform/telemetry/src/TelemetryQueue.js @@ -37,22 +37,22 @@ define( function TelemetryQueue() { // General approach here: // * Maintain a queue as an array of objects containing key-value - // pairs. Putting values into the queue will assign to the - // earliest-available queue position for the associated key + // pairs. Putting values into the queue will assign to the + // earliest-available queue position for the associated key // (appending to the array if necessary.) // * Maintain a set of counts for each key, such that determining // the next available queue position is easy; O(1) insertion. - // * When retrieving objects, pop off the queue and decrement + // * When retrieving objects, pop off the queue and decrement // counts. This provides O(n+k) or O(k) retrieval for a queue // of length n with k unique keys; this depends on whether // the browser's implementation of Array.prototype.shift is // O(n) or O(1). - + // Graphically (indexes at top, keys along side, values as *'s), // if we have a queue that looks like: // 0 1 2 3 4 // a * * * * * - // b * * + // b * * // c * * * // // And we put a new value for b, we expect: diff --git a/platform/telemetry/test/TelemetryAggregatorSpec.js b/platform/telemetry/test/TelemetryAggregatorSpec.js index 76a3a2cbb7..b99901a307 100644 --- a/platform/telemetry/test/TelemetryAggregatorSpec.js +++ b/platform/telemetry/test/TelemetryAggregatorSpec.js @@ -41,7 +41,7 @@ define( function mockProvider(key, index) { var provider = jasmine.createSpyObj( "provider" + index, - [ "requestTelemetry", "subscribe" ] + ["requestTelemetry", "subscribe"] ), unsubscribe = jasmine.createSpy("unsubscribe" + index); provider.requestTelemetry.andReturn({ someKey: key }); @@ -53,11 +53,11 @@ define( } beforeEach(function () { - mockQ = jasmine.createSpyObj("$q", [ "all" ]); + mockQ = jasmine.createSpyObj("$q", ["all"]); mockQ.all.andReturn(mockPromise([])); mockUnsubscribes = []; - mockProviders = [ "a", "b", "c" ].map(mockProvider); + mockProviders = ["a", "b", "c"].map(mockProvider); aggregator = new TelemetryAggregator(mockQ, mockProviders); }); @@ -121,4 +121,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/telemetry/test/TelemetryCapabilitySpec.js b/platform/telemetry/test/TelemetryCapabilitySpec.js index 440a577e96..e5b57cb365 100644 --- a/platform/telemetry/test/TelemetryCapabilitySpec.js +++ b/platform/telemetry/test/TelemetryCapabilitySpec.js @@ -49,11 +49,11 @@ define( mockLog = jasmine.createSpyObj("$log", ["warn", "info", "debug"]); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getId", "getCapability", "getModel" ] + ["getId", "getCapability", "getModel"] ); mockTelemetryService = jasmine.createSpyObj( "telemetryService", - [ "requestTelemetry", "subscribe" ] + ["requestTelemetry", "subscribe"] ); mockReject = jasmine.createSpyObj("reject", ["then"]); mockUnsubscribe = jasmine.createSpy("unsubscribe"); @@ -119,7 +119,9 @@ define( it("provides an empty series when telemetry is missing", function () { var series; mockTelemetryService.requestTelemetry.andReturn(mockPromise({})); - telemetry.requestData({}).then(function (s) { series = s; }); + telemetry.requestData({}).then(function (s) { + series = s; + }); expect(series.getPointCount()).toEqual(0); }); @@ -147,7 +149,9 @@ define( it("warns if no telemetry service can be injected", function () { - mockInjector.get.andCallFake(function () { throw ""; }); + mockInjector.get.andCallFake(function () { + throw ""; + }); // Verify precondition expect(mockLog.warn).not.toHaveBeenCalled(); diff --git a/platform/telemetry/test/TelemetryControllerSpec.js b/platform/telemetry/test/TelemetryControllerSpec.js index 8dc60ef231..b5dd7ea847 100644 --- a/platform/telemetry/test/TelemetryControllerSpec.js +++ b/platform/telemetry/test/TelemetryControllerSpec.js @@ -45,9 +45,9 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( "$scope", - [ "$on", "$broadcast", "$watch" ] + ["$on", "$broadcast", "$watch"] ); - mockQ = jasmine.createSpyObj("$q", [ "all", "when" ]); + mockQ = jasmine.createSpyObj("$q", ["all", "when"]); mockTimeout = jasmine.createSpy("$timeout"); mockLog = jasmine.createSpyObj("$log", ["warn", "info", "debug"]); @@ -64,7 +64,7 @@ define( mockTelemetry = jasmine.createSpyObj( "telemetry", - [ "requestData", "subscribe", "getMetadata" ] + ["requestData", "subscribe", "getMetadata"] ); mockUnsubscribe = jasmine.createSpy("unsubscribe"); @@ -239,4 +239,4 @@ define( }); }); } -); \ No newline at end of file +); diff --git a/platform/telemetry/test/TelemetryHandleSpec.js b/platform/telemetry/test/TelemetryHandleSpec.js index 4ede2a4b5d..aedf734807 100644 --- a/platform/telemetry/test/TelemetryHandleSpec.js +++ b/platform/telemetry/test/TelemetryHandleSpec.js @@ -71,7 +71,9 @@ define( mockQ.all.andCallFake(function (values) { return values.map(function (v) { var r; - asPromise(v).then(function (value) { r = value; }); + asPromise(v).then(function (value) { + r = value; + }); return r; }); }); diff --git a/platform/telemetry/test/TelemetryQueueSpec.js b/platform/telemetry/test/TelemetryQueueSpec.js index d81221f95f..af4f866048 100644 --- a/platform/telemetry/test/TelemetryQueueSpec.js +++ b/platform/telemetry/test/TelemetryQueueSpec.js @@ -71,4 +71,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/telemetry/test/TelemetrySubscriberSpec.js b/platform/telemetry/test/TelemetrySubscriberSpec.js index 7ca7b054ad..f79cb608fc 100644 --- a/platform/telemetry/test/TelemetrySubscriberSpec.js +++ b/platform/telemetry/test/TelemetrySubscriberSpec.js @@ -40,7 +40,7 @@ define( mockTimeout = jasmine.createSpy("$timeout"); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getCapability", "useCapability", "hasCapability" ] + ["getCapability", "useCapability", "hasCapability"] ); mockCallback = jasmine.createSpy("callback"); mockPromise = jasmine.createSpyObj("promise", ["then"]); @@ -70,4 +70,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/platform/telemetry/test/TelemetrySubscriptionSpec.js b/platform/telemetry/test/TelemetrySubscriptionSpec.js index 7665a823b9..c3e4b23be2 100644 --- a/platform/telemetry/test/TelemetrySubscriptionSpec.js +++ b/platform/telemetry/test/TelemetrySubscriptionSpec.js @@ -52,7 +52,7 @@ define( mockTimeout = jasmine.createSpy("$timeout"); mockDomainObject = jasmine.createSpyObj( "domainObject", - [ "getCapability", "useCapability", "hasCapability", "getId" ] + ["getCapability", "useCapability", "hasCapability", "getId"] ); mockCallback = jasmine.createSpy("callback"); mockTelemetry = jasmine.createSpyObj( @@ -67,7 +67,7 @@ define( mockUnlisten = jasmine.createSpy("unlisten"); mockSeries = jasmine.createSpyObj( "series", - [ "getPointCount", "getDomainValue", "getRangeValue" ] + ["getPointCount", "getDomainValue", "getRangeValue"] ); mockQ.when.andCallFake(mockPromise); @@ -223,7 +223,7 @@ define( subscription.promiseTelemetryObjects().then(mockCallback2); expect(mockCallback2) - .toHaveBeenCalledWith([ mockDomainObject ]); + .toHaveBeenCalledWith([mockDomainObject]); }); it("reinitializes on mutation", function () { @@ -252,8 +252,8 @@ define( mockSeries.getDomainValue.andCallFake(lookup); mockSeries.getRangeValue.andCallFake(lookup); - testMetadata.domains = [ { key: 'a' }, { key: 'b'} ]; - testMetadata.ranges = [ { key: 'c' }, { key: 'd'} ]; + testMetadata.domains = [{ key: 'a' }, { key: 'b'}]; + testMetadata.ranges = [{ key: 'c' }, { key: 'd'}]; mockTelemetry.subscribe.mostRecentCall.args[0](mockSeries); mockTimeout.mostRecentCall.args[0](); diff --git a/platform/telemetry/test/TelemetryTableSpec.js b/platform/telemetry/test/TelemetryTableSpec.js index cc7bcf6cd2..c787a5ec93 100644 --- a/platform/telemetry/test/TelemetryTableSpec.js +++ b/platform/telemetry/test/TelemetryTableSpec.js @@ -69,4 +69,4 @@ define( }); } -); \ No newline at end of file +); diff --git a/src/BundleRegistry.js b/src/BundleRegistry.js index d87b23e34f..f55d3fcd4c 100644 --- a/src/BundleRegistry.js +++ b/src/BundleRegistry.js @@ -47,4 +47,4 @@ define(function () { }; return BundleRegistry; -}); \ No newline at end of file +}); diff --git a/src/BundleRegistrySpec.js b/src/BundleRegistrySpec.js index e60a76fef3..208e9d4fcc 100644 --- a/src/BundleRegistrySpec.js +++ b/src/BundleRegistrySpec.js @@ -85,4 +85,4 @@ define(['./BundleRegistry'], function (BundleRegistry) { }); -}); \ No newline at end of file +}); diff --git a/src/legacyRegistry.js b/src/legacyRegistry.js index 39af6673f4..25bf1b40fe 100644 --- a/src/legacyRegistry.js +++ b/src/legacyRegistry.js @@ -22,4 +22,4 @@ define(['src/BundleRegistry'], function (BundleRegistry) { return new BundleRegistry(); -}); \ No newline at end of file +}); From f9631ff4c5e37bb6485d45b4c852b2505ec582ff Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 12 May 2016 16:35:34 -0700 Subject: [PATCH 18/59] [Code Style] Fix style missed by gulp fixstyle ...and remove an unnecessary comment, too. --- .../timeline/src/controllers/swimlane/TimelineSwimlane.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlane.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlane.js index 44d7b65aa2..1938145d6e 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlane.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlane.js @@ -47,9 +47,7 @@ define( depth = parent ? (parent.depth + 1) : 0, timespan, path = (!parent || !parent.parent) ? "" : parent.path + - //(parent.path.length > 0 ? " / " : "") + - parent.domainObject.getModel().name + - " > "; + parent.domainObject.getModel().name + " > "; // Look up timespan for this object domainObject.useCapability('timespan').then(function (t) { From 516b8c9e38a668619ae93be4093954241088d99d Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 19 May 2016 10:36:58 -0700 Subject: [PATCH 19/59] [Website] #901 Automate build process - Updated build SHA --- build-docs.sh | 10 ++++++---- circle.yml | 6 ++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build-docs.sh b/build-docs.sh index 9fdfdc91d3..87ada35524 100755 --- a/build-docs.sh +++ b/build-docs.sh @@ -22,13 +22,14 @@ #* at runtime from the About dialog for additional information. #***************************************************************************** -# Script to build and deploy docs to github pages. +# Script to build and deploy docs. OUTPUT_DIRECTORY="target/docs" +# Docs, once built, are pushed to the private website repo REPOSITORY_URL="git@github.com:nasa/openmct-website.git" WEBSITE_DIRECTORY="website" -BUILD_SHA=`git rev-parse head` +BUILD_SHA=`git rev-parse HEAD` # A remote will be created for the git repository we are pushing to. # Don't worry, as this entire directory will get trashed inbetween builds. @@ -55,6 +56,7 @@ git config user.name "BuildBot" echo "git add ." git add . -echo "git commit -m \"Docs updated from build build $BUILD_SHA\"" -git commit -m "Docs updated from build build $BUILD_SHA" +echo "git commit -m \"Docs updated from build $BUILD_SHA\"" +git commit -m "Docs updated from build $BUILD_SHA" +# Push to the website repo git push diff --git a/circle.yml b/circle.yml index 5ed3bf7147..db25ab22de 100644 --- a/circle.yml +++ b/circle.yml @@ -1,13 +1,11 @@ deployment: production: branch: master - heroku: - appname: openmctweb-demo - website: - branch: openmct-website commands: - npm install canvas nomnoml - ./build-docs.sh + heroku: + appname: openmctweb-demo openmct-demo: branch: live_demo heroku: From e4b192001f831457ef600c4dc669f5461fc77c22 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 19 May 2016 12:14:42 -0700 Subject: [PATCH 20/59] Changed circle.yml to go back to command-based deployment to heroku as cannot use 'heroku' deployment support and commands in the same deployment descriptor --- circle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index db25ab22de..3a671eaa72 100644 --- a/circle.yml +++ b/circle.yml @@ -4,8 +4,8 @@ deployment: commands: - npm install canvas nomnoml - ./build-docs.sh - heroku: - appname: openmctweb-demo + - git fetch--unshallow + - git push git@heroku.com:openmctweb-demo.git $CIRCLE_SHA1:refs/heads/master openmct-demo: branch: live_demo heroku: From b7cfaf6b63483a634fed88293aa7e4534f326899 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 19 May 2016 13:42:48 -0700 Subject: [PATCH 21/59] Fixed failed circle.yml command --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 3a671eaa72..bfc2e8fede 100644 --- a/circle.yml +++ b/circle.yml @@ -4,7 +4,7 @@ deployment: commands: - npm install canvas nomnoml - ./build-docs.sh - - git fetch--unshallow + - git fetch --unshallow - git push git@heroku.com:openmctweb-demo.git $CIRCLE_SHA1:refs/heads/master openmct-demo: branch: live_demo From 20ecf168f238b9a4b2341508650f4b573bfd4f0b Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 19 May 2016 15:00:12 -0700 Subject: [PATCH 22/59] [Timeline] Change ordering in mct-representation ...such that the configuration property is available in scope when a view is first instantiated. #908 --- platform/representation/src/MCTRepresentation.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index bcaa90e4e7..1e775b87be 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -180,10 +180,6 @@ define( // representation to store local variables into. $scope.representation = {}; - // Change templates (passing in undefined to clear - // if we don't have enough info to show a template.) - changeTemplate(canRepresent ? representation : undefined); - // Any existing representers are no longer valid; release them. destroyRepresenters(); @@ -230,6 +226,10 @@ define( // next change object/key pair changes toClear = uses.concat(['model']); } + + // Change templates (passing in undefined to clear + // if we don't have enough info to show a template.) + changeTemplate(canRepresent ? representation : undefined); } // Update the representation when the key changes (e.g. if a From b5229d7786506b17a189a19b7334b97c4764cbf4 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 19 May 2016 15:06:06 -0700 Subject: [PATCH 23/59] [Timeline] Commit changes on toggle #908 --- .../timeline/res/templates/tabular-swimlane-cols-tree.html | 2 +- platform/features/timeline/res/templates/timeline.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/features/timeline/res/templates/tabular-swimlane-cols-tree.html b/platform/features/timeline/res/templates/tabular-swimlane-cols-tree.html index e5ca69e15c..22c4a84229 100644 --- a/platform/features/timeline/res/templates/tabular-swimlane-cols-tree.html +++ b/platform/features/timeline/res/templates/tabular-swimlane-cols-tree.html @@ -29,7 +29,7 @@ }">
From 2a4004fd5bcddc8249c8911606d14dad8303d14b Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 19 May 2016 15:09:52 -0700 Subject: [PATCH 24/59] [Timeline] Test mct-representation ordering Verify that a configuration object has been added to scope before changing templates. #908 --- .../representation/test/MCTRepresentationSpec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/platform/representation/test/MCTRepresentationSpec.js b/platform/representation/test/MCTRepresentationSpec.js index 52d6c70d55..d3ccd61a7b 100644 --- a/platform/representation/test/MCTRepresentationSpec.js +++ b/platform/representation/test/MCTRepresentationSpec.js @@ -194,6 +194,21 @@ define( .toHaveBeenCalledWith(testViews[1]); }); + it("exposes configuration before changing templates", function () { + var observedConfiguration; + + mockChangeTemplate.andCallFake(function () { + observedConfiguration = mockScope.configuration; + }); + + mockScope.key = "xyz"; + mockScope.domainObject = mockDomainObject; + fireWatch('key', mockScope.key); + fireWatch('domainObject', mockDomainObject); + + expect(observedConfiguration).toBeDefined(); + }); + it("does not load templates until there is an object", function () { mockScope.key = "xyz"; From 78bf804e02a94d2624ac6d8a0f2623ff7d91c631 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 19 May 2016 15:24:14 -0700 Subject: [PATCH 25/59] [Build] Ignore gh-pages from circle-ci --- circle.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/circle.yml b/circle.yml index bfc2e8fede..7caa57740d 100644 --- a/circle.yml +++ b/circle.yml @@ -17,3 +17,8 @@ deployment: test: post: - gulp lint + +general: + branches: + ignore: + - gh-pages From 776586ae25fcd8a1f9c781f995ec63465f496dad Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 20:23:33 -0700 Subject: [PATCH 26/59] [New Edit Mode] #634 Removed edit concerns from MctRepresentation --- .../regions/src/InspectorController.js | 8 +++- .../regions/test/InspectorControllerSpec.js | 39 +++++++++++++++++-- .../representation/src/MCTRepresentation.js | 29 ++------------ .../test/MCTRepresentationSpec.js | 15 ------- 4 files changed, 45 insertions(+), 46 deletions(-) diff --git a/platform/commonUI/regions/src/InspectorController.js b/platform/commonUI/regions/src/InspectorController.js index 32b0e1903d..89b88d4b15 100644 --- a/platform/commonUI/regions/src/InspectorController.js +++ b/platform/commonUI/regions/src/InspectorController.js @@ -32,7 +32,8 @@ define( */ function InspectorController($scope, policyService) { var domainObject = $scope.domainObject, - typeCapability = domainObject.getCapability('type'); + typeCapability = domainObject.getCapability('type'), + statusListener; /** * Filters region parts to only those allowed by region policies @@ -50,6 +51,11 @@ define( $scope.regions = filterRegions(typeCapability.getDefinition().inspector || new InspectorRegion()); } + statusListener = domainObject.getCapability("status").listen(setRegions); + $scope.$on("$destroy", function () { + statusListener(); + }); + setRegions(); } diff --git a/platform/commonUI/regions/test/InspectorControllerSpec.js b/platform/commonUI/regions/test/InspectorControllerSpec.js index ad3243c348..9d815e2851 100644 --- a/platform/commonUI/regions/test/InspectorControllerSpec.js +++ b/platform/commonUI/regions/test/InspectorControllerSpec.js @@ -30,6 +30,8 @@ define( mockTypeCapability, mockTypeDefinition, mockPolicyService, + mockStatusCapability, + capabilities = {}, controller; beforeEach(function(){ @@ -47,19 +49,29 @@ define( 'getDefinition' ]); mockTypeCapability.getDefinition.andReturn(mockTypeDefinition); + capabilities.type = mockTypeCapability; + + mockStatusCapability = jasmine.createSpyObj('statusCapability', [ + 'listen' + ]); + capabilities.status = mockStatusCapability; mockDomainObject = jasmine.createSpyObj('domainObject', [ 'getCapability' ]); - mockDomainObject.getCapability.andReturn(mockTypeCapability); + mockDomainObject.getCapability.andCallFake(function (name) { + return capabilities[name]; + }); mockPolicyService = jasmine.createSpyObj('policyService', [ 'allow' ]); - mockScope = { - domainObject: mockDomainObject - }; + mockScope = jasmine.createSpyObj('$scope', + ['$on'] + ); + + mockScope.domainObject = mockDomainObject; }); it("filters out regions disallowed by region policy", function() { @@ -73,6 +85,25 @@ define( controller = new InspectorController(mockScope, mockPolicyService); expect(mockScope.regions.length).toBe(2); }); + + it("Responds to status changes", function() { + mockPolicyService.allow.andReturn(true); + controller = new InspectorController(mockScope, mockPolicyService); + expect(mockScope.regions.length).toBe(2); + expect(mockStatusCapability.listen).toHaveBeenCalled(); + mockPolicyService.allow.andReturn(false); + mockStatusCapability.listen.mostRecentCall.args[0](); + expect(mockScope.regions.length).toBe(0); + }); + + it("Unregisters status listener", function() { + var mockListener = jasmine.createSpy('listener'); + mockStatusCapability.listen.andReturn(mockListener); + controller = new InspectorController(mockScope, mockPolicyService); + expect(mockScope.$on).toHaveBeenCalledWith("$destroy", jasmine.any(Function)); + mockScope.$on.mostRecentCall.args[1](); + expect(mockListener).toHaveBeenCalled(); + }); }); } ); diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index bcaa90e4e7..331139b793 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -88,7 +88,6 @@ define( toClear = [], // Properties to clear out of scope on change counter = 0, couldRepresent = false, - couldEdit = false, lastIdPath = [], lastKey, statusListener, @@ -137,14 +136,13 @@ define( }); } - function unchanged(canRepresent, canEdit, idPath, key) { + function unchanged(canRepresent, idPath, key) { return (canRepresent === couldRepresent) && (key === lastKey) && (idPath.length === lastIdPath.length) && idPath.every(function (id, i) { return id === lastIdPath[i]; - }) && - (canEdit === couldEdit); + }); } function getIdPath(domainObject) { @@ -168,11 +166,10 @@ define( representation = lookup($scope.key, domainObject), uses = ((representation || {}).uses || []), canRepresent = !!(representation && domainObject), - canEdit = !!(domainObject && domainObject.hasCapability('editor') && domainObject.getCapability('editor').inEditContext()), idPath = getIdPath(domainObject), key = $scope.key; - if (unchanged(canRepresent, canEdit, idPath, key)) { + if (unchanged(canRepresent, idPath, key)) { return; } @@ -201,7 +198,6 @@ define( // To allow simplified change detection next time around couldRepresent = canRepresent; lastIdPath = idPath; - couldEdit = canEdit; lastKey = key; // Populate scope with fields associated with the current @@ -240,25 +236,6 @@ define( // (to a different object) $scope.$watch("domainObject", refresh); - function listenForStatusChange(object) { - if (statusListener) { - statusListener(); - } - statusListener = object.getCapability("status").listen(refresh); - } - - /** - * Add a listener to the object for status changes. - */ - $scope.$watch("domainObject", function (domainObject, oldDomainObject) { - if (domainObject !== oldDomainObject){ - listenForStatusChange(domainObject); - } - }); - if ($scope.domainObject) { - listenForStatusChange($scope.domainObject); - } - // Finally, also update when there is a new version of that // same domain object; these changes should be tracked in the // model's "modified" field, by the mutation capability. diff --git a/platform/representation/test/MCTRepresentationSpec.js b/platform/representation/test/MCTRepresentationSpec.js index 52d6c70d55..b5e78fec2a 100644 --- a/platform/representation/test/MCTRepresentationSpec.js +++ b/platform/representation/test/MCTRepresentationSpec.js @@ -253,21 +253,6 @@ define( expect(mockScope.testCapability).toBeUndefined(); }); - it("registers a status change listener", function () { - mockScope.$watch.calls[2].args[1](mockDomainObject); - expect(mockStatusCapability.listen).toHaveBeenCalled(); - }); - - it("unlistens for status change on scope destruction", function () { - var mockUnlistener = jasmine.createSpy("unlisten"); - mockStatusCapability.listen.andReturn(mockUnlistener); - mockScope.$watch.calls[2].args[1](mockDomainObject); - expect(mockStatusCapability.listen).toHaveBeenCalled(); - - mockScope.$on.calls[1].args[1](); - expect(mockUnlistener).toHaveBeenCalled(); - }); - describe("when a domain object has been observed", function () { var mockContext, mockContext2, From 601bc03ba2064a992553151e3843c69c0d9d41c1 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 20 May 2016 10:23:05 -0700 Subject: [PATCH 27/59] [New Edit Mode] #636 Modified EditAndCompose action to rely on a slightly refactored EditActionPolicy to remove folder specific logic --- .../edit/src/actions/EditAndComposeAction.js | 7 ++++--- .../edit/src/policies/EditActionPolicy.js | 19 ++++++++----------- .../test/actions/EditAndComposeActionSpec.js | 19 ++++++++++++++++--- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/platform/commonUI/edit/src/actions/EditAndComposeAction.js b/platform/commonUI/edit/src/actions/EditAndComposeAction.js index 974ab2f001..de43ca0fdc 100644 --- a/platform/commonUI/edit/src/actions/EditAndComposeAction.js +++ b/platform/commonUI/edit/src/actions/EditAndComposeAction.js @@ -37,7 +37,8 @@ define( } EditAndComposeAction.prototype.perform = function () { - var self = this; + var self = this, + editAction = this.domainObject.getCapability('action').getActions("edit")[0]; // Persist changes to the domain object function doPersist() { @@ -54,8 +55,8 @@ define( .then(doPersist); } - if (this.domainObject.getCapability('type').getKey() !== 'folder') { - this.domainObject.getCapability('action').perform('edit'); + if (editAction) { + editAction.perform(); } return this.selectedObject && doLink(); diff --git a/platform/commonUI/edit/src/policies/EditActionPolicy.js b/platform/commonUI/edit/src/policies/EditActionPolicy.js index f266d580eb..86e103b387 100644 --- a/platform/commonUI/edit/src/policies/EditActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditActionPolicy.js @@ -81,17 +81,14 @@ define( var key = action.getMetadata().key, category = (context || {}).category; - // Only worry about actions in the view-control category - if (category === 'view-control') { - // Restrict 'edit' to cases where there are editable - // views (similarly, restrict 'properties' to when - // the converse is true), and where the domain object is not - // already being edited. - if (key === 'edit') { - return this.countEditableViews(context) > 0 && !isEditing(context); - } else if (key === 'properties') { - return this.countEditableViews(context) < 1 && !isEditing(context); - } + // Restrict 'edit' to cases where there are editable + // views (similarly, restrict 'properties' to when + // the converse is true), and where the domain object is not + // already being edited. + if (key === 'edit') { + return this.countEditableViews(context) > 0 && !isEditing(context); + } else if (key === 'properties' && category === 'view-control') { + return this.countEditableViews(context) < 1 && !isEditing(context); } // Like all policies, allow by default. diff --git a/platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js b/platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js index a02c259fd1..2e83b2f9c7 100644 --- a/platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js +++ b/platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js @@ -32,6 +32,7 @@ define( mockComposition, mockPersistence, mockActionCapability, + mockEditAction, mockType, actionContext, model, @@ -69,7 +70,8 @@ define( mockComposition = jasmine.createSpyObj("composition", [ "invoke", "add" ]); mockPersistence = jasmine.createSpyObj("persistence", [ "persist" ]); mockType = jasmine.createSpyObj("type", [ "hasFeature", "getKey" ]); - mockActionCapability = jasmine.createSpyObj("actionCapability", [ "perform"]); + mockActionCapability = jasmine.createSpyObj("actionCapability", [ "getActions"]); + mockEditAction = jasmine.createSpyObj("editAction", ["perform"]); mockDomainObject.getId.andReturn("test"); mockDomainObject.getCapability.andReturn(mockContext); @@ -78,6 +80,7 @@ define( mockType.getKey.andReturn("layout"); mockComposition.invoke.andReturn(mockPromise(true)); mockComposition.add.andReturn(mockPromise(true)); + mockActionCapability.getActions.andReturn([]); capabilities = { composition: mockComposition, @@ -109,9 +112,19 @@ define( expect(mockPersistence.persist).toHaveBeenCalled(); }); - it("enables edit mode", function () { + it("enables edit mode for objects that have an edit action", function () { + mockActionCapability.getActions.andReturn([mockEditAction]); action.perform(); - expect(mockActionCapability.perform).toHaveBeenCalledWith("edit"); + expect(mockEditAction.perform).toHaveBeenCalled(); + }); + + it("Does not enable edit mode for objects that do not have an" + + " edit action", function () { + mockActionCapability.getActions.andReturn([]); + action.perform(); + expect(mockEditAction.perform).not.toHaveBeenCalled(); + expect(mockComposition.add) + .toHaveBeenCalledWith(mockDomainObject); }); }); From e468080373bfe01de9512f481f04a66b575ecb01 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 20 May 2016 11:38:36 -0700 Subject: [PATCH 28/59] [Code Style] Disallow outer shadowing https://github.com/nasa/openmct/commit/031a46aa8e34f2e428c71b9cf9e4c83412c8d438#commitcomment-17561082 --- .jshintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jshintrc b/.jshintrc index ca549530ff..dc2b733533 100644 --- a/.jshintrc +++ b/.jshintrc @@ -16,7 +16,7 @@ "define", "Promise" ], - "shadow": "inner", + "shadow": "outer", "strict": "implied", "undef": true, "unused": "vars" From ad5691142e076b52c127211c037f20f2759d5886 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 20 May 2016 11:39:49 -0700 Subject: [PATCH 29/59] [Code Style] Rename shadowing variables --- .../browse/test/creation/CreateWizardSpec.js | 6 +-- .../edit/src/actions/PropertiesAction.js | 4 +- .../commonUI/edit/src/actions/RemoveAction.js | 4 +- .../edit/src/representers/EditToolbar.js | 10 ++-- .../representers/EditToolbarRepresenter.js | 4 +- .../edit/test/actions/PropertiesDialogSpec.js | 8 ++-- .../general/src/services/UrlService.js | 4 +- .../commonUI/general/src/ui/TreeNodeView.js | 4 +- platform/commonUI/general/src/ui/TreeView.js | 4 +- .../commonUI/general/test/ui/TreeViewSpec.js | 48 ++++++++----------- .../inspect/src/gestures/InfoButtonGesture.js | 4 +- .../commonUI/mobile/test/AgentServiceSpec.js | 2 +- platform/core/src/actions/ActionProvider.js | 12 ++--- .../src/capabilities/CompositionCapability.js | 6 +-- .../capabilities/CoreCapabilityProvider.js | 4 +- .../src/capabilities/MutationCapability.js | 4 +- .../src/capabilities/PersistenceCapability.js | 4 +- .../core/src/models/PersistedModelProvider.js | 10 ++-- platform/core/src/types/MergeModels.js | 14 +++--- platform/core/src/types/TypeProvider.js | 6 +-- platform/core/src/views/ViewProvider.js | 12 ++--- .../InstantiationCapabilitySpec.js | 6 +-- .../test/models/CachingModelDecoratorSpec.js | 4 +- platform/core/test/views/ViewProviderSpec.js | 12 ++--- .../src/actions/AbstractComposeAction.js | 10 ++-- .../entanglement/src/services/CopyService.js | 6 +-- .../src/services/LocationService.js | 4 +- .../test/services/CopyServiceSpec.js | 10 ++-- .../plot/test/PlotOptionsControllerSpec.js | 10 ++-- .../src/controllers/MCTTableController.js | 22 ++++----- .../src/capabilities/ActivityTimespan.js | 14 +++--- .../src/capabilities/CumulativeGraph.js | 14 +++--- .../src/capabilities/ResourceGraph.js | 8 ++-- .../src/capabilities/TimelineTimespan.js | 4 +- .../src/capabilities/UtilizationCapability.js | 8 ++-- .../controllers/drag/TimelineDragHandler.js | 24 +++++----- .../graph/TimelineGraphPopulator.js | 7 ++- .../src/controllers/swimlane/TimelineProxy.js | 4 +- .../swimlane/TimelineSwimlaneDecorator.js | 10 ++-- .../swimlane/TimelineSwimlaneDropHandler.js | 8 ++-- .../swimlane/TimelineSwimlanePopulator.js | 4 +- .../timeline/src/services/ObjectLoader.js | 12 ++--- .../test/actions/TimelineTraverserSpec.js | 8 ++-- .../capabilities/UtilizationCapabilitySpec.js | 4 +- .../drag/TimelineDragHandlerSpec.js | 12 ++--- .../swimlane/TimelineSwimlanePopulatorSpec.js | 10 ++-- .../src/register/ExtensionRegistrar.js | 13 +++-- .../src/resolve/ExtensionResolver.js | 22 ++++----- .../elastic/src/ElasticPersistenceProvider.js | 4 +- .../queue/src/PersistenceFailureHandler.js | 14 +++--- .../queue/src/PersistenceQueueHandler.js | 10 ++-- platform/representation/src/TemplateLinker.js | 12 ++--- .../src/services/GenericSearchProvider.js | 4 +- platform/telemetry/src/TelemetryQueue.js | 6 +-- .../telemetry/src/TelemetrySubscription.js | 20 ++++---- .../telemetry/test/TelemetryAggregatorSpec.js | 4 +- 56 files changed, 256 insertions(+), 262 deletions(-) diff --git a/platform/commonUI/browse/test/creation/CreateWizardSpec.js b/platform/commonUI/browse/test/creation/CreateWizardSpec.js index 713b1d33d3..628fdbc447 100644 --- a/platform/commonUI/browse/test/creation/CreateWizardSpec.js +++ b/platform/commonUI/browse/test/creation/CreateWizardSpec.js @@ -152,7 +152,7 @@ define( }); it("validates selection types using policy", function () { - var mockDomainObject = jasmine.createSpyObj( + var mockDomainObj = jasmine.createSpyObj( 'domainObject', ['getCapability'] ), @@ -166,8 +166,8 @@ define( rows = structure.sections[sections.length - 1].rows, locationRow = rows[rows.length - 1]; - mockDomainObject.getCapability.andReturn(mockOtherType); - locationRow.validate(mockDomainObject); + mockDomainObj.getCapability.andReturn(mockOtherType); + locationRow.validate(mockDomainObj); // Should check policy to see if the user-selected location // can actually contain objects of this type diff --git a/platform/commonUI/edit/src/actions/PropertiesAction.js b/platform/commonUI/edit/src/actions/PropertiesAction.js index 7ec48122ca..2f682fc950 100644 --- a/platform/commonUI/edit/src/actions/PropertiesAction.js +++ b/platform/commonUI/edit/src/actions/PropertiesAction.js @@ -63,10 +63,10 @@ define( }); } - function showDialog(type) { + function showDialog(objType) { // Create a dialog object to generate the form structure, etc. var dialog = - new PropertiesDialog(type, domainObject.getModel()); + new PropertiesDialog(objType, domainObject.getModel()); // Show the dialog return dialogService.getUserInput( diff --git a/platform/commonUI/edit/src/actions/RemoveAction.js b/platform/commonUI/edit/src/actions/RemoveAction.js index 3174330d03..7617101549 100644 --- a/platform/commonUI/edit/src/actions/RemoveAction.js +++ b/platform/commonUI/edit/src/actions/RemoveAction.js @@ -75,8 +75,8 @@ define( * Invoke persistence on a domain object. This will be called upon * the removed object's parent (as its composition will have changed.) */ - function doPersist(domainObject) { - var persistence = domainObject.getCapability('persistence'); + function doPersist(domainObj) { + var persistence = domainObj.getCapability('persistence'); return persistence && persistence.persist(); } diff --git a/platform/commonUI/edit/src/representers/EditToolbar.js b/platform/commonUI/edit/src/representers/EditToolbar.js index 7659367dc6..5184d73086 100644 --- a/platform/commonUI/edit/src/representers/EditToolbar.js +++ b/platform/commonUI/edit/src/representers/EditToolbar.js @@ -223,7 +223,7 @@ define( // Update value for this property in all elements of the // selection which have this property. - function updateProperties(property, value) { + function updateProperties(property, val) { var changed = false; // Update property in a selected element @@ -233,12 +233,12 @@ define( // Check if this is a setter, or just assignable if (typeof selected[property] === 'function') { changed = - changed || (selected[property]() !== value); - selected[property](value); + changed || (selected[property]() !== val); + selected[property](val); } else { changed = - changed || (selected[property] !== value); - selected[property] = value; + changed || (selected[property] !== val); + selected[property] = val; } } } diff --git a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js index 0e30920575..a4146f5965 100644 --- a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js @@ -133,11 +133,11 @@ define( self = this; // Initialize toolbar (expose object to parent scope) - function initialize(definition) { + function initialize(def) { // If we have been asked to expose toolbar state... if (self.attrs.toolbar) { // Initialize toolbar object - self.toolbar = new EditToolbar(definition, self.commit); + self.toolbar = new EditToolbar(def, self.commit); // Ensure toolbar state is exposed self.exposeToolbar(); } diff --git a/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js b/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js index eebf513464..00d245a256 100644 --- a/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js +++ b/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js @@ -37,11 +37,11 @@ define( model = { x: "initial value" }; properties = ["x", "y", "z"].map(function (k) { return { - getValue: function (model) { - return model[k]; + getValue: function (m) { + return m[k]; }, - setValue: function (model, v) { - model[k] = v; + setValue: function (m, v) { + m[k] = v; }, getDefinition: function () { return { control: 'textfield '}; diff --git a/platform/commonUI/general/src/services/UrlService.js b/platform/commonUI/general/src/services/UrlService.js index 2348db23c4..af0204c24d 100644 --- a/platform/commonUI/general/src/services/UrlService.js +++ b/platform/commonUI/general/src/services/UrlService.js @@ -50,8 +50,8 @@ define( var context = domainObject && domainObject.getCapability('context'), objectPath = context ? context.getPath() : [], - ids = objectPath.map(function (domainObject) { - return domainObject.getId(); + ids = objectPath.map(function (domainObj) { + return domainObj.getId(); }); // Parses the path together. Starts with the diff --git a/platform/commonUI/general/src/ui/TreeNodeView.js b/platform/commonUI/general/src/ui/TreeNodeView.js index 2cff198e76..13b28bb473 100644 --- a/platform/commonUI/general/src/ui/TreeNodeView.js +++ b/platform/commonUI/general/src/ui/TreeNodeView.js @@ -105,8 +105,8 @@ define([ function getIdPath(domainObject) { var context = domainObject && domainObject.getCapability('context'); - function getId(domainObject) { - return domainObject.getId(); + function getId(domainObj) { + return domainObj.getId(); } return context ? context.getPath().map(getId) : []; diff --git a/platform/commonUI/general/src/ui/TreeView.js b/platform/commonUI/general/src/ui/TreeView.js index da0bed7091..07d155e960 100644 --- a/platform/commonUI/general/src/ui/TreeView.js +++ b/platform/commonUI/general/src/ui/TreeView.js @@ -62,8 +62,8 @@ define([ var self = this, domainObject = this.activeObject; - function addNode(domainObject, index) { - self.nodeViews[index].model(domainObject); + function addNode(domainObj, index) { + self.nodeViews[index].model(domainObj); } function addNodes(domainObjects) { diff --git a/platform/commonUI/general/test/ui/TreeViewSpec.js b/platform/commonUI/general/test/ui/TreeViewSpec.js index 1e492d4bfd..c889c31090 100644 --- a/platform/commonUI/general/test/ui/TreeViewSpec.js +++ b/platform/commonUI/general/test/ui/TreeViewSpec.js @@ -36,7 +36,7 @@ define([ treeView; function makeMockDomainObject(id, model, capabilities) { - var mockDomainObject = jasmine.createSpyObj( + var mockDomainObj = jasmine.createSpyObj( 'domainObject-' + id, [ 'getId', @@ -46,18 +46,18 @@ define([ 'useCapability' ] ); - mockDomainObject.getId.andReturn(id); - mockDomainObject.getModel.andReturn(model); - mockDomainObject.hasCapability.andCallFake(function (c) { + mockDomainObj.getId.andReturn(id); + mockDomainObj.getModel.andReturn(model); + mockDomainObj.hasCapability.andCallFake(function (c) { return !!(capabilities[c]); }); - mockDomainObject.getCapability.andCallFake(function (c) { + mockDomainObj.getCapability.andCallFake(function (c) { return capabilities[c]; }); - mockDomainObject.useCapability.andCallFake(function (c) { + mockDomainObj.useCapability.andCallFake(function (c) { return capabilities[c] && capabilities[c].invoke(); }); - return mockDomainObject; + return mockDomainObj; } beforeEach(function () { @@ -99,24 +99,16 @@ define([ var mockComposition; function makeGenericCapabilities() { - var mockContext = - jasmine.createSpyObj('context', ['getPath']), - mockType = - jasmine.createSpyObj('type', ['getGlyph']), - mockLocation = - jasmine.createSpyObj('location', ['isLink']), - mockMutation = - jasmine.createSpyObj('mutation', ['listen']), - mockStatus = + var mockStatus = jasmine.createSpyObj('status', ['listen', 'list']); mockStatus.list.andReturn([]); return { - context: mockContext, - type: mockType, - mutation: mockMutation, - location: mockLocation, + context: jasmine.createSpyObj('context', ['getPath']), + type: jasmine.createSpyObj('type', ['getGlyph']), + location: jasmine.createSpyObj('location', ['isLink']), + mutation: jasmine.createSpyObj('mutation', ['listen']), status: mockStatus }; } @@ -133,11 +125,11 @@ define([ beforeEach(function () { mockComposition = ['a', 'b', 'c'].map(function (id) { - var testCapabilities = makeGenericCapabilities(), + var testCaps = makeGenericCapabilities(), mockChild = - makeMockDomainObject(id, {}, testCapabilities); + makeMockDomainObject(id, {}, testCaps); - testCapabilities.context.getPath + testCaps.context.getPath .andReturn([mockDomainObject, mockChild]); return mockChild; @@ -207,11 +199,11 @@ define([ describe("when a context-less object is selected", function () { beforeEach(function () { - var testCapabilities = makeGenericCapabilities(), - mockDomainObject = - makeMockDomainObject('xyz', {}, testCapabilities); - delete testCapabilities.context; - treeView.value(mockDomainObject); + var testCaps = makeGenericCapabilities(), + mockDomainObj = + makeMockDomainObject('xyz', {}, testCaps); + delete testCaps.context; + treeView.value(mockDomainObj); }); it("clears all selection state", function () { diff --git a/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js b/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js index 5dbee8177d..81a3fd9e84 100644 --- a/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js +++ b/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js @@ -79,8 +79,8 @@ define( // On any touch on the body, default body touches/events // are prevented, the bubble is dismissed, and the touchstart // body event is unbound, reallowing gestures - body.on('touchstart', function (event) { - event.preventDefault(); + body.on('touchstart', function (evt) { + evt.preventDefault(); hideBubble(); body.unbind('touchstart'); }); diff --git a/platform/commonUI/mobile/test/AgentServiceSpec.js b/platform/commonUI/mobile/test/AgentServiceSpec.js index e55113810e..da8c19ddc8 100644 --- a/platform/commonUI/mobile/test/AgentServiceSpec.js +++ b/platform/commonUI/mobile/test/AgentServiceSpec.js @@ -69,7 +69,7 @@ define( }); it("detects display orientation", function () { - var agentService = new AgentService(testWindow); + agentService = new AgentService(testWindow); testWindow.innerWidth = 1024; testWindow.innerHeight = 400; expect(agentService.isPortrait()).toBeFalsy(); diff --git a/platform/core/src/actions/ActionProvider.js b/platform/core/src/actions/ActionProvider.js index 4e3973186c..b0afd3e909 100644 --- a/platform/core/src/actions/ActionProvider.js +++ b/platform/core/src/actions/ActionProvider.js @@ -81,8 +81,8 @@ define( // additionally fills in the action's getMetadata method // with the extension definition (if no getMetadata // method was supplied.) - function instantiateAction(Action, context) { - var action = new Action(context), + function instantiateAction(Action, ctxt) { + var action = new Action(ctxt), metadata; // Provide a getMetadata method that echos @@ -90,7 +90,7 @@ define( // unless the action has defined its own. if (!action.getMetadata) { metadata = Object.create(Action.definition || {}); - metadata.context = context; + metadata.context = ctxt; action.getMetadata = function () { return metadata; }; @@ -103,14 +103,14 @@ define( // applicable in a given context, according to the static // appliesTo method of given actions (if defined), and // instantiate those applicable actions. - function createIfApplicable(actions, context) { + function createIfApplicable(actions, ctxt) { function isApplicable(Action) { - return Action.appliesTo ? Action.appliesTo(context) : true; + return Action.appliesTo ? Action.appliesTo(ctxt) : true; } function instantiate(Action) { try { - return instantiateAction(Action, context); + return instantiateAction(Action, ctxt); } catch (e) { $log.error([ "Could not instantiate action", diff --git a/platform/core/src/capabilities/CompositionCapability.js b/platform/core/src/capabilities/CompositionCapability.js index c2d08cdf26..598767a422 100644 --- a/platform/core/src/capabilities/CompositionCapability.js +++ b/platform/core/src/capabilities/CompositionCapability.js @@ -82,7 +82,7 @@ define( return mutationResult && self.invoke().then(findObject); } - function addIdToModel(model) { + function addIdToModel(objModel) { // Pick a specific index if needed. index = isNaN(index) ? composition.length : index; // Also, don't put past the end of the array @@ -90,11 +90,11 @@ define( // Remove the existing instance of the id if (oldIndex !== -1) { - model.composition.splice(oldIndex, 1); + objModel.composition.splice(oldIndex, 1); } // ...and add it back at the appropriate index. - model.composition.splice(index, 0, id); + objModel.composition.splice(index, 0, id); } // If no index has been specified already and the id is already diff --git a/platform/core/src/capabilities/CoreCapabilityProvider.js b/platform/core/src/capabilities/CoreCapabilityProvider.js index 27833630a2..7e5d1e4b7b 100644 --- a/platform/core/src/capabilities/CoreCapabilityProvider.js +++ b/platform/core/src/capabilities/CoreCapabilityProvider.js @@ -62,9 +62,9 @@ define( } // Package capabilities as key-value pairs - function packageCapabilities(capabilities) { + function packageCapabilities(caps) { var result = {}; - capabilities.forEach(function (capability) { + caps.forEach(function (capability) { if (capability.key) { result[capability.key] = result[capability.key] || capability; diff --git a/platform/core/src/capabilities/MutationCapability.js b/platform/core/src/capabilities/MutationCapability.js index ec448af17c..592f613438 100644 --- a/platform/core/src/capabilities/MutationCapability.js +++ b/platform/core/src/capabilities/MutationCapability.js @@ -124,9 +124,9 @@ define( clone = JSON.parse(JSON.stringify(model)), useTimestamp = arguments.length > 1; - function notifyListeners(model) { + function notifyListeners(newModel) { generalTopic.notify(domainObject); - specificTopic.notify(model); + specificTopic.notify(newModel); } // Function to handle copying values to the actual diff --git a/platform/core/src/capabilities/PersistenceCapability.js b/platform/core/src/capabilities/PersistenceCapability.js index 204cd7de35..8e1990892d 100644 --- a/platform/core/src/capabilities/PersistenceCapability.js +++ b/platform/core/src/capabilities/PersistenceCapability.js @@ -124,8 +124,8 @@ define( this.persistenceService.createObject; // Update persistence timestamp... - domainObject.useCapability("mutation", function (model) { - model.persisted = modified; + domainObject.useCapability("mutation", function (m) { + m.persisted = modified; }, modified); // ...and persist diff --git a/platform/core/src/models/PersistedModelProvider.js b/platform/core/src/models/PersistedModelProvider.js index 7a74ebb23a..cd6fde75c4 100644 --- a/platform/core/src/models/PersistedModelProvider.js +++ b/platform/core/src/models/PersistedModelProvider.js @@ -82,9 +82,9 @@ define( } // Package the result as id->model - function packageResult(parsedIds, models) { + function packageResult(parsedIdsToPackage, models) { var result = {}; - parsedIds.forEach(function (parsedId, index) { + parsedIdsToPackage.forEach(function (parsedId, index) { var id = parsedId.id; if (models[index]) { result[id] = models[index]; @@ -93,11 +93,11 @@ define( return result; } - function loadModels(parsedIds) { - return $q.all(parsedIds.map(loadModel)) + function loadModels(parsedIdsToLoad) { + return $q.all(parsedIdsToLoad.map(loadModel)) .then(function (models) { return packageResult( - parsedIds, + parsedIdsToLoad, models.map(addPersistedTimestamp) ); }); diff --git a/platform/core/src/types/MergeModels.js b/platform/core/src/types/MergeModels.js index be9a6ebab8..a33c6dba40 100644 --- a/platform/core/src/types/MergeModels.js +++ b/platform/core/src/types/MergeModels.js @@ -58,14 +58,14 @@ define( * corresponding keys in the recursive step. * * - * @param a the first object to be merged - * @param b the second object to be merged + * @param modelA the first object to be merged + * @param modelB the second object to be merged * @param merger the merger, as described above - * @returns {*} the result of merging `a` and `b` + * @returns {*} the result of merging `modelA` and `modelB` * @constructor * @memberof platform/core */ - function mergeModels(a, b, merger) { + function mergeModels(modelA, modelB, merger) { var mergeFunction; function mergeArrays(a, b) { @@ -93,11 +93,11 @@ define( } mergeFunction = (merger && Function.isFunction(merger)) ? merger : - (Array.isArray(a) && Array.isArray(b)) ? mergeArrays : - (a instanceof Object && b instanceof Object) ? mergeObjects : + (Array.isArray(modelA) && Array.isArray(modelB)) ? mergeArrays : + (modelA instanceof Object && modelB instanceof Object) ? mergeObjects : mergeOther; - return mergeFunction(a, b); + return mergeFunction(modelA, modelB); } return mergeModels; diff --git a/platform/core/src/types/TypeProvider.js b/platform/core/src/types/TypeProvider.js index f2ae2655b6..b30efce0d9 100644 --- a/platform/core/src/types/TypeProvider.js +++ b/platform/core/src/types/TypeProvider.js @@ -159,8 +159,8 @@ define( } function lookupTypeDef(typeKey) { - function buildTypeDef(typeKey) { - var typeDefs = typeDefinitions[typeKey] || [], + function buildTypeDef(typeKeyToBuild) { + var typeDefs = typeDefinitions[typeKeyToBuild] || [], inherits = typeDefs.map(function (typeDef) { return asArray(typeDef.inherits || []); }).reduce(function (a, b) { @@ -175,7 +175,7 @@ define( // Always provide a default name def.model = def.model || {}; def.model.name = def.model.name || - ("Unnamed " + (def.name || "Object")); + ("Unnamed " + (def.name || "Object")); return def; } diff --git a/platform/core/src/views/ViewProvider.js b/platform/core/src/views/ViewProvider.js index 6ee1ccb4c4..7af298c7e8 100644 --- a/platform/core/src/views/ViewProvider.js +++ b/platform/core/src/views/ViewProvider.js @@ -105,15 +105,15 @@ define( // Check if an object has all capabilities designated as `needs` // for a view. Exposing a capability via delegation is taken to // satisfy this filter if `allowDelegation` is true. - function capabilitiesMatch(domainObject, capabilities, allowDelegation) { - var delegation = domainObject.getCapability("delegation"); + function capabilitiesMatch(domainObj, capabilities, allowDelegation) { + var delegation = domainObj.getCapability("delegation"); allowDelegation = allowDelegation && (delegation !== undefined); // Check if an object has (or delegates, if allowed) a // capability. function hasCapability(c) { - return domainObject.hasCapability(c) || + return domainObj.hasCapability(c) || (allowDelegation && delegation.doesDelegateCapability(c)); } @@ -128,13 +128,13 @@ define( // Check if a view and domain object type can be paired; // both can restrict the others they accept. - function viewMatchesType(view, type) { - var views = type && (type.getDefinition() || {}).views, + function viewMatchesType(view, objType) { + var views = objType && (objType.getDefinition() || {}).views, matches = true; // View is restricted to a certain type if (view.type) { - matches = matches && type && type.instanceOf(view.type); + matches = matches && objType && objType.instanceOf(view.type); } // Type wishes to restrict its specific views diff --git a/platform/core/test/capabilities/InstantiationCapabilitySpec.js b/platform/core/test/capabilities/InstantiationCapabilitySpec.js index 4a798a567d..b65f26f368 100644 --- a/platform/core/test/capabilities/InstantiationCapabilitySpec.js +++ b/platform/core/test/capabilities/InstantiationCapabilitySpec.js @@ -73,16 +73,16 @@ define( }); it("uses the instantiate service to create domain objects", function () { - var mockDomainObject = jasmine.createSpyObj('domainObject', [ + var mockDomainObj = jasmine.createSpyObj('domainObject', [ 'getId', 'getModel', 'getCapability', 'useCapability', 'hasCapability' ]), testModel = { someKey: "some value" }; - mockInstantiate.andReturn(mockDomainObject); + mockInstantiate.andReturn(mockDomainObj); expect(instantiation.instantiate(testModel)) - .toBe(mockDomainObject); + .toBe(mockDomainObj); expect(mockInstantiate) .toHaveBeenCalledWith({ someKey: "some value", diff --git a/platform/core/test/models/CachingModelDecoratorSpec.js b/platform/core/test/models/CachingModelDecoratorSpec.js index ec7a4dd32d..73a0957b28 100644 --- a/platform/core/test/models/CachingModelDecoratorSpec.js +++ b/platform/core/test/models/CachingModelDecoratorSpec.js @@ -99,7 +99,7 @@ define( }); it("ensures a single object instance, even for multiple concurrent calls", function () { - var promiseA, promiseB, mockCallback = jasmine.createSpy(); + var promiseA, promiseB; promiseA = fakePromise(); promiseB = fakePromise(); @@ -126,7 +126,7 @@ define( }); it("is robust against updating with undefined values", function () { - var promiseA, promiseB, mockCallback = jasmine.createSpy(); + var promiseA, promiseB; promiseA = fakePromise(); promiseB = fakePromise(); diff --git a/platform/core/test/views/ViewProviderSpec.js b/platform/core/test/views/ViewProviderSpec.js index ddeff3e158..6d725708da 100644 --- a/platform/core/test/views/ViewProviderSpec.js +++ b/platform/core/test/views/ViewProviderSpec.js @@ -109,7 +109,7 @@ define( it("restricts typed views to matching types", function () { var testType = "testType", testView = { key: "x", type: testType }, - provider = new ViewProvider([testView], mockLog); + viewProvider = new ViewProvider([testView], mockLog); // Include a "type" capability capabilities.type = jasmine.createSpyObj( @@ -120,21 +120,21 @@ define( // Should be included when types match capabilities.type.instanceOf.andReturn(true); - expect(provider.getViews(mockDomainObject)) + expect(viewProvider.getViews(mockDomainObject)) .toEqual([testView]); expect(capabilities.type.instanceOf) .toHaveBeenCalledWith(testType); // ...but not when they don't capabilities.type.instanceOf.andReturn(false); - expect(provider.getViews(mockDomainObject)) + expect(viewProvider.getViews(mockDomainObject)) .toEqual([]); }); it("enforces view restrictions from types", function () { var testView = { key: "x" }, - provider = new ViewProvider([testView], mockLog); + viewProvider = new ViewProvider([testView], mockLog); // Include a "type" capability capabilities.type = jasmine.createSpyObj( @@ -146,13 +146,13 @@ define( // Should be included when view keys match capabilities.type.getDefinition .andReturn({ views: [testView.key]}); - expect(provider.getViews(mockDomainObject)) + expect(viewProvider.getViews(mockDomainObject)) .toEqual([testView]); // ...but not when they don't capabilities.type.getDefinition .andReturn({ views: ["somethingElse"]}); - expect(provider.getViews(mockDomainObject)) + expect(viewProvider.getViews(mockDomainObject)) .toEqual([]); }); diff --git a/platform/entanglement/src/actions/AbstractComposeAction.js b/platform/entanglement/src/actions/AbstractComposeAction.js index 25c9fbabf5..e81ee4361c 100644 --- a/platform/entanglement/src/actions/AbstractComposeAction.js +++ b/platform/entanglement/src/actions/AbstractComposeAction.js @@ -126,11 +126,11 @@ define( label = this.verb + " To"; - validateLocation = function (newParent) { + validateLocation = function (newParentObj) { var newContext = self.cloneContext(); newContext.selectedObject = object; - newContext.domainObject = newParent; - return composeService.validate(object, newParent) && + newContext.domainObject = newParentObj; + return composeService.validate(object, newParentObj) && self.policyService.allow("action", self, newContext); }; @@ -139,8 +139,8 @@ define( label, validateLocation, currentParent - ).then(function (newParent) { - return composeService.perform(object, newParent); + ).then(function (newParentObj) { + return composeService.perform(object, newParentObj); }); }; diff --git a/platform/entanglement/src/services/CopyService.js b/platform/entanglement/src/services/CopyService.js index 3bff772ef5..37745501ac 100644 --- a/platform/entanglement/src/services/CopyService.js +++ b/platform/entanglement/src/services/CopyService.js @@ -83,11 +83,11 @@ define( // Combines caller-provided filter (if any) with the // baseline behavior of respecting creation policy. - function filterWithPolicy(domainObject) { - return (!filter || filter(domainObject)) && + function filterWithPolicy(domainObj) { + return (!filter || filter(domainObj)) && policyService.allow( "creation", - domainObject.getCapability("type") + domainObj.getCapability("type") ); } diff --git a/platform/entanglement/src/services/LocationService.js b/platform/entanglement/src/services/LocationService.js index 0fa096f2af..42925b8235 100644 --- a/platform/entanglement/src/services/LocationService.js +++ b/platform/entanglement/src/services/LocationService.js @@ -77,8 +77,8 @@ define( return dialogService .getUserInput(formStructure, formState) - .then(function (formState) { - return formState.location; + .then(function (userFormState) { + return userFormState.location; }); } }; diff --git a/platform/entanglement/test/services/CopyServiceSpec.js b/platform/entanglement/test/services/CopyServiceSpec.js index a392b59b03..b52e7aab6a 100644 --- a/platform/entanglement/test/services/CopyServiceSpec.js +++ b/platform/entanglement/test/services/CopyServiceSpec.js @@ -458,17 +458,17 @@ define( }); it("throws an error", function () { - var copyService = + var service = new CopyService(mockQ, policyService); function perform() { - copyService.perform(object, newParent); + service.perform(object, newParent); } - spyOn(copyService, "validate"); - copyService.validate.andReturn(true); + spyOn(service, "validate"); + service.validate.andReturn(true); expect(perform).not.toThrow(); - copyService.validate.andReturn(false); + service.validate.andReturn(false); expect(perform).toThrow(); }); }); diff --git a/platform/features/plot/test/PlotOptionsControllerSpec.js b/platform/features/plot/test/PlotOptionsControllerSpec.js index f48aa517e1..a95aabce7c 100644 --- a/platform/features/plot/test/PlotOptionsControllerSpec.js +++ b/platform/features/plot/test/PlotOptionsControllerSpec.js @@ -120,7 +120,7 @@ define( it("on changes in form values, updates the object model", function () { var scopeConfiguration = mockScope.configuration, - model = mockDomainObject.getModel(); + objModel = mockDomainObject.getModel(); scopeConfiguration.plot.yAxis.autoScale = true; scopeConfiguration.plot.yAxis.key = 'eu'; @@ -130,10 +130,10 @@ define( mockScope.$watchCollection.calls[0].args[1](); expect(mockDomainObject.useCapability).toHaveBeenCalledWith('mutation', jasmine.any(Function)); - mockDomainObject.useCapability.mostRecentCall.args[1](model); - expect(model.configuration.plot.yAxis.autoScale).toBe(true); - expect(model.configuration.plot.yAxis.key).toBe('eu'); - expect(model.configuration.plot.xAxis.key).toBe('lst'); + mockDomainObject.useCapability.mostRecentCall.args[1](objModel); + expect(objModel.configuration.plot.yAxis.autoScale).toBe(true); + expect(objModel.configuration.plot.yAxis.key).toBe('eu'); + expect(objModel.configuration.plot.xAxis.key).toBe('lst'); }); diff --git a/platform/features/table/src/controllers/MCTTableController.js b/platform/features/table/src/controllers/MCTTableController.js index 79496a14db..e4cfa45b23 100644 --- a/platform/features/table/src/controllers/MCTTableController.js +++ b/platform/features/table/src/controllers/MCTTableController.js @@ -32,15 +32,15 @@ define( /** * Set default values for optional parameters on a given scope */ - function setDefaults($scope) { - if (typeof $scope.enableFilter === 'undefined') { - $scope.enableFilter = true; - $scope.filters = {}; + function setDefaults(scope) { + if (typeof scope.enableFilter === 'undefined') { + scope.enableFilter = true; + scope.filters = {}; } - if (typeof $scope.enableSort === 'undefined') { - $scope.enableSort = true; - $scope.sortColumn = undefined; - $scope.sortDirection = undefined; + if (typeof scope.enableSort === 'undefined') { + scope.enableSort = true; + scope.sortColumn = undefined; + scope.sortDirection = undefined; } } @@ -485,13 +485,13 @@ define( /** * Returns true if row matches all filters. */ - function matchRow(filters, row) { - return Object.keys(filters).every(function (key) { + function matchRow(filterMap, row) { + return Object.keys(filterMap).every(function (key) { if (!row[key]) { return false; } var testVal = String(row[key].text).toLowerCase(); - return testVal.indexOf(filters[key]) !== -1; + return testVal.indexOf(filterMap[key]) !== -1; }); } diff --git a/platform/features/timeline/src/capabilities/ActivityTimespan.js b/platform/features/timeline/src/capabilities/ActivityTimespan.js index 405fbec50b..61e120d688 100644 --- a/platform/features/timeline/src/capabilities/ActivityTimespan.js +++ b/platform/features/timeline/src/capabilities/ActivityTimespan.js @@ -52,25 +52,25 @@ define( // Set the start time associated with this object function setStart(value) { var end = getEnd(); - mutation.mutate(function (model) { - model.start.timestamp = Math.max(value, 0); + mutation.mutate(function (m) { + m.start.timestamp = Math.max(value, 0); // Update duration to keep end time - model.duration.timestamp = Math.max(end - value, 0); + m.duration.timestamp = Math.max(end - value, 0); }, model.modified); } // Set the duration associated with this object function setDuration(value) { - mutation.mutate(function (model) { - model.duration.timestamp = Math.max(value, 0); + mutation.mutate(function (m) { + m.duration.timestamp = Math.max(value, 0); }, model.modified); } // Set the end time associated with this object function setEnd(value) { var start = getStart(); - mutation.mutate(function (model) { - model.duration.timestamp = Math.max(value - start, 0); + mutation.mutate(function (m) { + m.duration.timestamp = Math.max(value - start, 0); }, model.modified); } diff --git a/platform/features/timeline/src/capabilities/CumulativeGraph.js b/platform/features/timeline/src/capabilities/CumulativeGraph.js index f9ffcb4b66..92d1cfa503 100644 --- a/platform/features/timeline/src/capabilities/CumulativeGraph.js +++ b/platform/features/timeline/src/capabilities/CumulativeGraph.js @@ -53,21 +53,21 @@ define( // Initialize the data values function initializeValues() { - var values = [], + var vals = [], slope = 0, i; // Add a point (or points, if needed) reaching to the provided // domain and/or range value function addPoint(domain, range) { - var previous = values[values.length - 1], + var previous = vals[vals.length - 1], delta = domain - previous.domain, // time delta change = delta * slope * rate, // change next = previous.range + change; // Crop to minimum boundary... if (next < minimum) { - values.push({ + vals.push({ domain: intercept( previous.domain, previous.range, @@ -81,7 +81,7 @@ define( // ...and maximum boundary if (next > maximum) { - values.push({ + vals.push({ domain: intercept( previous.domain, previous.range, @@ -95,19 +95,19 @@ define( // Add the new data value if (delta > 0) { - values.push({ domain: domain, range: next }); + vals.push({ domain: domain, range: next }); } slope = range; } - values.push({ domain: 0, range: initial }); + vals.push({ domain: 0, range: initial }); for (i = 0; i < graph.getPointCount(); i += 1) { addPoint(graph.getDomainValue(i), graph.getRangeValue(i)); } - return values; + return vals; } function convertToPercent(point) { diff --git a/platform/features/timeline/src/capabilities/ResourceGraph.js b/platform/features/timeline/src/capabilities/ResourceGraph.js index 2e0bec8497..93ced78f09 100644 --- a/platform/features/timeline/src/capabilities/ResourceGraph.js +++ b/platform/features/timeline/src/capabilities/ResourceGraph.js @@ -72,13 +72,13 @@ define( // If there are sequences of points with the same timestamp, // allow only the first and last. - function filterPoint(value, index, values) { + function filterPoint(value, index, vals) { // Allow the first or last point as a base case; aside from // that, allow only points that have different timestamps // from their predecessor or successor. - return (index === 0) || (index === values.length - 1) || - (value.domain !== values[index - 1].domain) || - (value.domain !== values[index + 1].domain); + return (index === 0) || (index === vals.length - 1) || + (value.domain !== vals[index - 1].domain) || + (value.domain !== vals[index + 1].domain); } // Add a step up or down (Step 3c above) diff --git a/platform/features/timeline/src/capabilities/TimelineTimespan.js b/platform/features/timeline/src/capabilities/TimelineTimespan.js index 3224d42ab5..de747764ef 100644 --- a/platform/features/timeline/src/capabilities/TimelineTimespan.js +++ b/platform/features/timeline/src/capabilities/TimelineTimespan.js @@ -57,8 +57,8 @@ define( // Set the start time associated with this object function setStart(value) { - mutation.mutate(function (model) { - model.start.timestamp = Math.max(value, 0); + mutation.mutate(function (m) { + m.start.timestamp = Math.max(value, 0); }, model.modified); } diff --git a/platform/features/timeline/src/capabilities/UtilizationCapability.js b/platform/features/timeline/src/capabilities/UtilizationCapability.js index 79a803a3ae..2744976615 100644 --- a/platform/features/timeline/src/capabilities/UtilizationCapability.js +++ b/platform/features/timeline/src/capabilities/UtilizationCapability.js @@ -120,13 +120,13 @@ define( } // Look up a specific object's resource utilization - function lookupUtilization(domainObject) { - return domainObject.useCapability('utilization'); + function lookupUtilization(object) { + return object.useCapability('utilization'); } // Look up a specific object's resource utilization keys - function lookupUtilizationResources(domainObject) { - var utilization = domainObject.getCapability('utilization'); + function lookupUtilizationResources(object) { + var utilization = object.getCapability('utilization'); return utilization && utilization.resources(); } diff --git a/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js b/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js index cd699dc647..c1605a21e9 100644 --- a/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js +++ b/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js @@ -47,19 +47,19 @@ define( } // Get the timespan associated with this domain object - function populateCapabilityMaps(domainObject) { - var id = domainObject.getId(), - timespanPromise = domainObject.useCapability('timespan'); + function populateCapabilityMaps(object) { + var id = object.getId(), + timespanPromise = object.useCapability('timespan'); if (timespanPromise) { timespanPromise.then(function (timespan) { // Cache that timespan timespans[id] = timespan; // And its mutation capability - mutations[id] = domainObject.getCapability('mutation'); + mutations[id] = object.getCapability('mutation'); // Also cache the persistence capability for later - persists[id] = domainObject.getCapability('persistence'); + persists[id] = object.getCapability('persistence'); // And the composition, for bulk moves - compositions[id] = domainObject.getModel().composition || []; + compositions[id] = object.getModel().composition || []; }); } } @@ -199,8 +199,8 @@ define( minStart; // Update start & end, in that order - function updateStartEnd(id) { - var timespan = timespans[id], start, end; + function updateStartEnd(spanId) { + var timespan = timespans[spanId], start, end; if (timespan) { // Get start/end so we don't get fooled by our // own adjustments @@ -210,7 +210,7 @@ define( timespan.setStart(start + delta); timespan.setEnd(end + delta); // Mark as dirty for subsequent persistence - dirty[toId(id)] = true; + dirty[toId(spanId)] = true; } } @@ -228,12 +228,12 @@ define( } // Find the minimum start time - minStart = Object.keys(ids).map(function (id) { + minStart = Object.keys(ids).map(function (spanId) { // Get the start time; default to +Inf if not // found, since this will not survive a min // test if any real timespans are present - return timespans[id] ? - timespans[id].getStart() : + return timespans[spanId] ? + timespans[spanId].getStart() : Number.POSITIVE_INFINITY; }).reduce(function (a, b) { // Reduce with a minimum test diff --git a/platform/features/timeline/src/controllers/graph/TimelineGraphPopulator.js b/platform/features/timeline/src/controllers/graph/TimelineGraphPopulator.js index 0032b8cbe8..2488d57030 100644 --- a/platform/features/timeline/src/controllers/graph/TimelineGraphPopulator.js +++ b/platform/features/timeline/src/controllers/graph/TimelineGraphPopulator.js @@ -75,11 +75,14 @@ define( // Look up resources for a domain object function lookupResources(swimlane) { - var graphs = swimlane.domainObject.useCapability('graph'); + var graphPromise = + swimlane.domainObject.useCapability('graph'); function getKeys(obj) { return Object.keys(obj); } - return $q.when(graphs ? (graphs.then(getKeys)) : []); + return $q.when( + graphPromise ? (graphPromise.then(getKeys)) : [] + ); } // Add all graph assignments appropriate for this swimlane diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineProxy.js b/platform/features/timeline/src/controllers/swimlane/TimelineProxy.js index ee470edc77..7fa4dc2e9b 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineProxy.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineProxy.js @@ -34,8 +34,8 @@ define( var actionMap = {}; // Populate available Create actions for this domain object - function populateActionMap(domainObject) { - var actionCapability = domainObject.getCapability('action'), + function populateActionMap(object) { + var actionCapability = object.getCapability('action'), actions = actionCapability ? actionCapability.getActions('add') : []; actions.forEach(function (action) { diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDecorator.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDecorator.js index dd655bcb5e..898ca119ee 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDecorator.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDecorator.js @@ -45,9 +45,9 @@ define( if (arguments.length > 0 && Array.isArray(value)) { if ((model.relationships || {})[ACTIVITY_RELATIONSHIP] !== value) { // Update the relationships - mutator.mutate(function (model) { - model.relationships = model.relationships || {}; - model.relationships[ACTIVITY_RELATIONSHIP] = value; + mutator.mutate(function (m) { + m.relationships = m.relationships || {}; + m.relationships[ACTIVITY_RELATIONSHIP] = value; }).then(persister.persist); } } @@ -61,8 +61,8 @@ define( if (arguments.length > 0 && (typeof value === 'string') && value !== model.link) { // Update the link - mutator.mutate(function (model) { - model.link = value; + mutator.mutate(function (m) { + m.link = value; }).then(persister.persist); } return model.link; diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js index e655741342..71648995f0 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js @@ -51,7 +51,7 @@ define( } // Check if pathA entirely contains pathB - function pathContains(swimlane, id) { + function pathContains(swimlaneToCheck, id) { // Check if id at a specific index matches (for map below) function matches(pathId) { return pathId === id; @@ -59,18 +59,18 @@ define( // Path A contains Path B if it is longer, and all of // B's ids match the ids in A. - return swimlane.idPath.map(matches).reduce(or, false); + return swimlaneToCheck.idPath.map(matches).reduce(or, false); } // Check if a swimlane contains a child with the specified id - function contains(swimlane, id) { + function contains(swimlaneToCheck, id) { // Check if a child swimlane has a matching domain object id function matches(child) { return child.domainObject.getId() === id; } // Find any one child id that matches this id - return swimlane.children.map(matches).reduce(or, false); + return swimlaneToCheck.children.map(matches).reduce(or, false); } // Initiate mutation of a domain object diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js index f7a77fe2df..ccc6148997 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js @@ -61,8 +61,8 @@ define( swimlane; // For the recursive step - function populate(childSubgraph, index) { - populateSwimlanes(childSubgraph, swimlane, index); + function populate(childSubgraph, nextIndex) { + populateSwimlanes(childSubgraph, swimlane, nextIndex); } // Make sure we have a valid object instance... diff --git a/platform/features/timeline/src/services/ObjectLoader.js b/platform/features/timeline/src/services/ObjectLoader.js index 377709592f..ec4d7b15c8 100644 --- a/platform/features/timeline/src/services/ObjectLoader.js +++ b/platform/features/timeline/src/services/ObjectLoader.js @@ -41,13 +41,13 @@ define( filter; // Check object existence (for criterion-less filtering) - function exists(domainObject) { - return !!domainObject; + function exists(object) { + return !!object; } // Check for capability matching criterion - function hasCapability(domainObject) { - return domainObject && domainObject.hasCapability(criterion); + function hasCapability(object) { + return object && object.hasCapability(criterion); } // For the recursive step... @@ -61,8 +61,8 @@ define( } // Avoid infinite recursion - function notVisiting(domainObject) { - return !visiting[domainObject.getId()]; + function notVisiting(object) { + return !visiting[object.getId()]; } // Put the composition of this domain object into the result diff --git a/platform/features/timeline/test/actions/TimelineTraverserSpec.js b/platform/features/timeline/test/actions/TimelineTraverserSpec.js index 48fb584162..e6000c6c62 100644 --- a/platform/features/timeline/test/actions/TimelineTraverserSpec.js +++ b/platform/features/timeline/test/actions/TimelineTraverserSpec.js @@ -55,8 +55,8 @@ define([ if (!!model.composition) { mockDomainObject.useCapability.andCallFake(function (c) { return c === 'composition' && - Promise.resolve(model.composition.map(function (id) { - return mockDomainObjects[id]; + Promise.resolve(model.composition.map(function (cid) { + return mockDomainObjects[cid]; })); }); } @@ -68,8 +68,8 @@ define([ ); mockRelationships.getRelatedObjects.andCallFake(function (k) { var ids = model.relationships[k] || []; - return Promise.resolve(ids.map(function (id) { - return mockDomainObjects[id]; + return Promise.resolve(ids.map(function (objId) { + return mockDomainObjects[objId]; })); }); mockDomainObject.getCapability.andCallFake(function (c) { diff --git a/platform/features/timeline/test/capabilities/UtilizationCapabilitySpec.js b/platform/features/timeline/test/capabilities/UtilizationCapabilitySpec.js index 3899ce8120..0c37f3edae 100644 --- a/platform/features/timeline/test/capabilities/UtilizationCapabilitySpec.js +++ b/platform/features/timeline/test/capabilities/UtilizationCapabilitySpec.js @@ -69,8 +69,8 @@ define( resources: function () { return Object.keys(costs).sort(); }, - cost: function (c) { - return costs[c]; + cost: function (k) { + return costs[k]; } }); }, diff --git a/platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js b/platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js index 502d2e7642..1e62983437 100644 --- a/platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js +++ b/platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js @@ -56,22 +56,22 @@ define( } function makeMockDomainObject(id, composition) { - var mockDomainObject = jasmine.createSpyObj( + var mockDomainObj = jasmine.createSpyObj( 'domainObject-' + id, ['getId', 'getModel', 'getCapability', 'useCapability'] ); - mockDomainObject.getId.andReturn(id); - mockDomainObject.getModel.andReturn({ composition: composition }); - mockDomainObject.useCapability.andReturn(asPromise(mockTimespans[id])); - mockDomainObject.getCapability.andCallFake(function (c) { + mockDomainObj.getId.andReturn(id); + mockDomainObj.getModel.andReturn({ composition: composition }); + mockDomainObj.useCapability.andReturn(asPromise(mockTimespans[id])); + mockDomainObj.getCapability.andCallFake(function (c) { return { persistence: mockPersists[id], mutation: mockMutations[id] }[c]; }); - return mockDomainObject; + return mockDomainObj; } beforeEach(function () { diff --git a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js index 4fd374a412..f9358a514e 100644 --- a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js +++ b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js @@ -42,16 +42,16 @@ define( } function makeMockDomainObject(id, composition) { - var mockDomainObject = jasmine.createSpyObj( + var mockDomainObj = jasmine.createSpyObj( 'domainObject-' + id, ['getId', 'getModel', 'getCapability', 'useCapability'] ); - mockDomainObject.getId.andReturn(id); - mockDomainObject.getModel.andReturn({ composition: composition }); - mockDomainObject.useCapability.andReturn(asPromise(false)); + mockDomainObj.getId.andReturn(id); + mockDomainObj.getModel.andReturn({ composition: composition }); + mockDomainObj.useCapability.andReturn(asPromise(false)); - return mockDomainObject; + return mockDomainObj; } function subgraph(domainObject, objects) { diff --git a/platform/framework/src/register/ExtensionRegistrar.js b/platform/framework/src/register/ExtensionRegistrar.js index 0dcd86ea4c..7b5ef7e096 100644 --- a/platform/framework/src/register/ExtensionRegistrar.js +++ b/platform/framework/src/register/ExtensionRegistrar.js @@ -164,15 +164,15 @@ define( // Examine a group of resolved dependencies to determine // which extension categories still need to be satisfied. - function findEmptyExtensionDependencies(extensionGroup) { + function findEmptyExtensionDependencies(extGroup) { var needed = {}, - categories = Object.keys(extensionGroup), + categories = Object.keys(extGroup), allExtensions = []; // Build up an array of all extensions categories.forEach(function (category) { allExtensions = - allExtensions.concat(extensionGroup[category]); + allExtensions.concat(extGroup[category]); }); // Track all extension dependencies exposed therefrom @@ -197,10 +197,9 @@ define( // Register any extension categories that are depended-upon but // have not been declared anywhere; such dependencies are then // satisfied by an empty array, instead of not at all. - function registerEmptyDependencies(extensionGroup) { - findEmptyExtensionDependencies( - extensionGroup - ).forEach(function (name) { + function registerEmptyDependencies(extGroup) { + findEmptyExtensionDependencies(extGroup) + .forEach(function (name) { $log.info("Registering empty extension category " + name); app.factory(name, [staticFunction([])]); }); diff --git a/platform/framework/src/resolve/ExtensionResolver.js b/platform/framework/src/resolve/ExtensionResolver.js index bac334a4a0..1abcd91a91 100644 --- a/platform/framework/src/resolve/ExtensionResolver.js +++ b/platform/framework/src/resolve/ExtensionResolver.js @@ -58,11 +58,11 @@ define( var loader = this.loader, $log = this.$log; - function loadImplementation(extension) { - var implPromise = extension.hasImplementationValue() ? - Promise.resolve(extension.getImplementationValue()) : - loader.load(extension.getImplementationPath()), - definition = extension.getDefinition(); + function loadImplementation(ext) { + var implPromise = ext.hasImplementationValue() ? + Promise.resolve(ext.getImplementationValue()) : + loader.load(ext.getImplementationPath()), + definition = ext.getDefinition(); // Wrap a constructor function (to avoid modifying the original) function constructorFor(impl) { @@ -94,7 +94,7 @@ define( result.definition = definition; // Log that this load was successful - $log.info("Resolved " + extension.getLogName()); + $log.info("Resolved " + ext.getLogName()); return result; } @@ -105,7 +105,7 @@ define( // Build up a log message from parts var message = [ "Could not load implementation for extension ", - extension.getLogName(), + ext.getLogName(), " due to ", err.message ].join(""); @@ -113,16 +113,16 @@ define( // Log that the extension was not loaded $log.warn(message); - return extension.getDefinition(); + return ext.getDefinition(); } - if (!extension.hasImplementationValue()) { + if (!ext.hasImplementationValue()) { // Log that loading has begun $log.info([ "Loading implementation ", - extension.getImplementationPath(), + ext.getImplementationPath(), " for extension ", - extension.getLogName() + ext.getLogName() ].join("")); } diff --git a/platform/persistence/elastic/src/ElasticPersistenceProvider.js b/platform/persistence/elastic/src/ElasticPersistenceProvider.js index 1b421b527f..2fe826bb49 100644 --- a/platform/persistence/elastic/src/ElasticPersistenceProvider.js +++ b/platform/persistence/elastic/src/ElasticPersistenceProvider.js @@ -92,8 +92,8 @@ define( if ((response || {}).status === CONFLICT) { error.key = "revision"; // Load the updated model, then reject the promise - return this.get(key).then(function (response) { - error.model = response[SRC]; + return this.get(key).then(function (res) { + error.model = res[SRC]; return $q.reject(error); }); } diff --git a/platform/persistence/queue/src/PersistenceFailureHandler.js b/platform/persistence/queue/src/PersistenceFailureHandler.js index c449ed5f7b..447519633c 100644 --- a/platform/persistence/queue/src/PersistenceFailureHandler.js +++ b/platform/persistence/queue/src/PersistenceFailureHandler.js @@ -68,7 +68,7 @@ define( } // Retry persistence (overwrite) for this set of failed attempts - function retry(failures) { + function retry(failuresToRetry) { var models = {}; // Cache a copy of the model @@ -92,17 +92,17 @@ define( } // Cache the object models we might want to save - failures.forEach(cacheModel); + failuresToRetry.forEach(cacheModel); // Strategy here: // * Cache all of the models we might want to save (above) // * Refresh all domain objects (so they are latest versions) // * Re-insert the cached domain object models // * Invoke persistence again - return $q.all(failures.map(refresh)).then(function () { - return $q.all(failures.map(remutate)); + return $q.all(failuresToRetry.map(refresh)).then(function () { + return $q.all(failuresToRetry.map(remutate)); }).then(function () { - return $q.all(failures.map(persist)); + return $q.all(failuresToRetry.map(persist)); }); } @@ -114,8 +114,8 @@ define( } // Discard changes associated with a failed save - function discardAll(failures) { - return $q.all(failures.map(discard)); + function discardAll(failuresToDiscard) { + return $q.all(failuresToDiscard.map(discard)); } // Handle user input (did they choose to overwrite?) diff --git a/platform/persistence/queue/src/PersistenceQueueHandler.js b/platform/persistence/queue/src/PersistenceQueueHandler.js index 3a394a1e54..511685b350 100644 --- a/platform/persistence/queue/src/PersistenceQueueHandler.js +++ b/platform/persistence/queue/src/PersistenceQueueHandler.js @@ -57,20 +57,20 @@ define( failureHandler = this.failureHandler; // Handle a group of persistence invocations - function persistGroup(ids, persistences, domainObjects, queue) { + function persistGroup(groupIds, persistenceCaps, domainObjs, pQueue) { var failures = []; // Try to persist a specific domain object function tryPersist(id) { // Look up its persistence capability from the provided // id->persistence object. - var persistence = persistences[id], - domainObject = domainObjects[id]; + var persistence = persistenceCaps[id], + domainObject = domainObjs[id]; // Put a domain object back in the queue // (e.g. after Overwrite) function requeue() { - return queue.put(domainObject, persistence); + return pQueue.put(domainObject, persistence); } // Handle success @@ -103,7 +103,7 @@ define( } // Try to persist everything, then handle any failures - return $q.all(ids.map(tryPersist)).then(handleFailure); + return $q.all(groupIds.map(tryPersist)).then(handleFailure); } return persistGroup(ids, persistences, domainObjects, queue); diff --git a/platform/representation/src/TemplateLinker.js b/platform/representation/src/TemplateLinker.js index 8637819d63..e248ebd1de 100644 --- a/platform/representation/src/TemplateLinker.js +++ b/platform/representation/src/TemplateLinker.js @@ -154,12 +154,12 @@ define( activeTemplateUrl = templateUrl; } - function changeTemplate(ext) { - ext = ext || {}; - if (ext.templateUrl) { - changeTemplateUrl(self.getPath(ext)); - } else if (ext.template) { - showTemplate(ext.template); + function changeTemplate(templateExt) { + templateExt = templateExt || {}; + if (templateExt.templateUrl) { + changeTemplateUrl(self.getPath(templateExt)); + } else if (templateExt.template) { + showTemplate(templateExt.template); } else { removeElement(); } diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index 101c718669..b610bb022d 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -178,8 +178,8 @@ define([ }); if (Array.isArray(model.composition)) { - model.composition.forEach(function (id) { - provider.scheduleForIndexing(id); + model.composition.forEach(function (idToIndex) { + provider.scheduleForIndexing(idToIndex); }); } }; diff --git a/platform/telemetry/src/TelemetryQueue.js b/platform/telemetry/src/TelemetryQueue.js index 3017906802..dadb34d3df 100644 --- a/platform/telemetry/src/TelemetryQueue.js +++ b/platform/telemetry/src/TelemetryQueue.js @@ -93,11 +93,11 @@ define( // Look up an object in the queue that does not have a value // assigned to this key (or, add a new one) - function getFreeObject(key) { - var index = counts[key] || 0, object; + function getFreeObject(k) { + var index = counts[k] || 0, object; // Track the largest free position for this key - counts[key] = index + 1; + counts[k] = index + 1; // If it's before the end of the queue, add it there if (index < queue.length) { diff --git a/platform/telemetry/src/TelemetrySubscription.js b/platform/telemetry/src/TelemetrySubscription.js index 0334c29455..7cf524b184 100644 --- a/platform/telemetry/src/TelemetrySubscription.js +++ b/platform/telemetry/src/TelemetrySubscription.js @@ -84,8 +84,8 @@ define( // Look up domain objects which have telemetry capabilities. // This will either be the object in view, or object that // this object delegates its telemetry capability to. - function promiseRelevantObjects(domainObject) { - return delegator.promiseTelemetryObjects(domainObject); + function promiseRelevantObjects(domainObj) { + return delegator.promiseTelemetryObjects(domainObj); } function updateValuesFromPool() { @@ -114,16 +114,16 @@ define( // Look up metadata associated with an object's telemetry - function lookupMetadata(domainObject) { + function lookupMetadata(domainObj) { var telemetryCapability = - domainObject.getCapability("telemetry"); + domainObj.getCapability("telemetry"); return telemetryCapability && telemetryCapability.getMetadata(); } // Update the latest telemetry data for a specific // domain object. This will notify listeners. - function update(domainObject, series) { + function update(domainObj, series) { var count = series && series.getPointCount(); // Only schedule notification if there isn't already @@ -136,21 +136,21 @@ define( // Update the latest-value table if (count > 0) { - pool.put(domainObject.getId(), { + pool.put(domainObj.getId(), { domain: series.getDomainValue(count - 1), range: series.getRangeValue(count - 1), - datum: self.makeDatum(domainObject, series, count - 1) + datum: self.makeDatum(domainObj, series, count - 1) }); } } // Prepare a subscription to a specific telemetry-providing // domain object. - function subscribe(domainObject) { + function subscribe(domainObj) { var telemetryCapability = - domainObject.getCapability("telemetry"); + domainObj.getCapability("telemetry"); return telemetryCapability.subscribe(function (telemetry) { - update(domainObject, telemetry); + update(domainObj, telemetry); }); } diff --git a/platform/telemetry/test/TelemetryAggregatorSpec.js b/platform/telemetry/test/TelemetryAggregatorSpec.js index b99901a307..39ac5a9c9a 100644 --- a/platform/telemetry/test/TelemetryAggregatorSpec.js +++ b/platform/telemetry/test/TelemetryAggregatorSpec.js @@ -38,7 +38,7 @@ define( }; } - function mockProvider(key, index) { + function makeMockProvider(key, index) { var provider = jasmine.createSpyObj( "provider" + index, ["requestTelemetry", "subscribe"] @@ -57,7 +57,7 @@ define( mockQ.all.andReturn(mockPromise([])); mockUnsubscribes = []; - mockProviders = ["a", "b", "c"].map(mockProvider); + mockProviders = ["a", "b", "c"].map(makeMockProvider); aggregator = new TelemetryAggregator(mockQ, mockProviders); }); From 9861e6358983d4cc27bd4db8f30f3557eb527bf9 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 20 May 2016 13:09:16 -0700 Subject: [PATCH 30/59] [Code Style] Run fixstyle on merged changes --- .../edit/test/actions/EditAndComposeActionSpec.js | 10 +++++----- .../commonUI/regions/test/InspectorControllerSpec.js | 6 +++--- platform/representation/src/MCTRepresentation.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js b/platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js index 50934530b4..fa1d21b1e8 100644 --- a/platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js +++ b/platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js @@ -66,11 +66,11 @@ define( return capabilities[k].invoke(v); } }; - mockContext = jasmine.createSpyObj("context", [ "getParent" ]); - mockComposition = jasmine.createSpyObj("composition", [ "invoke", "add" ]); - mockPersistence = jasmine.createSpyObj("persistence", [ "persist" ]); - mockType = jasmine.createSpyObj("type", [ "hasFeature", "getKey" ]); - mockActionCapability = jasmine.createSpyObj("actionCapability", [ "getActions"]); + mockContext = jasmine.createSpyObj("context", ["getParent"]); + mockComposition = jasmine.createSpyObj("composition", ["invoke", "add"]); + mockPersistence = jasmine.createSpyObj("persistence", ["persist"]); + mockType = jasmine.createSpyObj("type", ["hasFeature", "getKey"]); + mockActionCapability = jasmine.createSpyObj("actionCapability", ["getActions"]); mockEditAction = jasmine.createSpyObj("editAction", ["perform"]); mockDomainObject.getId.andReturn("test"); diff --git a/platform/commonUI/regions/test/InspectorControllerSpec.js b/platform/commonUI/regions/test/InspectorControllerSpec.js index 9c5197b72f..8acd00267c 100644 --- a/platform/commonUI/regions/test/InspectorControllerSpec.js +++ b/platform/commonUI/regions/test/InspectorControllerSpec.js @@ -60,7 +60,7 @@ define( 'getCapability' ]); mockDomainObject.getCapability.andCallFake(function (name) { - return capabilities[name]; + return capabilities[name]; }); mockPolicyService = jasmine.createSpyObj('policyService', [ @@ -86,7 +86,7 @@ define( expect(mockScope.regions.length).toBe(2); }); - it("Responds to status changes", function() { + it("Responds to status changes", function () { mockPolicyService.allow.andReturn(true); controller = new InspectorController(mockScope, mockPolicyService); expect(mockScope.regions.length).toBe(2); @@ -96,7 +96,7 @@ define( expect(mockScope.regions.length).toBe(0); }); - it("Unregisters status listener", function() { + it("Unregisters status listener", function () { var mockListener = jasmine.createSpy('listener'); mockStatusCapability.listen.andReturn(mockListener); controller = new InspectorController(mockScope, mockPolicyService); diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index f25fb7b14e..331139b793 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -235,7 +235,7 @@ define( // Also update when the represented domain object changes // (to a different object) $scope.$watch("domainObject", refresh); - + // Finally, also update when there is a new version of that // same domain object; these changes should be tracked in the // model's "modified" field, by the mutation capability. From b6502e9ea17d8ebc7827ef1c7578022056d54b05 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 May 2016 19:12:00 -0700 Subject: [PATCH 31/59] [New Edit Mode] #633 Removed Editing workflow concerns from FixedController, LayoutController --- .../commonUI/edit/src/representers/EditRepresenter.js | 6 ------ platform/features/layout/bundle.js | 3 --- platform/features/layout/src/FixedController.js | 6 ++---- platform/features/layout/src/LayoutController.js | 8 ++------ 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/platform/commonUI/edit/src/representers/EditRepresenter.js b/platform/commonUI/edit/src/representers/EditRepresenter.js index a5d4af9b14..ffe7f24d11 100644 --- a/platform/commonUI/edit/src/representers/EditRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditRepresenter.js @@ -91,14 +91,8 @@ define( } } - function setEditable(editableDomainObject) { - self.domainObject = editableDomainObject; - scope.model = editableDomainObject.getModel(); - } - // Place the "commit" method in the scope scope.commit = commit; - scope.setEditable = setEditable; // Clean up when the scope is destroyed scope.$on("$destroy", function () { diff --git a/platform/features/layout/bundle.js b/platform/features/layout/bundle.js index fa98fb94b2..21a0f8f263 100644 --- a/platform/features/layout/bundle.js +++ b/platform/features/layout/bundle.js @@ -71,9 +71,6 @@ define([ "uses": [ "composition" ], - "gestures": [ - "drop" - ], "toolbar": { "sections": [ { diff --git a/platform/features/layout/src/FixedController.js b/platform/features/layout/src/FixedController.js index b154f5f161..c8b5aebb2e 100644 --- a/platform/features/layout/src/FixedController.js +++ b/platform/features/layout/src/FixedController.js @@ -271,15 +271,13 @@ define( } // Position a panel after a drop event - function handleDrop(e, id, position, editableDomainObject) { + function handleDrop(e, id, position) { // Don't handle this event if it has already been handled // color is set to "" to let the CSS theme determine the default color if (e.defaultPrevented) { return; } - if (editableDomainObject) { - $scope.setEditable(editableDomainObject); - } + e.preventDefault(); // Store the position of this element. addElement({ diff --git a/platform/features/layout/src/LayoutController.js b/platform/features/layout/src/LayoutController.js index 496ee9d1a6..6d60738fc3 100644 --- a/platform/features/layout/src/LayoutController.js +++ b/platform/features/layout/src/LayoutController.js @@ -60,15 +60,11 @@ define( } // Position a panel after a drop event - //An editableDomainObject is provided, as the drop may have - // triggered a transition to edit mode. - function handleDrop(e, id, position, editableDomainObject) { + function handleDrop(e, id, position) { if (e.defaultPrevented) { return; } - if (editableDomainObject) { - $scope.setEditable(editableDomainObject); - } + // Ensure that configuration field is populated $scope.configuration = $scope.configuration || {}; // Make sure there is a "panels" field in the From fd9d766913f06cda4c9d5b0508f3c958d8a3edbf Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 20 May 2016 15:15:18 -0700 Subject: [PATCH 32/59] Defer resolution of scope in DropGesture --- platform/representation/src/gestures/DropGesture.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index 4c9d872f55..7f94dad223 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -40,12 +40,13 @@ define( */ function DropGesture(dndService, $q, element, domainObject) { var actionCapability = domainObject.getCapability('action'), - scope = element.scope && element.scope(), action; // Action for the drop, when it occurs function broadcastDrop(id, event) { // Find the relevant scope... - var rect; + var rect, + scope = element.scope && element.scope(); + if (scope && scope.$broadcast) { // Get the representation's bounds, to convert // drop position From 6e7f4df5e37da939b30e12afa97be9e98d02f5b7 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 20 May 2016 16:13:51 -0700 Subject: [PATCH 33/59] [Mobile] Remove usage of element.scope() Usage is unnecessary and is sensitive to initialization ordering of representations, resulting in #948. --- platform/commonUI/inspect/src/gestures/InfoButtonGesture.js | 6 ------ .../commonUI/inspect/test/gestures/InfoButtonGestureSpec.js | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js b/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js index 81a3fd9e84..045202aa7a 100644 --- a/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js +++ b/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js @@ -38,7 +38,6 @@ define( function InfoGestureButton($document, agentService, infoService, element, domainObject) { var dismissBubble, touchPosition, - scopeOff, body = $document.find('body'); function trackPosition(event) { @@ -94,10 +93,6 @@ define( element.on('click', showBubble); } - // Also make sure we dismiss bubble if representation is destroyed - // before the mouse actually leaves it - scopeOff = element.scope().$on('$destroy', hideBubble); - return { /** * Detach any event handlers associated with this gesture. @@ -109,7 +104,6 @@ define( hideBubble(); // ...and detach listeners element.off('click', showBubble); - scopeOff(); } }; } diff --git a/platform/commonUI/inspect/test/gestures/InfoButtonGestureSpec.js b/platform/commonUI/inspect/test/gestures/InfoButtonGestureSpec.js index 781bfd3769..5be65650cb 100644 --- a/platform/commonUI/inspect/test/gestures/InfoButtonGestureSpec.js +++ b/platform/commonUI/inspect/test/gestures/InfoButtonGestureSpec.js @@ -137,6 +137,11 @@ define( ); }); + // https://github.com/nasa/openmct/issues/948 + it("does not try to access scope", function () { + expect(mockElement.scope).not.toHaveBeenCalled(); + }); + }); } ); From 6c1412784b99e21a35d412c28e1914496648cbf1 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 20 May 2016 17:08:23 -0700 Subject: [PATCH 34/59] [Example] REMS heirarchy appear as links --- example/msl/src/RemsTelemetryModelProvider.js | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/example/msl/src/RemsTelemetryModelProvider.js b/example/msl/src/RemsTelemetryModelProvider.js index cf45b22d4e..c3f6f45374 100644 --- a/example/msl/src/RemsTelemetryModelProvider.js +++ b/example/msl/src/RemsTelemetryModelProvider.js @@ -45,11 +45,12 @@ define( function buildTaxonomy(dictionary){ var models = {}; - function addMeasurement(measurement){ + function addMeasurement(measurement, parent){ var format = FORMAT_MAPPINGS[measurement.type]; models[makeId(measurement)] = { type: "msl.measurement", name: measurement.name, + location: parent, telemetry: { key: measurement.identifier, ranges: [{ @@ -62,17 +63,24 @@ define( }; } - function addInstrument(subsystem) { - var measurements = (subsystem.measurements || []); - models[makeId(subsystem)] = { + function addInstrument(subsystem, spacecraftId) { + var measurements = (subsystem.measurements || []), + instrumentId = makeId(subsystem); + + models[instrumentId] = { type: "msl.instrument", name: subsystem.name, + location: spacecraftId, composition: measurements.map(makeId) }; - measurements.forEach(addMeasurement); + measurements.forEach(function(measurement) { + addMeasurement(measurement, instrumentId); + }); } - (dictionary.instruments || []).forEach(addInstrument); + (dictionary.instruments || []).forEach(function(instrument) { + addInstrument(instrument, "msl:curiosity"); + }); return models; } From 1c007ea2561ce1047ecc88e113e641d0c86f84d0 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 23 May 2016 14:55:04 -0700 Subject: [PATCH 35/59] [Code Style] Remove trailing whitespace ...to fix build after changes for #142. --- platform/representation/src/gestures/DropGesture.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index 7f94dad223..966618d88c 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -46,7 +46,7 @@ define( // Find the relevant scope... var rect, scope = element.scope && element.scope(); - + if (scope && scope.$broadcast) { // Get the representation's bounds, to convert // drop position From ab64b682c3ccc5d69e7aa27ba6f81c506ba4c876 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 23 May 2016 14:58:23 -0700 Subject: [PATCH 36/59] [Code Style] Run checkstyle on CircleCI Run the full gulp verify task for testing on CircleCI, to handle unit tests as well as code style checks and linting (and other verification steps that may be added in the future.) --- circle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index 7caa57740d..3b245f7941 100644 --- a/circle.yml +++ b/circle.yml @@ -15,8 +15,8 @@ deployment: heroku: appname: openmctweb-staging-deux test: - post: - - gulp lint + override: + - gulp verify general: branches: From eff46b076c296ce3346121551dd19aeb51ed7f20 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 23 May 2016 15:03:20 -0700 Subject: [PATCH 37/59] [New Edit Mode] #628 Removed duplicate logic from Create Action --- .../browse/src/creation/CreateAction.js | 30 +++++++++++-------- .../commonUI/edit/src/actions/EditAction.js | 6 ++++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index c5097e166d..2e04a0b07e 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -83,25 +83,29 @@ define( CreateAction.prototype.perform = function () { var newModel = this.type.getInitialModel(), parentObject = this.navigationService.getNavigation(), - editorCapability, - newObject; + newObject, + editAction, + editorCapability; + + function onSave() { + return editorCapability.save(); + } + + function onCancel() { + return editorCapability.cancel(); + } newModel.type = this.type.getKey(); newModel.location = parentObject.getId(); newObject = parentObject.useCapability('instantiation', newModel); + editorCapability = newObject.hasCapability('editor') && newObject.getCapability("editor"); - editorCapability = newObject.getCapability("editor"); - - if (countEditableViews(newObject) > 0 && newObject.hasCapability('composition')) { - this.navigationService.setNavigation(newObject); - return newObject.getCapability("action").perform("edit"); - } else { + editAction = newObject.getCapability("action").getActions("edit")[0]; + if (editAction) { + return editAction.perform("edit"); + } else if (editorCapability) { editorCapability.edit(); - return newObject.useCapability("action").perform("save").then(function () { - return editorCapability.save(); - }, function () { - return editorCapability.cancel(); - }); + return newObject.useCapability("action").perform("save").then(onSave, onCancel); } }; diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index b2aae8fa1b..9e5c90d897 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -74,6 +74,12 @@ define( self.domainObject.getCapability('editor').cancel(); self.navigationService.removeListener(cancelEditing); } + //If this is not the currently navigated object, then navigate + // to it. + if (this.navigationService.getNavigation() !== this.domainObject) { + this.navigationService.setNavigation(this.domainObject); + } + this.navigationService.addListener(cancelEditing); this.domainObject.useCapability("editor"); }; From 9a8bcc055002729a791656529781c5f413f8cc5f Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 23 May 2016 15:10:05 -0700 Subject: [PATCH 38/59] [Code Style] Specify lint, codestyle in CircleCI config ...to work around unexpected failure running test suite via gulp verify, https://circleci.com/gh/nasa/openmct/1981 --- circle.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index 3b245f7941..b075c1f5fe 100644 --- a/circle.yml +++ b/circle.yml @@ -15,8 +15,9 @@ deployment: heroku: appname: openmctweb-staging-deux test: - override: - - gulp verify + post: + - gulp lint + - gulp checkstyle general: branches: From f35947361ca0a5c1d69a4a645d007167559d7604 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 23 May 2016 15:32:48 -0700 Subject: [PATCH 39/59] [Timeline] Remain centered during zoom #936 --- platform/features/timeline/res/templates/timeline.html | 4 ++-- .../timeline/src/controllers/TimelineZoomController.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/features/timeline/res/templates/timeline.html b/platform/features/timeline/res/templates/timeline.html index 41a1c67a87..fc2e779a36 100644 --- a/platform/features/timeline/res/templates/timeline.html +++ b/platform/features/timeline/res/templates/timeline.html @@ -104,14 +104,14 @@
X Y diff --git a/platform/features/timeline/src/controllers/TimelineZoomController.js b/platform/features/timeline/src/controllers/TimelineZoomController.js index 4c8acd0061..4208a7465c 100644 --- a/platform/features/timeline/src/controllers/TimelineZoomController.js +++ b/platform/features/timeline/src/controllers/TimelineZoomController.js @@ -80,11 +80,13 @@ define( * @returns {number} current zoom level (as the size of a * major tick mark, in pixels) */ - zoom: function (amount) { + zoom: function (amount, bounds) { // Update the zoom level if called with an argument if (arguments.length > 0 && !isNaN(amount)) { + var center = this.toMillis(bounds.x + bounds.width / 2); setZoomLevel(zoomIndex + amount); storeZoom(zoomIndex); + bounds.x = this.toPixels(center) - bounds.width / 2; } return zoomLevels[zoomIndex]; }, From 0818a7cda089d6a7aeb18ca7a011b99cf5ac4bf3 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 23 May 2016 15:36:26 -0700 Subject: [PATCH 40/59] [Timeline] Increase maximum zoom level #936 --- platform/features/timeline/bundle.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/platform/features/timeline/bundle.js b/platform/features/timeline/bundle.js index a6c0931f4e..eb66456ce4 100644 --- a/platform/features/timeline/bundle.js +++ b/platform/features/timeline/bundle.js @@ -127,7 +127,16 @@ define([ 14400000, 28800000, 43200000, - 86400000 + 86400000, + 86400000 * 2, + 86400000 * 5, + 86400000 * 10, + 86400000 * 20, + 86400000 * 30, + 86400000 * 60, + 86400000 * 120, + 86400000 * 240, + 86400000 * 365 ], "width": 200 } From 9a5209f7c2d3d03ca9f268e7dad28c2642dca64e Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 23 May 2016 16:06:10 -0700 Subject: [PATCH 41/59] [Timeline] Add zoom-to-fit button --- .../timeline/res/templates/timeline.html | 7 +++ .../src/controllers/TimelineZoomController.js | 46 ++++++++++++++++--- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/platform/features/timeline/res/templates/timeline.html b/platform/features/timeline/res/templates/timeline.html index fc2e779a36..8dc145b7f0 100644 --- a/platform/features/timeline/res/templates/timeline.html +++ b/platform/features/timeline/res/templates/timeline.html @@ -103,6 +103,13 @@
+ + I + + 0 && !isNaN(amount)) { var center = this.toMillis(bounds.x + bounds.width / 2); @@ -90,22 +120,24 @@ define( } return zoomLevels[zoomIndex]; }, + fit: function () { + if ($scope.domainObject) { + initializeZoom($scope.domainObject); + storeZoom(); + } + }, /** * Get the width, in pixels, of a specific time duration at * the current zoom level. * @returns {number} the number of pixels */ - toPixels: function (millis) { - return tickWidth * millis / zoomLevels[zoomIndex]; - }, + toPixels: toPixels, /** * Get the time duration, in milliseconds, occupied by the * width (specified in pixels) at the current zoom level. * @returns {number} the number of pixels */ - toMillis: function (pixels) { - return (pixels / tickWidth) * zoomLevels[zoomIndex]; - }, + toMillis: toMillis, /** * Get or set the current displayed duration. If used as a * setter, this will typically be rounded up to ensure extra From 96af931c0b8a9aaa89085c935c3aecbcdd8f4304 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 23 May 2016 16:48:31 -0700 Subject: [PATCH 42/59] Modified EditActionPolicy to prevent editing of table views unless object is a table type --- platform/commonUI/edit/src/policies/EditActionPolicy.js | 5 ++++- platform/features/table/bundle.js | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/commonUI/edit/src/policies/EditActionPolicy.js b/platform/commonUI/edit/src/policies/EditActionPolicy.js index f0c2910c11..cc40c32d9f 100644 --- a/platform/commonUI/edit/src/policies/EditActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditActionPolicy.js @@ -56,7 +56,10 @@ define( // A view is editable unless explicitly flagged as not (views || []).forEach(function (view) { if (view.editable === true || - (view.key === 'plot' && type.getKey() === 'telemetry.panel')) { + (view.key === 'plot' && type.getKey() === 'telemetry.panel') || + (view.key === 'table' && type.getKey() === 'table') || + (view.key === 'rt-table' && type.getKey() === 'rttable') + ) { count++; } }); diff --git a/platform/features/table/bundle.js b/platform/features/table/bundle.js index ee907bc963..cdcb6603d9 100644 --- a/platform/features/table/bundle.js +++ b/platform/features/table/bundle.js @@ -133,7 +133,7 @@ define([ "telemetry" ], "delegation": true, - "editable": true + "editable": false }, { "name": "Real-time Table", @@ -144,7 +144,7 @@ define([ "telemetry" ], "delegation": true, - "editable": true + "editable": false } ], "directives": [ From f0ab817e87ce3f66941a637fdd19721804b13ab4 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 24 May 2016 10:23:48 -0700 Subject: [PATCH 43/59] Added tests, and fixed failing ones --- platform/commonUI/browse/bundle.js | 2 - .../browse/src/creation/CreateAction.js | 32 +---- .../src/creation/CreateActionProvider.js | 8 +- .../test/creation/CreateActionProviderSpec.js | 13 -- .../browse/test/creation/CreateActionSpec.js | 128 +++++++++++++----- 5 files changed, 103 insertions(+), 80 deletions(-) diff --git a/platform/commonUI/browse/bundle.js b/platform/commonUI/browse/bundle.js index 73b3f44de7..8a694c57a7 100644 --- a/platform/commonUI/browse/bundle.js +++ b/platform/commonUI/browse/bundle.js @@ -309,9 +309,7 @@ define([ "type": "provider", "implementation": CreateActionProvider, "depends": [ - "$q", "typeService", - "navigationService", "policyService" ] }, diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index 2e04a0b07e..6ea0d513a5 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -43,11 +43,8 @@ define( * override this) * @param {ActionContext} context the context in which the * action is being performed - * @param {NavigationService} navigationService the navigation service, - * which handles changes in navigation. It allows the object - * being browsed/edited to be set. */ - function CreateAction(type, parent, context, $q, navigationService) { + function CreateAction(type, parent, context) { this.metadata = { key: 'create', glyph: type.getGlyph(), @@ -56,24 +53,8 @@ define( description: type.getDescription(), context: context }; - this.type = type; this.parent = parent; - this.navigationService = navigationService; - this.$q = $q; - } - - // Get a count of views which are not flagged as non-editable. - function countEditableViews(domainObject) { - var views = domainObject && domainObject.useCapability('view'), - count = 0; - - // A view is editable unless explicitly flagged as not - (views || []).forEach(function (view) { - count += (view.editable !== false) ? 1 : 0; - }); - - return count; } /** @@ -82,7 +63,6 @@ define( */ CreateAction.prototype.perform = function () { var newModel = this.type.getInitialModel(), - parentObject = this.navigationService.getNavigation(), newObject, editAction, editorCapability; @@ -96,16 +76,18 @@ define( } newModel.type = this.type.getKey(); - newModel.location = parentObject.getId(); - newObject = parentObject.useCapability('instantiation', newModel); + newModel.location = this.parent.getId(); + newObject = this.parent.useCapability('instantiation', newModel); editorCapability = newObject.hasCapability('editor') && newObject.getCapability("editor"); editAction = newObject.getCapability("action").getActions("edit")[0]; + //If an edit action is available, perform it if (editAction) { - return editAction.perform("edit"); + return editAction.perform(); } else if (editorCapability) { + //otherwise, use the save action editorCapability.edit(); - return newObject.useCapability("action").perform("save").then(onSave, onCancel); + return newObject.getCapability("action").perform("save").then(onSave, onCancel); } }; diff --git a/platform/commonUI/browse/src/creation/CreateActionProvider.js b/platform/commonUI/browse/src/creation/CreateActionProvider.js index 82f57343da..5039149104 100644 --- a/platform/commonUI/browse/src/creation/CreateActionProvider.js +++ b/platform/commonUI/browse/src/creation/CreateActionProvider.js @@ -44,10 +44,8 @@ define( * introduced in this bundle), responsible for handling actual * object creation. */ - function CreateActionProvider($q, typeService, navigationService, policyService) { + function CreateActionProvider(typeService, policyService) { this.typeService = typeService; - this.navigationService = navigationService; - this.$q = $q; this.policyService = policyService; } @@ -72,9 +70,7 @@ define( return new CreateAction( type, destination, - context, - self.$q, - self.navigationService + context ); }); }; diff --git a/platform/commonUI/browse/test/creation/CreateActionProviderSpec.js b/platform/commonUI/browse/test/creation/CreateActionProviderSpec.js index fbfc4a1140..d8aefe17fa 100644 --- a/platform/commonUI/browse/test/creation/CreateActionProviderSpec.js +++ b/platform/commonUI/browse/test/creation/CreateActionProviderSpec.js @@ -29,13 +29,10 @@ define( describe("The create action provider", function () { var mockTypeService, - mockDialogService, - mockNavigationService, mockPolicyService, mockCreationPolicy, mockPolicyMap = {}, mockTypes, - mockQ, provider; function createMockType(name) { @@ -61,14 +58,6 @@ define( "typeService", ["listTypes"] ); - mockDialogService = jasmine.createSpyObj( - "dialogService", - ["getUserInput"] - ); - mockNavigationService = jasmine.createSpyObj( - "navigationService", - ["setNavigation"] - ); mockPolicyService = jasmine.createSpyObj( "policyService", ["allow"] @@ -91,9 +80,7 @@ define( mockTypeService.listTypes.andReturn(mockTypes); provider = new CreateActionProvider( - mockQ, mockTypeService, - mockNavigationService, mockPolicyService ); }); diff --git a/platform/commonUI/browse/test/creation/CreateActionSpec.js b/platform/commonUI/browse/test/creation/CreateActionSpec.js index 5fa89512e0..b37339fa40 100644 --- a/platform/commonUI/browse/test/creation/CreateActionSpec.js +++ b/platform/commonUI/browse/test/creation/CreateActionSpec.js @@ -31,8 +31,10 @@ define( var mockType, mockParent, mockContext, - mockDialogService, - mockCreationService, + mockDomainObject, + capabilities = {}, + mockEditAction, + mockSaveAction, action; function mockPromise(value) { @@ -60,20 +62,61 @@ define( [ "getId", "getModel", - "getCapability" + "getCapability", + "useCapability" ] ); + mockDomainObject = jasmine.createSpyObj( + "domainObject", + [ + "getId", + "getModel", + "getCapability", + "hasCapability", + "useCapability" + ] + ); + mockDomainObject.hasCapability.andCallFake(function (name) { + return !!capabilities[name]; + }); + mockDomainObject.getCapability.andCallFake(function (name) { + return capabilities[name]; + }); + mockSaveAction = jasmine.createSpyObj( + "saveAction", + [ + "perform" + ] + ); + + capabilities.action = jasmine.createSpyObj( + "actionCapability", + [ + "getActions", + "perform" + ] + ); + + capabilities.editor = jasmine.createSpyObj( + "editorCapability", + [ + "edit", + "save", + "cancel" + ] + ); + + mockEditAction = jasmine.createSpyObj( + "editAction", + [ + "perform" + ] + ); + mockContext = { domainObject: mockParent }; - mockDialogService = jasmine.createSpyObj( - "dialogService", - ["getUserInput"] - ); - mockCreationService = jasmine.createSpyObj( - "creationService", - ["createObject"] - ); + mockParent.useCapability.andReturn(mockDomainObject); mockType.getKey.andReturn("test"); mockType.getGlyph.andReturn("T"); @@ -82,14 +125,10 @@ define( mockType.getProperties.andReturn([]); mockType.getInitialModel.andReturn({}); - mockDialogService.getUserInput.andReturn(mockPromise({})); - action = new CreateAction( mockType, mockParent, - mockContext, - mockDialogService, - mockCreationService + mockContext ); }); @@ -101,28 +140,49 @@ define( expect(metadata.glyph).toEqual("T"); }); - //TODO: Disabled for NEM Beta - xit("invokes the creation service when performed", function () { - action.perform(); - expect(mockCreationService.createObject).toHaveBeenCalledWith( - { type: "test" }, - mockParent - ); - }); - - //TODO: Disabled for NEM Beta - xit("does not create an object if the user cancels", function () { - mockDialogService.getUserInput.andReturn({ - then: function (callback, fail) { - fail(); - } + describe("the perform function", function () { + beforeEach(function () { + capabilities.action.getActions.andReturn([mockEditAction]); }); - action.perform(); + it("uses the instantiation capability when performed", function () { + action.perform(); + expect(mockParent.useCapability).toHaveBeenCalledWith("instantiation", jasmine.any(Object)); + }); - expect(mockCreationService.createObject) - .not.toHaveBeenCalled(); + it("uses the edit action if available", function () { + action.perform(); + expect(mockEditAction.perform).toHaveBeenCalled(); + }); + it("uses the save action if object does not have an edit action" + + " available", function () { + capabilities.action.getActions.andReturn([]); + capabilities.action.perform.andReturn(mockPromise(undefined)); + action.perform(); + expect(capabilities.action.perform).toHaveBeenCalledWith("save"); + }); + + describe("uses to editor capability", function () { + var promise = jasmine.createSpyObj("promise", ["then"]); + beforeEach(function () { + capabilities.action.getActions.andReturn([]); + capabilities.action.perform.andReturn(promise); + }); + + it("to save the edit if user saves dialog", function () { + action.perform(); + expect(promise.then).toHaveBeenCalled(); + promise.then.mostRecentCall.args[0](); + expect(capabilities.editor.save).toHaveBeenCalled(); + }); + + it("to cancel the edit if user cancels dialog", function () { + action.perform(); + promise.then.mostRecentCall.args[1](); + expect(capabilities.editor.cancel).toHaveBeenCalled(); + }); + }); }); }); From 85432af187408be0acfea560f46e4619864bf451 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 24 May 2016 11:53:27 -0700 Subject: [PATCH 44/59] [Timeline] Don't store zoom configuration https://github.com/nasa/openmct/issues/936#issuecomment-221343620 --- .../src/controllers/TimelineZoomController.js | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/platform/features/timeline/src/controllers/TimelineZoomController.js b/platform/features/timeline/src/controllers/TimelineZoomController.js index 884904e7ba..0ba5abbb28 100644 --- a/platform/features/timeline/src/controllers/TimelineZoomController.js +++ b/platform/features/timeline/src/controllers/TimelineZoomController.js @@ -62,19 +62,6 @@ define( } } - // Persist current zoom level - function storeZoom() { - var isEditMode = $scope.commit && - $scope.domainObject && - $scope.domainObject.hasCapability('editor') && - $scope.domainObject.getCapability('editor').inEditContext(); - if (isEditMode) { - $scope.configuration = $scope.configuration || {}; - $scope.configuration.zoomLevel = zoomIndex; - $scope.commit(); - } - } - function initializeZoomFromTimespan(timespan) { var duration = timespan.getDuration(); zoomIndex = 0; @@ -96,7 +83,6 @@ define( bounds = scroll; }); $scope.$watch("domainObject", initializeZoom); - $scope.$watch("configuration.zoomLevel", setZoomLevel); return { /** @@ -115,15 +101,17 @@ define( if (arguments.length > 0 && !isNaN(amount)) { var center = this.toMillis(bounds.x + bounds.width / 2); setZoomLevel(zoomIndex + amount); - storeZoom(zoomIndex); bounds.x = this.toPixels(center) - bounds.width / 2; } return zoomLevels[zoomIndex]; }, + /** + * Set the zoom level to fit the bounds of the timeline + * being viewed. + */ fit: function () { if ($scope.domainObject) { initializeZoom($scope.domainObject); - storeZoom(); } }, /** From 757da1dff45aae24bbea5f733311e572e6d5f3fb Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 24 May 2016 11:54:49 -0700 Subject: [PATCH 45/59] [Timeline] Remove obsolete test cases --- .../controllers/TimelineZoomControllerSpec.js | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js b/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js index 1365fca7d6..35b5bad8b4 100644 --- a/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js @@ -74,34 +74,6 @@ define( expect(controller.zoom()).toEqual(3500); }); - it("does not normally persist zoom changes", function () { - controller.zoom(1); - expect(mockScope.commit).not.toHaveBeenCalled(); - }); - - it("persists zoom changes in Edit mode", function () { - mockScope.domainObject = jasmine.createSpyObj( - 'domainObject', - ['hasCapability', 'getCapability'] - ); - mockScope.domainObject.hasCapability.andCallFake(function (c) { - return c === 'editor'; - }); - mockScope.domainObject.getCapability.andCallFake(function (c) { - if (c === 'editor') { - return { - inEditContext: function () { - return true; - } - }; - } - }); - controller.zoom(1); - expect(mockScope.commit).toHaveBeenCalled(); - expect(mockScope.configuration.zoomLevel) - .toEqual(jasmine.any(Number)); - }); - }); } From eb5566f0417f7bc139329610e5791bbc88a18bb4 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 24 May 2016 12:33:19 -0700 Subject: [PATCH 46/59] [Timeline] Add tests for timeline zoom changes --- .../src/controllers/TimelineZoomController.js | 2 +- .../controllers/TimelineZoomControllerSpec.js | 63 +++++++++++++++++-- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/platform/features/timeline/src/controllers/TimelineZoomController.js b/platform/features/timeline/src/controllers/TimelineZoomController.js index 0ba5abbb28..1c21cbfe8c 100644 --- a/platform/features/timeline/src/controllers/TimelineZoomController.js +++ b/platform/features/timeline/src/controllers/TimelineZoomController.js @@ -66,7 +66,7 @@ define( var duration = timespan.getDuration(); zoomIndex = 0; while (toMillis(bounds.width) < duration && - zoomIndex < zoomLevels.length) { + zoomIndex < zoomLevels.length - 1) { zoomIndex += 1; } bounds.x = toPixels(timespan.getStart()); diff --git a/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js b/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js index 35b5bad8b4..b5f8e32f6f 100644 --- a/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js @@ -32,11 +32,7 @@ define( beforeEach(function () { testConfiguration = { - levels: [ - 1000, - 2000, - 3500 - ], + levels: [ 1000, 2000, 3500 ], width: 12321 }; mockScope = jasmine.createSpyObj("$scope", ['$watch']); @@ -74,6 +70,63 @@ define( expect(controller.zoom()).toEqual(3500); }); + it("observes scroll bounds", function () { + expect(mockScope.$watch) + .toHaveBeenCalledWith("scroll", jasmine.any(Function)); + }); + + describe("when watches have fired", function () { + var mockDomainObject, + mockPromise, + mockTimespan, + testStart, + testEnd; + + beforeEach(function () { + testStart = 3000; + testEnd = 5500; + + mockDomainObject = jasmine.createSpyObj('domainObject', [ + 'getId', + 'getModel', + 'getCapability', + 'useCapability' + ]); + mockPromise = jasmine.createSpyObj('promise', ['then']); + mockTimespan = jasmine.createSpyObj('timespan', [ + 'getStart', + 'getEnd', + 'getDuration' + ]); + + mockDomainObject.useCapability.andCallFake(function (c) { + return c === 'timespan' && mockPromise; + }); + mockPromise.then.andCallFake(function (callback) { + callback(mockTimespan); + }); + mockTimespan.getStart.andReturn(testStart); + mockTimespan.getEnd.andReturn(testEnd); + mockTimespan.getDuration.andReturn(testEnd - testStart); + + mockScope.scroll = { x: 0, width: 20000 }; + mockScope.domainObject = mockDomainObject; + + mockScope.$watch.calls.forEach(function (call) { + call.args[1](mockScope[call.args[0]]); + }); + }); + + it("zooms to fit the timeline", function () { + var x1 = mockScope.scroll.x, + x2 = mockScope.scroll.x + mockScope.scroll.width; + expect(Math.round(controller.toMillis(x1))) + .toEqual(testStart); + expect(Math.round(controller.toMillis(x2))) + .toBeGreaterThan(testEnd); + }); + }); + }); } From 16d20eabd2d61c8af245b7a219781cf9182e930d Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 24 May 2016 12:33:47 -0700 Subject: [PATCH 47/59] [Timeline] Simplify method --- .../src/controllers/TimelineZoomController.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/platform/features/timeline/src/controllers/TimelineZoomController.js b/platform/features/timeline/src/controllers/TimelineZoomController.js index 1c21cbfe8c..7bd64eb408 100644 --- a/platform/features/timeline/src/controllers/TimelineZoomController.js +++ b/platform/features/timeline/src/controllers/TimelineZoomController.js @@ -72,9 +72,9 @@ define( bounds.x = toPixels(timespan.getStart()); } - function initializeZoom(domainObject) { - if (domainObject) { - domainObject.useCapability('timespan') + function initializeZoom() { + if ($scope.domainObject) { + $scope.domainObject.useCapability('timespan') .then(initializeZoomFromTimespan); } } @@ -109,11 +109,7 @@ define( * Set the zoom level to fit the bounds of the timeline * being viewed. */ - fit: function () { - if ($scope.domainObject) { - initializeZoom($scope.domainObject); - } - }, + fit: initializeZoom, /** * Get the width, in pixels, of a specific time duration at * the current zoom level. From 362248a02e1114c09f1188c839375251f755bd4c Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 24 May 2016 12:37:10 -0700 Subject: [PATCH 48/59] [Timeline] Run gulp fixstyle --- .../timeline/test/controllers/TimelineZoomControllerSpec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js b/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js index b5f8e32f6f..47e79fefa8 100644 --- a/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js @@ -32,7 +32,7 @@ define( beforeEach(function () { testConfiguration = { - levels: [ 1000, 2000, 3500 ], + levels: [1000, 2000, 3500], width: 12321 }; mockScope = jasmine.createSpyObj("$scope", ['$watch']); From 379557093870d2ef35505167b495de69033cb62d Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 24 May 2016 12:45:25 -0700 Subject: [PATCH 49/59] [Timeline] Rename shadowing variable --- .../timeline/src/controllers/TimelineZoomController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/features/timeline/src/controllers/TimelineZoomController.js b/platform/features/timeline/src/controllers/TimelineZoomController.js index 7bd64eb408..d94a05d291 100644 --- a/platform/features/timeline/src/controllers/TimelineZoomController.js +++ b/platform/features/timeline/src/controllers/TimelineZoomController.js @@ -63,9 +63,9 @@ define( } function initializeZoomFromTimespan(timespan) { - var duration = timespan.getDuration(); + var timelineDuration = timespan.getDuration(); zoomIndex = 0; - while (toMillis(bounds.width) < duration && + while (toMillis(bounds.width) < timelineDuration && zoomIndex < zoomLevels.length - 1) { zoomIndex += 1; } From 00534f8af7349ccab364bd5659cd8d5b276a2b3b Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 24 May 2016 13:02:30 -0700 Subject: [PATCH 50/59] [Timeline] Account for tick size Account for tick size in duration reported by TimelineZoomController, to avoid tick marks being cut off prematurely due to changes for #936 --- platform/features/timeline/res/templates/timeline.html | 2 +- .../timeline/src/controllers/TimelineZoomController.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/features/timeline/res/templates/timeline.html b/platform/features/timeline/res/templates/timeline.html index 8dc145b7f0..6e74a8c7b2 100644 --- a/platform/features/timeline/res/templates/timeline.html +++ b/platform/features/timeline/res/templates/timeline.html @@ -128,7 +128,7 @@
Date: Wed, 25 May 2016 10:11:34 -0700 Subject: [PATCH 52/59] [Test] Add spy method for addClass Add spy method, fix a merge conflict that was improperly resolved in https://github.com/nasa/openmct/pull/922 --- .../commonUI/general/test/directives/MCTPopupSpec.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/platform/commonUI/general/test/directives/MCTPopupSpec.js b/platform/commonUI/general/test/directives/MCTPopupSpec.js index 372dd4b042..fa26b6f6f7 100644 --- a/platform/commonUI/general/test/directives/MCTPopupSpec.js +++ b/platform/commonUI/general/test/directives/MCTPopupSpec.js @@ -24,7 +24,15 @@ define( ["../../src/directives/MCTPopup"], function (MCTPopup) { - var JQLITE_METHODS = ["on", "off", "find", "parent", "css", "append"]; + var JQLITE_METHODS = [ + "on", + "off", + "find", + "parent", + "css", + "addClass", + "append" + ]; describe("The mct-popup directive", function () { var mockCompile, From ed69a65f9b1c7c36947a4f6ba7a0127cae2e84c2 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 25 May 2016 11:03:32 -0700 Subject: [PATCH 53/59] [Representation] Restore ordering in mct-representation Revert "[Timeline] Change ordering in mct-representation" This reverts commit 20ecf168f238b9a4b2341508650f4b573bfd4f0b. These changes introduced a regression due to ordering expected by time conductor, #957 --- platform/representation/src/MCTRepresentation.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index 953ed7cf5a..331139b793 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -177,6 +177,10 @@ define( // representation to store local variables into. $scope.representation = {}; + // Change templates (passing in undefined to clear + // if we don't have enough info to show a template.) + changeTemplate(canRepresent ? representation : undefined); + // Any existing representers are no longer valid; release them. destroyRepresenters(); @@ -222,10 +226,6 @@ define( // next change object/key pair changes toClear = uses.concat(['model']); } - - // Change templates (passing in undefined to clear - // if we don't have enough info to show a template.) - changeTemplate(canRepresent ? representation : undefined); } // Update the representation when the key changes (e.g. if a From 70b593e28a4b3657cabf86a6d005f51d2d419817 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 25 May 2016 11:21:20 -0700 Subject: [PATCH 54/59] [Timeline] Watch for configuration object ...to address #908 in a manner which does not cause #957 --- .../src/controllers/TimelineController.js | 2 ++ .../swimlane/TimelineSwimlanePopulator.js | 21 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/platform/features/timeline/src/controllers/TimelineController.js b/platform/features/timeline/src/controllers/TimelineController.js index 796807c76a..64900b586c 100644 --- a/platform/features/timeline/src/controllers/TimelineController.js +++ b/platform/features/timeline/src/controllers/TimelineController.js @@ -97,6 +97,8 @@ define( } } + $scope.$watch("configuration", swimlanePopulator.configure); + // Recalculate swimlane state on changes $scope.$watch("domainObject", swimlanePopulator.populate); diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js index ccc6148997..74c28b46b8 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js @@ -43,8 +43,7 @@ define( var swimlanes = [], start = Number.POSITIVE_INFINITY, end = Number.NEGATIVE_INFINITY, - colors = (configuration.colors || {}), - assigner = new TimelineColorAssigner(colors), + assigner, lastDomainObject; // Track extremes of start/end times @@ -152,8 +151,15 @@ define( recalculateSwimlanes(lastDomainObject); } + function initialize() { + var colors = (configuration.colors || {}); + assigner = new TimelineColorAssigner(colors); + configuration.colors = colors; + recalculateSwimlanes(lastDomainObject); + } + // Ensure colors are exposed in configuration - configuration.colors = colors; + initialize(); return { /** @@ -188,6 +194,15 @@ define( */ end: function () { return end; + }, + /** + * Pass a new configuration object (to retrieve and store + * swimlane configuration) + * @param newConfig + */ + configure: function (newConfig) { + configuration = newConfig; + initialize(); } }; } From 0a75a5be1f1f086f572fcc4e970e784afa7dea10 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 25 May 2016 11:27:16 -0700 Subject: [PATCH 55/59] [Timeline] Add minimal test case --- .../timeline/test/controllers/TimelineControllerSpec.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/features/timeline/test/controllers/TimelineControllerSpec.js b/platform/features/timeline/test/controllers/TimelineControllerSpec.js index 9e777b0d8e..2b78829c3a 100644 --- a/platform/features/timeline/test/controllers/TimelineControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineControllerSpec.js @@ -141,6 +141,13 @@ define( expect(mockScope.scroll.y).toEqual(0); }); + it("watches for a configuration object", function () { + expect(mockScope.$watch).toHaveBeenCalledWith( + "configuration", + jasmine.any(Function) + ); + }); + it("repopulates when modifications are made", function () { var fnWatchCall, strWatchCall; From 952f95aa4c9b19fe0a081ab9e073a2087c3a3221 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 25 May 2016 11:33:51 -0700 Subject: [PATCH 56/59] [Timeline] Update failing specs --- .../controllers/TimelineControllerSpec.js | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/platform/features/timeline/test/controllers/TimelineControllerSpec.js b/platform/features/timeline/test/controllers/TimelineControllerSpec.js index 2b78829c3a..aa88866ebc 100644 --- a/platform/features/timeline/test/controllers/TimelineControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineControllerSpec.js @@ -68,6 +68,14 @@ define( }; } + function fireWatch(expr, value) { + mockScope.$watch.calls.forEach(function (call) { + if (call.args[0] === expr) { + call.args[1](value); + } + }); + } + beforeEach(function () { var mockA, mockB, mockUtilization, mockPromise, mockGraph, testCapabilities; @@ -149,8 +157,7 @@ define( }); it("repopulates when modifications are made", function () { - var fnWatchCall, - strWatchCall; + var fnWatchCall; // Find the $watch that was given a function mockScope.$watch.calls.forEach(function (call) { @@ -158,16 +165,11 @@ define( // white-box: we know the first call is // the one we're looking for fnWatchCall = fnWatchCall || call; - } else if (typeof call.args[0] === 'string') { - strWatchCall = strWatchCall || call; } }); // Make sure string watch was for domainObject - expect(strWatchCall.args[0]).toEqual('domainObject'); - // Initially populate - strWatchCall.args[1](mockDomainObject); - + fireWatch('domainObject', mockDomainObject); // There should be to swimlanes expect(controller.swimlanes().length).toEqual(2); @@ -189,23 +191,23 @@ define( // order of $watch calls in TimelineController. // Initially populate - mockScope.$watch.calls[0].args[1](mockDomainObject); + fireWatch('domainObject', mockDomainObject); // Verify precondition - no graphs expect(controller.graphs().length).toEqual(0); // Execute the watch function for graph state - tmp = mockScope.$watch.calls[2].args[0](); + tmp = mockScope.$watch.calls[3].args[0](); // Change graph state testConfiguration.graph = { a: true, b: true }; // Verify that this would have triggered a watch - expect(mockScope.$watch.calls[2].args[0]()) + expect(mockScope.$watch.calls[3].args[0]()) .not.toEqual(tmp); // Run the function the watch would have triggered - mockScope.$watch.calls[2].args[1](); + mockScope.$watch.calls[3].args[1](); // Should have some graphs now expect(controller.graphs().length).toEqual(2); @@ -218,7 +220,7 @@ define( mockZoom.duration.andReturn(12345); // Initially populate - mockScope.$watch.calls[0].args[1](mockDomainObject); + fireWatch('domainObject', mockDomainObject); expect(controller.width(mockZoom)).toEqual(54321); // Verify interactions; we took zoom's duration for our start/end, From 3935378b0c1f832bde5e64359443fa500a95dd67 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 25 May 2016 11:34:29 -0700 Subject: [PATCH 57/59] Revert "[Timeline] Test mct-representation ordering" This reverts commit 2a4004fd5bcddc8249c8911606d14dad8303d14b. --- .../representation/test/MCTRepresentationSpec.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/platform/representation/test/MCTRepresentationSpec.js b/platform/representation/test/MCTRepresentationSpec.js index 98da386c91..025ab0f14d 100644 --- a/platform/representation/test/MCTRepresentationSpec.js +++ b/platform/representation/test/MCTRepresentationSpec.js @@ -194,21 +194,6 @@ define( .toHaveBeenCalledWith(testViews[1]); }); - it("exposes configuration before changing templates", function () { - var observedConfiguration; - - mockChangeTemplate.andCallFake(function () { - observedConfiguration = mockScope.configuration; - }); - - mockScope.key = "xyz"; - mockScope.domainObject = mockDomainObject; - fireWatch('key', mockScope.key); - fireWatch('domainObject', mockDomainObject); - - expect(observedConfiguration).toBeDefined(); - }); - it("does not load templates until there is an object", function () { mockScope.key = "xyz"; From 7501f679f7132ab0ebc96f3abb38f2678a4ba8dd Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 25 May 2016 12:10:39 -0700 Subject: [PATCH 58/59] [Style] Fixed style issues introduced by #954 --- platform/commonUI/edit/bundle.js | 4 ++-- .../commonUI/edit/test/creation/CreateActionSpec.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/commonUI/edit/bundle.js b/platform/commonUI/edit/bundle.js index 5107329bfb..a07c5bb230 100644 --- a/platform/commonUI/edit/bundle.js +++ b/platform/commonUI/edit/bundle.js @@ -146,7 +146,7 @@ define([ "$timeout", "objectService" ] - }, + } ], "directives": [ { @@ -309,7 +309,7 @@ define([ "uses": [ "action" ] - }, + } ], "components": [ { diff --git a/platform/commonUI/edit/test/creation/CreateActionSpec.js b/platform/commonUI/edit/test/creation/CreateActionSpec.js index b37339fa40..c2d8e64279 100644 --- a/platform/commonUI/edit/test/creation/CreateActionSpec.js +++ b/platform/commonUI/edit/test/creation/CreateActionSpec.js @@ -77,10 +77,10 @@ define( ] ); mockDomainObject.hasCapability.andCallFake(function (name) { - return !!capabilities[name]; + return !!capabilities[name]; }); mockDomainObject.getCapability.andCallFake(function (name) { - return capabilities[name]; + return capabilities[name]; }); mockSaveAction = jasmine.createSpyObj( "saveAction", @@ -165,10 +165,10 @@ define( describe("uses to editor capability", function () { var promise = jasmine.createSpyObj("promise", ["then"]); - beforeEach(function () { - capabilities.action.getActions.andReturn([]); - capabilities.action.perform.andReturn(promise); - }); + beforeEach(function () { + capabilities.action.getActions.andReturn([]); + capabilities.action.perform.andReturn(promise); + }); it("to save the edit if user saves dialog", function () { action.perform(); From a5b7badb9586e5b0d8c31927babc2d51257154e3 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 25 May 2016 16:08:28 -0700 Subject: [PATCH 59/59] [Timeline] Remove obsolete arguments https://github.com/nasa/openmct/pull/955/files#r64668507 --- platform/features/timeline/res/templates/timeline.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/features/timeline/res/templates/timeline.html b/platform/features/timeline/res/templates/timeline.html index 6e74a8c7b2..0bb53d1196 100644 --- a/platform/features/timeline/res/templates/timeline.html +++ b/platform/features/timeline/res/templates/timeline.html @@ -111,14 +111,14 @@ X Y