@angular/cdk 16.0.0-next.4 → 16.0.0-rc.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/a11y/index.d.ts +2 -2
- package/accordion/index.d.ts +2 -2
- package/bidi/index.d.ts +1 -1
- package/clipboard/index.d.ts +1 -1
- package/drag-drop/index.d.ts +6 -6
- package/{esm2020 → esm2022}/a11y/a11y-module.mjs +5 -5
- package/{esm2020 → esm2022}/a11y/aria-describer/aria-describer.mjs +4 -4
- package/{esm2020 → esm2022}/a11y/focus-monitor/focus-monitor.mjs +7 -7
- package/{esm2020 → esm2022}/a11y/focus-trap/configurable-focus-trap-factory.mjs +4 -4
- package/{esm2020 → esm2022}/a11y/focus-trap/focus-trap-manager.mjs +4 -4
- package/{esm2020 → esm2022}/a11y/focus-trap/focus-trap.mjs +7 -7
- package/{esm2020 → esm2022}/a11y/high-contrast-mode/high-contrast-mode-detector.mjs +4 -4
- package/{esm2020 → esm2022}/a11y/input-modality/input-modality-detector.mjs +4 -4
- package/{esm2020 → esm2022}/a11y/interactivity-checker/interactivity-checker.mjs +4 -4
- package/{esm2020 → esm2022}/a11y/live-announcer/live-announcer.mjs +7 -7
- package/{esm2020 → esm2022}/accordion/accordion-item.mjs +8 -8
- package/{esm2020 → esm2022}/accordion/accordion-module.mjs +5 -5
- package/{esm2020 → esm2022}/accordion/accordion.mjs +4 -4
- package/{esm2020 → esm2022}/bidi/bidi-module.mjs +5 -5
- package/{esm2020 → esm2022}/bidi/dir.mjs +4 -4
- package/{esm2020 → esm2022}/bidi/directionality.mjs +4 -4
- package/{esm2020 → esm2022}/clipboard/clipboard-module.mjs +5 -5
- package/{esm2020 → esm2022}/clipboard/clipboard.mjs +4 -4
- package/{esm2020 → esm2022}/clipboard/copy-to-clipboard.mjs +4 -4
- package/{esm2020 → esm2022}/collections/unique-selection-dispatcher.mjs +4 -4
- package/{esm2020 → esm2022}/dialog/dialog-container.mjs +4 -4
- package/{esm2020 → esm2022}/dialog/dialog-module.mjs +12 -12
- package/{esm2020 → esm2022}/dialog/dialog.mjs +4 -4
- package/{esm2020 → esm2022}/drag-drop/directives/drag-handle.mjs +4 -4
- package/{esm2020 → esm2022}/drag-drop/directives/drag-placeholder.mjs +4 -4
- package/{esm2020 → esm2022}/drag-drop/directives/drag-preview.mjs +4 -4
- package/esm2022/drag-drop/directives/drag.mjs +489 -0
- package/{esm2020 → esm2022}/drag-drop/directives/drop-list-group.mjs +4 -4
- package/esm2022/drag-drop/directives/drop-list.mjs +348 -0
- package/{esm2020 → esm2022}/drag-drop/drag-drop-module.mjs +15 -15
- package/{esm2020 → esm2022}/drag-drop/drag-drop-registry.mjs +4 -4
- package/{esm2020 → esm2022}/drag-drop/drag-drop.mjs +4 -4
- package/{esm2020 → esm2022}/layout/breakpoints-observer.mjs +4 -4
- package/{esm2020 → esm2022}/layout/layout-module.mjs +5 -5
- package/{esm2020 → esm2022}/layout/media-matcher.mjs +4 -4
- package/{esm2020 → esm2022}/listbox/listbox-module.mjs +5 -5
- package/{esm2020 → esm2022}/listbox/listbox.mjs +13 -13
- package/{esm2020 → esm2022}/menu/context-menu-trigger.mjs +10 -10
- package/{esm2020 → esm2022}/menu/menu-aim.mjs +7 -7
- package/{esm2020 → esm2022}/menu/menu-bar.mjs +8 -8
- package/{esm2020 → esm2022}/menu/menu-base.mjs +4 -4
- package/{esm2020 → esm2022}/menu/menu-group.mjs +4 -4
- package/{esm2020 → esm2022}/menu/menu-item-checkbox.mjs +7 -7
- package/{esm2020 → esm2022}/menu/menu-item-radio.mjs +7 -7
- package/{esm2020 → esm2022}/menu/menu-item-selectable.mjs +4 -4
- package/{esm2020 → esm2022}/menu/menu-item.mjs +4 -4
- package/{esm2020 → esm2022}/menu/menu-module.mjs +21 -21
- package/{esm2020 → esm2022}/menu/menu-stack.mjs +4 -4
- package/{esm2020 → esm2022}/menu/menu-trigger-base.mjs +4 -4
- package/esm2022/menu/menu-trigger.mjs +307 -0
- package/{esm2020 → esm2022}/menu/menu.mjs +8 -8
- package/{esm2020 → esm2022}/observers/observe-content.mjs +14 -14
- package/{esm2020 → esm2022}/overlay/dispatchers/base-overlay-dispatcher.mjs +4 -4
- package/{esm2020 → esm2022}/overlay/dispatchers/overlay-keyboard-dispatcher.mjs +4 -4
- package/{esm2020 → esm2022}/overlay/dispatchers/overlay-outside-click-dispatcher.mjs +4 -4
- package/{esm2020 → esm2022}/overlay/fullscreen-overlay-container.mjs +4 -4
- package/{esm2020 → esm2022}/overlay/overlay-container.mjs +4 -4
- package/{esm2020 → esm2022}/overlay/overlay-directives.mjs +7 -7
- package/{esm2020 → esm2022}/overlay/overlay-module.mjs +5 -5
- package/{esm2020 → esm2022}/overlay/overlay.mjs +4 -4
- package/{esm2020 → esm2022}/overlay/position/overlay-position-builder.mjs +4 -4
- package/{esm2020 → esm2022}/overlay/scroll/scroll-strategy-options.mjs +4 -4
- package/{esm2020 → esm2022}/platform/platform-module.mjs +5 -5
- package/{esm2020 → esm2022}/platform/platform.mjs +4 -4
- package/esm2022/portal/portal-directives.mjs +250 -0
- package/{esm2020 → esm2022}/scrolling/fixed-size-virtual-scroll.mjs +10 -10
- package/{esm2020 → esm2022}/scrolling/scroll-dispatcher.mjs +4 -4
- package/{esm2020 → esm2022}/scrolling/scrollable.mjs +4 -4
- package/{esm2020 → esm2022}/scrolling/scrolling-module.mjs +19 -19
- package/{esm2020 → esm2022}/scrolling/viewport-ruler.mjs +4 -4
- package/{esm2020 → esm2022}/scrolling/virtual-for-of.mjs +4 -4
- package/{esm2020 → esm2022}/scrolling/virtual-scroll-viewport.mjs +10 -10
- package/{esm2020 → esm2022}/scrolling/virtual-scrollable-element.mjs +4 -4
- package/{esm2020 → esm2022}/scrolling/virtual-scrollable-window.mjs +4 -4
- package/{esm2020 → esm2022}/scrolling/virtual-scrollable.mjs +4 -4
- package/{esm2020 → esm2022}/stepper/step-header.mjs +4 -4
- package/{esm2020 → esm2022}/stepper/step-label.mjs +4 -4
- package/{esm2020 → esm2022}/stepper/stepper-button.mjs +7 -7
- package/{esm2020 → esm2022}/stepper/stepper-module.mjs +10 -10
- package/{esm2020 → esm2022}/stepper/stepper.mjs +7 -7
- package/{esm2020 → esm2022}/table/cell.mjs +22 -22
- package/{esm2020 → esm2022}/table/coalesced-style-scheduler.mjs +4 -4
- package/esm2022/table/row.mjs +271 -0
- package/{esm2020 → esm2022}/table/table-module.mjs +47 -47
- package/{esm2020 → esm2022}/table/table.mjs +25 -25
- package/{esm2020 → esm2022}/table/text-column.mjs +6 -6
- package/{esm2020 → esm2022}/text-field/autofill.mjs +7 -7
- package/{esm2020 → esm2022}/text-field/autosize.mjs +4 -4
- package/{esm2020 → esm2022}/text-field/text-field-module.mjs +5 -5
- package/{esm2020 → esm2022}/tree/nested-node.mjs +7 -7
- package/{esm2020 → esm2022}/tree/node.mjs +4 -4
- package/{esm2020 → esm2022}/tree/outlet.mjs +4 -4
- package/{esm2020 → esm2022}/tree/padding.mjs +4 -4
- package/{esm2020 → esm2022}/tree/toggle.mjs +4 -4
- package/{esm2020 → esm2022}/tree/tree-module.mjs +17 -17
- package/esm2022/tree/tree.mjs +349 -0
- package/{esm2020 → esm2022}/version.mjs +1 -1
- package/{fesm2020 → fesm2022}/a11y.mjs +40 -197
- package/fesm2022/a11y.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/accordion.mjs +14 -51
- package/fesm2022/accordion.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/bidi.mjs +10 -54
- package/fesm2022/bidi.mjs.map +1 -0
- package/fesm2022/cdk.mjs +7 -0
- package/fesm2022/cdk.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/clipboard.mjs +10 -54
- package/fesm2022/clipboard.mjs.map +1 -0
- package/{fesm2015 → fesm2022}/coercion.mjs +0 -58
- package/fesm2022/coercion.mjs.map +1 -0
- package/{fesm2015 → fesm2022}/collections.mjs +5 -70
- package/fesm2022/collections.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/dialog.mjs +17 -75
- package/fesm2022/dialog.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/drag-drop.mjs +45 -216
- package/fesm2022/drag-drop.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/keycodes.mjs +0 -30
- package/fesm2022/keycodes.mjs.map +1 -0
- package/{fesm2015 → fesm2022}/layout.mjs +10 -54
- package/fesm2022/layout.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/listbox.mjs +16 -46
- package/fesm2022/listbox.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/menu.mjs +86 -220
- package/fesm2022/menu.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/observers.mjs +13 -36
- package/fesm2022/observers.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/overlay.mjs +34 -206
- package/fesm2022/overlay.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/platform.mjs +7 -72
- package/fesm2022/platform.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/portal.mjs +26 -77
- package/fesm2022/portal.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/scrolling.mjs +57 -158
- package/fesm2022/scrolling.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/stepper.mjs +27 -78
- package/fesm2022/stepper.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/table.mjs +134 -227
- package/fesm2022/table.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/testing/selenium-webdriver.mjs +0 -37
- package/fesm2022/testing/selenium-webdriver.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/testing/testbed.mjs +1 -72
- package/fesm2022/testing/testbed.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/testing.mjs +0 -66
- package/fesm2022/testing.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/text-field.mjs +13 -50
- package/fesm2022/text-field.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/tree.mjs +45 -131
- package/fesm2022/tree.mjs.map +1 -0
- package/listbox/index.d.ts +2 -2
- package/menu/index.d.ts +5 -5
- package/observers/index.d.ts +1 -1
- package/overlay/index.d.ts +1 -1
- package/package.json +77 -131
- package/portal/index.d.ts +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-update/devkit-file-system.js +3 -2
- package/schematics/ng-update/devkit-file-system.mjs +3 -2
- package/schematics/ng-update/migrations/attribute-selectors.js +5 -8
- package/schematics/ng-update/migrations/attribute-selectors.mjs +5 -8
- package/schematics/ng-update/migrations/class-inheritance.js +8 -11
- package/schematics/ng-update/migrations/class-inheritance.mjs +8 -11
- package/schematics/ng-update/migrations/class-names.js +12 -15
- package/schematics/ng-update/migrations/class-names.mjs +12 -15
- package/schematics/ng-update/migrations/constructor-signature.js +7 -10
- package/schematics/ng-update/migrations/constructor-signature.mjs +7 -10
- package/schematics/ng-update/migrations/css-selectors.js +5 -8
- package/schematics/ng-update/migrations/css-selectors.mjs +5 -8
- package/schematics/ng-update/migrations/element-selectors.js +5 -8
- package/schematics/ng-update/migrations/element-selectors.mjs +5 -8
- package/schematics/ng-update/migrations/input-names.js +5 -8
- package/schematics/ng-update/migrations/input-names.mjs +5 -8
- package/schematics/ng-update/migrations/method-call-arguments.js +5 -8
- package/schematics/ng-update/migrations/method-call-arguments.mjs +5 -8
- package/schematics/ng-update/migrations/misc-template.js +3 -6
- package/schematics/ng-update/migrations/misc-template.mjs +3 -6
- package/schematics/ng-update/migrations/output-names.js +5 -8
- package/schematics/ng-update/migrations/output-names.mjs +5 -8
- package/schematics/ng-update/migrations/property-names.js +5 -8
- package/schematics/ng-update/migrations/property-names.mjs +5 -8
- package/schematics/ng-update/migrations/symbol-removal.js +5 -8
- package/schematics/ng-update/migrations/symbol-removal.mjs +5 -8
- package/schematics/update-tool/component-resource-collector.js +5 -3
- package/schematics/update-tool/component-resource-collector.mjs +5 -3
- package/schematics/update-tool/index.js +8 -2
- package/schematics/update-tool/index.mjs +8 -2
- package/schematics/update-tool/migration.js +10 -3
- package/schematics/update-tool/migration.mjs +10 -3
- package/schematics/update-tool/utils/virtual-host.js +3 -2
- package/schematics/update-tool/utils/virtual-host.mjs +3 -2
- package/scrolling/index.d.ts +3 -3
- package/stepper/index.d.ts +4 -4
- package/table/index.d.ts +6 -6
- package/text-field/index.d.ts +1 -1
- package/tree/index.d.ts +6 -6
- package/esm2020/drag-drop/directives/drag.mjs +0 -489
- package/esm2020/drag-drop/directives/drop-list.mjs +0 -348
- package/esm2020/menu/menu-trigger.mjs +0 -306
- package/esm2020/portal/portal-directives.mjs +0 -250
- package/esm2020/table/row.mjs +0 -271
- package/esm2020/tree/tree.mjs +0 -349
- package/fesm2015/a11y.mjs +0 -2544
- package/fesm2015/a11y.mjs.map +0 -1
- package/fesm2015/accordion.mjs +0 -275
- package/fesm2015/accordion.mjs.map +0 -1
- package/fesm2015/bidi.mjs +0 -194
- package/fesm2015/bidi.mjs.map +0 -1
- package/fesm2015/cdk.mjs +0 -30
- package/fesm2015/cdk.mjs.map +0 -1
- package/fesm2015/clipboard.mjs +0 -263
- package/fesm2015/clipboard.mjs.map +0 -1
- package/fesm2015/coercion.mjs.map +0 -1
- package/fesm2015/collections.mjs.map +0 -1
- package/fesm2015/dialog.mjs +0 -800
- package/fesm2015/dialog.mjs.map +0 -1
- package/fesm2015/drag-drop.mjs +0 -3823
- package/fesm2015/drag-drop.mjs.map +0 -1
- package/fesm2015/keycodes.mjs +0 -167
- package/fesm2015/keycodes.mjs.map +0 -1
- package/fesm2015/layout.mjs.map +0 -1
- package/fesm2015/listbox.mjs +0 -918
- package/fesm2015/listbox.mjs.map +0 -1
- package/fesm2015/menu.mjs +0 -2009
- package/fesm2015/menu.mjs.map +0 -1
- package/fesm2015/observers.mjs +0 -211
- package/fesm2015/observers.mjs.map +0 -1
- package/fesm2015/overlay.mjs +0 -3142
- package/fesm2015/overlay.mjs.map +0 -1
- package/fesm2015/platform.mjs +0 -385
- package/fesm2015/platform.mjs.map +0 -1
- package/fesm2015/portal.mjs +0 -691
- package/fesm2015/portal.mjs.map +0 -1
- package/fesm2015/scrolling.mjs +0 -1566
- package/fesm2015/scrolling.mjs.map +0 -1
- package/fesm2015/stepper.mjs +0 -621
- package/fesm2015/stepper.mjs.map +0 -1
- package/fesm2015/table.mjs +0 -2357
- package/fesm2015/table.mjs.map +0 -1
- package/fesm2015/testing/selenium-webdriver.mjs +0 -419
- package/fesm2015/testing/selenium-webdriver.mjs.map +0 -1
- package/fesm2015/testing/testbed.mjs +0 -868
- package/fesm2015/testing/testbed.mjs.map +0 -1
- package/fesm2015/testing.mjs +0 -785
- package/fesm2015/testing.mjs.map +0 -1
- package/fesm2015/text-field.mjs +0 -461
- package/fesm2015/text-field.mjs.map +0 -1
- package/fesm2015/tree.mjs +0 -950
- package/fesm2015/tree.mjs.map +0 -1
- package/fesm2020/a11y.mjs.map +0 -1
- package/fesm2020/accordion.mjs.map +0 -1
- package/fesm2020/bidi.mjs.map +0 -1
- package/fesm2020/cdk.mjs +0 -30
- package/fesm2020/cdk.mjs.map +0 -1
- package/fesm2020/clipboard.mjs.map +0 -1
- package/fesm2020/coercion.mjs +0 -132
- package/fesm2020/coercion.mjs.map +0 -1
- package/fesm2020/collections.mjs +0 -543
- package/fesm2020/collections.mjs.map +0 -1
- package/fesm2020/dialog.mjs.map +0 -1
- package/fesm2020/drag-drop.mjs.map +0 -1
- package/fesm2020/keycodes.mjs.map +0 -1
- package/fesm2020/layout.mjs +0 -254
- package/fesm2020/layout.mjs.map +0 -1
- package/fesm2020/listbox.mjs.map +0 -1
- package/fesm2020/menu.mjs.map +0 -1
- package/fesm2020/observers.mjs.map +0 -1
- package/fesm2020/overlay.mjs.map +0 -1
- package/fesm2020/platform.mjs.map +0 -1
- package/fesm2020/portal.mjs.map +0 -1
- package/fesm2020/scrolling.mjs.map +0 -1
- package/fesm2020/stepper.mjs.map +0 -1
- package/fesm2020/table.mjs.map +0 -1
- package/fesm2020/testing/selenium-webdriver.mjs.map +0 -1
- package/fesm2020/testing/testbed.mjs.map +0 -1
- package/fesm2020/testing.mjs.map +0 -1
- package/fesm2020/text-field.mjs.map +0 -1
- package/fesm2020/tree.mjs.map +0 -1
- /package/{esm2020 → esm2022}/a11y/a11y_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/a11y/aria-describer/aria-reference.mjs +0 -0
- /package/{esm2020 → esm2022}/a11y/fake-event-detection.mjs +0 -0
- /package/{esm2020 → esm2022}/a11y/focus-trap/configurable-focus-trap-config.mjs +0 -0
- /package/{esm2020 → esm2022}/a11y/focus-trap/configurable-focus-trap.mjs +0 -0
- /package/{esm2020 → esm2022}/a11y/focus-trap/event-listener-inert-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/a11y/focus-trap/focus-trap-inert-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/a11y/index.mjs +0 -0
- /package/{esm2020 → esm2022}/a11y/key-manager/activedescendant-key-manager.mjs +0 -0
- /package/{esm2020 → esm2022}/a11y/key-manager/focus-key-manager.mjs +0 -0
- /package/{esm2020 → esm2022}/a11y/key-manager/list-key-manager.mjs +0 -0
- /package/{esm2020 → esm2022}/a11y/live-announcer/live-announcer-tokens.mjs +0 -0
- /package/{esm2020 → esm2022}/a11y/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/accordion/accordion_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/accordion/index.mjs +0 -0
- /package/{esm2020 → esm2022}/accordion/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/bidi/bidi_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/bidi/dir-document-token.mjs +0 -0
- /package/{esm2020 → esm2022}/bidi/index.mjs +0 -0
- /package/{esm2020 → esm2022}/bidi/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/clipboard/clipboard_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/clipboard/index.mjs +0 -0
- /package/{esm2020 → esm2022}/clipboard/pending-copy.mjs +0 -0
- /package/{esm2020 → esm2022}/clipboard/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/coercion/array.mjs +0 -0
- /package/{esm2020 → esm2022}/coercion/boolean-property.mjs +0 -0
- /package/{esm2020 → esm2022}/coercion/css-pixel-value.mjs +0 -0
- /package/{esm2020 → esm2022}/coercion/element.mjs +0 -0
- /package/{esm2020 → esm2022}/coercion/index.mjs +0 -0
- /package/{esm2020 → esm2022}/coercion/number-property.mjs +0 -0
- /package/{esm2020 → esm2022}/coercion/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/coercion/string-array.mjs +0 -0
- /package/{esm2020 → esm2022}/collections/array-data-source.mjs +0 -0
- /package/{esm2020 → esm2022}/collections/collection-viewer.mjs +0 -0
- /package/{esm2020 → esm2022}/collections/collections_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/collections/data-source.mjs +0 -0
- /package/{esm2020 → esm2022}/collections/dispose-view-repeater-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/collections/index.mjs +0 -0
- /package/{esm2020 → esm2022}/collections/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/collections/recycle-view-repeater-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/collections/selection-model.mjs +0 -0
- /package/{esm2020 → esm2022}/collections/tree-adapter.mjs +0 -0
- /package/{esm2020 → esm2022}/collections/view-repeater.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/dialog-config.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/dialog-injectors.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/dialog-ref.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/dialog_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/index.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/directives/assertions.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/directives/config.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/dom/client-rect.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/dom/clone-node.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/dom/parent-position-tracker.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/dom/styling.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/dom/transition-duration.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/drag-drop_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/drag-events.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/drag-parent.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/drag-ref.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/drag-utils.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/drop-list-ref.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/index.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/sorting/drop-list-sort-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/drag-drop/sorting/single-axis-sort-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/keycodes/index.mjs +0 -0
- /package/{esm2020 → esm2022}/keycodes/keycodes.mjs +0 -0
- /package/{esm2020 → esm2022}/keycodes/keycodes_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/keycodes/modifiers.mjs +0 -0
- /package/{esm2020 → esm2022}/keycodes/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/layout/breakpoints.mjs +0 -0
- /package/{esm2020 → esm2022}/layout/index.mjs +0 -0
- /package/{esm2020 → esm2022}/layout/layout_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/layout/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/listbox/index.mjs +0 -0
- /package/{esm2020 → esm2022}/listbox/listbox_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/listbox/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/menu/index.mjs +0 -0
- /package/{esm2020 → esm2022}/menu/menu-errors.mjs +0 -0
- /package/{esm2020 → esm2022}/menu/menu-interface.mjs +0 -0
- /package/{esm2020 → esm2022}/menu/menu_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/menu/pointer-focus-tracker.mjs +0 -0
- /package/{esm2020 → esm2022}/menu/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/observers/index.mjs +0 -0
- /package/{esm2020 → esm2022}/observers/observers_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/observers/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/dispatchers/index.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/index.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/overlay-config.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/overlay-ref.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/overlay-reference.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/overlay_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/position/connected-position.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/position/flexible-connected-position-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/position/global-position-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/position/position-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/position/scroll-clip.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/scroll/block-scroll-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/scroll/close-scroll-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/scroll/index.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/scroll/noop-scroll-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/scroll/reposition-scroll-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/overlay/scroll/scroll-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/platform/features/input-types.mjs +0 -0
- /package/{esm2020 → esm2022}/platform/features/passive-listeners.mjs +0 -0
- /package/{esm2020 → esm2022}/platform/features/scrolling.mjs +0 -0
- /package/{esm2020 → esm2022}/platform/features/shadow-dom.mjs +0 -0
- /package/{esm2020 → esm2022}/platform/features/test-environment.mjs +0 -0
- /package/{esm2020 → esm2022}/platform/index.mjs +0 -0
- /package/{esm2020 → esm2022}/platform/platform_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/platform/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/portal/dom-portal-outlet.mjs +0 -0
- /package/{esm2020 → esm2022}/portal/index.mjs +0 -0
- /package/{esm2020 → esm2022}/portal/portal-errors.mjs +0 -0
- /package/{esm2020 → esm2022}/portal/portal-injector.mjs +0 -0
- /package/{esm2020 → esm2022}/portal/portal.mjs +0 -0
- /package/{esm2020 → esm2022}/portal/portal_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/portal/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/scrolling/index.mjs +0 -0
- /package/{esm2020 → esm2022}/scrolling/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/scrolling/scrolling_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/scrolling/virtual-scroll-repeater.mjs +0 -0
- /package/{esm2020 → esm2022}/scrolling/virtual-scroll-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/stepper/index.mjs +0 -0
- /package/{esm2020 → esm2022}/stepper/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/stepper/stepper_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/table/can-stick.mjs +0 -0
- /package/{esm2020 → esm2022}/table/index.mjs +0 -0
- /package/{esm2020 → esm2022}/table/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/table/sticky-position-listener.mjs +0 -0
- /package/{esm2020 → esm2022}/table/sticky-styler.mjs +0 -0
- /package/{esm2020 → esm2022}/table/table-errors.mjs +0 -0
- /package/{esm2020 → esm2022}/table/table_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/table/tokens.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/change-detection.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/component-harness.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/element-dimensions.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/harness-environment.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/selenium-webdriver/index.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/selenium-webdriver/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/selenium-webdriver/selenium-web-driver-element.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/selenium-webdriver/selenium-web-driver-harness-environment.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/selenium-webdriver/selenium-webdriver-keys.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/test-element-errors.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/test-element.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/testbed/fake-events/dispatch-events.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/testbed/fake-events/element-focus.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/testbed/fake-events/event-objects.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/testbed/fake-events/index.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/testbed/fake-events/type-in-element.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/testbed/index.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/testbed/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/testbed/task-state-zone-interceptor.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/testbed/testbed-harness-environment.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/testbed/unit-test-element.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/text-filtering.mjs +0 -0
- /package/{esm2020 → esm2022}/text-field/index.mjs +0 -0
- /package/{esm2020 → esm2022}/text-field/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/text-field/text-field_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/tree/control/base-tree-control.mjs +0 -0
- /package/{esm2020 → esm2022}/tree/control/flat-tree-control.mjs +0 -0
- /package/{esm2020 → esm2022}/tree/control/nested-tree-control.mjs +0 -0
- /package/{esm2020 → esm2022}/tree/control/tree-control.mjs +0 -0
- /package/{esm2020 → esm2022}/tree/index.mjs +0 -0
- /package/{esm2020 → esm2022}/tree/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/tree/tree-errors.mjs +0 -0
- /package/{esm2020 → esm2022}/tree/tree_public_index.mjs +0 -0
|
@@ -1,868 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from 'tslib';
|
|
2
|
-
import { getNoKeysSpecifiedError, TestKey, _getTextWithExcludedElements, handleAutoChangeDetectionStatus, stopHandlingAutoChangeDetectionStatus, HarnessEnvironment } from '@angular/cdk/testing';
|
|
3
|
-
import { flush } from '@angular/core/testing';
|
|
4
|
-
import { takeWhile } from 'rxjs/operators';
|
|
5
|
-
import { BehaviorSubject } from 'rxjs';
|
|
6
|
-
import * as keyCodes from '@angular/cdk/keycodes';
|
|
7
|
-
import { PERIOD } from '@angular/cdk/keycodes';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @license
|
|
11
|
-
* Copyright Google LLC All Rights Reserved.
|
|
12
|
-
*
|
|
13
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
14
|
-
* found in the LICENSE file at https://angular.io/license
|
|
15
|
-
*/
|
|
16
|
-
/** Unique symbol that is used to patch a property to a proxy zone. */
|
|
17
|
-
const stateObservableSymbol = Symbol('ProxyZone_PATCHED#stateObservable');
|
|
18
|
-
/**
|
|
19
|
-
* Interceptor that can be set up in a `ProxyZone` instance. The interceptor
|
|
20
|
-
* will keep track of the task state and emit whenever the state changes.
|
|
21
|
-
*
|
|
22
|
-
* This serves as a workaround for https://github.com/angular/angular/issues/32896.
|
|
23
|
-
*/
|
|
24
|
-
class TaskStateZoneInterceptor {
|
|
25
|
-
constructor(_lastState) {
|
|
26
|
-
this._lastState = _lastState;
|
|
27
|
-
/** Subject that can be used to emit a new state change. */
|
|
28
|
-
this._stateSubject = new BehaviorSubject(this._lastState ? this._getTaskStateFromInternalZoneState(this._lastState) : { stable: true });
|
|
29
|
-
/** Public observable that emits whenever the task state changes. */
|
|
30
|
-
this.state = this._stateSubject;
|
|
31
|
-
}
|
|
32
|
-
/** This will be called whenever the task state changes in the intercepted zone. */
|
|
33
|
-
onHasTask(delegate, current, target, hasTaskState) {
|
|
34
|
-
if (current === target) {
|
|
35
|
-
this._stateSubject.next(this._getTaskStateFromInternalZoneState(hasTaskState));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/** Gets the task state from the internal ZoneJS task state. */
|
|
39
|
-
_getTaskStateFromInternalZoneState(state) {
|
|
40
|
-
return { stable: !state.macroTask && !state.microTask };
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Sets up the custom task state Zone interceptor in the `ProxyZone`. Throws if
|
|
44
|
-
* no `ProxyZone` could be found.
|
|
45
|
-
* @returns an observable that emits whenever the task state changes.
|
|
46
|
-
*/
|
|
47
|
-
static setup() {
|
|
48
|
-
if (Zone === undefined) {
|
|
49
|
-
throw Error('Could not find ZoneJS. For test harnesses running in TestBed, ' +
|
|
50
|
-
'ZoneJS needs to be installed.');
|
|
51
|
-
}
|
|
52
|
-
// tslint:disable-next-line:variable-name
|
|
53
|
-
const ProxyZoneSpec = Zone['ProxyZoneSpec'];
|
|
54
|
-
// If there is no "ProxyZoneSpec" installed, we throw an error and recommend
|
|
55
|
-
// setting up the proxy zone by pulling in the testing bundle.
|
|
56
|
-
if (!ProxyZoneSpec) {
|
|
57
|
-
throw Error('ProxyZoneSpec is needed for the test harnesses but could not be found. ' +
|
|
58
|
-
'Please make sure that your environment includes zone.js/dist/zone-testing.js');
|
|
59
|
-
}
|
|
60
|
-
// Ensure that there is a proxy zone instance set up, and get
|
|
61
|
-
// a reference to the instance if present.
|
|
62
|
-
const zoneSpec = ProxyZoneSpec.assertPresent();
|
|
63
|
-
// If there already is a delegate registered in the proxy zone, and it
|
|
64
|
-
// is type of the custom task state interceptor, we just use that state
|
|
65
|
-
// observable. This allows us to only intercept Zone once per test
|
|
66
|
-
// (similar to how `fakeAsync` or `async` work).
|
|
67
|
-
if (zoneSpec[stateObservableSymbol]) {
|
|
68
|
-
return zoneSpec[stateObservableSymbol];
|
|
69
|
-
}
|
|
70
|
-
// Since we intercept on environment creation and the fixture has been
|
|
71
|
-
// created before, we might have missed tasks scheduled before. Fortunately
|
|
72
|
-
// the proxy zone keeps track of the previous task state, so we can just pass
|
|
73
|
-
// this as initial state to the task zone interceptor.
|
|
74
|
-
const interceptor = new TaskStateZoneInterceptor(zoneSpec.lastTaskState);
|
|
75
|
-
const zoneSpecOnHasTask = zoneSpec.onHasTask.bind(zoneSpec);
|
|
76
|
-
// We setup the task state interceptor in the `ProxyZone`. Note that we cannot register
|
|
77
|
-
// the interceptor as a new proxy zone delegate because it would mean that other zone
|
|
78
|
-
// delegates (e.g. `FakeAsyncTestZone` or `AsyncTestZone`) can accidentally overwrite/disable
|
|
79
|
-
// our interceptor. Since we just intend to monitor the task state of the proxy zone, it is
|
|
80
|
-
// sufficient to just patch the proxy zone. This also avoids that we interfere with the task
|
|
81
|
-
// queue scheduling logic.
|
|
82
|
-
zoneSpec.onHasTask = function (...args) {
|
|
83
|
-
zoneSpecOnHasTask(...args);
|
|
84
|
-
interceptor.onHasTask(...args);
|
|
85
|
-
};
|
|
86
|
-
return (zoneSpec[stateObservableSymbol] = interceptor.state);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @license
|
|
92
|
-
* Copyright Google LLC All Rights Reserved.
|
|
93
|
-
*
|
|
94
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
95
|
-
* found in the LICENSE file at https://angular.io/license
|
|
96
|
-
*/
|
|
97
|
-
/** Used to generate unique IDs for events. */
|
|
98
|
-
let uniqueIds = 0;
|
|
99
|
-
/**
|
|
100
|
-
* Creates a browser MouseEvent with the specified options.
|
|
101
|
-
* @docs-private
|
|
102
|
-
*/
|
|
103
|
-
function createMouseEvent(type, clientX = 0, clientY = 0, offsetX = 1, offsetY = 1, button = 0, modifiers = {}) {
|
|
104
|
-
// Note: We cannot determine the position of the mouse event based on the screen
|
|
105
|
-
// because the dimensions and position of the browser window are not available
|
|
106
|
-
// To provide reasonable `screenX` and `screenY` coordinates, we simply use the
|
|
107
|
-
// client coordinates as if the browser is opened in fullscreen.
|
|
108
|
-
const screenX = clientX;
|
|
109
|
-
const screenY = clientY;
|
|
110
|
-
const event = new MouseEvent(type, {
|
|
111
|
-
bubbles: true,
|
|
112
|
-
cancelable: true,
|
|
113
|
-
composed: true,
|
|
114
|
-
view: window,
|
|
115
|
-
detail: 0,
|
|
116
|
-
relatedTarget: null,
|
|
117
|
-
screenX,
|
|
118
|
-
screenY,
|
|
119
|
-
clientX,
|
|
120
|
-
clientY,
|
|
121
|
-
ctrlKey: modifiers.control,
|
|
122
|
-
altKey: modifiers.alt,
|
|
123
|
-
shiftKey: modifiers.shift,
|
|
124
|
-
metaKey: modifiers.meta,
|
|
125
|
-
button: button,
|
|
126
|
-
buttons: 1,
|
|
127
|
-
});
|
|
128
|
-
// The `MouseEvent` constructor doesn't allow us to pass these properties into the constructor.
|
|
129
|
-
// Override them to `1`, because they're used for fake screen reader event detection.
|
|
130
|
-
if (offsetX != null) {
|
|
131
|
-
defineReadonlyEventProperty(event, 'offsetX', offsetX);
|
|
132
|
-
}
|
|
133
|
-
if (offsetY != null) {
|
|
134
|
-
defineReadonlyEventProperty(event, 'offsetY', offsetY);
|
|
135
|
-
}
|
|
136
|
-
return event;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Creates a browser `PointerEvent` with the specified options. Pointer events
|
|
140
|
-
* by default will appear as if they are the primary pointer of their type.
|
|
141
|
-
* https://www.w3.org/TR/pointerevents2/#dom-pointerevent-isprimary.
|
|
142
|
-
*
|
|
143
|
-
* For example, if pointer events for a multi-touch interaction are created, the non-primary
|
|
144
|
-
* pointer touches would need to be represented by non-primary pointer events.
|
|
145
|
-
*
|
|
146
|
-
* @docs-private
|
|
147
|
-
*/
|
|
148
|
-
function createPointerEvent(type, clientX = 0, clientY = 0, offsetX, offsetY, options = { isPrimary: true }) {
|
|
149
|
-
const event = new PointerEvent(type, Object.assign({ bubbles: true, cancelable: true, composed: true, view: window, clientX,
|
|
150
|
-
clientY }, options));
|
|
151
|
-
if (offsetX != null) {
|
|
152
|
-
defineReadonlyEventProperty(event, 'offsetX', offsetX);
|
|
153
|
-
}
|
|
154
|
-
if (offsetY != null) {
|
|
155
|
-
defineReadonlyEventProperty(event, 'offsetY', offsetY);
|
|
156
|
-
}
|
|
157
|
-
return event;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Creates a browser TouchEvent with the specified pointer coordinates.
|
|
161
|
-
* @docs-private
|
|
162
|
-
*/
|
|
163
|
-
function createTouchEvent(type, pageX = 0, pageY = 0, clientX = 0, clientY = 0) {
|
|
164
|
-
// We cannot use the `TouchEvent` or `Touch` because Firefox and Safari lack support.
|
|
165
|
-
// TODO: Switch to the constructor API when it is available for Firefox and Safari.
|
|
166
|
-
const event = document.createEvent('UIEvent');
|
|
167
|
-
const touchDetails = { pageX, pageY, clientX, clientY, identifier: uniqueIds++ };
|
|
168
|
-
// TS3.6 removes the initUIEvent method and suggests porting to "new UIEvent()".
|
|
169
|
-
event.initUIEvent(type, true, true, window, 0);
|
|
170
|
-
// Most of the browsers don't have a "initTouchEvent" method that can be used to define
|
|
171
|
-
// the touch details.
|
|
172
|
-
defineReadonlyEventProperty(event, 'touches', [touchDetails]);
|
|
173
|
-
defineReadonlyEventProperty(event, 'targetTouches', [touchDetails]);
|
|
174
|
-
defineReadonlyEventProperty(event, 'changedTouches', [touchDetails]);
|
|
175
|
-
return event;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Creates a keyboard event with the specified key and modifiers.
|
|
179
|
-
* @docs-private
|
|
180
|
-
*/
|
|
181
|
-
function createKeyboardEvent(type, keyCode = 0, key = '', modifiers = {}) {
|
|
182
|
-
return new KeyboardEvent(type, {
|
|
183
|
-
bubbles: true,
|
|
184
|
-
cancelable: true,
|
|
185
|
-
composed: true,
|
|
186
|
-
view: window,
|
|
187
|
-
keyCode: keyCode,
|
|
188
|
-
key: key,
|
|
189
|
-
shiftKey: modifiers.shift,
|
|
190
|
-
metaKey: modifiers.meta,
|
|
191
|
-
altKey: modifiers.alt,
|
|
192
|
-
ctrlKey: modifiers.control,
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Creates a fake event object with any desired event type.
|
|
197
|
-
* @docs-private
|
|
198
|
-
*/
|
|
199
|
-
function createFakeEvent(type, bubbles = false, cancelable = true, composed = true) {
|
|
200
|
-
return new Event(type, { bubbles, cancelable, composed });
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Defines a readonly property on the given event object. Readonly properties on an event object
|
|
204
|
-
* are always set as configurable as that matches default readonly properties for DOM event objects.
|
|
205
|
-
*/
|
|
206
|
-
function defineReadonlyEventProperty(event, propertyName, value) {
|
|
207
|
-
Object.defineProperty(event, propertyName, { get: () => value, configurable: true });
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* @license
|
|
212
|
-
* Copyright Google LLC All Rights Reserved.
|
|
213
|
-
*
|
|
214
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
215
|
-
* found in the LICENSE file at https://angular.io/license
|
|
216
|
-
*/
|
|
217
|
-
/**
|
|
218
|
-
* Utility to dispatch any event on a Node.
|
|
219
|
-
* @docs-private
|
|
220
|
-
*/
|
|
221
|
-
function dispatchEvent(node, event) {
|
|
222
|
-
node.dispatchEvent(event);
|
|
223
|
-
return event;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Shorthand to dispatch a fake event on a specified node.
|
|
227
|
-
* @docs-private
|
|
228
|
-
*/
|
|
229
|
-
function dispatchFakeEvent(node, type, bubbles) {
|
|
230
|
-
return dispatchEvent(node, createFakeEvent(type, bubbles));
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Shorthand to dispatch a keyboard event with a specified key code and
|
|
234
|
-
* optional modifiers.
|
|
235
|
-
* @docs-private
|
|
236
|
-
*/
|
|
237
|
-
function dispatchKeyboardEvent(node, type, keyCode, key, modifiers) {
|
|
238
|
-
return dispatchEvent(node, createKeyboardEvent(type, keyCode, key, modifiers));
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Shorthand to dispatch a mouse event on the specified coordinates.
|
|
242
|
-
* @docs-private
|
|
243
|
-
*/
|
|
244
|
-
function dispatchMouseEvent(node, type, clientX = 0, clientY = 0, offsetX, offsetY, button, modifiers) {
|
|
245
|
-
return dispatchEvent(node, createMouseEvent(type, clientX, clientY, offsetX, offsetY, button, modifiers));
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Shorthand to dispatch a pointer event on the specified coordinates.
|
|
249
|
-
* @docs-private
|
|
250
|
-
*/
|
|
251
|
-
function dispatchPointerEvent(node, type, clientX = 0, clientY = 0, offsetX, offsetY, options) {
|
|
252
|
-
return dispatchEvent(node, createPointerEvent(type, clientX, clientY, offsetX, offsetY, options));
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Shorthand to dispatch a touch event on the specified coordinates.
|
|
256
|
-
* @docs-private
|
|
257
|
-
*/
|
|
258
|
-
function dispatchTouchEvent(node, type, pageX = 0, pageY = 0, clientX = 0, clientY = 0) {
|
|
259
|
-
return dispatchEvent(node, createTouchEvent(type, pageX, pageY, clientX, clientY));
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* @license
|
|
264
|
-
* Copyright Google LLC All Rights Reserved.
|
|
265
|
-
*
|
|
266
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
267
|
-
* found in the LICENSE file at https://angular.io/license
|
|
268
|
-
*/
|
|
269
|
-
function triggerFocusChange(element, event) {
|
|
270
|
-
let eventFired = false;
|
|
271
|
-
const handler = () => (eventFired = true);
|
|
272
|
-
element.addEventListener(event, handler);
|
|
273
|
-
element[event]();
|
|
274
|
-
element.removeEventListener(event, handler);
|
|
275
|
-
if (!eventFired) {
|
|
276
|
-
dispatchFakeEvent(element, event);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Patches an elements focus and blur methods to emit events consistently and predictably.
|
|
281
|
-
* This is necessary, because some browsers can call the focus handlers asynchronously,
|
|
282
|
-
* while others won't fire them at all if the browser window is not focused.
|
|
283
|
-
* @docs-private
|
|
284
|
-
*/
|
|
285
|
-
// TODO: Check if this element focus patching is still needed for local testing,
|
|
286
|
-
// where browser is not necessarily focused.
|
|
287
|
-
function patchElementFocus(element) {
|
|
288
|
-
element.focus = () => dispatchFakeEvent(element, 'focus');
|
|
289
|
-
element.blur = () => dispatchFakeEvent(element, 'blur');
|
|
290
|
-
}
|
|
291
|
-
/** @docs-private */
|
|
292
|
-
function triggerFocus(element) {
|
|
293
|
-
triggerFocusChange(element, 'focus');
|
|
294
|
-
}
|
|
295
|
-
/** @docs-private */
|
|
296
|
-
function triggerBlur(element) {
|
|
297
|
-
triggerFocusChange(element, 'blur');
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* @license
|
|
302
|
-
* Copyright Google LLC All Rights Reserved.
|
|
303
|
-
*
|
|
304
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
305
|
-
* found in the LICENSE file at https://angular.io/license
|
|
306
|
-
*/
|
|
307
|
-
/** Input types for which the value can be entered incrementally. */
|
|
308
|
-
const incrementalInputTypes = new Set([
|
|
309
|
-
'text',
|
|
310
|
-
'email',
|
|
311
|
-
'hidden',
|
|
312
|
-
'password',
|
|
313
|
-
'search',
|
|
314
|
-
'tel',
|
|
315
|
-
'url',
|
|
316
|
-
]);
|
|
317
|
-
/**
|
|
318
|
-
* Checks whether the given Element is a text input element.
|
|
319
|
-
* @docs-private
|
|
320
|
-
*/
|
|
321
|
-
function isTextInput(element) {
|
|
322
|
-
const nodeName = element.nodeName.toLowerCase();
|
|
323
|
-
return nodeName === 'input' || nodeName === 'textarea';
|
|
324
|
-
}
|
|
325
|
-
function typeInElement(element, ...modifiersAndKeys) {
|
|
326
|
-
const first = modifiersAndKeys[0];
|
|
327
|
-
let modifiers;
|
|
328
|
-
let rest;
|
|
329
|
-
if (first !== undefined &&
|
|
330
|
-
typeof first !== 'string' &&
|
|
331
|
-
first.keyCode === undefined &&
|
|
332
|
-
first.key === undefined) {
|
|
333
|
-
modifiers = first;
|
|
334
|
-
rest = modifiersAndKeys.slice(1);
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
modifiers = {};
|
|
338
|
-
rest = modifiersAndKeys;
|
|
339
|
-
}
|
|
340
|
-
const isInput = isTextInput(element);
|
|
341
|
-
const inputType = element.getAttribute('type') || 'text';
|
|
342
|
-
const keys = rest
|
|
343
|
-
.map(k => typeof k === 'string'
|
|
344
|
-
? k.split('').map(c => ({ keyCode: c.toUpperCase().charCodeAt(0), key: c }))
|
|
345
|
-
: [k])
|
|
346
|
-
.reduce((arr, k) => arr.concat(k), []);
|
|
347
|
-
// Throw an error if no keys have been specified. Calling this function with no
|
|
348
|
-
// keys should not result in a focus event being dispatched unexpectedly.
|
|
349
|
-
if (keys.length === 0) {
|
|
350
|
-
throw getNoKeysSpecifiedError();
|
|
351
|
-
}
|
|
352
|
-
// We simulate the user typing in a value by incrementally assigning the value below. The problem
|
|
353
|
-
// is that for some input types, the browser won't allow for an invalid value to be set via the
|
|
354
|
-
// `value` property which will always be the case when going character-by-character. If we detect
|
|
355
|
-
// such an input, we have to set the value all at once or listeners to the `input` event (e.g.
|
|
356
|
-
// the `ReactiveFormsModule` uses such an approach) won't receive the correct value.
|
|
357
|
-
const enterValueIncrementally = inputType === 'number'
|
|
358
|
-
? // The value can be set character by character in number inputs if it doesn't have any decimals.
|
|
359
|
-
keys.every(key => key.key !== '.' && key.key !== '-' && key.keyCode !== PERIOD)
|
|
360
|
-
: incrementalInputTypes.has(inputType);
|
|
361
|
-
triggerFocus(element);
|
|
362
|
-
// When we aren't entering the value incrementally, assign it all at once ahead
|
|
363
|
-
// of time so that any listeners to the key events below will have access to it.
|
|
364
|
-
if (!enterValueIncrementally) {
|
|
365
|
-
element.value = keys.reduce((value, key) => value + (key.key || ''), '');
|
|
366
|
-
}
|
|
367
|
-
for (const key of keys) {
|
|
368
|
-
dispatchKeyboardEvent(element, 'keydown', key.keyCode, key.key, modifiers);
|
|
369
|
-
dispatchKeyboardEvent(element, 'keypress', key.keyCode, key.key, modifiers);
|
|
370
|
-
if (isInput && key.key && key.key.length === 1) {
|
|
371
|
-
if (enterValueIncrementally) {
|
|
372
|
-
element.value += key.key;
|
|
373
|
-
dispatchFakeEvent(element, 'input');
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
dispatchKeyboardEvent(element, 'keyup', key.keyCode, key.key, modifiers);
|
|
377
|
-
}
|
|
378
|
-
// Since we weren't dispatching `input` events while sending the keys, we have to do it now.
|
|
379
|
-
if (!enterValueIncrementally) {
|
|
380
|
-
dispatchFakeEvent(element, 'input');
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Clears the text in an input or textarea element.
|
|
385
|
-
* @docs-private
|
|
386
|
-
*/
|
|
387
|
-
function clearElement(element) {
|
|
388
|
-
triggerFocus(element);
|
|
389
|
-
element.value = '';
|
|
390
|
-
dispatchFakeEvent(element, 'input');
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* @license
|
|
395
|
-
* Copyright Google LLC All Rights Reserved.
|
|
396
|
-
*
|
|
397
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
398
|
-
* found in the LICENSE file at https://angular.io/license
|
|
399
|
-
*/
|
|
400
|
-
|
|
401
|
-
/** Maps `TestKey` constants to the `keyCode` and `key` values used by native browser events. */
|
|
402
|
-
const keyMap = {
|
|
403
|
-
[TestKey.BACKSPACE]: { keyCode: keyCodes.BACKSPACE, key: 'Backspace' },
|
|
404
|
-
[TestKey.TAB]: { keyCode: keyCodes.TAB, key: 'Tab' },
|
|
405
|
-
[TestKey.ENTER]: { keyCode: keyCodes.ENTER, key: 'Enter' },
|
|
406
|
-
[TestKey.SHIFT]: { keyCode: keyCodes.SHIFT, key: 'Shift' },
|
|
407
|
-
[TestKey.CONTROL]: { keyCode: keyCodes.CONTROL, key: 'Control' },
|
|
408
|
-
[TestKey.ALT]: { keyCode: keyCodes.ALT, key: 'Alt' },
|
|
409
|
-
[TestKey.ESCAPE]: { keyCode: keyCodes.ESCAPE, key: 'Escape' },
|
|
410
|
-
[TestKey.PAGE_UP]: { keyCode: keyCodes.PAGE_UP, key: 'PageUp' },
|
|
411
|
-
[TestKey.PAGE_DOWN]: { keyCode: keyCodes.PAGE_DOWN, key: 'PageDown' },
|
|
412
|
-
[TestKey.END]: { keyCode: keyCodes.END, key: 'End' },
|
|
413
|
-
[TestKey.HOME]: { keyCode: keyCodes.HOME, key: 'Home' },
|
|
414
|
-
[TestKey.LEFT_ARROW]: { keyCode: keyCodes.LEFT_ARROW, key: 'ArrowLeft' },
|
|
415
|
-
[TestKey.UP_ARROW]: { keyCode: keyCodes.UP_ARROW, key: 'ArrowUp' },
|
|
416
|
-
[TestKey.RIGHT_ARROW]: { keyCode: keyCodes.RIGHT_ARROW, key: 'ArrowRight' },
|
|
417
|
-
[TestKey.DOWN_ARROW]: { keyCode: keyCodes.DOWN_ARROW, key: 'ArrowDown' },
|
|
418
|
-
[TestKey.INSERT]: { keyCode: keyCodes.INSERT, key: 'Insert' },
|
|
419
|
-
[TestKey.DELETE]: { keyCode: keyCodes.DELETE, key: 'Delete' },
|
|
420
|
-
[TestKey.F1]: { keyCode: keyCodes.F1, key: 'F1' },
|
|
421
|
-
[TestKey.F2]: { keyCode: keyCodes.F2, key: 'F2' },
|
|
422
|
-
[TestKey.F3]: { keyCode: keyCodes.F3, key: 'F3' },
|
|
423
|
-
[TestKey.F4]: { keyCode: keyCodes.F4, key: 'F4' },
|
|
424
|
-
[TestKey.F5]: { keyCode: keyCodes.F5, key: 'F5' },
|
|
425
|
-
[TestKey.F6]: { keyCode: keyCodes.F6, key: 'F6' },
|
|
426
|
-
[TestKey.F7]: { keyCode: keyCodes.F7, key: 'F7' },
|
|
427
|
-
[TestKey.F8]: { keyCode: keyCodes.F8, key: 'F8' },
|
|
428
|
-
[TestKey.F9]: { keyCode: keyCodes.F9, key: 'F9' },
|
|
429
|
-
[TestKey.F10]: { keyCode: keyCodes.F10, key: 'F10' },
|
|
430
|
-
[TestKey.F11]: { keyCode: keyCodes.F11, key: 'F11' },
|
|
431
|
-
[TestKey.F12]: { keyCode: keyCodes.F12, key: 'F12' },
|
|
432
|
-
[TestKey.META]: { keyCode: keyCodes.META, key: 'Meta' },
|
|
433
|
-
};
|
|
434
|
-
/** A `TestElement` implementation for unit tests. */
|
|
435
|
-
class UnitTestElement {
|
|
436
|
-
constructor(element, _stabilize) {
|
|
437
|
-
this.element = element;
|
|
438
|
-
this._stabilize = _stabilize;
|
|
439
|
-
}
|
|
440
|
-
/** Blur the element. */
|
|
441
|
-
blur() {
|
|
442
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
443
|
-
triggerBlur(this.element);
|
|
444
|
-
yield this._stabilize();
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
/** Clear the element's input (for input and textarea elements only). */
|
|
448
|
-
clear() {
|
|
449
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
450
|
-
if (!isTextInput(this.element)) {
|
|
451
|
-
throw Error('Attempting to clear an invalid element');
|
|
452
|
-
}
|
|
453
|
-
clearElement(this.element);
|
|
454
|
-
yield this._stabilize();
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
click(...args) {
|
|
458
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
459
|
-
const isDisabled = this.element.disabled === true;
|
|
460
|
-
// If the element is `disabled` and has a `disabled` property, we emit the mouse event
|
|
461
|
-
// sequence but not dispatch the `click` event. This is necessary to keep the behavior
|
|
462
|
-
// consistent with an actual user interaction. The click event is not necessarily
|
|
463
|
-
// automatically prevented by the browser. There is mismatch between Firefox and Chromium:
|
|
464
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=329509.
|
|
465
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=1115661.
|
|
466
|
-
yield this._dispatchMouseEventSequence(isDisabled ? null : 'click', args, 0);
|
|
467
|
-
yield this._stabilize();
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
rightClick(...args) {
|
|
471
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
472
|
-
yield this._dispatchMouseEventSequence('contextmenu', args, 2);
|
|
473
|
-
yield this._stabilize();
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
/** Focus the element. */
|
|
477
|
-
focus() {
|
|
478
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
479
|
-
triggerFocus(this.element);
|
|
480
|
-
yield this._stabilize();
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
/** Get the computed value of the given CSS property for the element. */
|
|
484
|
-
getCssValue(property) {
|
|
485
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
486
|
-
yield this._stabilize();
|
|
487
|
-
// TODO(mmalerba): Consider adding value normalization if we run into common cases where its
|
|
488
|
-
// needed.
|
|
489
|
-
return getComputedStyle(this.element).getPropertyValue(property);
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
/** Hovers the mouse over the element. */
|
|
493
|
-
hover() {
|
|
494
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
495
|
-
this._dispatchPointerEventIfSupported('pointerenter');
|
|
496
|
-
dispatchMouseEvent(this.element, 'mouseover');
|
|
497
|
-
dispatchMouseEvent(this.element, 'mouseenter');
|
|
498
|
-
yield this._stabilize();
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
/** Moves the mouse away from the element. */
|
|
502
|
-
mouseAway() {
|
|
503
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
504
|
-
this._dispatchPointerEventIfSupported('pointerleave');
|
|
505
|
-
dispatchMouseEvent(this.element, 'mouseout');
|
|
506
|
-
dispatchMouseEvent(this.element, 'mouseleave');
|
|
507
|
-
yield this._stabilize();
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
sendKeys(...modifiersAndKeys) {
|
|
511
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
512
|
-
const args = modifiersAndKeys.map(k => (typeof k === 'number' ? keyMap[k] : k));
|
|
513
|
-
typeInElement(this.element, ...args);
|
|
514
|
-
yield this._stabilize();
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* Gets the text from the element.
|
|
519
|
-
* @param options Options that affect what text is included.
|
|
520
|
-
*/
|
|
521
|
-
text(options) {
|
|
522
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
523
|
-
yield this._stabilize();
|
|
524
|
-
if (options === null || options === void 0 ? void 0 : options.exclude) {
|
|
525
|
-
return _getTextWithExcludedElements(this.element, options.exclude);
|
|
526
|
-
}
|
|
527
|
-
return (this.element.textContent || '').trim();
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
/**
|
|
531
|
-
* Sets the value of a `contenteditable` element.
|
|
532
|
-
* @param value Value to be set on the element.
|
|
533
|
-
*/
|
|
534
|
-
setContenteditableValue(value) {
|
|
535
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
536
|
-
const contenteditableAttr = yield this.getAttribute('contenteditable');
|
|
537
|
-
if (contenteditableAttr !== '' && contenteditableAttr !== 'true') {
|
|
538
|
-
throw new Error('setContenteditableValue can only be called on a `contenteditable` element.');
|
|
539
|
-
}
|
|
540
|
-
yield this._stabilize();
|
|
541
|
-
this.element.textContent = value;
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
/** Gets the value for the given attribute from the element. */
|
|
545
|
-
getAttribute(name) {
|
|
546
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
547
|
-
yield this._stabilize();
|
|
548
|
-
return this.element.getAttribute(name);
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
/** Checks whether the element has the given class. */
|
|
552
|
-
hasClass(name) {
|
|
553
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
554
|
-
yield this._stabilize();
|
|
555
|
-
return this.element.classList.contains(name);
|
|
556
|
-
});
|
|
557
|
-
}
|
|
558
|
-
/** Gets the dimensions of the element. */
|
|
559
|
-
getDimensions() {
|
|
560
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
561
|
-
yield this._stabilize();
|
|
562
|
-
return this.element.getBoundingClientRect();
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
/** Gets the value of a property of an element. */
|
|
566
|
-
getProperty(name) {
|
|
567
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
568
|
-
yield this._stabilize();
|
|
569
|
-
return this.element[name];
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
/** Sets the value of a property of an input. */
|
|
573
|
-
setInputValue(value) {
|
|
574
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
575
|
-
this.element.value = value;
|
|
576
|
-
yield this._stabilize();
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
/** Selects the options at the specified indexes inside of a native `select` element. */
|
|
580
|
-
selectOptions(...optionIndexes) {
|
|
581
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
582
|
-
let hasChanged = false;
|
|
583
|
-
const options = this.element.querySelectorAll('option');
|
|
584
|
-
const indexes = new Set(optionIndexes); // Convert to a set to remove duplicates.
|
|
585
|
-
for (let i = 0; i < options.length; i++) {
|
|
586
|
-
const option = options[i];
|
|
587
|
-
const wasSelected = option.selected;
|
|
588
|
-
// We have to go through `option.selected`, because `HTMLSelectElement.value` doesn't
|
|
589
|
-
// allow for multiple options to be selected, even in `multiple` mode.
|
|
590
|
-
option.selected = indexes.has(i);
|
|
591
|
-
if (option.selected !== wasSelected) {
|
|
592
|
-
hasChanged = true;
|
|
593
|
-
dispatchFakeEvent(this.element, 'change');
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
if (hasChanged) {
|
|
597
|
-
yield this._stabilize();
|
|
598
|
-
}
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
/** Checks whether this element matches the given selector. */
|
|
602
|
-
matchesSelector(selector) {
|
|
603
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
604
|
-
yield this._stabilize();
|
|
605
|
-
const elementPrototype = Element.prototype;
|
|
606
|
-
return (elementPrototype['matches'] || elementPrototype['msMatchesSelector']).call(this.element, selector);
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
/** Checks whether the element is focused. */
|
|
610
|
-
isFocused() {
|
|
611
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
612
|
-
yield this._stabilize();
|
|
613
|
-
return document.activeElement === this.element;
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* Dispatches an event with a particular name.
|
|
618
|
-
* @param name Name of the event to be dispatched.
|
|
619
|
-
*/
|
|
620
|
-
dispatchEvent(name, data) {
|
|
621
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
622
|
-
const event = createFakeEvent(name);
|
|
623
|
-
if (data) {
|
|
624
|
-
// tslint:disable-next-line:ban Have to use `Object.assign` to preserve the original object.
|
|
625
|
-
Object.assign(event, data);
|
|
626
|
-
}
|
|
627
|
-
dispatchEvent(this.element, event);
|
|
628
|
-
yield this._stabilize();
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* Dispatches a pointer event on the current element if the browser supports it.
|
|
633
|
-
* @param name Name of the pointer event to be dispatched.
|
|
634
|
-
* @param clientX Coordinate of the user's pointer along the X axis.
|
|
635
|
-
* @param clientY Coordinate of the user's pointer along the Y axis.
|
|
636
|
-
* @param button Mouse button that should be pressed when dispatching the event.
|
|
637
|
-
*/
|
|
638
|
-
_dispatchPointerEventIfSupported(name, clientX, clientY, offsetX, offsetY, button) {
|
|
639
|
-
// The latest versions of all browsers we support have the new `PointerEvent` API.
|
|
640
|
-
// Though since we capture the two most recent versions of these browsers, we also
|
|
641
|
-
// need to support Safari 12 at time of writing. Safari 12 does not have support for this,
|
|
642
|
-
// so we need to conditionally create and dispatch these events based on feature detection.
|
|
643
|
-
if (typeof PointerEvent !== 'undefined' && PointerEvent) {
|
|
644
|
-
dispatchPointerEvent(this.element, name, clientX, clientY, offsetX, offsetY, {
|
|
645
|
-
isPrimary: true,
|
|
646
|
-
button,
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
/**
|
|
651
|
-
* Dispatches all the events that are part of a mouse event sequence
|
|
652
|
-
* and then emits a given primary event at the end, if speciifed.
|
|
653
|
-
*/
|
|
654
|
-
_dispatchMouseEventSequence(primaryEventName, args, button) {
|
|
655
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
656
|
-
let clientX = undefined;
|
|
657
|
-
let clientY = undefined;
|
|
658
|
-
let offsetX = undefined;
|
|
659
|
-
let offsetY = undefined;
|
|
660
|
-
let modifiers = {};
|
|
661
|
-
if (args.length && typeof args[args.length - 1] === 'object') {
|
|
662
|
-
modifiers = args.pop();
|
|
663
|
-
}
|
|
664
|
-
if (args.length) {
|
|
665
|
-
const { left, top, width, height } = yield this.getDimensions();
|
|
666
|
-
offsetX = args[0] === 'center' ? width / 2 : args[0];
|
|
667
|
-
offsetY = args[0] === 'center' ? height / 2 : args[1];
|
|
668
|
-
// Round the computed click position as decimal pixels are not
|
|
669
|
-
// supported by mouse events and could lead to unexpected results.
|
|
670
|
-
clientX = Math.round(left + offsetX);
|
|
671
|
-
clientY = Math.round(top + offsetY);
|
|
672
|
-
}
|
|
673
|
-
this._dispatchPointerEventIfSupported('pointerdown', clientX, clientY, offsetX, offsetY, button);
|
|
674
|
-
dispatchMouseEvent(this.element, 'mousedown', clientX, clientY, offsetX, offsetY, button, modifiers);
|
|
675
|
-
this._dispatchPointerEventIfSupported('pointerup', clientX, clientY, offsetX, offsetY, button);
|
|
676
|
-
dispatchMouseEvent(this.element, 'mouseup', clientX, clientY, offsetX, offsetY, button, modifiers);
|
|
677
|
-
// If a primary event name is specified, emit it after the mouse event sequence.
|
|
678
|
-
if (primaryEventName !== null) {
|
|
679
|
-
dispatchMouseEvent(this.element, primaryEventName, clientX, clientY, offsetX, offsetY, button, modifiers);
|
|
680
|
-
}
|
|
681
|
-
// This call to _stabilize should not be needed since the callers will already do that them-
|
|
682
|
-
// selves. Nevertheless it breaks some tests in g3 without it. It needs to be investigated
|
|
683
|
-
// why removing breaks those tests.
|
|
684
|
-
// See: https://github.com/angular/components/pull/20758/files#r520886256.
|
|
685
|
-
yield this._stabilize();
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
/** The default environment options. */
|
|
691
|
-
const defaultEnvironmentOptions = {
|
|
692
|
-
queryFn: (selector, root) => root.querySelectorAll(selector),
|
|
693
|
-
};
|
|
694
|
-
/** Whether auto change detection is currently disabled. */
|
|
695
|
-
let disableAutoChangeDetection = false;
|
|
696
|
-
/**
|
|
697
|
-
* The set of non-destroyed fixtures currently being used by `TestbedHarnessEnvironment` instances.
|
|
698
|
-
*/
|
|
699
|
-
const activeFixtures = new Set();
|
|
700
|
-
/**
|
|
701
|
-
* Installs a handler for change detection batching status changes for a specific fixture.
|
|
702
|
-
* @param fixture The fixture to handle change detection batching for.
|
|
703
|
-
*/
|
|
704
|
-
function installAutoChangeDetectionStatusHandler(fixture) {
|
|
705
|
-
if (!activeFixtures.size) {
|
|
706
|
-
handleAutoChangeDetectionStatus(({ isDisabled, onDetectChangesNow }) => {
|
|
707
|
-
disableAutoChangeDetection = isDisabled;
|
|
708
|
-
if (onDetectChangesNow) {
|
|
709
|
-
Promise.all(Array.from(activeFixtures).map(detectChanges)).then(onDetectChangesNow);
|
|
710
|
-
}
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
activeFixtures.add(fixture);
|
|
714
|
-
}
|
|
715
|
-
/**
|
|
716
|
-
* Uninstalls a handler for change detection batching status changes for a specific fixture.
|
|
717
|
-
* @param fixture The fixture to stop handling change detection batching for.
|
|
718
|
-
*/
|
|
719
|
-
function uninstallAutoChangeDetectionStatusHandler(fixture) {
|
|
720
|
-
activeFixtures.delete(fixture);
|
|
721
|
-
if (!activeFixtures.size) {
|
|
722
|
-
stopHandlingAutoChangeDetectionStatus();
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
/** Whether we are currently in the fake async zone. */
|
|
726
|
-
function isInFakeAsyncZone() {
|
|
727
|
-
return Zone.current.get('FakeAsyncTestZoneSpec') != null;
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* Triggers change detection for a specific fixture.
|
|
731
|
-
* @param fixture The fixture to trigger change detection for.
|
|
732
|
-
*/
|
|
733
|
-
function detectChanges(fixture) {
|
|
734
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
735
|
-
fixture.detectChanges();
|
|
736
|
-
if (isInFakeAsyncZone()) {
|
|
737
|
-
flush();
|
|
738
|
-
}
|
|
739
|
-
else {
|
|
740
|
-
yield fixture.whenStable();
|
|
741
|
-
}
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
/** A `HarnessEnvironment` implementation for Angular's Testbed. */
|
|
745
|
-
class TestbedHarnessEnvironment extends HarnessEnvironment {
|
|
746
|
-
constructor(rawRootElement, _fixture, options) {
|
|
747
|
-
super(rawRootElement);
|
|
748
|
-
this._fixture = _fixture;
|
|
749
|
-
/** Whether the environment has been destroyed. */
|
|
750
|
-
this._destroyed = false;
|
|
751
|
-
this._options = Object.assign(Object.assign({}, defaultEnvironmentOptions), options);
|
|
752
|
-
this._taskState = TaskStateZoneInterceptor.setup();
|
|
753
|
-
this._stabilizeCallback = () => this.forceStabilize();
|
|
754
|
-
installAutoChangeDetectionStatusHandler(_fixture);
|
|
755
|
-
_fixture.componentRef.onDestroy(() => {
|
|
756
|
-
uninstallAutoChangeDetectionStatusHandler(_fixture);
|
|
757
|
-
this._destroyed = true;
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
/** Creates a `HarnessLoader` rooted at the given fixture's root element. */
|
|
761
|
-
static loader(fixture, options) {
|
|
762
|
-
return new TestbedHarnessEnvironment(fixture.nativeElement, fixture, options);
|
|
763
|
-
}
|
|
764
|
-
/**
|
|
765
|
-
* Creates a `HarnessLoader` at the document root. This can be used if harnesses are
|
|
766
|
-
* located outside of a fixture (e.g. overlays appended to the document body).
|
|
767
|
-
*/
|
|
768
|
-
static documentRootLoader(fixture, options) {
|
|
769
|
-
return new TestbedHarnessEnvironment(document.body, fixture, options);
|
|
770
|
-
}
|
|
771
|
-
/** Gets the native DOM element corresponding to the given TestElement. */
|
|
772
|
-
static getNativeElement(el) {
|
|
773
|
-
if (el instanceof UnitTestElement) {
|
|
774
|
-
return el.element;
|
|
775
|
-
}
|
|
776
|
-
throw Error('This TestElement was not created by the TestbedHarnessEnvironment');
|
|
777
|
-
}
|
|
778
|
-
/**
|
|
779
|
-
* Creates an instance of the given harness type, using the fixture's root element as the
|
|
780
|
-
* harness's host element. This method should be used when creating a harness for the root element
|
|
781
|
-
* of a fixture, as components do not have the correct selector when they are created as the root
|
|
782
|
-
* of the fixture.
|
|
783
|
-
*/
|
|
784
|
-
static harnessForFixture(fixture, harnessType, options) {
|
|
785
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
786
|
-
const environment = new TestbedHarnessEnvironment(fixture.nativeElement, fixture, options);
|
|
787
|
-
yield environment.forceStabilize();
|
|
788
|
-
return environment.createComponentHarness(harnessType, fixture.nativeElement);
|
|
789
|
-
});
|
|
790
|
-
}
|
|
791
|
-
/**
|
|
792
|
-
* Flushes change detection and async tasks captured in the Angular zone.
|
|
793
|
-
* In most cases it should not be necessary to call this manually. However, there may be some edge
|
|
794
|
-
* cases where it is needed to fully flush animation events.
|
|
795
|
-
*/
|
|
796
|
-
forceStabilize() {
|
|
797
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
798
|
-
if (!disableAutoChangeDetection) {
|
|
799
|
-
if (this._destroyed) {
|
|
800
|
-
throw Error('Harness is attempting to use a fixture that has already been destroyed.');
|
|
801
|
-
}
|
|
802
|
-
yield detectChanges(this._fixture);
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
/**
|
|
807
|
-
* Waits for all scheduled or running async tasks to complete. This allows harness
|
|
808
|
-
* authors to wait for async tasks outside of the Angular zone.
|
|
809
|
-
*/
|
|
810
|
-
waitForTasksOutsideAngular() {
|
|
811
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
812
|
-
// If we run in the fake async zone, we run "flush" to run any scheduled tasks. This
|
|
813
|
-
// ensures that the harnesses behave inside of the FakeAsyncTestZone similar to the
|
|
814
|
-
// "AsyncTestZone" and the root zone (i.e. neither fakeAsync or async). Note that we
|
|
815
|
-
// cannot just rely on the task state observable to become stable because the state will
|
|
816
|
-
// never change. This is because the task queue will be only drained if the fake async
|
|
817
|
-
// zone is being flushed.
|
|
818
|
-
if (isInFakeAsyncZone()) {
|
|
819
|
-
flush();
|
|
820
|
-
}
|
|
821
|
-
// Wait until the task queue has been drained and the zone is stable. Note that
|
|
822
|
-
// we cannot rely on "fixture.whenStable" since it does not catch tasks scheduled
|
|
823
|
-
// outside of the Angular zone. For test harnesses, we want to ensure that the
|
|
824
|
-
// app is fully stabilized and therefore need to use our own zone interceptor.
|
|
825
|
-
yield this._taskState.pipe(takeWhile(state => !state.stable)).toPromise();
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
/** Gets the root element for the document. */
|
|
829
|
-
getDocumentRoot() {
|
|
830
|
-
return document.body;
|
|
831
|
-
}
|
|
832
|
-
/** Creates a `TestElement` from a raw element. */
|
|
833
|
-
createTestElement(element) {
|
|
834
|
-
return new UnitTestElement(element, this._stabilizeCallback);
|
|
835
|
-
}
|
|
836
|
-
/** Creates a `HarnessLoader` rooted at the given raw element. */
|
|
837
|
-
createEnvironment(element) {
|
|
838
|
-
return new TestbedHarnessEnvironment(element, this._fixture, this._options);
|
|
839
|
-
}
|
|
840
|
-
/**
|
|
841
|
-
* Gets a list of all elements matching the given selector under this environment's root element.
|
|
842
|
-
*/
|
|
843
|
-
getAllRawElements(selector) {
|
|
844
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
845
|
-
yield this.forceStabilize();
|
|
846
|
-
return Array.from(this._options.queryFn(selector, this.rawRootElement));
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* @license
|
|
853
|
-
* Copyright Google LLC All Rights Reserved.
|
|
854
|
-
*
|
|
855
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
856
|
-
* found in the LICENSE file at https://angular.io/license
|
|
857
|
-
*/
|
|
858
|
-
|
|
859
|
-
/**
|
|
860
|
-
* @license
|
|
861
|
-
* Copyright Google LLC All Rights Reserved.
|
|
862
|
-
*
|
|
863
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
864
|
-
* found in the LICENSE file at https://angular.io/license
|
|
865
|
-
*/
|
|
866
|
-
|
|
867
|
-
export { TestbedHarnessEnvironment, UnitTestElement };
|
|
868
|
-
//# sourceMappingURL=testbed.mjs.map
|