1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16import {ScrollingModule} from '@angular/cdk/scrolling'; 17import {ComponentFixture, ComponentFixtureAutoDetect, TestBed} from '@angular/core/testing'; 18import {ViewerProtologComponent} from './viewer_protolog_component'; 19 20import {CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA} from '@angular/core'; 21 22describe('ViewerProtologComponent', () => { 23 let fixture: ComponentFixture<ViewerProtologComponent>; 24 let component: ViewerProtologComponent; 25 let htmlElement: HTMLElement; 26 27 beforeAll(async () => { 28 await TestBed.configureTestingModule({ 29 providers: [{provide: ComponentFixtureAutoDetect, useValue: true}], 30 imports: [ScrollingModule], 31 declarations: [ViewerProtologComponent], 32 schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA], 33 }).compileComponents(); 34 }); 35 36 beforeEach(() => { 37 fixture = TestBed.createComponent(ViewerProtologComponent); 38 component = fixture.componentInstance; 39 htmlElement = fixture.nativeElement; 40 }); 41 42 it('can be created', () => { 43 expect(component).toBeTruthy(); 44 }); 45 46 it('creates message filters', () => { 47 expect(htmlElement.querySelector('.filters .log-level')).toBeTruthy(); 48 expect(htmlElement.querySelector('.filters .tag')).toBeTruthy(); 49 expect(htmlElement.querySelector('.filters .source-file')).toBeTruthy(); 50 expect(htmlElement.querySelector('.filters .text')).toBeTruthy(); 51 }); 52 53 it('renders log messages', () => { 54 expect(htmlElement.querySelector('.scroll-messages')).toBeTruthy(); 55 }); 56}); 57