@angular/cdk 19.2.13 → 19.2.15
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/_adev_assets/cdk_testing.json +7032 -1
- package/_adev_assets/cdk_testing_protractor.json +1747 -1
- package/_adev_assets/cdk_testing_selenium_webdriver.json +1801 -1
- package/_adev_assets/cdk_testing_testbed.json +1903 -1
- package/dialog/index.d.ts +17 -12
- package/fesm2022/cdk.mjs +1 -1
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/dialog.mjs +21 -9
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/testing.mjs +255 -52
- package/fesm2022/testing.mjs.map +1 -1
- package/{harness-environment.d-BatBdODN.d.ts → harness-environment.d-BbFzIFDE.d.ts} +362 -89
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/testing/index.d.ts +6 -2
- package/testing/selenium-webdriver/index.d.ts +1 -1
- package/testing/testbed/index.d.ts +1 -1
- package/npm_package/LICENSE +0 -21
- package/npm_package/README.md +0 -6
- package/npm_package/_adev_assets/cdk_testing.json +0 -1
- package/npm_package/_adev_assets/cdk_testing_protractor.json +0 -1
- package/npm_package/_adev_assets/cdk_testing_selenium_webdriver.json +0 -1
- package/npm_package/_adev_assets/cdk_testing_testbed.json +0 -1
- package/npm_package/_index.scss +0 -8
- package/npm_package/a11y/_index.scss +0 -60
- package/npm_package/a11y/index.d.ts +0 -550
- package/npm_package/a11y-module.d-DBHGyKoh.d.ts +0 -314
- package/npm_package/a11y-prebuilt.css +0 -1
- package/npm_package/accordion/index.d.ts +0 -90
- package/npm_package/activedescendant-key-manager.d-Bjic5obv.d.ts +0 -32
- package/npm_package/bidi/index.d.ts +0 -21
- package/npm_package/bidi-module.d-D-fEBKdS.d.ts +0 -54
- package/npm_package/clipboard/index.d.ts +0 -101
- package/npm_package/coercion/index.d.ts +0 -45
- package/npm_package/coercion/private/index.d.ts +0 -9
- package/npm_package/collections/index.d.ts +0 -99
- package/npm_package/data-source.d-Bblv7Zvh.d.ts +0 -43
- package/npm_package/dialog/index.d.ts +0 -426
- package/npm_package/drag-drop/index.d.ts +0 -1383
- package/npm_package/fesm2022/a11y-module-BYox5gpI.mjs +0 -952
- package/npm_package/fesm2022/a11y-module-BYox5gpI.mjs.map +0 -1
- package/npm_package/fesm2022/a11y.mjs +0 -539
- package/npm_package/fesm2022/a11y.mjs.map +0 -1
- package/npm_package/fesm2022/accordion.mjs +0 -210
- package/npm_package/fesm2022/accordion.mjs.map +0 -1
- package/npm_package/fesm2022/activedescendant-key-manager-DC3-fwQI.mjs +0 -16
- package/npm_package/fesm2022/activedescendant-key-manager-DC3-fwQI.mjs.map +0 -1
- package/npm_package/fesm2022/array-I1yfCXUO.mjs +0 -6
- package/npm_package/fesm2022/array-I1yfCXUO.mjs.map +0 -1
- package/npm_package/fesm2022/backwards-compatibility-DHR38MsD.mjs +0 -25
- package/npm_package/fesm2022/backwards-compatibility-DHR38MsD.mjs.map +0 -1
- package/npm_package/fesm2022/bidi.mjs +0 -80
- package/npm_package/fesm2022/bidi.mjs.map +0 -1
- package/npm_package/fesm2022/boolean-property-DaaVhX5A.mjs +0 -7
- package/npm_package/fesm2022/boolean-property-DaaVhX5A.mjs.map +0 -1
- package/npm_package/fesm2022/breakpoints-observer-CljOfYGy.mjs +0 -179
- package/npm_package/fesm2022/breakpoints-observer-CljOfYGy.mjs.map +0 -1
- package/npm_package/fesm2022/cdk.mjs +0 -7
- package/npm_package/fesm2022/cdk.mjs.map +0 -1
- package/npm_package/fesm2022/clipboard.mjs +0 -211
- package/npm_package/fesm2022/clipboard.mjs.map +0 -1
- package/npm_package/fesm2022/coercion/private.mjs +0 -15
- package/npm_package/fesm2022/coercion/private.mjs.map +0 -1
- package/npm_package/fesm2022/coercion.mjs +0 -39
- package/npm_package/fesm2022/coercion.mjs.map +0 -1
- package/npm_package/fesm2022/collections.mjs +0 -8
- package/npm_package/fesm2022/collections.mjs.map +0 -1
- package/npm_package/fesm2022/css-pixel-value-C_HEqLhI.mjs +0 -10
- package/npm_package/fesm2022/css-pixel-value-C_HEqLhI.mjs.map +0 -1
- package/npm_package/fesm2022/data-source-D34wiQZj.mjs +0 -15
- package/npm_package/fesm2022/data-source-D34wiQZj.mjs.map +0 -1
- package/npm_package/fesm2022/dialog.mjs +0 -870
- package/npm_package/fesm2022/dialog.mjs.map +0 -1
- package/npm_package/fesm2022/directionality-CBXD4hga.mjs +0 -72
- package/npm_package/fesm2022/directionality-CBXD4hga.mjs.map +0 -1
- package/npm_package/fesm2022/dispose-view-repeater-strategy-D_JReLI1.mjs +0 -44
- package/npm_package/fesm2022/dispose-view-repeater-strategy-D_JReLI1.mjs.map +0 -1
- package/npm_package/fesm2022/drag-drop.mjs +0 -4359
- package/npm_package/fesm2022/drag-drop.mjs.map +0 -1
- package/npm_package/fesm2022/element-x4z00URv.mjs +0 -29
- package/npm_package/fesm2022/element-x4z00URv.mjs.map +0 -1
- package/npm_package/fesm2022/fake-event-detection-DWOdFTFz.mjs +0 -24
- package/npm_package/fesm2022/fake-event-detection-DWOdFTFz.mjs.map +0 -1
- package/npm_package/fesm2022/focus-key-manager-C1rAQJ5z.mjs +0 -22
- package/npm_package/fesm2022/focus-key-manager-C1rAQJ5z.mjs.map +0 -1
- package/npm_package/fesm2022/focus-monitor-e2l_RpN3.mjs +0 -629
- package/npm_package/fesm2022/focus-monitor-e2l_RpN3.mjs.map +0 -1
- package/npm_package/fesm2022/id-generator-Dw_9dSDu.mjs +0 -37
- package/npm_package/fesm2022/id-generator-Dw_9dSDu.mjs.map +0 -1
- package/npm_package/fesm2022/keycodes-CpHkExLC.mjs +0 -122
- package/npm_package/fesm2022/keycodes-CpHkExLC.mjs.map +0 -1
- package/npm_package/fesm2022/keycodes.mjs +0 -15
- package/npm_package/fesm2022/keycodes.mjs.map +0 -1
- package/npm_package/fesm2022/layout.mjs +0 -43
- package/npm_package/fesm2022/layout.mjs.map +0 -1
- package/npm_package/fesm2022/list-key-manager-CyOIXo8P.mjs +0 -360
- package/npm_package/fesm2022/list-key-manager-CyOIXo8P.mjs.map +0 -1
- package/npm_package/fesm2022/listbox.mjs +0 -925
- package/npm_package/fesm2022/listbox.mjs.map +0 -1
- package/npm_package/fesm2022/menu.mjs +0 -1966
- package/npm_package/fesm2022/menu.mjs.map +0 -1
- package/npm_package/fesm2022/observers/private.mjs +0 -124
- package/npm_package/fesm2022/observers/private.mjs.map +0 -1
- package/npm_package/fesm2022/observers.mjs +0 -210
- package/npm_package/fesm2022/observers.mjs.map +0 -1
- package/npm_package/fesm2022/overlay-module-BUj0D19H.mjs +0 -3029
- package/npm_package/fesm2022/overlay-module-BUj0D19H.mjs.map +0 -1
- package/npm_package/fesm2022/overlay.mjs +0 -102
- package/npm_package/fesm2022/overlay.mjs.map +0 -1
- package/npm_package/fesm2022/passive-listeners-esHZRgIN.mjs +0 -31
- package/npm_package/fesm2022/passive-listeners-esHZRgIN.mjs.map +0 -1
- package/npm_package/fesm2022/platform-DmdVEw_C.mjs +0 -77
- package/npm_package/fesm2022/platform-DmdVEw_C.mjs.map +0 -1
- package/npm_package/fesm2022/platform.mjs +0 -74
- package/npm_package/fesm2022/platform.mjs.map +0 -1
- package/npm_package/fesm2022/portal-directives-Bw5woq8I.mjs +0 -653
- package/npm_package/fesm2022/portal-directives-Bw5woq8I.mjs.map +0 -1
- package/npm_package/fesm2022/portal.mjs +0 -29
- package/npm_package/fesm2022/portal.mjs.map +0 -1
- package/npm_package/fesm2022/private.mjs +0 -19
- package/npm_package/fesm2022/private.mjs.map +0 -1
- package/npm_package/fesm2022/recycle-view-repeater-strategy-DoWdPqVw.mjs +0 -156
- package/npm_package/fesm2022/recycle-view-repeater-strategy-DoWdPqVw.mjs.map +0 -1
- package/npm_package/fesm2022/scrolling-BkvA05C8.mjs +0 -99
- package/npm_package/fesm2022/scrolling-BkvA05C8.mjs.map +0 -1
- package/npm_package/fesm2022/scrolling.mjs +0 -1464
- package/npm_package/fesm2022/scrolling.mjs.map +0 -1
- package/npm_package/fesm2022/selection-model-CeeHVIcP.mjs +0 -226
- package/npm_package/fesm2022/selection-model-CeeHVIcP.mjs.map +0 -1
- package/npm_package/fesm2022/shadow-dom-B0oHn41l.mjs +0 -49
- package/npm_package/fesm2022/shadow-dom-B0oHn41l.mjs.map +0 -1
- package/npm_package/fesm2022/stepper.mjs +0 -614
- package/npm_package/fesm2022/stepper.mjs.map +0 -1
- package/npm_package/fesm2022/style-loader-Cu9AvjH9.mjs +0 -47
- package/npm_package/fesm2022/style-loader-Cu9AvjH9.mjs.map +0 -1
- package/npm_package/fesm2022/table.mjs +0 -2602
- package/npm_package/fesm2022/table.mjs.map +0 -1
- package/npm_package/fesm2022/test-environment-CT0XxPyp.mjs +0 -19
- package/npm_package/fesm2022/test-environment-CT0XxPyp.mjs.map +0 -1
- package/npm_package/fesm2022/testing/selenium-webdriver.mjs +0 -353
- package/npm_package/fesm2022/testing/selenium-webdriver.mjs.map +0 -1
- package/npm_package/fesm2022/testing/testbed.mjs +0 -782
- package/npm_package/fesm2022/testing/testbed.mjs.map +0 -1
- package/npm_package/fesm2022/testing.mjs +0 -698
- package/npm_package/fesm2022/testing.mjs.map +0 -1
- package/npm_package/fesm2022/text-field.mjs +0 -437
- package/npm_package/fesm2022/text-field.mjs.map +0 -1
- package/npm_package/fesm2022/tree-key-manager-KnCoIkIC.mjs +0 -360
- package/npm_package/fesm2022/tree-key-manager-KnCoIkIC.mjs.map +0 -1
- package/npm_package/fesm2022/tree.mjs +0 -1795
- package/npm_package/fesm2022/tree.mjs.map +0 -1
- package/npm_package/fesm2022/typeahead-9ZW4Dtsf.mjs +0 -88
- package/npm_package/fesm2022/typeahead-9ZW4Dtsf.mjs.map +0 -1
- package/npm_package/fesm2022/unique-selection-dispatcher-DtHZDqyJ.mjs +0 -49
- package/npm_package/fesm2022/unique-selection-dispatcher-DtHZDqyJ.mjs.map +0 -1
- package/npm_package/focus-key-manager.d-BIKDy8oD.d.ts +0 -34
- package/npm_package/focus-monitor.d-CvvJeQRc.d.ts +0 -210
- package/npm_package/harness-environment.d-BatBdODN.d.ts +0 -620
- package/npm_package/index.d.ts +0 -6
- package/npm_package/keycodes/index.d.ts +0 -129
- package/npm_package/layout/index.d.ts +0 -89
- package/npm_package/list-key-manager.d-BlK3jyRn.d.ts +0 -165
- package/npm_package/listbox/index.d.ts +0 -353
- package/npm_package/menu/index.d.ts +0 -821
- package/npm_package/number-property.d-CJVxXUcb.d.ts +0 -16
- package/npm_package/observers/index.d.ts +0 -84
- package/npm_package/observers/private/index.d.ts +0 -34
- package/npm_package/overlay/_index-deprecated.scss +0 -13
- package/npm_package/overlay/_index.scss +0 -193
- package/npm_package/overlay/index.d.ts +0 -42
- package/npm_package/overlay-module.d-B3qEQtts.d.ts +0 -791
- package/npm_package/overlay-prebuilt.css +0 -1
- package/npm_package/overlay.d-BdoMy0hX.d.ts +0 -296
- package/npm_package/package.json +0 -186
- package/npm_package/platform/index.d.ts +0 -83
- package/npm_package/platform.d-B3vREl3q.d.ts +0 -33
- package/npm_package/portal/index.d.ts +0 -86
- package/npm_package/portal-directives.d-BoG39gYN.d.ts +0 -232
- package/npm_package/private/index.d.ts +0 -13
- package/npm_package/schematics/collection.json +0 -18
- package/npm_package/schematics/index.d.ts +0 -14
- package/npm_package/schematics/index.js +0 -37
- package/npm_package/schematics/index.js.map +0 -1
- package/npm_package/schematics/migration.json +0 -15
- package/npm_package/schematics/ng-add/index.d.ts +0 -17
- package/npm_package/schematics/ng-add/index.js +0 -39
- package/npm_package/schematics/ng-add/index.js.map +0 -1
- package/npm_package/schematics/ng-add/package-config.d.ts +0 -12
- package/npm_package/schematics/ng-add/package-config.js +0 -51
- package/npm_package/schematics/ng-add/package-config.js.map +0 -1
- package/npm_package/schematics/ng-add/schema.d.ts +0 -11
- package/npm_package/schematics/ng-add/schema.js +0 -10
- package/npm_package/schematics/ng-add/schema.js.map +0 -1
- package/npm_package/schematics/ng-add/schema.json +0 -16
- package/npm_package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.__style__.template +0 -53
- package/npm_package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template +0 -21
- package/npm_package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template +0 -25
- package/npm_package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +0 -45
- package/npm_package/schematics/ng-generate/drag-drop/index.d.ts +0 -11
- package/npm_package/schematics/ng-generate/drag-drop/index.js +0 -42
- package/npm_package/schematics/ng-generate/drag-drop/index.js.map +0 -1
- package/npm_package/schematics/ng-generate/drag-drop/schema.d.ts +0 -10
- package/npm_package/schematics/ng-generate/drag-drop/schema.js +0 -10
- package/npm_package/schematics/ng-generate/drag-drop/schema.js.map +0 -1
- package/npm_package/schematics/ng-generate/drag-drop/schema.json +0 -100
- package/npm_package/schematics/ng-update/data/attribute-selectors.d.ts +0 -15
- package/npm_package/schematics/ng-update/data/attribute-selectors.js +0 -12
- package/npm_package/schematics/ng-update/data/attribute-selectors.js.map +0 -1
- package/npm_package/schematics/ng-update/data/class-names.d.ts +0 -15
- package/npm_package/schematics/ng-update/data/class-names.js +0 -12
- package/npm_package/schematics/ng-update/data/class-names.js.map +0 -1
- package/npm_package/schematics/ng-update/data/constructor-checks.d.ts +0 -15
- package/npm_package/schematics/ng-update/data/constructor-checks.js +0 -17
- package/npm_package/schematics/ng-update/data/constructor-checks.js.map +0 -1
- package/npm_package/schematics/ng-update/data/css-selectors.d.ts +0 -27
- package/npm_package/schematics/ng-update/data/css-selectors.js +0 -12
- package/npm_package/schematics/ng-update/data/css-selectors.js.map +0 -1
- package/npm_package/schematics/ng-update/data/css-tokens.d.ts +0 -27
- package/npm_package/schematics/ng-update/data/css-tokens.js +0 -12
- package/npm_package/schematics/ng-update/data/css-tokens.js.map +0 -1
- package/npm_package/schematics/ng-update/data/element-selectors.d.ts +0 -15
- package/npm_package/schematics/ng-update/data/element-selectors.js +0 -12
- package/npm_package/schematics/ng-update/data/element-selectors.js.map +0 -1
- package/npm_package/schematics/ng-update/data/index.d.ts +0 -18
- package/npm_package/schematics/ng-update/data/index.js +0 -35
- package/npm_package/schematics/ng-update/data/index.js.map +0 -1
- package/npm_package/schematics/ng-update/data/input-names.d.ts +0 -22
- package/npm_package/schematics/ng-update/data/input-names.js +0 -12
- package/npm_package/schematics/ng-update/data/input-names.js.map +0 -1
- package/npm_package/schematics/ng-update/data/method-call-checks.d.ts +0 -17
- package/npm_package/schematics/ng-update/data/method-call-checks.js +0 -12
- package/npm_package/schematics/ng-update/data/method-call-checks.js.map +0 -1
- package/npm_package/schematics/ng-update/data/output-names.d.ts +0 -22
- package/npm_package/schematics/ng-update/data/output-names.js +0 -12
- package/npm_package/schematics/ng-update/data/output-names.js.map +0 -1
- package/npm_package/schematics/ng-update/data/property-names.d.ts +0 -20
- package/npm_package/schematics/ng-update/data/property-names.js +0 -12
- package/npm_package/schematics/ng-update/data/property-names.js.map +0 -1
- package/npm_package/schematics/ng-update/data/symbol-removal.d.ts +0 -17
- package/npm_package/schematics/ng-update/data/symbol-removal.js +0 -12
- package/npm_package/schematics/ng-update/data/symbol-removal.js.map +0 -1
- package/npm_package/schematics/ng-update/devkit-file-system.d.ts +0 -30
- package/npm_package/schematics/ng-update/devkit-file-system.js +0 -83
- package/npm_package/schematics/ng-update/devkit-file-system.js.map +0 -1
- package/npm_package/schematics/ng-update/devkit-migration-rule.d.ts +0 -24
- package/npm_package/schematics/ng-update/devkit-migration-rule.js +0 -142
- package/npm_package/schematics/ng-update/devkit-migration-rule.js.map +0 -1
- package/npm_package/schematics/ng-update/devkit-migration.d.ts +0 -35
- package/npm_package/schematics/ng-update/devkit-migration.js +0 -20
- package/npm_package/schematics/ng-update/devkit-migration.js.map +0 -1
- package/npm_package/schematics/ng-update/find-stylesheets.d.ts +0 -16
- package/npm_package/schematics/ng-update/find-stylesheets.js +0 -41
- package/npm_package/schematics/ng-update/find-stylesheets.js.map +0 -1
- package/npm_package/schematics/ng-update/html-parsing/angular.d.ts +0 -15
- package/npm_package/schematics/ng-update/html-parsing/angular.js +0 -51
- package/npm_package/schematics/ng-update/html-parsing/angular.js.map +0 -1
- package/npm_package/schematics/ng-update/html-parsing/elements.d.ts +0 -24
- package/npm_package/schematics/ng-update/html-parsing/elements.js +0 -63
- package/npm_package/schematics/ng-update/html-parsing/elements.js.map +0 -1
- package/npm_package/schematics/ng-update/index.d.ts +0 -10
- package/npm_package/schematics/ng-update/index.js +0 -29
- package/npm_package/schematics/ng-update/index.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/attribute-selectors.d.ts +0 -26
- package/npm_package/schematics/ng-update/migrations/attribute-selectors.js +0 -71
- package/npm_package/schematics/ng-update/migrations/attribute-selectors.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/class-inheritance.d.ts +0 -26
- package/npm_package/schematics/ng-update/migrations/class-inheritance.js +0 -58
- package/npm_package/schematics/ng-update/migrations/class-inheritance.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/class-names.d.ts +0 -32
- package/npm_package/schematics/ng-update/migrations/class-names.js +0 -91
- package/npm_package/schematics/ng-update/migrations/class-names.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/constructor-signature.d.ts +0 -29
- package/npm_package/schematics/ng-update/migrations/constructor-signature.js +0 -139
- package/npm_package/schematics/ng-update/migrations/constructor-signature.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/css-selectors.d.ts +0 -26
- package/npm_package/schematics/ng-update/migrations/css-selectors.js +0 -75
- package/npm_package/schematics/ng-update/migrations/css-selectors.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/css-tokens.d.ts +0 -26
- package/npm_package/schematics/ng-update/migrations/css-tokens.js +0 -83
- package/npm_package/schematics/ng-update/migrations/css-tokens.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/element-selectors.d.ts +0 -26
- package/npm_package/schematics/ng-update/migrations/element-selectors.js +0 -66
- package/npm_package/schematics/ng-update/migrations/element-selectors.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/input-names.d.ts +0 -26
- package/npm_package/schematics/ng-update/migrations/input-names.js +0 -59
- package/npm_package/schematics/ng-update/migrations/input-names.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/method-call-arguments.d.ts +0 -22
- package/npm_package/schematics/ng-update/migrations/method-call-arguments.js +0 -62
- package/npm_package/schematics/ng-update/migrations/method-call-arguments.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/misc-template.d.ts +0 -18
- package/npm_package/schematics/ng-update/migrations/misc-template.js +0 -25
- package/npm_package/schematics/ng-update/migrations/misc-template.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/output-names.d.ts +0 -22
- package/npm_package/schematics/ng-update/migrations/output-names.js +0 -46
- package/npm_package/schematics/ng-update/migrations/output-names.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/property-names.d.ts +0 -22
- package/npm_package/schematics/ng-update/migrations/property-names.js +0 -60
- package/npm_package/schematics/ng-update/migrations/property-names.js.map +0 -1
- package/npm_package/schematics/ng-update/migrations/symbol-removal.d.ts +0 -18
- package/npm_package/schematics/ng-update/migrations/symbol-removal.js +0 -47
- package/npm_package/schematics/ng-update/migrations/symbol-removal.js.map +0 -1
- package/npm_package/schematics/ng-update/public-api.d.ts +0 -19
- package/npm_package/schematics/ng-update/public-api.js +0 -36
- package/npm_package/schematics/ng-update/public-api.js.map +0 -1
- package/npm_package/schematics/ng-update/typescript/base-types.d.ts +0 -10
- package/npm_package/schematics/ng-update/typescript/base-types.js +0 -23
- package/npm_package/schematics/ng-update/typescript/base-types.js.map +0 -1
- package/npm_package/schematics/ng-update/typescript/imports.d.ts +0 -18
- package/npm_package/schematics/ng-update/typescript/imports.js +0 -53
- package/npm_package/schematics/ng-update/typescript/imports.js.map +0 -1
- package/npm_package/schematics/ng-update/typescript/literal.d.ts +0 -18
- package/npm_package/schematics/ng-update/typescript/literal.js +0 -32
- package/npm_package/schematics/ng-update/typescript/literal.js.map +0 -1
- package/npm_package/schematics/ng-update/typescript/module-specifiers.d.ts +0 -16
- package/npm_package/schematics/ng-update/typescript/module-specifiers.js +0 -35
- package/npm_package/schematics/ng-update/typescript/module-specifiers.js.map +0 -1
- package/npm_package/schematics/ng-update/upgrade-data.d.ts +0 -35
- package/npm_package/schematics/ng-update/upgrade-data.js +0 -40
- package/npm_package/schematics/ng-update/upgrade-data.js.map +0 -1
- package/npm_package/schematics/package.json +0 -3
- package/npm_package/schematics/paths.d.ts +0 -11
- package/npm_package/schematics/paths.js +0 -16
- package/npm_package/schematics/paths.js.map +0 -1
- package/npm_package/schematics/update-tool/component-resource-collector.d.ts +0 -44
- package/npm_package/schematics/update-tool/component-resource-collector.js +0 -164
- package/npm_package/schematics/update-tool/component-resource-collector.js.map +0 -1
- package/npm_package/schematics/update-tool/file-system.d.ts +0 -72
- package/npm_package/schematics/update-tool/file-system.js +0 -18
- package/npm_package/schematics/update-tool/file-system.js.map +0 -1
- package/npm_package/schematics/update-tool/index.d.ts +0 -74
- package/npm_package/schematics/update-tool/index.js +0 -172
- package/npm_package/schematics/update-tool/index.js.map +0 -1
- package/npm_package/schematics/update-tool/logger.d.ts +0 -15
- package/npm_package/schematics/update-tool/logger.js +0 -18
- package/npm_package/schematics/update-tool/logger.js.map +0 -1
- package/npm_package/schematics/update-tool/migration.d.ts +0 -87
- package/npm_package/schematics/update-tool/migration.js +0 -70
- package/npm_package/schematics/update-tool/migration.js.map +0 -1
- package/npm_package/schematics/update-tool/public-api.d.ts +0 -16
- package/npm_package/schematics/update-tool/public-api.js +0 -33
- package/npm_package/schematics/update-tool/public-api.js.map +0 -1
- package/npm_package/schematics/update-tool/target-version.d.ts +0 -16
- package/npm_package/schematics/update-tool/target-version.js +0 -27
- package/npm_package/schematics/update-tool/target-version.js.map +0 -1
- package/npm_package/schematics/update-tool/update-recorder.d.ts +0 -13
- package/npm_package/schematics/update-tool/update-recorder.js +0 -10
- package/npm_package/schematics/update-tool/update-recorder.js.map +0 -1
- package/npm_package/schematics/update-tool/utils/decorators.d.ts +0 -22
- package/npm_package/schematics/update-tool/utils/decorators.js +0 -41
- package/npm_package/schematics/update-tool/utils/decorators.js.map +0 -1
- package/npm_package/schematics/update-tool/utils/diagnostics.d.ts +0 -11
- package/npm_package/schematics/update-tool/utils/diagnostics.js +0 -18
- package/npm_package/schematics/update-tool/utils/diagnostics.js.map +0 -1
- package/npm_package/schematics/update-tool/utils/functions.d.ts +0 -14
- package/npm_package/schematics/update-tool/utils/functions.js +0 -20
- package/npm_package/schematics/update-tool/utils/functions.js.map +0 -1
- package/npm_package/schematics/update-tool/utils/imports.d.ts +0 -17
- package/npm_package/schematics/update-tool/utils/imports.js +0 -110
- package/npm_package/schematics/update-tool/utils/imports.js.map +0 -1
- package/npm_package/schematics/update-tool/utils/line-mappings.d.ts +0 -21
- package/npm_package/schematics/update-tool/utils/line-mappings.js +0 -75
- package/npm_package/schematics/update-tool/utils/line-mappings.js.map +0 -1
- package/npm_package/schematics/update-tool/utils/parse-tsconfig.d.ts +0 -18
- package/npm_package/schematics/update-tool/utils/parse-tsconfig.js +0 -45
- package/npm_package/schematics/update-tool/utils/parse-tsconfig.js.map +0 -1
- package/npm_package/schematics/update-tool/utils/property-name.d.ts +0 -18
- package/npm_package/schematics/update-tool/utils/property-name.js +0 -27
- package/npm_package/schematics/update-tool/utils/property-name.js.map +0 -1
- package/npm_package/schematics/update-tool/utils/virtual-host.d.ts +0 -36
- package/npm_package/schematics/update-tool/utils/virtual-host.js +0 -71
- package/npm_package/schematics/update-tool/utils/virtual-host.js.map +0 -1
- package/npm_package/schematics/update-tool/version-changes.d.ts +0 -32
- package/npm_package/schematics/update-tool/version-changes.js +0 -38
- package/npm_package/schematics/update-tool/version-changes.js.map +0 -1
- package/npm_package/schematics/utils/ast/ng-module-imports.d.ts +0 -12
- package/npm_package/schematics/utils/ast/ng-module-imports.js +0 -82
- package/npm_package/schematics/utils/ast/ng-module-imports.js.map +0 -1
- package/npm_package/schematics/utils/ast.d.ts +0 -25
- package/npm_package/schematics/utils/ast.js +0 -79
- package/npm_package/schematics/utils/ast.js.map +0 -1
- package/npm_package/schematics/utils/build-component.d.ts +0 -20
- package/npm_package/schematics/utils/build-component.js +0 -188
- package/npm_package/schematics/utils/build-component.js.map +0 -1
- package/npm_package/schematics/utils/get-project.d.ts +0 -13
- package/npm_package/schematics/utils/get-project.js +0 -28
- package/npm_package/schematics/utils/get-project.js.map +0 -1
- package/npm_package/schematics/utils/html-manipulation.d.ts +0 -15
- package/npm_package/schematics/utils/html-manipulation.js +0 -91
- package/npm_package/schematics/utils/html-manipulation.js.map +0 -1
- package/npm_package/schematics/utils/index.d.ts +0 -19
- package/npm_package/schematics/utils/index.js +0 -36
- package/npm_package/schematics/utils/index.js.map +0 -1
- package/npm_package/schematics/utils/parse5-element.d.ts +0 -12
- package/npm_package/schematics/utils/parse5-element.js +0 -30
- package/npm_package/schematics/utils/parse5-element.js.map +0 -1
- package/npm_package/schematics/utils/project-index-file.d.ts +0 -10
- package/npm_package/schematics/utils/project-index-file.js +0 -20
- package/npm_package/schematics/utils/project-index-file.js.map +0 -1
- package/npm_package/schematics/utils/project-main-file.d.ts +0 -10
- package/npm_package/schematics/utils/project-main-file.js +0 -25
- package/npm_package/schematics/utils/project-main-file.js.map +0 -1
- package/npm_package/schematics/utils/project-style-file.d.ts +0 -13
- package/npm_package/schematics/utils/project-style-file.js +0 -42
- package/npm_package/schematics/utils/project-style-file.js.map +0 -1
- package/npm_package/schematics/utils/project-targets.d.ts +0 -14
- package/npm_package/schematics/utils/project-targets.js +0 -46
- package/npm_package/schematics/utils/project-targets.js.map +0 -1
- package/npm_package/schematics/utils/project-tsconfig-paths.d.ts +0 -14
- package/npm_package/schematics/utils/project-tsconfig-paths.js +0 -46
- package/npm_package/schematics/utils/project-tsconfig-paths.js.map +0 -1
- package/npm_package/schematics/utils/schematic-options.d.ts +0 -20
- package/npm_package/schematics/utils/schematic-options.js +0 -89
- package/npm_package/schematics/utils/schematic-options.js.map +0 -1
- package/npm_package/scrolling/index.d.ts +0 -62
- package/npm_package/scrolling-module.d-ud2XrbF8.d.ts +0 -552
- package/npm_package/selection-model.d-C_vvNGP-.d.ts +0 -117
- package/npm_package/stepper/index.d.ts +0 -228
- package/npm_package/style-loader.d-BXZfQZTF.d.ts +0 -21
- package/npm_package/table/index.d.ts +0 -1100
- package/npm_package/testing/index.d.ts +0 -94
- package/npm_package/testing/selenium-webdriver/index.d.ts +0 -150
- package/npm_package/testing/testbed/index.d.ts +0 -157
- package/npm_package/text-field/_index.scss +0 -89
- package/npm_package/text-field/index.d.ts +0 -156
- package/npm_package/text-field-prebuilt.css +0 -1
- package/npm_package/tree/index.d.ts +0 -720
- package/npm_package/tree-key-manager-strategy.d-XB6M79l-.d.ts +0 -116
- package/npm_package/unique-selection-dispatcher.d-DSFqf1MM.d.ts +0 -33
- package/npm_package/view-repeater.d-BKljR8u8.d.ts +0 -89
|
@@ -1,782 +0,0 @@
|
|
|
1
|
-
import { flush } from '@angular/core/testing';
|
|
2
|
-
import { takeWhile } from 'rxjs/operators';
|
|
3
|
-
import { BehaviorSubject } from 'rxjs';
|
|
4
|
-
import { getNoKeysSpecifiedError, _getTextWithExcludedElements, TestKey, HarnessEnvironment, handleAutoChangeDetectionStatus, stopHandlingAutoChangeDetectionStatus } from '../testing.mjs';
|
|
5
|
-
import { h as PERIOD, B as BACKSPACE, T as TAB, c as ENTER, f as SHIFT, C as CONTROL, d as ALT, g as ESCAPE, a as PAGE_UP, P as PAGE_DOWN, E as END, H as HOME, L as LEFT_ARROW, U as UP_ARROW, R as RIGHT_ARROW, D as DOWN_ARROW, I as INSERT, i as DELETE, F as F1, j as F2, k as F3, l as F4, m as F5, n as F6, o as F7, p as F8, q as F9, r as F10, s as F11, t as F12, e as META, u as COMMA } from '../keycodes-CpHkExLC.mjs';
|
|
6
|
-
|
|
7
|
-
/** Unique symbol that is used to patch a property to a proxy zone. */
|
|
8
|
-
const stateObservableSymbol = Symbol('ProxyZone_PATCHED#stateObservable');
|
|
9
|
-
/**
|
|
10
|
-
* Interceptor that can be set up in a `ProxyZone` instance. The interceptor
|
|
11
|
-
* will keep track of the task state and emit whenever the state changes.
|
|
12
|
-
*
|
|
13
|
-
* This serves as a workaround for https://github.com/angular/angular/issues/32896.
|
|
14
|
-
*/
|
|
15
|
-
class TaskStateZoneInterceptor {
|
|
16
|
-
_lastState = null;
|
|
17
|
-
/** Subject that can be used to emit a new state change. */
|
|
18
|
-
_stateSubject = new BehaviorSubject(this._lastState ? this._getTaskStateFromInternalZoneState(this._lastState) : { stable: true });
|
|
19
|
-
/** Public observable that emits whenever the task state changes. */
|
|
20
|
-
state = this._stateSubject;
|
|
21
|
-
constructor(lastState) {
|
|
22
|
-
this._lastState = lastState;
|
|
23
|
-
}
|
|
24
|
-
/** This will be called whenever the task state changes in the intercepted zone. */
|
|
25
|
-
onHasTask(delegate, current, target, hasTaskState) {
|
|
26
|
-
if (current === target) {
|
|
27
|
-
this._stateSubject.next(this._getTaskStateFromInternalZoneState(hasTaskState));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/** Gets the task state from the internal ZoneJS task state. */
|
|
31
|
-
_getTaskStateFromInternalZoneState(state) {
|
|
32
|
-
return { stable: !state.macroTask && !state.microTask };
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Sets up the custom task state Zone interceptor in the `ProxyZone`. Throws if
|
|
36
|
-
* no `ProxyZone` could be found.
|
|
37
|
-
* @returns an observable that emits whenever the task state changes.
|
|
38
|
-
*/
|
|
39
|
-
static setup() {
|
|
40
|
-
if (Zone === undefined) {
|
|
41
|
-
throw Error('Could not find ZoneJS. For test harnesses running in TestBed, ' +
|
|
42
|
-
'ZoneJS needs to be installed.');
|
|
43
|
-
}
|
|
44
|
-
// tslint:disable-next-line:variable-name
|
|
45
|
-
const ProxyZoneSpec = Zone['ProxyZoneSpec'];
|
|
46
|
-
// If there is no "ProxyZoneSpec" installed, we throw an error and recommend
|
|
47
|
-
// setting up the proxy zone by pulling in the testing bundle.
|
|
48
|
-
if (!ProxyZoneSpec) {
|
|
49
|
-
throw Error('ProxyZoneSpec is needed for the test harnesses but could not be found. ' +
|
|
50
|
-
'Please make sure that your environment includes zone.js/dist/zone-testing.js');
|
|
51
|
-
}
|
|
52
|
-
// Ensure that there is a proxy zone instance set up, and get
|
|
53
|
-
// a reference to the instance if present.
|
|
54
|
-
const zoneSpec = ProxyZoneSpec.assertPresent();
|
|
55
|
-
// If there already is a delegate registered in the proxy zone, and it
|
|
56
|
-
// is type of the custom task state interceptor, we just use that state
|
|
57
|
-
// observable. This allows us to only intercept Zone once per test
|
|
58
|
-
// (similar to how `fakeAsync` or `async` work).
|
|
59
|
-
if (zoneSpec[stateObservableSymbol]) {
|
|
60
|
-
return zoneSpec[stateObservableSymbol];
|
|
61
|
-
}
|
|
62
|
-
// Since we intercept on environment creation and the fixture has been
|
|
63
|
-
// created before, we might have missed tasks scheduled before. Fortunately
|
|
64
|
-
// the proxy zone keeps track of the previous task state, so we can just pass
|
|
65
|
-
// this as initial state to the task zone interceptor.
|
|
66
|
-
const interceptor = new TaskStateZoneInterceptor(zoneSpec.lastTaskState);
|
|
67
|
-
const zoneSpecOnHasTask = zoneSpec.onHasTask.bind(zoneSpec);
|
|
68
|
-
// We setup the task state interceptor in the `ProxyZone`. Note that we cannot register
|
|
69
|
-
// the interceptor as a new proxy zone delegate because it would mean that other zone
|
|
70
|
-
// delegates (e.g. `FakeAsyncTestZone` or `AsyncTestZone`) can accidentally overwrite/disable
|
|
71
|
-
// our interceptor. Since we just intend to monitor the task state of the proxy zone, it is
|
|
72
|
-
// sufficient to just patch the proxy zone. This also avoids that we interfere with the task
|
|
73
|
-
// queue scheduling logic.
|
|
74
|
-
zoneSpec.onHasTask = function (...args) {
|
|
75
|
-
zoneSpecOnHasTask(...args);
|
|
76
|
-
interceptor.onHasTask(...args);
|
|
77
|
-
};
|
|
78
|
-
return (zoneSpec[stateObservableSymbol] = interceptor.state);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/** Used to generate unique IDs for events. */
|
|
83
|
-
/**
|
|
84
|
-
* Creates a browser MouseEvent with the specified options.
|
|
85
|
-
* @docs-private
|
|
86
|
-
*/
|
|
87
|
-
function createMouseEvent(type, clientX = 0, clientY = 0, offsetX = 0, offsetY = 0, button = 0, modifiers = {}) {
|
|
88
|
-
// Note: We cannot determine the position of the mouse event based on the screen
|
|
89
|
-
// because the dimensions and position of the browser window are not available
|
|
90
|
-
// To provide reasonable `screenX` and `screenY` coordinates, we simply use the
|
|
91
|
-
// client coordinates as if the browser is opened in fullscreen.
|
|
92
|
-
const screenX = clientX;
|
|
93
|
-
const screenY = clientY;
|
|
94
|
-
const event = new MouseEvent(type, {
|
|
95
|
-
bubbles: true,
|
|
96
|
-
cancelable: true,
|
|
97
|
-
composed: true, // Required for shadow DOM events.
|
|
98
|
-
view: window,
|
|
99
|
-
detail: 1,
|
|
100
|
-
relatedTarget: null,
|
|
101
|
-
screenX,
|
|
102
|
-
screenY,
|
|
103
|
-
clientX,
|
|
104
|
-
clientY,
|
|
105
|
-
ctrlKey: modifiers.control,
|
|
106
|
-
altKey: modifiers.alt,
|
|
107
|
-
shiftKey: modifiers.shift,
|
|
108
|
-
metaKey: modifiers.meta,
|
|
109
|
-
button: button,
|
|
110
|
-
buttons: 1,
|
|
111
|
-
});
|
|
112
|
-
// The `MouseEvent` constructor doesn't allow us to pass these properties into the constructor.
|
|
113
|
-
// Override them to `1`, because they're used for fake screen reader event detection.
|
|
114
|
-
if (offsetX != null) {
|
|
115
|
-
defineReadonlyEventProperty(event, 'offsetX', offsetX);
|
|
116
|
-
}
|
|
117
|
-
if (offsetY != null) {
|
|
118
|
-
defineReadonlyEventProperty(event, 'offsetY', offsetY);
|
|
119
|
-
}
|
|
120
|
-
return event;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Creates a browser `PointerEvent` with the specified options. Pointer events
|
|
124
|
-
* by default will appear as if they are the primary pointer of their type.
|
|
125
|
-
* https://www.w3.org/TR/pointerevents2/#dom-pointerevent-isprimary.
|
|
126
|
-
*
|
|
127
|
-
* For example, if pointer events for a multi-touch interaction are created, the non-primary
|
|
128
|
-
* pointer touches would need to be represented by non-primary pointer events.
|
|
129
|
-
*
|
|
130
|
-
* @docs-private
|
|
131
|
-
*/
|
|
132
|
-
function createPointerEvent(type, clientX = 0, clientY = 0, offsetX, offsetY, options = { isPrimary: true }) {
|
|
133
|
-
const event = new PointerEvent(type, {
|
|
134
|
-
bubbles: true,
|
|
135
|
-
cancelable: true,
|
|
136
|
-
composed: true, // Required for shadow DOM events.
|
|
137
|
-
view: window,
|
|
138
|
-
clientX,
|
|
139
|
-
clientY,
|
|
140
|
-
...options,
|
|
141
|
-
});
|
|
142
|
-
if (offsetX != null) {
|
|
143
|
-
defineReadonlyEventProperty(event, 'offsetX', offsetX);
|
|
144
|
-
}
|
|
145
|
-
if (offsetY != null) {
|
|
146
|
-
defineReadonlyEventProperty(event, 'offsetY', offsetY);
|
|
147
|
-
}
|
|
148
|
-
return event;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Creates a keyboard event with the specified key and modifiers.
|
|
152
|
-
* @docs-private
|
|
153
|
-
*/
|
|
154
|
-
function createKeyboardEvent(type, keyCode = 0, key = '', modifiers = {}, code = '') {
|
|
155
|
-
return new KeyboardEvent(type, {
|
|
156
|
-
bubbles: true,
|
|
157
|
-
cancelable: true,
|
|
158
|
-
composed: true, // Required for shadow DOM events.
|
|
159
|
-
view: window,
|
|
160
|
-
keyCode,
|
|
161
|
-
key,
|
|
162
|
-
shiftKey: modifiers.shift,
|
|
163
|
-
metaKey: modifiers.meta,
|
|
164
|
-
altKey: modifiers.alt,
|
|
165
|
-
ctrlKey: modifiers.control,
|
|
166
|
-
code,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Creates a fake event object with any desired event type.
|
|
171
|
-
* @docs-private
|
|
172
|
-
*/
|
|
173
|
-
function createFakeEvent(type, bubbles = false, cancelable = true, composed = true) {
|
|
174
|
-
return new Event(type, { bubbles, cancelable, composed });
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Defines a readonly property on the given event object. Readonly properties on an event object
|
|
178
|
-
* are always set as configurable as that matches default readonly properties for DOM event objects.
|
|
179
|
-
*/
|
|
180
|
-
function defineReadonlyEventProperty(event, propertyName, value) {
|
|
181
|
-
Object.defineProperty(event, propertyName, { get: () => value, configurable: true });
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Utility to dispatch any event on a Node.
|
|
186
|
-
* @docs-private
|
|
187
|
-
*/
|
|
188
|
-
function dispatchEvent(node, event) {
|
|
189
|
-
node.dispatchEvent(event);
|
|
190
|
-
return event;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Shorthand to dispatch a fake event on a specified node.
|
|
194
|
-
* @docs-private
|
|
195
|
-
*/
|
|
196
|
-
function dispatchFakeEvent(node, type, bubbles) {
|
|
197
|
-
return dispatchEvent(node, createFakeEvent(type, bubbles));
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Shorthand to dispatch a keyboard event with a specified key code and
|
|
201
|
-
* optional modifiers.
|
|
202
|
-
* @docs-private
|
|
203
|
-
*/
|
|
204
|
-
function dispatchKeyboardEvent(node, type, keyCode, key, modifiers, code) {
|
|
205
|
-
return dispatchEvent(node, createKeyboardEvent(type, keyCode, key, modifiers, code));
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Shorthand to dispatch a mouse event on the specified coordinates.
|
|
209
|
-
* @docs-private
|
|
210
|
-
*/
|
|
211
|
-
function dispatchMouseEvent(node, type, clientX = 0, clientY = 0, offsetX, offsetY, button, modifiers) {
|
|
212
|
-
return dispatchEvent(node, createMouseEvent(type, clientX, clientY, offsetX, offsetY, button, modifiers));
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Shorthand to dispatch a pointer event on the specified coordinates.
|
|
216
|
-
* @docs-private
|
|
217
|
-
*/
|
|
218
|
-
function dispatchPointerEvent(node, type, clientX = 0, clientY = 0, offsetX, offsetY, options) {
|
|
219
|
-
return dispatchEvent(node, createPointerEvent(type, clientX, clientY, offsetX, offsetY, options));
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function triggerFocusChange(element, event) {
|
|
223
|
-
let eventFired = false;
|
|
224
|
-
const handler = () => (eventFired = true);
|
|
225
|
-
element.addEventListener(event, handler);
|
|
226
|
-
element[event]();
|
|
227
|
-
element.removeEventListener(event, handler);
|
|
228
|
-
if (!eventFired) {
|
|
229
|
-
dispatchFakeEvent(element, event);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
/** @docs-private */
|
|
233
|
-
function triggerFocus(element) {
|
|
234
|
-
triggerFocusChange(element, 'focus');
|
|
235
|
-
}
|
|
236
|
-
/** @docs-private */
|
|
237
|
-
function triggerBlur(element) {
|
|
238
|
-
triggerFocusChange(element, 'blur');
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/** Input types for which the value can be entered incrementally. */
|
|
242
|
-
const incrementalInputTypes = new Set([
|
|
243
|
-
'text',
|
|
244
|
-
'email',
|
|
245
|
-
'hidden',
|
|
246
|
-
'password',
|
|
247
|
-
'search',
|
|
248
|
-
'tel',
|
|
249
|
-
'url',
|
|
250
|
-
]);
|
|
251
|
-
/**
|
|
252
|
-
* Manual mapping of some common characters to their `code` in a keyboard event. Non-exhaustive, see
|
|
253
|
-
* the tables on MDN for more info: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
|
|
254
|
-
*/
|
|
255
|
-
const charsToCodes = {
|
|
256
|
-
' ': 'Space',
|
|
257
|
-
'.': 'Period',
|
|
258
|
-
',': 'Comma',
|
|
259
|
-
'`': 'Backquote',
|
|
260
|
-
'-': 'Minus',
|
|
261
|
-
'=': 'Equal',
|
|
262
|
-
'[': 'BracketLeft',
|
|
263
|
-
']': 'BracketRight',
|
|
264
|
-
'\\': 'Backslash',
|
|
265
|
-
'/': 'Slash',
|
|
266
|
-
"'": 'Quote',
|
|
267
|
-
'"': 'Quote',
|
|
268
|
-
';': 'Semicolon',
|
|
269
|
-
};
|
|
270
|
-
/**
|
|
271
|
-
* Determines the `KeyboardEvent.key` from a character. See #27034 and
|
|
272
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
|
|
273
|
-
*/
|
|
274
|
-
function getKeyboardEventCode(char) {
|
|
275
|
-
if (char.length !== 1) {
|
|
276
|
-
return '';
|
|
277
|
-
}
|
|
278
|
-
const charCode = char.charCodeAt(0);
|
|
279
|
-
// Key is a letter between a and z, uppercase or lowercase.
|
|
280
|
-
if ((charCode >= 97 && charCode <= 122) || (charCode >= 65 && charCode <= 90)) {
|
|
281
|
-
return `Key${char.toUpperCase()}`;
|
|
282
|
-
}
|
|
283
|
-
// Digits from 0 to 9.
|
|
284
|
-
if (48 <= charCode && charCode <= 57) {
|
|
285
|
-
return `Digit${char}`;
|
|
286
|
-
}
|
|
287
|
-
return charsToCodes[char] ?? '';
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Checks whether the given Element is a text input element.
|
|
291
|
-
* @docs-private
|
|
292
|
-
*/
|
|
293
|
-
function isTextInput(element) {
|
|
294
|
-
const nodeName = element.nodeName.toLowerCase();
|
|
295
|
-
return nodeName === 'input' || nodeName === 'textarea';
|
|
296
|
-
}
|
|
297
|
-
function typeInElement(element, ...modifiersAndKeys) {
|
|
298
|
-
const first = modifiersAndKeys[0];
|
|
299
|
-
let modifiers;
|
|
300
|
-
let rest;
|
|
301
|
-
if (first !== undefined &&
|
|
302
|
-
typeof first !== 'string' &&
|
|
303
|
-
first.keyCode === undefined &&
|
|
304
|
-
first.key === undefined) {
|
|
305
|
-
modifiers = first;
|
|
306
|
-
rest = modifiersAndKeys.slice(1);
|
|
307
|
-
}
|
|
308
|
-
else {
|
|
309
|
-
modifiers = {};
|
|
310
|
-
rest = modifiersAndKeys;
|
|
311
|
-
}
|
|
312
|
-
const isInput = isTextInput(element);
|
|
313
|
-
const inputType = element.getAttribute('type') || 'text';
|
|
314
|
-
const keys = rest
|
|
315
|
-
.map(k => typeof k === 'string'
|
|
316
|
-
? k.split('').map(c => ({
|
|
317
|
-
keyCode: c.toUpperCase().charCodeAt(0),
|
|
318
|
-
key: c,
|
|
319
|
-
code: getKeyboardEventCode(c),
|
|
320
|
-
}))
|
|
321
|
-
: [k])
|
|
322
|
-
.reduce((arr, k) => arr.concat(k), []);
|
|
323
|
-
// Throw an error if no keys have been specified. Calling this function with no
|
|
324
|
-
// keys should not result in a focus event being dispatched unexpectedly.
|
|
325
|
-
if (keys.length === 0) {
|
|
326
|
-
throw getNoKeysSpecifiedError();
|
|
327
|
-
}
|
|
328
|
-
// We simulate the user typing in a value by incrementally assigning the value below. The problem
|
|
329
|
-
// is that for some input types, the browser won't allow for an invalid value to be set via the
|
|
330
|
-
// `value` property which will always be the case when going character-by-character. If we detect
|
|
331
|
-
// such an input, we have to set the value all at once or listeners to the `input` event (e.g.
|
|
332
|
-
// the `ReactiveFormsModule` uses such an approach) won't receive the correct value.
|
|
333
|
-
const enterValueIncrementally = inputType === 'number'
|
|
334
|
-
? // The value can be set character by character in number inputs if it doesn't have any decimals.
|
|
335
|
-
keys.every(key => key.key !== '.' && key.key !== '-' && key.keyCode !== PERIOD)
|
|
336
|
-
: incrementalInputTypes.has(inputType);
|
|
337
|
-
triggerFocus(element);
|
|
338
|
-
// When we aren't entering the value incrementally, assign it all at once ahead
|
|
339
|
-
// of time so that any listeners to the key events below will have access to it.
|
|
340
|
-
if (!enterValueIncrementally) {
|
|
341
|
-
element.value = keys.reduce((value, key) => value + (key.key || ''), '');
|
|
342
|
-
}
|
|
343
|
-
for (const key of keys) {
|
|
344
|
-
dispatchKeyboardEvent(element, 'keydown', key.keyCode, key.key, modifiers, key.code);
|
|
345
|
-
dispatchKeyboardEvent(element, 'keypress', key.keyCode, key.key, modifiers, key.code);
|
|
346
|
-
if (isInput && key.key && key.key.length === 1) {
|
|
347
|
-
if (enterValueIncrementally) {
|
|
348
|
-
element.value += key.key;
|
|
349
|
-
dispatchFakeEvent(element, 'input');
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
dispatchKeyboardEvent(element, 'keyup', key.keyCode, key.key, modifiers, key.code);
|
|
353
|
-
}
|
|
354
|
-
// Since we weren't dispatching `input` events while sending the keys, we have to do it now.
|
|
355
|
-
if (!enterValueIncrementally) {
|
|
356
|
-
dispatchFakeEvent(element, 'input');
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Clears the text in an input or textarea element.
|
|
361
|
-
* @docs-private
|
|
362
|
-
*/
|
|
363
|
-
function clearElement(element) {
|
|
364
|
-
triggerFocus(element);
|
|
365
|
-
element.value = '';
|
|
366
|
-
dispatchFakeEvent(element, 'input');
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/** Maps `TestKey` constants to the `keyCode` and `key` values used by native browser events. */
|
|
370
|
-
const keyMap = {
|
|
371
|
-
[TestKey.BACKSPACE]: { keyCode: BACKSPACE, key: 'Backspace', code: 'Backspace' },
|
|
372
|
-
[TestKey.TAB]: { keyCode: TAB, key: 'Tab', code: 'Tab' },
|
|
373
|
-
[TestKey.ENTER]: { keyCode: ENTER, key: 'Enter', code: 'Enter' },
|
|
374
|
-
[TestKey.SHIFT]: { keyCode: SHIFT, key: 'Shift', code: 'ShiftLeft' },
|
|
375
|
-
[TestKey.CONTROL]: { keyCode: CONTROL, key: 'Control', code: 'ControlLeft' },
|
|
376
|
-
[TestKey.ALT]: { keyCode: ALT, key: 'Alt', code: 'AltLeft' },
|
|
377
|
-
[TestKey.ESCAPE]: { keyCode: ESCAPE, key: 'Escape', code: 'Escape' },
|
|
378
|
-
[TestKey.PAGE_UP]: { keyCode: PAGE_UP, key: 'PageUp', code: 'PageUp' },
|
|
379
|
-
[TestKey.PAGE_DOWN]: { keyCode: PAGE_DOWN, key: 'PageDown', code: 'PageDown' },
|
|
380
|
-
[TestKey.END]: { keyCode: END, key: 'End', code: 'End' },
|
|
381
|
-
[TestKey.HOME]: { keyCode: HOME, key: 'Home', code: 'Home' },
|
|
382
|
-
[TestKey.LEFT_ARROW]: { keyCode: LEFT_ARROW, key: 'ArrowLeft', code: 'ArrowLeft' },
|
|
383
|
-
[TestKey.UP_ARROW]: { keyCode: UP_ARROW, key: 'ArrowUp', code: 'ArrowUp' },
|
|
384
|
-
[TestKey.RIGHT_ARROW]: { keyCode: RIGHT_ARROW, key: 'ArrowRight', code: 'ArrowRight' },
|
|
385
|
-
[TestKey.DOWN_ARROW]: { keyCode: DOWN_ARROW, key: 'ArrowDown', code: 'ArrowDown' },
|
|
386
|
-
[TestKey.INSERT]: { keyCode: INSERT, key: 'Insert', code: 'Insert' },
|
|
387
|
-
[TestKey.DELETE]: { keyCode: DELETE, key: 'Delete', code: 'Delete' },
|
|
388
|
-
[TestKey.F1]: { keyCode: F1, key: 'F1', code: 'F1' },
|
|
389
|
-
[TestKey.F2]: { keyCode: F2, key: 'F2', code: 'F2' },
|
|
390
|
-
[TestKey.F3]: { keyCode: F3, key: 'F3', code: 'F3' },
|
|
391
|
-
[TestKey.F4]: { keyCode: F4, key: 'F4', code: 'F4' },
|
|
392
|
-
[TestKey.F5]: { keyCode: F5, key: 'F5', code: 'F5' },
|
|
393
|
-
[TestKey.F6]: { keyCode: F6, key: 'F6', code: 'F6' },
|
|
394
|
-
[TestKey.F7]: { keyCode: F7, key: 'F7', code: 'F7' },
|
|
395
|
-
[TestKey.F8]: { keyCode: F8, key: 'F8', code: 'F8' },
|
|
396
|
-
[TestKey.F9]: { keyCode: F9, key: 'F9', code: 'F9' },
|
|
397
|
-
[TestKey.F10]: { keyCode: F10, key: 'F10', code: 'F10' },
|
|
398
|
-
[TestKey.F11]: { keyCode: F11, key: 'F11', code: 'F11' },
|
|
399
|
-
[TestKey.F12]: { keyCode: F12, key: 'F12', code: 'F12' },
|
|
400
|
-
[TestKey.META]: { keyCode: META, key: 'Meta', code: 'MetaLeft' },
|
|
401
|
-
[TestKey.COMMA]: { keyCode: COMMA, key: ',', code: 'Comma' },
|
|
402
|
-
};
|
|
403
|
-
/** A `TestElement` implementation for unit tests. */
|
|
404
|
-
class UnitTestElement {
|
|
405
|
-
element;
|
|
406
|
-
_stabilize;
|
|
407
|
-
constructor(element, _stabilize) {
|
|
408
|
-
this.element = element;
|
|
409
|
-
this._stabilize = _stabilize;
|
|
410
|
-
}
|
|
411
|
-
/** Blur the element. */
|
|
412
|
-
async blur() {
|
|
413
|
-
triggerBlur(this.element);
|
|
414
|
-
await this._stabilize();
|
|
415
|
-
}
|
|
416
|
-
/** Clear the element's input (for input and textarea elements only). */
|
|
417
|
-
async clear() {
|
|
418
|
-
if (!isTextInput(this.element)) {
|
|
419
|
-
throw Error('Attempting to clear an invalid element');
|
|
420
|
-
}
|
|
421
|
-
clearElement(this.element);
|
|
422
|
-
await this._stabilize();
|
|
423
|
-
}
|
|
424
|
-
async click(...args) {
|
|
425
|
-
const isDisabled = this.element.disabled === true;
|
|
426
|
-
// If the element is `disabled` and has a `disabled` property, we emit the mouse event
|
|
427
|
-
// sequence but not dispatch the `click` event. This is necessary to keep the behavior
|
|
428
|
-
// consistent with an actual user interaction. The click event is not necessarily
|
|
429
|
-
// automatically prevented by the browser. There is mismatch between Firefox and Chromium:
|
|
430
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=329509.
|
|
431
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=1115661.
|
|
432
|
-
await this._dispatchMouseEventSequence(isDisabled ? null : 'click', args, 0);
|
|
433
|
-
await this._stabilize();
|
|
434
|
-
}
|
|
435
|
-
async rightClick(...args) {
|
|
436
|
-
await this._dispatchMouseEventSequence('contextmenu', args, 2);
|
|
437
|
-
await this._stabilize();
|
|
438
|
-
}
|
|
439
|
-
/** Focus the element. */
|
|
440
|
-
async focus() {
|
|
441
|
-
triggerFocus(this.element);
|
|
442
|
-
await this._stabilize();
|
|
443
|
-
}
|
|
444
|
-
/** Get the computed value of the given CSS property for the element. */
|
|
445
|
-
async getCssValue(property) {
|
|
446
|
-
await this._stabilize();
|
|
447
|
-
// TODO(mmalerba): Consider adding value normalization if we run into common cases where its
|
|
448
|
-
// needed.
|
|
449
|
-
return getComputedStyle(this.element).getPropertyValue(property);
|
|
450
|
-
}
|
|
451
|
-
/** Hovers the mouse over the element. */
|
|
452
|
-
async hover() {
|
|
453
|
-
this._dispatchPointerEventIfSupported('pointerenter');
|
|
454
|
-
dispatchMouseEvent(this.element, 'mouseover');
|
|
455
|
-
dispatchMouseEvent(this.element, 'mouseenter');
|
|
456
|
-
await this._stabilize();
|
|
457
|
-
}
|
|
458
|
-
/** Moves the mouse away from the element. */
|
|
459
|
-
async mouseAway() {
|
|
460
|
-
this._dispatchPointerEventIfSupported('pointerleave');
|
|
461
|
-
dispatchMouseEvent(this.element, 'mouseout');
|
|
462
|
-
dispatchMouseEvent(this.element, 'mouseleave');
|
|
463
|
-
await this._stabilize();
|
|
464
|
-
}
|
|
465
|
-
async sendKeys(...modifiersAndKeys) {
|
|
466
|
-
const args = modifiersAndKeys.map(k => (typeof k === 'number' ? keyMap[k] : k));
|
|
467
|
-
typeInElement(this.element, ...args);
|
|
468
|
-
await this._stabilize();
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Gets the text from the element.
|
|
472
|
-
* @param options Options that affect what text is included.
|
|
473
|
-
*/
|
|
474
|
-
async text(options) {
|
|
475
|
-
await this._stabilize();
|
|
476
|
-
if (options?.exclude) {
|
|
477
|
-
return _getTextWithExcludedElements(this.element, options.exclude);
|
|
478
|
-
}
|
|
479
|
-
return (this.element.textContent || '').trim();
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Sets the value of a `contenteditable` element.
|
|
483
|
-
* @param value Value to be set on the element.
|
|
484
|
-
*/
|
|
485
|
-
async setContenteditableValue(value) {
|
|
486
|
-
const contenteditableAttr = await this.getAttribute('contenteditable');
|
|
487
|
-
if (contenteditableAttr !== '' &&
|
|
488
|
-
contenteditableAttr !== 'true' &&
|
|
489
|
-
contenteditableAttr !== 'plaintext-only') {
|
|
490
|
-
throw new Error('setContenteditableValue can only be called on a `contenteditable` element.');
|
|
491
|
-
}
|
|
492
|
-
await this._stabilize();
|
|
493
|
-
this.element.textContent = value;
|
|
494
|
-
}
|
|
495
|
-
/** Gets the value for the given attribute from the element. */
|
|
496
|
-
async getAttribute(name) {
|
|
497
|
-
await this._stabilize();
|
|
498
|
-
return this.element.getAttribute(name);
|
|
499
|
-
}
|
|
500
|
-
/** Checks whether the element has the given class. */
|
|
501
|
-
async hasClass(name) {
|
|
502
|
-
await this._stabilize();
|
|
503
|
-
return this.element.classList.contains(name);
|
|
504
|
-
}
|
|
505
|
-
/** Gets the dimensions of the element. */
|
|
506
|
-
async getDimensions() {
|
|
507
|
-
await this._stabilize();
|
|
508
|
-
return this.element.getBoundingClientRect();
|
|
509
|
-
}
|
|
510
|
-
/** Gets the value of a property of an element. */
|
|
511
|
-
async getProperty(name) {
|
|
512
|
-
await this._stabilize();
|
|
513
|
-
return this.element[name];
|
|
514
|
-
}
|
|
515
|
-
/** Sets the value of a property of an input. */
|
|
516
|
-
async setInputValue(value) {
|
|
517
|
-
this.element.value = value;
|
|
518
|
-
await this._stabilize();
|
|
519
|
-
}
|
|
520
|
-
/** Selects the options at the specified indexes inside of a native `select` element. */
|
|
521
|
-
async selectOptions(...optionIndexes) {
|
|
522
|
-
let hasChanged = false;
|
|
523
|
-
const options = this.element.querySelectorAll('option');
|
|
524
|
-
const indexes = new Set(optionIndexes); // Convert to a set to remove duplicates.
|
|
525
|
-
for (let i = 0; i < options.length; i++) {
|
|
526
|
-
const option = options[i];
|
|
527
|
-
const wasSelected = option.selected;
|
|
528
|
-
// We have to go through `option.selected`, because `HTMLSelectElement.value` doesn't
|
|
529
|
-
// allow for multiple options to be selected, even in `multiple` mode.
|
|
530
|
-
option.selected = indexes.has(i);
|
|
531
|
-
if (option.selected !== wasSelected) {
|
|
532
|
-
hasChanged = true;
|
|
533
|
-
dispatchFakeEvent(this.element, 'change');
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
if (hasChanged) {
|
|
537
|
-
await this._stabilize();
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
/** Checks whether this element matches the given selector. */
|
|
541
|
-
async matchesSelector(selector) {
|
|
542
|
-
await this._stabilize();
|
|
543
|
-
const elementPrototype = Element.prototype;
|
|
544
|
-
return (elementPrototype['matches'] || elementPrototype['msMatchesSelector']).call(this.element, selector);
|
|
545
|
-
}
|
|
546
|
-
/** Checks whether the element is focused. */
|
|
547
|
-
async isFocused() {
|
|
548
|
-
await this._stabilize();
|
|
549
|
-
return document.activeElement === this.element;
|
|
550
|
-
}
|
|
551
|
-
/**
|
|
552
|
-
* Dispatches an event with a particular name.
|
|
553
|
-
* @param name Name of the event to be dispatched.
|
|
554
|
-
*/
|
|
555
|
-
async dispatchEvent(name, data) {
|
|
556
|
-
const event = createFakeEvent(name);
|
|
557
|
-
if (data) {
|
|
558
|
-
// tslint:disable-next-line:ban Have to use `Object.assign` to preserve the original object.
|
|
559
|
-
Object.assign(event, data);
|
|
560
|
-
}
|
|
561
|
-
dispatchEvent(this.element, event);
|
|
562
|
-
await this._stabilize();
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* Dispatches a pointer event on the current element if the browser supports it.
|
|
566
|
-
* @param name Name of the pointer event to be dispatched.
|
|
567
|
-
* @param clientX Coordinate of the user's pointer along the X axis.
|
|
568
|
-
* @param clientY Coordinate of the user's pointer along the Y axis.
|
|
569
|
-
* @param button Mouse button that should be pressed when dispatching the event.
|
|
570
|
-
*/
|
|
571
|
-
_dispatchPointerEventIfSupported(name, clientX, clientY, offsetX, offsetY, button) {
|
|
572
|
-
// The latest versions of all browsers we support have the new `PointerEvent` API.
|
|
573
|
-
// Though since we capture the two most recent versions of these browsers, we also
|
|
574
|
-
// need to support Safari 12 at time of writing. Safari 12 does not have support for this,
|
|
575
|
-
// so we need to conditionally create and dispatch these events based on feature detection.
|
|
576
|
-
if (typeof PointerEvent !== 'undefined' && PointerEvent) {
|
|
577
|
-
dispatchPointerEvent(this.element, name, clientX, clientY, offsetX, offsetY, {
|
|
578
|
-
isPrimary: true,
|
|
579
|
-
button,
|
|
580
|
-
});
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* Dispatches all the events that are part of a mouse event sequence
|
|
585
|
-
* and then emits a given primary event at the end, if speciifed.
|
|
586
|
-
*/
|
|
587
|
-
async _dispatchMouseEventSequence(primaryEventName, args, button) {
|
|
588
|
-
let clientX = undefined;
|
|
589
|
-
let clientY = undefined;
|
|
590
|
-
let offsetX = undefined;
|
|
591
|
-
let offsetY = undefined;
|
|
592
|
-
let modifiers = {};
|
|
593
|
-
if (args.length && typeof args[args.length - 1] === 'object') {
|
|
594
|
-
modifiers = args.pop();
|
|
595
|
-
}
|
|
596
|
-
if (args.length) {
|
|
597
|
-
const { left, top, width, height } = await this.getDimensions();
|
|
598
|
-
offsetX = args[0] === 'center' ? width / 2 : args[0];
|
|
599
|
-
offsetY = args[0] === 'center' ? height / 2 : args[1];
|
|
600
|
-
// Round the computed click position as decimal pixels are not
|
|
601
|
-
// supported by mouse events and could lead to unexpected results.
|
|
602
|
-
clientX = Math.round(left + offsetX);
|
|
603
|
-
clientY = Math.round(top + offsetY);
|
|
604
|
-
}
|
|
605
|
-
this._dispatchPointerEventIfSupported('pointerdown', clientX, clientY, offsetX, offsetY, button);
|
|
606
|
-
dispatchMouseEvent(this.element, 'mousedown', clientX, clientY, offsetX, offsetY, button, modifiers);
|
|
607
|
-
this._dispatchPointerEventIfSupported('pointerup', clientX, clientY, offsetX, offsetY, button);
|
|
608
|
-
dispatchMouseEvent(this.element, 'mouseup', clientX, clientY, offsetX, offsetY, button, modifiers);
|
|
609
|
-
// If a primary event name is specified, emit it after the mouse event sequence.
|
|
610
|
-
if (primaryEventName !== null) {
|
|
611
|
-
dispatchMouseEvent(this.element, primaryEventName, clientX, clientY, offsetX, offsetY, button, modifiers);
|
|
612
|
-
}
|
|
613
|
-
// This call to _stabilize should not be needed since the callers will already do that them-
|
|
614
|
-
// selves. Nevertheless it breaks some tests in g3 without it. It needs to be investigated
|
|
615
|
-
// why removing breaks those tests.
|
|
616
|
-
// See: https://github.com/angular/components/pull/20758/files#r520886256.
|
|
617
|
-
await this._stabilize();
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
/** The default environment options. */
|
|
622
|
-
const defaultEnvironmentOptions = {
|
|
623
|
-
queryFn: (selector, root) => root.querySelectorAll(selector),
|
|
624
|
-
};
|
|
625
|
-
/** Whether auto change detection is currently disabled. */
|
|
626
|
-
let disableAutoChangeDetection = false;
|
|
627
|
-
/**
|
|
628
|
-
* The set of non-destroyed fixtures currently being used by `TestbedHarnessEnvironment` instances.
|
|
629
|
-
*/
|
|
630
|
-
const activeFixtures = new Set();
|
|
631
|
-
/**
|
|
632
|
-
* Installs a handler for change detection batching status changes for a specific fixture.
|
|
633
|
-
* @param fixture The fixture to handle change detection batching for.
|
|
634
|
-
*/
|
|
635
|
-
function installAutoChangeDetectionStatusHandler(fixture) {
|
|
636
|
-
if (!activeFixtures.size) {
|
|
637
|
-
handleAutoChangeDetectionStatus(({ isDisabled, onDetectChangesNow }) => {
|
|
638
|
-
disableAutoChangeDetection = isDisabled;
|
|
639
|
-
if (onDetectChangesNow) {
|
|
640
|
-
Promise.all(Array.from(activeFixtures).map(detectChanges)).then(onDetectChangesNow);
|
|
641
|
-
}
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
activeFixtures.add(fixture);
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* Uninstalls a handler for change detection batching status changes for a specific fixture.
|
|
648
|
-
* @param fixture The fixture to stop handling change detection batching for.
|
|
649
|
-
*/
|
|
650
|
-
function uninstallAutoChangeDetectionStatusHandler(fixture) {
|
|
651
|
-
activeFixtures.delete(fixture);
|
|
652
|
-
if (!activeFixtures.size) {
|
|
653
|
-
stopHandlingAutoChangeDetectionStatus();
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
/** Whether we are currently in the fake async zone. */
|
|
657
|
-
function isInFakeAsyncZone() {
|
|
658
|
-
return typeof Zone !== 'undefined' && Zone.current.get('FakeAsyncTestZoneSpec') != null;
|
|
659
|
-
}
|
|
660
|
-
/**
|
|
661
|
-
* Triggers change detection for a specific fixture.
|
|
662
|
-
* @param fixture The fixture to trigger change detection for.
|
|
663
|
-
*/
|
|
664
|
-
async function detectChanges(fixture) {
|
|
665
|
-
fixture.detectChanges();
|
|
666
|
-
if (isInFakeAsyncZone()) {
|
|
667
|
-
flush();
|
|
668
|
-
}
|
|
669
|
-
else {
|
|
670
|
-
await fixture.whenStable();
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
/** A `HarnessEnvironment` implementation for Angular's Testbed. */
|
|
674
|
-
class TestbedHarnessEnvironment extends HarnessEnvironment {
|
|
675
|
-
_fixture;
|
|
676
|
-
/** Whether the environment has been destroyed. */
|
|
677
|
-
_destroyed = false;
|
|
678
|
-
/** Observable that emits whenever the test task state changes. */
|
|
679
|
-
_taskState;
|
|
680
|
-
/** The options for this environment. */
|
|
681
|
-
_options;
|
|
682
|
-
/** Environment stabilization callback passed to the created test elements. */
|
|
683
|
-
_stabilizeCallback;
|
|
684
|
-
constructor(rawRootElement, _fixture, options) {
|
|
685
|
-
super(rawRootElement);
|
|
686
|
-
this._fixture = _fixture;
|
|
687
|
-
this._options = { ...defaultEnvironmentOptions, ...options };
|
|
688
|
-
if (typeof Zone !== 'undefined') {
|
|
689
|
-
this._taskState = TaskStateZoneInterceptor.setup();
|
|
690
|
-
}
|
|
691
|
-
this._stabilizeCallback = () => this.forceStabilize();
|
|
692
|
-
installAutoChangeDetectionStatusHandler(_fixture);
|
|
693
|
-
_fixture.componentRef.onDestroy(() => {
|
|
694
|
-
uninstallAutoChangeDetectionStatusHandler(_fixture);
|
|
695
|
-
this._destroyed = true;
|
|
696
|
-
});
|
|
697
|
-
}
|
|
698
|
-
/** Creates a `HarnessLoader` rooted at the given fixture's root element. */
|
|
699
|
-
static loader(fixture, options) {
|
|
700
|
-
return new TestbedHarnessEnvironment(fixture.nativeElement, fixture, options);
|
|
701
|
-
}
|
|
702
|
-
/**
|
|
703
|
-
* Creates a `HarnessLoader` at the document root. This can be used if harnesses are
|
|
704
|
-
* located outside of a fixture (e.g. overlays appended to the document body).
|
|
705
|
-
*/
|
|
706
|
-
static documentRootLoader(fixture, options) {
|
|
707
|
-
return new TestbedHarnessEnvironment(document.body, fixture, options);
|
|
708
|
-
}
|
|
709
|
-
/** Gets the native DOM element corresponding to the given TestElement. */
|
|
710
|
-
static getNativeElement(el) {
|
|
711
|
-
if (el instanceof UnitTestElement) {
|
|
712
|
-
return el.element;
|
|
713
|
-
}
|
|
714
|
-
throw Error('This TestElement was not created by the TestbedHarnessEnvironment');
|
|
715
|
-
}
|
|
716
|
-
/**
|
|
717
|
-
* Creates an instance of the given harness type, using the fixture's root element as the
|
|
718
|
-
* harness's host element. This method should be used when creating a harness for the root element
|
|
719
|
-
* of a fixture, as components do not have the correct selector when they are created as the root
|
|
720
|
-
* of the fixture.
|
|
721
|
-
*/
|
|
722
|
-
static async harnessForFixture(fixture, harnessType, options) {
|
|
723
|
-
const environment = new TestbedHarnessEnvironment(fixture.nativeElement, fixture, options);
|
|
724
|
-
await environment.forceStabilize();
|
|
725
|
-
return environment.createComponentHarness(harnessType, fixture.nativeElement);
|
|
726
|
-
}
|
|
727
|
-
/**
|
|
728
|
-
* Flushes change detection and async tasks captured in the Angular zone.
|
|
729
|
-
* In most cases it should not be necessary to call this manually. However, there may be some edge
|
|
730
|
-
* cases where it is needed to fully flush animation events.
|
|
731
|
-
*/
|
|
732
|
-
async forceStabilize() {
|
|
733
|
-
if (!disableAutoChangeDetection) {
|
|
734
|
-
if (this._destroyed) {
|
|
735
|
-
throw Error('Harness is attempting to use a fixture that has already been destroyed.');
|
|
736
|
-
}
|
|
737
|
-
await detectChanges(this._fixture);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
/**
|
|
741
|
-
* Waits for all scheduled or running async tasks to complete. This allows harness
|
|
742
|
-
* authors to wait for async tasks outside of the Angular zone.
|
|
743
|
-
*/
|
|
744
|
-
async waitForTasksOutsideAngular() {
|
|
745
|
-
// If we run in the fake async zone, we run "flush" to run any scheduled tasks. This
|
|
746
|
-
// ensures that the harnesses behave inside of the FakeAsyncTestZone similar to the
|
|
747
|
-
// "AsyncTestZone" and the root zone (i.e. neither fakeAsync or async). Note that we
|
|
748
|
-
// cannot just rely on the task state observable to become stable because the state will
|
|
749
|
-
// never change. This is because the task queue will be only drained if the fake async
|
|
750
|
-
// zone is being flushed.
|
|
751
|
-
if (isInFakeAsyncZone()) {
|
|
752
|
-
flush();
|
|
753
|
-
}
|
|
754
|
-
// Wait until the task queue has been drained and the zone is stable. Note that
|
|
755
|
-
// we cannot rely on "fixture.whenStable" since it does not catch tasks scheduled
|
|
756
|
-
// outside of the Angular zone. For test harnesses, we want to ensure that the
|
|
757
|
-
// app is fully stabilized and therefore need to use our own zone interceptor.
|
|
758
|
-
await this._taskState?.pipe(takeWhile(state => !state.stable)).toPromise();
|
|
759
|
-
}
|
|
760
|
-
/** Gets the root element for the document. */
|
|
761
|
-
getDocumentRoot() {
|
|
762
|
-
return document.body;
|
|
763
|
-
}
|
|
764
|
-
/** Creates a `TestElement` from a raw element. */
|
|
765
|
-
createTestElement(element) {
|
|
766
|
-
return new UnitTestElement(element, this._stabilizeCallback);
|
|
767
|
-
}
|
|
768
|
-
/** Creates a `HarnessLoader` rooted at the given raw element. */
|
|
769
|
-
createEnvironment(element) {
|
|
770
|
-
return new TestbedHarnessEnvironment(element, this._fixture, this._options);
|
|
771
|
-
}
|
|
772
|
-
/**
|
|
773
|
-
* Gets a list of all elements matching the given selector under this environment's root element.
|
|
774
|
-
*/
|
|
775
|
-
async getAllRawElements(selector) {
|
|
776
|
-
await this.forceStabilize();
|
|
777
|
-
return Array.from(this._options.queryFn(selector, this.rawRootElement));
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
export { TestbedHarnessEnvironment, UnitTestElement };
|
|
782
|
-
//# sourceMappingURL=testbed.mjs.map
|