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 {CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA} from '@angular/core'; 17import {ComponentFixture, ComponentFixtureAutoDetect, TestBed} from '@angular/core/testing'; 18import {MatDividerModule} from '@angular/material/divider'; 19import {MatIconModule} from '@angular/material/icon'; 20import {HierarchyComponent} from 'viewers/components/hierarchy_component'; 21import {PropertiesComponent} from 'viewers/components/properties_component'; 22import {ViewerInputMethodComponent} from './viewer_input_method_component'; 23 24describe('ViewerInputMethodComponent', () => { 25 let fixture: ComponentFixture<ViewerInputMethodComponent>; 26 let component: ViewerInputMethodComponent; 27 let htmlElement: HTMLElement; 28 29 beforeAll(async () => { 30 await TestBed.configureTestingModule({ 31 providers: [{provide: ComponentFixtureAutoDetect, useValue: true}], 32 imports: [MatIconModule, MatDividerModule], 33 declarations: [ViewerInputMethodComponent, HierarchyComponent, PropertiesComponent], 34 schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA], 35 }).compileComponents(); 36 }); 37 38 beforeEach(() => { 39 fixture = TestBed.createComponent(ViewerInputMethodComponent); 40 component = fixture.componentInstance; 41 htmlElement = fixture.nativeElement; 42 }); 43 44 it('can be created', () => { 45 expect(component).toBeTruthy(); 46 }); 47 48 it('creates hierarchy view', () => { 49 const hierarchyView = htmlElement.querySelector('.hierarchy-view'); 50 expect(hierarchyView).toBeTruthy(); 51 }); 52 53 it('creates properties view', () => { 54 const propertiesView = htmlElement.querySelector('.properties-view'); 55 expect(propertiesView).toBeTruthy(); 56 }); 57}); 58