[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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

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

View File

@ -7,15 +7,14 @@ export default class Snapshot {
constructor(openmct) {
this.openmct = 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._saveSnapShot = this._saveSnapShot.bind(this);
}
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) {
const reader = new window.FileReader();
reader.readAsDataURL(blob);

View File

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