[Testing] Fixes console errors while running npm test (#3593)

* ERROR: Error: [$injector:unpr] Unknown provider: exportImageServiceProvider <- exportImageService
* [Vue warn]: Injection "stylesManager" not found
* [Vue warn]: Error in mounted hook: "TypeError: identifier is undefined"
This commit is contained in:
Nikhil
2020-12-10 19:44:51 -08:00
committed by GitHub
parent 5eb6c15959
commit 52fab78625
3 changed files with 9 additions and 4 deletions

View File

@ -22,6 +22,7 @@
import { createOpenMct, resetApplicationState } from "utils/testing"; import { createOpenMct, resetApplicationState } from "utils/testing";
import ConditionPlugin from "./plugin"; import ConditionPlugin from "./plugin";
import stylesManager from '@/ui/inspector/styles/StylesManager';
import StylesView from "./components/inspector/StylesView.vue"; import StylesView from "./components/inspector/StylesView.vue";
import Vue from 'vue'; import Vue from 'vue';
import {getApplicableStylesForItem} from "./utils/styleUtils"; import {getApplicableStylesForItem} from "./utils/styleUtils";
@ -402,7 +403,8 @@ describe('the plugin', function () {
component = new Vue({ component = new Vue({
provide: { provide: {
openmct: openmct, openmct: openmct,
selection: selection selection: selection,
stylesManager
}, },
el: viewContainer, el: viewContainer,
components: { components: {

View File

@ -7,15 +7,14 @@ export default class Snapshot {
constructor(openmct) { constructor(openmct) {
this.openmct = openmct; this.openmct = openmct;
this.snapshotContainer = new SnapshotContainer(openmct); this.snapshotContainer = new SnapshotContainer(openmct);
this.exportImageService = openmct.$injector.get('exportImageService');
this.dialogService = openmct.$injector.get('dialogService');
this.capture = this.capture.bind(this); this.capture = this.capture.bind(this);
this._saveSnapShot = this._saveSnapShot.bind(this); this._saveSnapShot = this._saveSnapShot.bind(this);
} }
capture(snapshotMeta, notebookType, domElement) { capture(snapshotMeta, notebookType, domElement) {
this.exportImageService.exportPNGtoSRC(domElement, 's-status-taking-snapshot') const exportImageService = this.openmct.$injector.get('exportImageService');
exportImageService.exportPNGtoSRC(domElement, 's-status-taking-snapshot')
.then(function (blob) { .then(function (blob) {
const reader = new window.FileReader(); const reader = new window.FileReader();
reader.readAsDataURL(blob); reader.readAsDataURL(blob);

View File

@ -98,6 +98,10 @@ describe('the plugin', function () {
beforeEach((done) => { beforeEach((done) => {
planDomainObject = { planDomainObject = {
identifier: {
key: 'test-object',
namespace: ''
},
type: 'plan', type: 'plan',
id: "test-object", id: "test-object",
selectFile: { selectFile: {