@skyux/phone-field 14.0.0-alpha.8 → 14.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/skyux-phone-field-testing.mjs +13 -16
- package/fesm2022/skyux-phone-field-testing.mjs.map +1 -1
- package/fesm2022/skyux-phone-field.mjs +73 -190
- package/fesm2022/skyux-phone-field.mjs.map +1 -1
- package/package.json +7 -9
- package/types/skyux-phone-field-testing.d.ts +1 -2
- package/types/skyux-phone-field.d.ts +3 -10
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { NgModule } from '@angular/core';
|
|
3
|
-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
4
3
|
import { SkyPhoneFieldModule } from '@skyux/phone-field';
|
|
5
4
|
import { SkyInputHarness, SkyComponentHarness } from '@skyux/core/testing';
|
|
6
5
|
import { SkyCountryFieldHarness } from '@skyux/lookup/testing';
|
|
@@ -10,24 +9,13 @@ import { SkyCountryFieldHarness } from '@skyux/lookup/testing';
|
|
|
10
9
|
*/
|
|
11
10
|
class SkyPhoneFieldTestingModule {
|
|
12
11
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SkyPhoneFieldTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
13
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.0", ngImport: i0, type: SkyPhoneFieldTestingModule, exports: [SkyPhoneFieldModule
|
|
14
|
-
|
|
15
|
-
// subsequent modules adding animations and overriding this.
|
|
16
|
-
NoopAnimationsModule] }); }
|
|
17
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SkyPhoneFieldTestingModule, imports: [SkyPhoneFieldModule,
|
|
18
|
-
// The noop animations module needs to be loaded last to avoid
|
|
19
|
-
// subsequent modules adding animations and overriding this.
|
|
20
|
-
NoopAnimationsModule] }); }
|
|
12
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.0", ngImport: i0, type: SkyPhoneFieldTestingModule, exports: [SkyPhoneFieldModule] }); }
|
|
13
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SkyPhoneFieldTestingModule, imports: [SkyPhoneFieldModule] }); }
|
|
21
14
|
}
|
|
22
15
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SkyPhoneFieldTestingModule, decorators: [{
|
|
23
16
|
type: NgModule,
|
|
24
17
|
args: [{
|
|
25
|
-
exports: [
|
|
26
|
-
SkyPhoneFieldModule,
|
|
27
|
-
// The noop animations module needs to be loaded last to avoid
|
|
28
|
-
// subsequent modules adding animations and overriding this.
|
|
29
|
-
NoopAnimationsModule,
|
|
30
|
-
],
|
|
18
|
+
exports: [SkyPhoneFieldModule],
|
|
31
19
|
}]
|
|
32
20
|
}] });
|
|
33
21
|
|
|
@@ -104,7 +92,16 @@ class SkyPhoneFieldHarness extends SkyComponentHarness {
|
|
|
104
92
|
await countryField.selectSearchResult({});
|
|
105
93
|
}
|
|
106
94
|
async #openCountrySelectionAndSearch(searchText) {
|
|
107
|
-
|
|
95
|
+
const button = await this.#getCountryFieldButton();
|
|
96
|
+
// Focus the button before clicking to move focus away from the phone input.
|
|
97
|
+
// Without this, the phone input remains focused when the component toggles
|
|
98
|
+
// to the country search view, and Angular's @if removal of the focused
|
|
99
|
+
// input fires a blur event during change detection, causing an
|
|
100
|
+
// ExpressionChangedAfterItHasBeenCheckedError. In a real browser, clicking
|
|
101
|
+
// the button naturally moves focus, so this aligns test behavior with
|
|
102
|
+
// actual user interaction.
|
|
103
|
+
await button.focus();
|
|
104
|
+
await button.click();
|
|
108
105
|
const countryField = await this.#getCountryField();
|
|
109
106
|
await countryField?.enterText(searchText);
|
|
110
107
|
return countryField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skyux-phone-field-testing.mjs","sources":["../../../../../libs/components/phone-field/testing/src/legacy/phone-field/phone-field-testing.module.ts","../../../../../libs/components/phone-field/testing/src/modules/phone-field/phone-field-input-harness.ts","../../../../../libs/components/phone-field/testing/src/modules/phone-field/phone-field-harness.ts","../../../../../libs/components/phone-field/testing/src/skyux-phone-field-testing.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport {
|
|
1
|
+
{"version":3,"file":"skyux-phone-field-testing.mjs","sources":["../../../../../libs/components/phone-field/testing/src/legacy/phone-field/phone-field-testing.module.ts","../../../../../libs/components/phone-field/testing/src/modules/phone-field/phone-field-input-harness.ts","../../../../../libs/components/phone-field/testing/src/modules/phone-field/phone-field-harness.ts","../../../../../libs/components/phone-field/testing/src/skyux-phone-field-testing.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport { SkyPhoneFieldModule } from '@skyux/phone-field';\n\n/**\n * @internal\n */\n@NgModule({\n exports: [SkyPhoneFieldModule],\n})\nexport class SkyPhoneFieldTestingModule {}\n","import { SkyInputHarness } from '@skyux/core/testing';\n\n/**\n * Harness to interact with the phone field input harness.\n */\nexport class SkyPhoneFieldInputHarness extends SkyInputHarness {\n /**\n * @internal\n */\n public static hostSelector = '[skyPhoneFieldInput]';\n}\n","import { HarnessPredicate } from '@angular/cdk/testing';\nimport { SkyComponentHarness } from '@skyux/core/testing';\nimport { SkyCountryFieldHarness } from '@skyux/lookup/testing';\n\nimport { SkyPhoneFieldHarnessFilters } from './phone-field-harness-filters';\nimport { SkyPhoneFieldInputHarness } from './phone-field-input-harness';\n\n/**\n * Harness for interacting with a phone field component in tests.\n */\nexport class SkyPhoneFieldHarness extends SkyComponentHarness {\n /**\n * Finds a standard phone field component, or a phone field component that is wrapped by an input box component.\n * For input box implementations, we need to use the `.sky-input-box` selector since the `sky-country-field`\n * element is removed from the DOM.\n * @internal\n */\n public static hostSelector = 'sky-phone-field,.sky-input-box';\n\n #getCountryField = this.locatorForOptional(SkyCountryFieldHarness);\n #getCountryFieldButton = this.locatorFor(\n '.sky-phone-field-country-btn button',\n );\n #getCountryFieldButtonContainer = this.locatorFor(\n '.sky-phone-field-country-btn',\n );\n #getInput = this.locatorFor(SkyPhoneFieldInputHarness);\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a\n * `SkyPhoneFieldHarness` that meets certain criteria.\n *\n * These filters only work for standalone phone fields. For phone fields\n * wrapped inside `sky-input-box`, place filters on the input box\n * instead and query the datepicker using a `SkyInputBoxHarness`.\n * For the input box implementation, see the code example.\n */\n public static with(\n filters: SkyPhoneFieldHarnessFilters,\n ): HarnessPredicate<SkyPhoneFieldHarness> {\n return SkyPhoneFieldHarness.getDataSkyIdPredicate(filters);\n }\n\n /**\n * Gets the phone field input harness.\n */\n public async getControl(): Promise<SkyPhoneFieldInputHarness> {\n return await this.#getInput();\n }\n\n /**\n * Returns the selected country iso2 code.\n */\n public async getSelectedCountryIso2(): Promise<string | null> {\n return await (\n await this.#getCountryFieldButtonContainer()\n ).getAttribute('data-sky-test-iso2');\n }\n\n /**\n * Returns the selected country name.\n */\n public async getSelectedCountryName(): Promise<string | null> {\n return await (\n await this.#getCountryFieldButtonContainer()\n ).getAttribute('data-sky-test-name');\n }\n\n /**\n * Opens the country selector, performs a search, but makes no selection.\n * @param searchText The name of the country to select.\n * @returns The list of country names matching the search text.\n */\n public async searchCountry(searchText: string): Promise<string[]> {\n const countryField = await this.#openCountrySelectionAndSearch(searchText);\n\n return await countryField.getSearchResultsText();\n }\n\n /**\n * Opens the country selector, performs a search, and selects the first result (if any).\n * @param searchText The name of the country to select.\n */\n public async selectCountry(searchText: string): Promise<void> {\n const countryField = await this.#openCountrySelectionAndSearch(searchText);\n\n await countryField.selectSearchResult({});\n }\n\n async #openCountrySelectionAndSearch(\n searchText: string,\n ): Promise<SkyCountryFieldHarness> {\n const button = await this.#getCountryFieldButton();\n\n // Focus the button before clicking to move focus away from the phone input.\n // Without this, the phone input remains focused when the component toggles\n // to the country search view, and Angular's @if removal of the focused\n // input fires a blur event during change detection, causing an\n // ExpressionChangedAfterItHasBeenCheckedError. In a real browser, clicking\n // the button naturally moves focus, so this aligns test behavior with\n // actual user interaction.\n await button.focus();\n await button.click();\n\n const countryField = await this.#getCountryField();\n\n await countryField?.enterText(searchText);\n\n return countryField!;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAGA;;AAEG;MAIU,0BAA0B,CAAA;8GAA1B,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAA1B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,YAF3B,mBAAmB,CAAA,EAAA,CAAA,CAAA;AAElB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,YAF3B,mBAAmB,CAAA,EAAA,CAAA,CAAA;;2FAElB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAHtC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,mBAAmB,CAAC;AAC/B,iBAAA;;;ACND;;AAEG;AACG,MAAO,yBAA0B,SAAQ,eAAe,CAAA;AAC5D;;AAEG;aACW,IAAA,CAAA,YAAY,GAAG,sBAAsB,CAAC;;;ACFtD;;AAEG;AACG,MAAO,oBAAqB,SAAQ,mBAAmB,CAAA;AAC3D;;;;;AAKG;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