Warning, /firebird/firebird-ng/src/app/components/auto-rotate/auto-rotate.component.test.ts is written in an unsupported language. File is not indexed.
0001 import { ComponentFixture, TestBed } from '@angular/core/testing';
0002
0003 import { AutoRotateComponent } from './auto-rotate.component';
0004 import { EventDisplayService } from '../../../services/event-display.service';
0005 import { PhoenixUIModule } from '../../phoenix-ui.module';
0006
0007 describe('AutoRotateComponent', () => {
0008 let component: AutoRotateComponent;
0009 let fixture: ComponentFixture<AutoRotateComponent>;
0010
0011 const mockEventDisplay = {
0012 getUIManager: jest.fn().mockReturnThis(),
0013 setAutoRotate: jest.fn().mockReturnThis(),
0014 };
0015
0016 beforeEach(() => {
0017 TestBed.configureTestingModule({
0018 imports: [PhoenixUIModule],
0019 providers: [
0020 {
0021 provide: EventDisplayService,
0022 useValue: mockEventDisplay,
0023 },
0024 ],
0025 declarations: [AutoRotateComponent],
0026 }).compileComponents();
0027 });
0028
0029 beforeEach(() => {
0030 fixture = TestBed.createComponent(AutoRotateComponent);
0031 component = fixture.componentInstance;
0032 fixture.detectChanges();
0033 });
0034
0035 it('should create', () => {
0036 expect(component).toBeTruthy();
0037 });
0038
0039 it('should toggle auto rotate', () => {
0040 expect(component.autoRotate).toBe(false);
0041
0042 component.toggleAutoRotate();
0043
0044 expect(component.autoRotate).toBe(true);
0045 expect(mockEventDisplay.getUIManager().setAutoRotate).toHaveBeenCalledWith(
0046 component.autoRotate,
0047 );
0048 });
0049 });