UNPKG

ngxsmk-tel-input

Version:

Angular international telephone input (intl-tel-input UI + libphonenumber-js validation). ControlValueAccessor. SSR-safe.

120 lines 3.42 kB
/** * Test fixtures for ngxsmk-tel-input */ import { ComponentFixture } from '@angular/core/testing'; import { CountryCode } from 'libphonenumber-js'; import { NgxsmkTelInputComponent } from '../ngxsmk-tel-input.component'; /** * Test data fixtures */ export declare const TEST_PHONE_NUMBERS: { valid: { US: string; US_NATIONAL: string; GB: string; GB_NATIONAL: string; AU: string; AU_NATIONAL: string; CA: string; CA_NATIONAL: string; }; invalid: { TOO_SHORT: string; TOO_LONG: string; INVALID_COUNTRY_CODE: string; INVALID_FORMAT: string; }; }; export declare const TEST_COUNTRIES: CountryCode[]; /** * Helper to create a test component fixture */ export declare function createTestComponentFixture<T>(fixture: ComponentFixture<T>): ComponentFixture<T>; /** * Helper to get phone input component from fixture */ export declare function getPhoneInputComponent(fixture: ComponentFixture<any>): NgxsmkTelInputComponent; /** * Helper to set phone input value */ export declare function setPhoneInputValue(component: NgxsmkTelInputComponent, value: string): void; /** * Helper to select country */ export declare function selectCountry(component: NgxsmkTelInputComponent, country: CountryCode): void; /** * Helper to trigger input event */ export declare function triggerInputEvent(fixture: ComponentFixture<any>, value: string): void; /** * Helper to trigger blur event */ export declare function triggerBlurEvent(fixture: ComponentFixture<any>): void; /** * Helper to trigger focus event */ export declare function triggerFocusEvent(fixture: ComponentFixture<any>): void; /** * Helper to get current input value */ export declare function getInputValue(fixture: ComponentFixture<any>): string; /** * Helper to check if input is valid */ export declare function isInputValid(component: NgxsmkTelInputComponent): boolean; /** * Helper to check if input has errors */ export declare function hasInputErrors(component: NgxsmkTelInputComponent): boolean; /** * Helper to get validation errors */ export declare function getValidationErrors(component: NgxsmkTelInputComponent): string[]; /** * Helper to wait for async operations */ export declare function waitForAsync(fn: () => void): Promise<void>; /** * Test form control interface */ export interface TestFormControl { value: string | null; setValue: (val: string | null) => void; patchValue: (val: string | null) => void; reset: (val?: string | null) => void; } /** * Helper to create test form control */ export declare function createTestFormControl(value?: string | null): TestFormControl; /** * Test scenarios */ export declare const TEST_SCENARIOS: { validUSNumber: { input: string; country: CountryCode; expectedE164: string; expectedValid: boolean; }; validUKNumber: { input: string; country: CountryCode; expectedE164: string; expectedValid: boolean; }; invalidNumber: { input: string; country: CountryCode; expectedE164: null; expectedValid: boolean; }; invalidCountryCode: { input: string; country: CountryCode; expectedE164: null; expectedValid: boolean; expectedError: string; }; }; //# sourceMappingURL=test-fixtures.d.ts.map