test: mock content for the context menu

This commit is contained in:
Jovan Krunić
2022-02-18 10:34:45 +01:00
parent aabb29ad05
commit b7be5b9dbc
2 changed files with 16 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
<stapps-context [contentId]="'map'"></stapps-context>
<stapps-context contentId="map"></stapps-context>
<ion-header class="ion-no-border" translucent="true">
<ion-toolbar>

View File

@@ -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: `
<ion-content id="foo"></ion-content>
<stapps-context contentId="foo"></stapps-context>
`,
})
class ContextMenuComponentContainer {
}
describe('ContextMenuComponent', async () => {
let fixture: ComponentFixture<ContextMenuComponent>;
let fixture: ComponentFixture<ContextMenuComponentContainer>;
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', () => {