|
20 | 20 | * at runtime from the About dialog for additional information. |
21 | 21 | *****************************************************************************/ |
22 | 22 |
|
23 | | -import mount from 'utils/mount'; |
24 | 23 | import { createOpenMct, resetApplicationState } from 'utils/testing'; |
25 | | -import { nextTick } from 'vue'; |
26 | 24 |
|
27 | | -import Properties from '../inspectorViews/properties/PropertiesComponent.vue'; |
28 | 25 | import PlanPlugin from '../plan/plugin.js'; |
29 | 26 |
|
30 | 27 | describe('the plugin', function () { |
@@ -129,176 +126,4 @@ describe('the plugin', function () { |
129 | 126 | expect(planView.canEdit(testViewObject)).toBeFalse(); |
130 | 127 | }); |
131 | 128 | }); |
132 | | - |
133 | | - describe('the plan view displays activities', () => { |
134 | | - let planDomainObject; |
135 | | - let mockObjectPath = [ |
136 | | - { |
137 | | - identifier: { |
138 | | - key: 'test', |
139 | | - namespace: '' |
140 | | - }, |
141 | | - type: 'time-strip', |
142 | | - name: 'Test Parent Object' |
143 | | - } |
144 | | - ]; |
145 | | - let planView; |
146 | | - |
147 | | - beforeEach(() => { |
148 | | - openmct.time.timeSystem('utc', { |
149 | | - start: 1597160002854, |
150 | | - end: 1597181232854 |
151 | | - }); |
152 | | - |
153 | | - planDomainObject = { |
154 | | - identifier: { |
155 | | - key: 'test-object', |
156 | | - namespace: '' |
157 | | - }, |
158 | | - type: 'plan', |
159 | | - id: 'test-object', |
160 | | - selectFile: { |
161 | | - body: JSON.stringify({ |
162 | | - 'TEST-GROUP': [ |
163 | | - { |
164 | | - name: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua', |
165 | | - start: 1597170002854, |
166 | | - end: 1597171032854, |
167 | | - type: 'TEST-GROUP', |
168 | | - color: 'fuchsia', |
169 | | - textColor: 'black' |
170 | | - }, |
171 | | - { |
172 | | - name: 'Sed ut perspiciatis', |
173 | | - start: 1597171132854, |
174 | | - end: 1597171232854, |
175 | | - type: 'TEST-GROUP', |
176 | | - color: 'fuchsia', |
177 | | - textColor: 'black' |
178 | | - } |
179 | | - ] |
180 | | - }) |
181 | | - } |
182 | | - }; |
183 | | - |
184 | | - openmct.router.path = [planDomainObject]; |
185 | | - |
186 | | - const applicableViews = openmct.objectViews.get(planDomainObject, [planDomainObject]); |
187 | | - planView = applicableViews.find((viewProvider) => viewProvider.key === 'plan.view'); |
188 | | - let view = planView.view(planDomainObject, mockObjectPath); |
189 | | - view.show(child, true); |
190 | | - |
191 | | - return nextTick(); |
192 | | - }); |
193 | | - |
194 | | - it('loads activities into the view', () => { |
195 | | - const svgEls = element.querySelectorAll('.c-plan__contents svg'); |
196 | | - expect(svgEls.length).toEqual(1); |
197 | | - }); |
198 | | - |
199 | | - it('displays the group label', () => { |
200 | | - const labelEl = element.querySelector( |
201 | | - '.c-plan__contents .c-object-label .c-object-label__name' |
202 | | - ); |
203 | | - expect(labelEl.innerHTML).toMatch(/TEST-GROUP/); |
204 | | - }); |
205 | | - |
206 | | - it('displays the activities and their labels', async () => { |
207 | | - const bounds = { |
208 | | - start: 1597160002854, |
209 | | - end: 1597181232854 |
210 | | - }; |
211 | | - |
212 | | - openmct.time.bounds(bounds); |
213 | | - |
214 | | - await nextTick(); |
215 | | - const rectEls = element.querySelectorAll('.c-plan__contents use'); |
216 | | - expect(rectEls.length).toEqual(2); |
217 | | - const textEls = element.querySelectorAll('.c-plan__contents text'); |
218 | | - expect(textEls.length).toEqual(3); |
219 | | - }); |
220 | | - |
221 | | - it('shows the status indicator when available', async () => { |
222 | | - openmct.status.set( |
223 | | - { |
224 | | - key: 'test-object', |
225 | | - namespace: '' |
226 | | - }, |
227 | | - 'draft' |
228 | | - ); |
229 | | - |
230 | | - await nextTick(); |
231 | | - const statusEl = element.querySelector('.c-plan__contents .is-status--draft'); |
232 | | - expect(statusEl).toBeDefined(); |
233 | | - }); |
234 | | - }); |
235 | | - |
236 | | - describe('the plan version', () => { |
237 | | - let component; |
238 | | - let componentObject; |
239 | | - let _destroy; |
240 | | - let testPlanObject = { |
241 | | - name: 'Plan', |
242 | | - type: 'plan', |
243 | | - identifier: { |
244 | | - key: 'test-plan', |
245 | | - namespace: '' |
246 | | - }, |
247 | | - created: 123456789, |
248 | | - modified: 123456790, |
249 | | - version: 'v1' |
250 | | - }; |
251 | | - |
252 | | - beforeEach(async () => { |
253 | | - openmct.selection.select( |
254 | | - [ |
255 | | - { |
256 | | - element: element, |
257 | | - context: { |
258 | | - item: testPlanObject |
259 | | - } |
260 | | - }, |
261 | | - { |
262 | | - element: openmct.layout.$refs.browseObject.$el, |
263 | | - context: { |
264 | | - item: testPlanObject, |
265 | | - supportsMultiSelect: false |
266 | | - } |
267 | | - } |
268 | | - ], |
269 | | - false |
270 | | - ); |
271 | | - |
272 | | - await nextTick(); |
273 | | - let viewContainer = document.createElement('div'); |
274 | | - child.append(viewContainer); |
275 | | - const { vNode, destroy } = mount({ |
276 | | - components: { |
277 | | - Properties |
278 | | - }, |
279 | | - provide: { |
280 | | - openmct: openmct |
281 | | - }, |
282 | | - template: '<properties ref="root"/>' |
283 | | - }); |
284 | | - _destroy = destroy; |
285 | | - component = vNode.componentInstance; |
286 | | - }); |
287 | | - |
288 | | - afterEach(() => { |
289 | | - _destroy(); |
290 | | - }); |
291 | | - |
292 | | - it('provides an inspector view with the version information if available', () => { |
293 | | - componentObject = component.$refs.root; |
294 | | - const propertiesEls = componentObject.$el.querySelectorAll('.c-inspect-properties__row'); |
295 | | - const found = Array.from(propertiesEls).some((propertyEl) => { |
296 | | - return ( |
297 | | - propertyEl.children[0].innerHTML.trim() === 'Version' && |
298 | | - propertyEl.children[1].innerHTML.trim() === 'v1' |
299 | | - ); |
300 | | - }); |
301 | | - expect(found).toBeTrue(); |
302 | | - }); |
303 | | - }); |
304 | 129 | }); |
0 commit comments