import { ComponentFixture, TestBed } from '@angular/core/testing'; import { SelectComponent } from './select.component'; import { By } from '@angular/platform-browser'; describe('SelectComponent', () => { let component: SelectComponent; let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ imports: [SelectComponent], }).compileComponents(); fixture = TestBed.createComponent(SelectComponent); component = fixture.componentInstance; fixture.componentRef.setInput('options', [ { label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' } ]); fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); it('should render options', () => { const options = fixture.debugElement.queryAll(By.css('option')); expect(options.length).toBe(2); expect(options[0].nativeElement.textContent.trim()).toBe('Option 1'); }); it('should apply size classes correctly', () => { fixture.componentRef.setInput('size', 'lg'); fixture.detectChanges(); const selectEl = fixture.debugElement.query(By.css('select')); expect(selectEl.classes['mv-select--lg']).toBe(true); }); it('should handle disabled state', () => { fixture.componentRef.setInput('disabled', true); fixture.detectChanges(); const selectEl = fixture.debugElement.query(By.css('select')); expect(selectEl.nativeElement.disabled).toBe(true); }); });