Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ElementInteractiveGroupComponent } from './element-interactive-group.component';
import { Component, Input } from '@angular/core';
import { UIElement } from 'common/interfaces/elements';
import { CastPipe } from 'player/src/app/pipes/cast.pipe';
import { UnitStateService } from 'player/src/app/services/unit-state.service';
describe('ElementInteractiveGroupComponent', () => {
let component: ElementInteractiveGroupComponent;
let fixture: ComponentFixture<ElementInteractiveGroupComponent>;
let mockUnitStateService: UnitStateService;
@Component({ selector: 'aspect-button', template: '' })
class ButtonStubComponent {
@Input() elementModel!: UIElement;
}
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
ElementInteractiveGroupComponent,
ButtonStubComponent,
CastPipe
]
})
.compileComponents();
});
beforeEach(() => {
mockUnitStateService = TestBed.inject(UnitStateService);
fixture = TestBed.createComponent(ElementInteractiveGroupComponent);
spyOn(mockUnitStateService, 'registerElement')
.withArgs('test', 0, document.createElement('div'), 1);
spyOn(mockUnitStateService, 'getElementCodeById').withArgs('test').and
.returnValue({ id: 'test', status: 'NOT_REACHED', value: 0 });
component = fixture.componentInstance;
component.elementModel = {
type: 'button',
id: 'test',
width: 0,
height: 0
};
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});