From b7be5b9dbc2ca4907a14a91b032aa1140e20924d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jovan=20Kruni=C4=87?= Date: Fri, 18 Feb 2022 10:34:45 +0100 Subject: [PATCH] test: mock content for the context menu --- src/app/modules/map/page/map-page.html | 2 +- .../context/context-menu.component.spec.ts | 20 ++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/app/modules/map/page/map-page.html b/src/app/modules/map/page/map-page.html index c461a67e..733c0996 100644 --- a/src/app/modules/map/page/map-page.html +++ b/src/app/modules/map/page/map-page.html @@ -1,4 +1,4 @@ - + diff --git a/src/app/modules/menu/context/context-menu.component.spec.ts b/src/app/modules/menu/context/context-menu.component.spec.ts index dfaee429..dc61b7b3 100644 --- a/src/app/modules/menu/context/context-menu.component.spec.ts +++ b/src/app/modules/menu/context/context-menu.component.spec.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion,@typescript-eslint/ban-ts-comment */ /* * Copyright (C) 2020 StApps * This program is free software: you can redistribute it and/or modify it @@ -34,14 +33,25 @@ import {ContextMenuComponent} from './context-menu.component'; import {SettingsModule} from '../../settings/settings.module'; import {ContextMenuService} from './context-menu.service'; import {FilterContext, SortContext} from './context-type'; +import {Component} from '@angular/core'; +import {By} from '@angular/platform-browser'; + +@Component({ + template: ` + + + `, +}) +class ContextMenuComponentContainer { +} describe('ContextMenuComponent', async () => { - let fixture: ComponentFixture; + let fixture: ComponentFixture; let instance: ContextMenuComponent; beforeEach(() => { TestBed.configureTestingModule({ - declarations: [ContextMenuComponent], + declarations: [ContextMenuComponent, ContextMenuComponentContainer], providers: [ ChildrenOutletContexts, Location, @@ -60,8 +70,8 @@ describe('ContextMenuComponent', async () => { ], }).compileComponents(); - fixture = TestBed.createComponent(ContextMenuComponent); - instance = fixture.componentInstance; + fixture = TestBed.createComponent(ContextMenuComponentContainer); + instance = fixture.debugElement.query(By.directive(ContextMenuComponent)).componentInstance; }); it('should show items in sort context', () => {