diff --git a/platform/commonUI/general/res/fonts/symbols/icomoon-project-openmct-symbols-16px.json b/platform/commonUI/general/res/fonts/symbols/icomoon-project-openmct-symbols-16px.json index 3351eb3318..986474ad5f 100644 --- a/platform/commonUI/general/res/fonts/symbols/icomoon-project-openmct-symbols-16px.json +++ b/platform/commonUI/general/res/fonts/symbols/icomoon-project-openmct-symbols-16px.json @@ -1,8 +1,8 @@ { "metadata": { "name": "openmct-symbols-16px", - "lastOpened": 1469724858940, - "created": 1469724856623 + "lastOpened": 1479173088107, + "created": 1479173085258 }, "iconSets": [ { @@ -540,13 +540,37 @@ "code": 921654, "tempChar": "" }, + { + "order": 117, + "id": 103, + "name": "icon-brightness", + "prevSize": 24, + "code": 921656, + "tempChar": "" + }, + { + "order": 118, + "id": 102, + "name": "icon-contrast", + "prevSize": 24, + "code": 921657, + "tempChar": "" + }, + { + "order": 119, + "id": 104, + "name": "icon-reset", + "prevSize": 24, + "code": 921664, + "tempChar": "" + }, { "order": 37, "prevSize": 24, "name": "icon-activity", "id": 32, "code": 921856, - "tempChar": "" + "tempChar": "" }, { "order": 36, @@ -554,7 +578,7 @@ "name": "icon-activity-mode", "id": 31, "code": 921857, - "tempChar": "" + "tempChar": "" }, { "order": 52, @@ -562,7 +586,7 @@ "name": "icon-autoflow-tabular", "id": 47, "code": 921858, - "tempChar": "" + "tempChar": "" }, { "order": 55, @@ -570,7 +594,7 @@ "name": "icon-clock", "id": 50, "code": 921859, - "tempChar": "" + "tempChar": "" }, { "order": 58, @@ -578,7 +602,7 @@ "name": "icon-database", "id": 53, "code": 921860, - "tempChar": "" + "tempChar": "" }, { "order": 57, @@ -586,7 +610,7 @@ "name": "icon-database-query", "id": 52, "code": 921861, - "tempChar": "" + "tempChar": "" }, { "order": 17, @@ -594,7 +618,7 @@ "name": "icon-dataset", "id": 12, "code": 921862, - "tempChar": "" + "tempChar": "" }, { "order": 22, @@ -602,7 +626,7 @@ "name": "icon-datatable", "id": 17, "code": 921863, - "tempChar": "" + "tempChar": "" }, { "order": 59, @@ -610,7 +634,7 @@ "name": "icon-dictionary", "id": 54, "code": 921864, - "tempChar": "" + "tempChar": "" }, { "order": 62, @@ -618,7 +642,7 @@ "name": "icon-folder", "id": 57, "code": 921865, - "tempChar": "" + "tempChar": "" }, { "order": 66, @@ -626,7 +650,7 @@ "name": "icon-image", "id": 61, "code": 921872, - "tempChar": "" + "tempChar": "" }, { "order": 68, @@ -634,7 +658,7 @@ "name": "icon-layout", "id": 63, "code": 921873, - "tempChar": "" + "tempChar": "" }, { "order": 77, @@ -642,7 +666,7 @@ "name": "icon-object", "id": 72, "code": 921874, - "tempChar": "" + "tempChar": "" }, { "order": 78, @@ -650,7 +674,7 @@ "name": "icon-object-unknown", "id": 73, "code": 921875, - "tempChar": "" + "tempChar": "" }, { "order": 79, @@ -658,7 +682,7 @@ "name": "icon-packet", "id": 74, "code": 921876, - "tempChar": "" + "tempChar": "" }, { "order": 80, @@ -666,7 +690,7 @@ "name": "icon-page", "id": 75, "code": 921877, - "tempChar": "" + "tempChar": "" }, { "order": 114, @@ -674,7 +698,7 @@ "name": "icon-plot-overlay", "prevSize": 24, "code": 921878, - "tempChar": "" + "tempChar": "" }, { "order": 113, @@ -682,7 +706,7 @@ "name": "icon-plot-stacked", "prevSize": 24, "code": 921879, - "tempChar": "" + "tempChar": "" }, { "order": 10, @@ -690,7 +714,7 @@ "name": "icon-session", "id": 5, "code": 921880, - "tempChar": "" + "tempChar": "" }, { "order": 24, @@ -698,7 +722,7 @@ "name": "icon-tabular", "id": 19, "code": 921881, - "tempChar": "" + "tempChar": "" }, { "order": 7, @@ -706,7 +730,7 @@ "name": "icon-tabular-lad", "id": 2, "code": 921888, - "tempChar": "" + "tempChar": "" }, { "order": 6, @@ -714,7 +738,7 @@ "name": "icon-tabular-lad-set", "id": 1, "code": 921889, - "tempChar": "" + "tempChar": "" }, { "order": 8, @@ -722,7 +746,7 @@ "name": "icon-tabular-realtime", "id": 3, "code": 921890, - "tempChar": "" + "tempChar": "" }, { "order": 23, @@ -730,7 +754,7 @@ "name": "icon-tabular-scrolling", "id": 18, "code": 921891, - "tempChar": "" + "tempChar": "" }, { "order": 112, @@ -738,7 +762,7 @@ "name": "icon-telemetry", "id": 86, "code": 921892, - "tempChar": "" + "tempChar": "" }, { "order": 90, @@ -746,7 +770,7 @@ "name": "icon-telemetry-panel", "id": 85, "code": 921893, - "tempChar": "" + "tempChar": "" }, { "order": 93, @@ -754,7 +778,7 @@ "name": "icon-timeline", "id": 88, "code": 921894, - "tempChar": "" + "tempChar": "" }, { "order": 116, @@ -762,7 +786,7 @@ "name": "icon-timer-v1.5", "prevSize": 24, "code": 921895, - "tempChar": "" + "tempChar": "" }, { "order": 11, @@ -770,7 +794,7 @@ "name": "icon-topic", "id": 6, "code": 921896, - "tempChar": "" + "tempChar": "" }, { "order": 115, @@ -778,13 +802,13 @@ "name": "icon-box-with-dashed-lines", "id": 29, "code": 921897, - "tempChar": "" + "tempChar": "" } ], "metadata": { "name": "openmct-symbols-16px", "importSize": { - "width": 448, + "width": 512, "height": 512 }, "designer": "Charles Hacskaylo", @@ -1973,7 +1997,7 @@ }, { "paths": [ - "M1012.8 414.2v-391.6l-127.6 127.4c-96.6-96.8-225.2-150-362-150s-265.2 53.2-362 150c-96.8 96.8-150 225.2-150 362s53.2 265.4 150 362c96.8 96.8 225.2 150 362 150s265.4-53.2 362-150l-136.6-136.6c-124.2 124.2-326.4 124.2-450.8 0-124.2-124.2-124.2-326.4 0-450.8 124.2-124.2 326.4-124.2 450.8 0l-127.4 127.4h391.6z" + "M1024 460.8v-460.8l-175.8 175.8c-85.2-69.6-190.8-107.6-302-107.6-127.6 0-247.6 49.8-338 140s-140 210.4-140 338 49.8 247.6 140 338 210.4 140 338 140 247.6-49.8 338-140c74-74 120.8-167.8 135-269.6h-138.6c-32 155.4-169.8 272.8-334.6 272.8-188.2 0-341.4-153.2-341.4-341.4s153.4-341.2 341.6-341.2c76.8 0 147.6 25.4 204.8 68.2l-187.8 187.8h460.8z" ], "grid": 16, "tags": [ @@ -1981,9 +2005,19 @@ ], "defaultCode": 114, "id": 27, - "attrs": [], + "attrs": [ + { + "fill": "rgb(0, 161, 75)" + } + ], + "isMulticolor": false, + "isMulticolor2": false, "colorPermutations": { - "1161751207457516161751": [] + "1161751207457516161751": [ + { + "f": 1 + } + ] } }, { @@ -2125,6 +2159,134 @@ "1161751207457516161751": [] } }, + { + "id": 103, + "paths": [ + "M253.414 318.061l-155.172-116.384c-50.233 66.209-85.127 146.713-97.91 234.39l191.586 30.216c8.145-56.552 29.998-106.879 62.068-149.006z", + "M191.98 557.717l-191.919 27.434c13.115 90.459 48.009 170.963 99.174 238.453l154.18-117.665c-31.476-41.347-53.309-91.675-61.231-146.504z", + "M466.283 191.98l-27.434-191.919c-90.459 13.115-170.963 48.009-238.453 99.174l117.665 154.18c41.347-31.476 91.675-53.309 146.504-61.231z", + "M822.323 98.242c-66.209-50.233-146.713-85.127-234.39-97.91l-30.216 191.586c56.552 8.145 106.879 29.998 149.006 62.068z", + "M832.020 466.283l191.919-27.434c-13.115-90.459-48.009-170.963-99.174-238.453l-154.18 117.665c31.476 41.347 53.309 91.675 61.231 146.504z", + "M201.677 925.758c66.209 50.233 146.713 85.127 234.39 97.91l30.216-191.586c-56.552-8.145-106.879-29.998-149.006-62.068z", + "M770.586 705.939l155.131 116.343c50.233-66.209 85.127-146.713 97.91-234.39l-191.586-30.216c-8.125 56.564-29.966 106.906-62.028 149.049z", + "M557.717 832.020l27.434 191.919c90.459-13.115 170.963-48.009 238.453-99.174l-117.665-154.18c-41.347 31.476-91.675 53.309-146.504 61.231z", + "M770.586 512c0 142.813-115.773 258.586-258.586 258.586s-258.586-115.773-258.586-258.586c0-142.813 115.773-258.586 258.586-258.586s258.586 115.773 258.586 258.586z" + ], + "attrs": [ + { + "fill": "rgb(0, 161, 75)" + }, + { + "fill": "rgb(0, 161, 75)" + }, + { + "fill": "rgb(0, 161, 75)" + }, + { + "fill": "rgb(0, 161, 75)" + }, + { + "fill": "rgb(0, 161, 75)" + }, + { + "fill": "rgb(0, 161, 75)" + }, + { + "fill": "rgb(0, 161, 75)" + }, + { + "fill": "rgb(0, 161, 75)" + }, + { + "fill": "rgb(0, 161, 75)" + } + ], + "isMulticolor": false, + "isMulticolor2": false, + "grid": 16, + "tags": [ + "icon-brightness" + ], + "colorPermutations": { + "1161751207457516161751": [ + { + "f": 1 + }, + { + "f": 1 + }, + { + "f": 1 + }, + { + "f": 1 + }, + { + "f": 1 + }, + { + "f": 1 + }, + { + "f": 1 + }, + { + "f": 1 + }, + { + "f": 1 + } + ] + } + }, + { + "id": 102, + "paths": [ + "M512 0c-282.78 0-512 229.24-512 512s229.22 512 512 512 512-229.24 512-512-229.22-512-512-512zM783.52 783.52c-69.111 69.481-164.785 112.481-270.502 112.481-0.358 0-0.716-0-1.074-0.001l0.055-768c212.070 0.010 383.982 171.929 383.982 384 0 106.034-42.977 202.031-112.462 271.52z" + ], + "attrs": [ + { + "fill": "rgb(0, 161, 75)" + } + ], + "isMulticolor": false, + "isMulticolor2": false, + "grid": 16, + "tags": [ + "icon-contrast" + ], + "colorPermutations": { + "1161751207457516161751": [ + { + "f": 1 + } + ] + } + }, + { + "id": 104, + "paths": [ + "M460.8 460.8l-187.8-187.8c57.2-42.8 128-68.2 204.8-68.2 188.2 0 341.6 153.2 341.6 341.4s-153.2 341.2-341.4 341.2c-165 0-302.8-117.6-334.6-273h-138.4c14.2 101.8 61 195.6 135 269.6 90.2 90.2 210.4 140 338 140s247.6-49.8 338-140 140-210.4 140-338-49.8-247.6-140-338-210.4-140-338-140c-111.4 0-217 38-302 107.6l-176-175.6v460.8h460.8z" + ], + "attrs": [ + { + "fill": "rgb(0, 161, 75)" + } + ], + "isMulticolor": false, + "isMulticolor2": false, + "grid": 16, + "tags": [ + "icon-reset" + ], + "colorPermutations": { + "1161751207457516161751": [ + { + "f": 1 + } + ] + } + }, { "paths": [ "M576 64h-256l320 320h-290.256c-44.264-76.516-126.99-128-221.744-128h-128v512h128c94.754 0 177.48-51.484 221.744-128h290.256l-320 320h256l448-448-448-448z" diff --git a/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.eot b/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.eot index a6b919620b..d22bc7851c 100755 Binary files a/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.eot and b/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.eot differ diff --git a/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.svg b/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.svg index b0d24712fc..68ac62d103 100755 --- a/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.svg +++ b/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.svg @@ -65,7 +65,7 @@ - + @@ -73,6 +73,9 @@ + + + diff --git a/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.ttf b/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.ttf index a920e86179..e6b00bcbe1 100755 Binary files a/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.ttf and b/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.ttf differ diff --git a/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.woff b/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.woff index 1e9f1acecd..72433dabfc 100755 Binary files a/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.woff and b/platform/commonUI/general/res/fonts/symbols/openmct-symbols-16px.woff differ diff --git a/platform/commonUI/general/res/sass/_global.scss b/platform/commonUI/general/res/sass/_global.scss index d5de7f2fe5..7f320d9330 100644 --- a/platform/commonUI/general/res/sass/_global.scss +++ b/platform/commonUI/general/res/sass/_global.scss @@ -204,6 +204,11 @@ a.disabled { display: none !important; } +.hide-nice { + opacity: 0; + pointer-events: none; +} + .off { visibility: hidden; opacity: 0; diff --git a/platform/commonUI/general/res/sass/_glyphs.scss b/platform/commonUI/general/res/sass/_glyphs.scss index 876cf36c0a..977233144d 100644 --- a/platform/commonUI/general/res/sass/_glyphs.scss +++ b/platform/commonUI/general/res/sass/_glyphs.scss @@ -74,6 +74,9 @@ $glyph-icon-thumbs-strip: '\e1033'; $glyph-icon-two-parts-both: '\e1034'; $glyph-icon-two-parts-one-only: '\e1035'; $glyph-icon-x-in-circle: '\e1036'; +$glyph-icon-brightness: '\e1038'; +$glyph-icon-contrast: '\e1039'; +$glyph-icon-reset: '\e1040'; $glyph-icon-activity: '\e1100'; $glyph-icon-activity-mode: '\e1101'; $glyph-icon-autoflow-tabular: '\e1102'; @@ -173,6 +176,9 @@ $glyph-icon-box-with-dashed-lines: '\e1129'; .icon-two-parts-both { @include glyph($glyph-icon-two-parts-both); } .icon-two-parts-one-only { @include glyph($glyph-icon-two-parts-one-only); } .icon-x-in-circle { @include glyph($glyph-icon-x-in-circle); } +.icon-brightness { @include glyph($glyph-icon-brightness); } +.icon-contrast { @include glyph($glyph-icon-contrast); } +.icon-reset { @include glyph($glyph-icon-reset); } .icon-activity { @include glyph($glyph-icon-activity); } .icon-activity-mode { @include glyph($glyph-icon-activity-mode); } .icon-autoflow-tabular { @include glyph($glyph-icon-autoflow-tabular); } diff --git a/platform/commonUI/general/res/sass/controls/_controls.scss b/platform/commonUI/general/res/sass/controls/_controls.scss index ad32ea0515..e15ae019f5 100644 --- a/platform/commonUI/general/res/sass/controls/_controls.scss +++ b/platform/commonUI/general/res/sass/controls/_controls.scss @@ -122,13 +122,21 @@ // Default position is upper right $p: $interiorMargin; position: absolute; - top: $p; - right: $p; + top: $p; right: $p; bottom: auto; + text-align: right; z-index: 5; } .s-local-controls { + @include trans-prop-nice(opacity); font-size: 0.7rem; + &.s-wrapper-transluc { + // Semi-opaque wrapper to visually distinguish a control + // from the background + background: rgba($colorTransLucBg, 0.7); + box-sizing: border-box; + border-radius: $controlCr; + } } /******************************************************** CUSTOM CHECKBOXES */ @@ -459,7 +467,7 @@ input[type="search"] { width: $h; height: $h; margin-top: 1 + floor($h/2) * -1; - @include btnSubtle(pullForward($colorBtnBg, 10%)); + @include btnSubtle(pullForward($colorBtnBg, 20%)); border-radius: 50% !important; } diff --git a/platform/commonUI/general/res/sass/features/_imagery.scss b/platform/commonUI/general/res/sass/features/_imagery.scss index e33970b0e9..3eb8a35122 100644 --- a/platform/commonUI/general/res/sass/features/_imagery.scss +++ b/platform/commonUI/general/res/sass/features/_imagery.scss @@ -1,5 +1,6 @@ .l-image-main-wrapper, -.l-image-thumbs-wrapper { +.l-image-thumbs-wrapper, +.image-main { @include absPosDefault(0, false); } @@ -32,7 +33,7 @@ /*************************************** MAIN IMAGE */ -.l-image-main, +.image-main, .l-image-thumb-item .l-thumb { background-size: contain; background-position: center; @@ -134,6 +135,54 @@ } } +/*************************************** LOCAL CONTROLS */ +.l-local-controls { + max-width: 200px; + width: 35%; + input[type="range"] { + display: block; + width: 100%; + &:not(:first-child) { + margin-top: $interiorMarginLg; + } + + &:before { + margin-right: $interiorMarginSm; + } + } + + .t-reset-btn-holder { + $bc: $scrollbarTrackColorBg; + &:before, + &:after { + border-right: 1px solid $bc; + content:''; + display: block; + width: 5px; + height: 4px; + } + + &:before { + border-top: 1px solid $bc; + margin-bottom: 2px; + } + + &:after { + border-bottom: 1px solid $bc; + margin-top: 2px; + } + } + + &.s-wrapper-transluc { + left: auto; + padding: $interiorMargin $interiorMarginLg; + } + + &.l-flex-row { + align-items: center; + } +} + /*************************************** WHEN IN FRAME */ .frame .t-imagery { .l-image-main-wrapper { diff --git a/platform/commonUI/themes/espresso/res/sass/_constants.scss b/platform/commonUI/themes/espresso/res/sass/_constants.scss index 54cc0a2cdd..4638281975 100644 --- a/platform/commonUI/themes/espresso/res/sass/_constants.scss +++ b/platform/commonUI/themes/espresso/res/sass/_constants.scss @@ -50,6 +50,7 @@ $sliderKnobW: 15px; $sliderKnobR: 2px; $timeControllerToiLineColor: #00c2ff; $timeControllerToiLineColorHov: #fff; +$colorTransLucBg: #666; // Used as a visual blocking element over variable backgrounds, like imagery // General Colors $colorAlt1: #ffc700; diff --git a/platform/commonUI/themes/snow/res/sass/_constants.scss b/platform/commonUI/themes/snow/res/sass/_constants.scss index 99dace8787..7ebe58b9cc 100644 --- a/platform/commonUI/themes/snow/res/sass/_constants.scss +++ b/platform/commonUI/themes/snow/res/sass/_constants.scss @@ -50,6 +50,7 @@ $sliderKnobW: 15px; $sliderKnobR: 2px; $timeControllerToiLineColor: $colorBodyFg; $timeControllerToiLineColorHov: #0052b5; +$colorTransLucBg: #666; // Used as a visual blocking element over variable backgrounds, like imagery // General Colors $colorAlt1: #776ba2; diff --git a/platform/features/imagery/res/templates/imagery.html b/platform/features/imagery/res/templates/imagery.html index fbdf4535af..542ef66e56 100644 --- a/platform/features/imagery/res/templates/imagery.html +++ b/platform/features/imagery/res/templates/imagery.html @@ -2,25 +2,33 @@
-
- - - - - +
+ + + + + + + + +
+ ng-class="{ paused: imagery.paused(), stale:false }"> +
+
diff --git a/platform/features/imagery/src/controllers/ImageryController.js b/platform/features/imagery/src/controllers/ImageryController.js index 33a442c206..71e5268a10 100644 --- a/platform/features/imagery/src/controllers/ImageryController.js +++ b/platform/features/imagery/src/controllers/ImageryController.js @@ -66,6 +66,11 @@ define( ); } + $scope.filters = { + brightness: 100, + contrast: 100 + }; + // Subscribe to telemetry when a domain object becomes available $scope.$watch('domainObject', subscribe); diff --git a/platform/features/imagery/src/directives/MCTBackgroundImage.js b/platform/features/imagery/src/directives/MCTBackgroundImage.js index d03c865e69..7a4a38d051 100644 --- a/platform/features/imagery/src/directives/MCTBackgroundImage.js +++ b/platform/features/imagery/src/directives/MCTBackgroundImage.js @@ -30,7 +30,13 @@ define( * property to the URL given in its value, but only after that * image has loaded; this avoids "flashing" as images change. * - * If `src` is falsy, no image will be displayed (immediately.) + * If the value of `mct-background-image`is falsy, no image + * will be displayed (immediately.) + * + * Optionally, a `filters` attribute may be specified as an + * object with `brightness` and/or `contrast` properties, + * whose values are percentages. A value of 100 will make + * no changes to the image's brightness or contrast. * * @constructor * @memberof platform/features/imagery @@ -51,6 +57,15 @@ define( // do not display out-of-order. var requested = 0, loaded = 0; + function updateFilters(filters) { + var styleValue = filters ? + Object.keys(filters).map(function (k) { + return k + "(" + filters[k] + "%)"; + }).join(' ') : + ""; + element.css('filter', styleValue); + } + function nextImage(url) { var myCounter = requested, image; @@ -75,11 +90,15 @@ define( } scope.$watch('mctBackgroundImage', nextImage); + scope.$watchCollection('filters', updateFilters); } return { restrict: "A", - scope: { mctBackgroundImage: "=" }, + scope: { + mctBackgroundImage: "=", + filters: "=" + }, link: link }; } diff --git a/platform/features/imagery/test/directives/MCTBackgroundImageSpec.js b/platform/features/imagery/test/directives/MCTBackgroundImageSpec.js index 262fc68fec..5ac9fd1a66 100644 --- a/platform/features/imagery/test/directives/MCTBackgroundImageSpec.js +++ b/platform/features/imagery/test/directives/MCTBackgroundImageSpec.js @@ -35,7 +35,10 @@ define( mockDocument = [ jasmine.createSpyObj('document', ['createElement']) ]; - mockScope = jasmine.createSpyObj('scope', ['$watch']); + mockScope = jasmine.createSpyObj('scope', [ + '$watch', + '$watchCollection' + ]); mockElement = jasmine.createSpyObj('element', ['css']); testImage = {}; @@ -52,46 +55,70 @@ define( expect(directive.scope.mctBackgroundImage).toEqual("="); }); - it("watches for changes to the URL", function () { - directive.link(mockScope, mockElement, {}); - expect(mockScope.$watch).toHaveBeenCalledWith( - 'mctBackgroundImage', - jasmine.any(Function) - ); - }); + describe("once linked", function () { + beforeEach(function () { + directive.link(mockScope, mockElement, {}); + }); - it("updates images in-order, even when they load out-of-order", function () { - var firstOnload; + it("watches for changes to the URL", function () { + expect(mockScope.$watch).toHaveBeenCalledWith( + 'mctBackgroundImage', + jasmine.any(Function) + ); + }); - directive.link(mockScope, mockElement); + it("updates images in-order, even when they load out-of-order", function () { + var firstOnload; - mockScope.$watch.mostRecentCall.args[1]("some/url/0"); - firstOnload = testImage.onload; + mockScope.$watch.mostRecentCall.args[1]("some/url/0"); + firstOnload = testImage.onload; - mockScope.$watch.mostRecentCall.args[1]("some/url/1"); + mockScope.$watch.mostRecentCall.args[1]("some/url/1"); - // Resolve in a different order - testImage.onload(); - firstOnload(); + // Resolve in a different order + testImage.onload(); + firstOnload(); - // Should still have taken the more recent value - expect(mockElement.css.mostRecentCall.args).toEqual([ - "background-image", - "url('some/url/1')" - ]); - }); + // Should still have taken the more recent value + expect(mockElement.css.mostRecentCall.args).toEqual([ + "background-image", + "url('some/url/1')" + ]); + }); - it("clears the background image when undefined is passed in", function () { - directive.link(mockScope, mockElement); + it("clears the background image when undefined is passed in", function () { + mockScope.$watch.mostRecentCall.args[1]("some/url/0"); + testImage.onload(); + mockScope.$watch.mostRecentCall.args[1](undefined); - mockScope.$watch.mostRecentCall.args[1]("some/url/0"); - testImage.onload(); - mockScope.$watch.mostRecentCall.args[1](undefined); + expect(mockElement.css.mostRecentCall.args).toEqual([ + "background-image", + "none" + ]); + }); - expect(mockElement.css.mostRecentCall.args).toEqual([ - "background-image", - "none" - ]); + it("updates filters on change", function () { + var filters = { brightness: 123, contrast: 21 }; + mockScope.$watchCollection.calls.forEach(function (call) { + if (call.args[0] === 'filters') { + call.args[1](filters); + } + }); + expect(mockElement.css).toHaveBeenCalledWith( + 'filter', + 'brightness(123%) contrast(21%)' + ); + }); + + it("clears filters when none are present", function () { + mockScope.$watchCollection.calls.forEach(function (call) { + if (call.args[0] === 'filters') { + call.args[1](undefined); + } + }); + expect(mockElement.css) + .toHaveBeenCalledWith('filter', ''); + }); }); }); }