@angular/cdk 13.2.4 → 13.3.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/drag-drop/drag-ref.d.ts +7 -1
- package/esm2020/a11y/a11y-module.mjs +4 -4
- package/esm2020/a11y/aria-describer/aria-describer.mjs +3 -3
- package/esm2020/a11y/focus-monitor/focus-monitor.mjs +6 -6
- package/esm2020/a11y/focus-trap/configurable-focus-trap-factory.mjs +3 -3
- package/esm2020/a11y/focus-trap/focus-trap-manager.mjs +3 -3
- package/esm2020/a11y/focus-trap/focus-trap.mjs +6 -6
- package/esm2020/a11y/high-contrast-mode/high-contrast-mode-detector.mjs +3 -3
- package/esm2020/a11y/input-modality/input-modality-detector.mjs +3 -3
- package/esm2020/a11y/interactivity-checker/interactivity-checker.mjs +3 -3
- package/esm2020/a11y/live-announcer/live-announcer.mjs +6 -6
- package/esm2020/accordion/accordion-item.mjs +3 -3
- package/esm2020/accordion/accordion-module.mjs +4 -4
- package/esm2020/accordion/accordion.mjs +3 -3
- package/esm2020/bidi/bidi-module.mjs +4 -4
- package/esm2020/bidi/dir.mjs +3 -3
- package/esm2020/bidi/directionality.mjs +3 -3
- package/esm2020/clipboard/clipboard-module.mjs +4 -4
- package/esm2020/clipboard/clipboard.mjs +3 -3
- package/esm2020/clipboard/copy-to-clipboard.mjs +3 -3
- package/esm2020/collections/unique-selection-dispatcher.mjs +3 -3
- package/esm2020/drag-drop/directives/drag-handle.mjs +3 -3
- package/esm2020/drag-drop/directives/drag-placeholder.mjs +3 -3
- package/esm2020/drag-drop/directives/drag-preview.mjs +3 -3
- package/esm2020/drag-drop/directives/drag.mjs +3 -3
- package/esm2020/drag-drop/directives/drop-list-group.mjs +3 -3
- package/esm2020/drag-drop/directives/drop-list.mjs +3 -3
- package/esm2020/drag-drop/drag-drop-module.mjs +4 -4
- package/esm2020/drag-drop/drag-drop-registry.mjs +3 -3
- package/esm2020/drag-drop/drag-drop.mjs +3 -3
- package/esm2020/drag-drop/drag-ref.mjs +36 -23
- package/esm2020/layout/breakpoints-observer.mjs +3 -3
- package/esm2020/layout/layout-module.mjs +4 -4
- package/esm2020/layout/media-matcher.mjs +3 -3
- package/esm2020/observers/observe-content.mjs +13 -13
- package/esm2020/overlay/dispatchers/base-overlay-dispatcher.mjs +3 -3
- package/esm2020/overlay/dispatchers/overlay-keyboard-dispatcher.mjs +26 -8
- package/esm2020/overlay/dispatchers/overlay-outside-click-dispatcher.mjs +33 -12
- package/esm2020/overlay/fullscreen-overlay-container.mjs +3 -3
- package/esm2020/overlay/overlay-container.mjs +3 -3
- package/esm2020/overlay/overlay-directives.mjs +6 -6
- package/esm2020/overlay/overlay-module.mjs +4 -4
- package/esm2020/overlay/overlay-ref.mjs +14 -16
- package/esm2020/overlay/overlay.mjs +3 -3
- package/esm2020/overlay/position/overlay-position-builder.mjs +3 -3
- package/esm2020/overlay/scroll/scroll-strategy-options.mjs +3 -3
- package/esm2020/platform/platform-module.mjs +4 -4
- package/esm2020/platform/platform.mjs +3 -3
- package/esm2020/portal/portal-directives.mjs +16 -16
- package/esm2020/scrolling/fixed-size-virtual-scroll.mjs +3 -3
- package/esm2020/scrolling/scroll-dispatcher.mjs +3 -3
- package/esm2020/scrolling/scrollable.mjs +3 -3
- package/esm2020/scrolling/scrolling-module.mjs +8 -8
- package/esm2020/scrolling/viewport-ruler.mjs +3 -3
- package/esm2020/scrolling/virtual-for-of.mjs +3 -3
- package/esm2020/scrolling/virtual-scroll-viewport.mjs +3 -3
- package/esm2020/stepper/step-header.mjs +3 -3
- package/esm2020/stepper/step-label.mjs +3 -3
- package/esm2020/stepper/stepper-button.mjs +6 -6
- package/esm2020/stepper/stepper-module.mjs +4 -4
- package/esm2020/stepper/stepper.mjs +6 -6
- package/esm2020/table/cell.mjs +21 -21
- package/esm2020/table/coalesced-style-scheduler.mjs +3 -3
- package/esm2020/table/row.mjs +27 -27
- package/esm2020/table/table-module.mjs +4 -4
- package/esm2020/table/table.mjs +18 -18
- package/esm2020/table/text-column.mjs +3 -3
- package/esm2020/testing/harness-environment.mjs +4 -1
- package/esm2020/testing/protractor/protractor-element.mjs +8 -3
- package/esm2020/testing/public-api.mjs +2 -1
- package/esm2020/testing/selenium-webdriver/selenium-web-driver-element.mjs +8 -3
- package/esm2020/testing/test-element-errors.mjs +15 -0
- package/esm2020/testing/test-element.mjs +1 -1
- package/esm2020/testing/testbed/fake-events/type-in-element.mjs +12 -3
- package/esm2020/testing/testbed/unit-test-element.mjs +21 -5
- package/esm2020/text-field/autofill.mjs +6 -6
- package/esm2020/text-field/autosize.mjs +3 -3
- package/esm2020/text-field/text-field-module.mjs +4 -4
- package/esm2020/tree/nested-node.mjs +3 -3
- package/esm2020/tree/node.mjs +3 -3
- package/esm2020/tree/outlet.mjs +3 -3
- package/esm2020/tree/padding.mjs +3 -3
- package/esm2020/tree/toggle.mjs +3 -3
- package/esm2020/tree/tree-module.mjs +4 -4
- package/esm2020/tree/tree.mjs +6 -6
- package/esm2020/version.mjs +1 -1
- package/fesm2015/a11y.mjs +40 -40
- package/fesm2015/a11y.mjs.map +1 -1
- package/fesm2015/accordion.mjs +10 -10
- package/fesm2015/accordion.mjs.map +1 -1
- package/fesm2015/bidi.mjs +10 -10
- package/fesm2015/bidi.mjs.map +1 -1
- package/fesm2015/cdk.mjs +1 -1
- package/fesm2015/cdk.mjs.map +1 -1
- package/fesm2015/clipboard.mjs +10 -10
- package/fesm2015/clipboard.mjs.map +1 -1
- package/fesm2015/coercion.mjs.map +1 -1
- package/fesm2015/collections.mjs +3 -3
- package/fesm2015/collections.mjs.map +1 -1
- package/fesm2015/drag-drop.mjs +63 -50
- package/fesm2015/drag-drop.mjs.map +1 -1
- package/fesm2015/keycodes.mjs.map +1 -1
- package/fesm2015/layout.mjs +10 -10
- package/fesm2015/layout.mjs.map +1 -1
- package/fesm2015/observers.mjs +13 -13
- package/fesm2015/observers.mjs.map +1 -1
- package/fesm2015/overlay.mjs +97 -60
- package/fesm2015/overlay.mjs.map +1 -1
- package/fesm2015/platform.mjs +7 -7
- package/fesm2015/platform.mjs.map +1 -1
- package/fesm2015/portal.mjs +16 -16
- package/fesm2015/portal.mjs.map +1 -1
- package/fesm2015/scrolling.mjs +26 -26
- package/fesm2015/scrolling.mjs.map +1 -1
- package/fesm2015/stepper.mjs +22 -22
- package/fesm2015/stepper.mjs.map +1 -1
- package/fesm2015/table.mjs +76 -76
- package/fesm2015/table.mjs.map +1 -1
- package/fesm2015/testing/protractor.mjs +7 -2
- package/fesm2015/testing/protractor.mjs.map +1 -1
- package/fesm2015/testing/selenium-webdriver.mjs +7 -2
- package/fesm2015/testing/selenium-webdriver.mjs.map +1 -1
- package/fesm2015/testing/testbed.mjs +31 -7
- package/fesm2015/testing/testbed.mjs.map +1 -1
- package/fesm2015/testing.mjs +19 -1
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2015/text-field.mjs +13 -13
- package/fesm2015/text-field.mjs.map +1 -1
- package/fesm2015/tree.mjs +25 -25
- package/fesm2015/tree.mjs.map +1 -1
- package/fesm2020/a11y.mjs +40 -40
- package/fesm2020/a11y.mjs.map +1 -1
- package/fesm2020/accordion.mjs +10 -10
- package/fesm2020/accordion.mjs.map +1 -1
- package/fesm2020/bidi.mjs +10 -10
- package/fesm2020/bidi.mjs.map +1 -1
- package/fesm2020/cdk.mjs +1 -1
- package/fesm2020/cdk.mjs.map +1 -1
- package/fesm2020/clipboard.mjs +10 -10
- package/fesm2020/clipboard.mjs.map +1 -1
- package/fesm2020/coercion.mjs.map +1 -1
- package/fesm2020/collections.mjs +3 -3
- package/fesm2020/collections.mjs.map +1 -1
- package/fesm2020/drag-drop.mjs +63 -50
- package/fesm2020/drag-drop.mjs.map +1 -1
- package/fesm2020/keycodes.mjs.map +1 -1
- package/fesm2020/layout.mjs +10 -10
- package/fesm2020/layout.mjs.map +1 -1
- package/fesm2020/observers.mjs +13 -13
- package/fesm2020/observers.mjs.map +1 -1
- package/fesm2020/overlay.mjs +97 -60
- package/fesm2020/overlay.mjs.map +1 -1
- package/fesm2020/platform.mjs +7 -7
- package/fesm2020/platform.mjs.map +1 -1
- package/fesm2020/portal.mjs +16 -16
- package/fesm2020/portal.mjs.map +1 -1
- package/fesm2020/scrolling.mjs +26 -26
- package/fesm2020/scrolling.mjs.map +1 -1
- package/fesm2020/stepper.mjs +22 -22
- package/fesm2020/stepper.mjs.map +1 -1
- package/fesm2020/table.mjs +76 -76
- package/fesm2020/table.mjs.map +1 -1
- package/fesm2020/testing/protractor.mjs +7 -2
- package/fesm2020/testing/protractor.mjs.map +1 -1
- package/fesm2020/testing/selenium-webdriver.mjs +7 -2
- package/fesm2020/testing/selenium-webdriver.mjs.map +1 -1
- package/fesm2020/testing/testbed.mjs +31 -7
- package/fesm2020/testing/testbed.mjs.map +1 -1
- package/fesm2020/testing.mjs +19 -1
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/text-field.mjs +13 -13
- package/fesm2020/text-field.mjs.map +1 -1
- package/fesm2020/tree.mjs +25 -25
- package/fesm2020/tree.mjs.map +1 -1
- package/overlay/_index.scss +7 -1
- package/overlay/dispatchers/overlay-keyboard-dispatcher.d.ts +7 -2
- package/overlay/dispatchers/overlay-outside-click-dispatcher.d.ts +8 -2
- package/overlay/overlay-ref.d.ts +2 -0
- package/overlay-prebuilt.css +1 -1
- package/package.json +1 -1
- package/schematics/index.js +6 -2
- package/schematics/index.mjs +6 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-update/data/index.js +6 -2
- package/schematics/ng-update/data/index.mjs +6 -2
- package/schematics/ng-update/devkit-migration-rule.js +2 -2
- package/schematics/ng-update/devkit-migration-rule.mjs +2 -2
- package/schematics/ng-update/public-api.js +6 -2
- package/schematics/ng-update/public-api.mjs +6 -2
- package/schematics/update-tool/public-api.js +6 -2
- package/schematics/update-tool/public-api.mjs +6 -2
- package/schematics/utils/index.js +6 -2
- package/schematics/utils/index.mjs +6 -2
- package/testing/public-api.d.ts +1 -0
- package/testing/test-element-errors.d.ts +12 -0
- package/testing/test-element.d.ts +4 -2
- package/testing/testbed/fake-events/type-in-element.d.ts +2 -2
- package/testing/testbed/unit-test-element.d.ts +4 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TestKey, _getTextWithExcludedElements, HarnessEnvironment } from '@angular/cdk/testing';
|
|
1
|
+
import { TestKey, getNoKeysSpecifiedError, _getTextWithExcludedElements, HarnessEnvironment } from '@angular/cdk/testing';
|
|
2
2
|
import { Key, browser, Button, by, element } from 'protractor';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -107,7 +107,7 @@ class ProtractorElement {
|
|
|
107
107
|
const first = modifiersAndKeys[0];
|
|
108
108
|
let modifiers;
|
|
109
109
|
let rest;
|
|
110
|
-
if (typeof first !== 'string' && typeof first !== 'number') {
|
|
110
|
+
if (first !== undefined && typeof first !== 'string' && typeof first !== 'number') {
|
|
111
111
|
modifiers = first;
|
|
112
112
|
rest = modifiersAndKeys.slice(1);
|
|
113
113
|
}
|
|
@@ -122,6 +122,11 @@ class ProtractorElement {
|
|
|
122
122
|
// Key.chord doesn't work well with geckodriver (mozilla/geckodriver#1502),
|
|
123
123
|
// so avoid it if no modifier keys are required.
|
|
124
124
|
.map(k => (modifierKeys.length > 0 ? Key.chord(...modifierKeys, k) : k));
|
|
125
|
+
// Throw an error if no keys have been specified. Calling this function with no
|
|
126
|
+
// keys should not result in a focus event being dispatched unexpectedly.
|
|
127
|
+
if (keys.length === 0) {
|
|
128
|
+
throw getNoKeysSpecifiedError();
|
|
129
|
+
}
|
|
125
130
|
return this.element.sendKeys(...keys);
|
|
126
131
|
}
|
|
127
132
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protractor.mjs","sources":["../../../../../../../src/cdk/testing/protractor/protractor-element.ts","../../../../../../../src/cdk/testing/protractor/protractor-harness-environment.ts","../../../../../../../src/cdk/testing/protractor/public-api.ts","../../../../../../../src/cdk/testing/protractor/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n _getTextWithExcludedElements,\n ElementDimensions,\n ModifierKeys,\n TestElement,\n TestKey,\n TextOptions,\n EventData,\n} from '@angular/cdk/testing';\nimport {browser, Button, by, ElementFinder, Key} from 'protractor';\n\n/** Maps the `TestKey` constants to Protractor's `Key` constants. */\nconst keyMap = {\n [TestKey.BACKSPACE]: Key.BACK_SPACE,\n [TestKey.TAB]: Key.TAB,\n [TestKey.ENTER]: Key.ENTER,\n [TestKey.SHIFT]: Key.SHIFT,\n [TestKey.CONTROL]: Key.CONTROL,\n [TestKey.ALT]: Key.ALT,\n [TestKey.ESCAPE]: Key.ESCAPE,\n [TestKey.PAGE_UP]: Key.PAGE_UP,\n [TestKey.PAGE_DOWN]: Key.PAGE_DOWN,\n [TestKey.END]: Key.END,\n [TestKey.HOME]: Key.HOME,\n [TestKey.LEFT_ARROW]: Key.ARROW_LEFT,\n [TestKey.UP_ARROW]: Key.ARROW_UP,\n [TestKey.RIGHT_ARROW]: Key.ARROW_RIGHT,\n [TestKey.DOWN_ARROW]: Key.ARROW_DOWN,\n [TestKey.INSERT]: Key.INSERT,\n [TestKey.DELETE]: Key.DELETE,\n [TestKey.F1]: Key.F1,\n [TestKey.F2]: Key.F2,\n [TestKey.F3]: Key.F3,\n [TestKey.F4]: Key.F4,\n [TestKey.F5]: Key.F5,\n [TestKey.F6]: Key.F6,\n [TestKey.F7]: Key.F7,\n [TestKey.F8]: Key.F8,\n [TestKey.F9]: Key.F9,\n [TestKey.F10]: Key.F10,\n [TestKey.F11]: Key.F11,\n [TestKey.F12]: Key.F12,\n [TestKey.META]: Key.META,\n};\n\n/** Converts a `ModifierKeys` object to a list of Protractor `Key`s. */\nfunction toProtractorModifierKeys(modifiers: ModifierKeys): string[] {\n const result: string[] = [];\n if (modifiers.control) {\n result.push(Key.CONTROL);\n }\n if (modifiers.alt) {\n result.push(Key.ALT);\n }\n if (modifiers.shift) {\n result.push(Key.SHIFT);\n }\n if (modifiers.meta) {\n result.push(Key.META);\n }\n return result;\n}\n\n/**\n * A `TestElement` implementation for Protractor.\n * @deprecated\n * @breaking-change 13.0.0\n */\nexport class ProtractorElement implements TestElement {\n constructor(readonly element: ElementFinder) {}\n\n /** Blur the element. */\n async blur(): Promise<void> {\n return browser.executeScript('arguments[0].blur()', this.element);\n }\n\n /** Clear the element's input (for input and textarea elements only). */\n async clear(): Promise<void> {\n return this.element.clear();\n }\n\n /**\n * Click the element at the default location for the current environment. If you need to guarantee\n * the element is clicked at a specific location, consider using `click('center')` or\n * `click(x, y)` instead.\n */\n click(modifiers?: ModifierKeys): Promise<void>;\n /** Click the element at the element's center. */\n click(location: 'center', modifiers?: ModifierKeys): Promise<void>;\n /**\n * Click the element at the specified coordinates relative to the top-left of the element.\n * @param relativeX Coordinate within the element, along the X-axis at which to click.\n * @param relativeY Coordinate within the element, along the Y-axis at which to click.\n * @param modifiers Modifier keys held while clicking\n */\n click(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;\n async click(\n ...args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?]\n ): Promise<void> {\n await this._dispatchClickEventSequence(args, Button.LEFT);\n }\n\n /**\n * Right clicks on the element at the specified coordinates relative to the top-left of it.\n * @param relativeX Coordinate within the element, along the X-axis at which to click.\n * @param relativeY Coordinate within the element, along the Y-axis at which to click.\n * @param modifiers Modifier keys held while clicking\n */\n rightClick(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;\n async rightClick(\n ...args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?]\n ): Promise<void> {\n await this._dispatchClickEventSequence(args, Button.RIGHT);\n }\n\n /** Focus the element. */\n async focus(): Promise<void> {\n return browser.executeScript('arguments[0].focus()', this.element);\n }\n\n /** Get the computed value of the given CSS property for the element. */\n async getCssValue(property: string): Promise<string> {\n return this.element.getCssValue(property);\n }\n\n /** Hovers the mouse over the element. */\n async hover(): Promise<void> {\n return browser\n .actions()\n .mouseMove(await this.element.getWebElement())\n .perform();\n }\n\n /** Moves the mouse away from the element. */\n async mouseAway(): Promise<void> {\n return browser\n .actions()\n .mouseMove(await this.element.getWebElement(), {x: -1, y: -1})\n .perform();\n }\n\n /**\n * Sends the given string to the input as a series of key presses. Also fires input events\n * and attempts to add the string to the Element's value.\n */\n async sendKeys(...keys: (string | TestKey)[]): Promise<void>;\n /**\n * Sends the given string to the input as a series of key presses. Also fires input events\n * and attempts to add the string to the Element's value.\n */\n async sendKeys(modifiers: ModifierKeys, ...keys: (string | TestKey)[]): Promise<void>;\n async sendKeys(...modifiersAndKeys: any[]): Promise<void> {\n const first = modifiersAndKeys[0];\n let modifiers: ModifierKeys;\n let rest: (string | TestKey)[];\n if (typeof first !== 'string' && typeof first !== 'number') {\n modifiers = first;\n rest = modifiersAndKeys.slice(1);\n } else {\n modifiers = {};\n rest = modifiersAndKeys;\n }\n\n const modifierKeys = toProtractorModifierKeys(modifiers);\n const keys = rest\n .map(k => (typeof k === 'string' ? k.split('') : [keyMap[k]]))\n .reduce((arr, k) => arr.concat(k), [])\n // Key.chord doesn't work well with geckodriver (mozilla/geckodriver#1502),\n // so avoid it if no modifier keys are required.\n .map(k => (modifierKeys.length > 0 ? Key.chord(...modifierKeys, k) : k));\n\n return this.element.sendKeys(...keys);\n }\n\n /**\n * Gets the text from the element.\n * @param options Options that affect what text is included.\n */\n async text(options?: TextOptions): Promise<string> {\n if (options?.exclude) {\n return browser.executeScript(_getTextWithExcludedElements, this.element, options.exclude);\n }\n // We don't go through Protractor's `getText`, because it excludes text from hidden elements.\n return browser.executeScript(`return (arguments[0].textContent || '').trim()`, this.element);\n }\n\n /** Gets the value for the given attribute from the element. */\n async getAttribute(name: string): Promise<string | null> {\n return browser.executeScript(\n `return arguments[0].getAttribute(arguments[1])`,\n this.element,\n name,\n );\n }\n\n /** Checks whether the element has the given class. */\n async hasClass(name: string): Promise<boolean> {\n const classes = (await this.getAttribute('class')) || '';\n return new Set(classes.split(/\\s+/).filter(c => c)).has(name);\n }\n\n /** Gets the dimensions of the element. */\n async getDimensions(): Promise<ElementDimensions> {\n const {width, height} = await this.element.getSize();\n const {x: left, y: top} = await this.element.getLocation();\n return {width, height, left, top};\n }\n\n /** Gets the value of a property of an element. */\n async getProperty<T = any>(name: string): Promise<T> {\n return browser.executeScript(`return arguments[0][arguments[1]]`, this.element, name);\n }\n\n /** Sets the value of a property of an input. */\n async setInputValue(value: string): Promise<void> {\n return browser.executeScript(`arguments[0].value = arguments[1]`, this.element, value);\n }\n\n /** Selects the options at the specified indexes inside of a native `select` element. */\n async selectOptions(...optionIndexes: number[]): Promise<void> {\n const options = await this.element.all(by.css('option'));\n const indexes = new Set(optionIndexes); // Convert to a set to remove duplicates.\n\n if (options.length && indexes.size) {\n // Reset the value so all the selected states are cleared. We can\n // reuse the input-specific method since the logic is the same.\n await this.setInputValue('');\n\n for (let i = 0; i < options.length; i++) {\n if (indexes.has(i)) {\n // We have to hold the control key while clicking on options so that multiple can be\n // selected in multi-selection mode. The key doesn't do anything for single selection.\n await browser.actions().keyDown(Key.CONTROL).perform();\n await options[i].click();\n await browser.actions().keyUp(Key.CONTROL).perform();\n }\n }\n }\n }\n\n /** Checks whether this element matches the given selector. */\n async matchesSelector(selector: string): Promise<boolean> {\n return browser.executeScript(\n `\n return (Element.prototype.matches ||\n Element.prototype.msMatchesSelector).call(arguments[0], arguments[1])\n `,\n this.element,\n selector,\n );\n }\n\n /** Checks whether the element is focused. */\n async isFocused(): Promise<boolean> {\n return this.element.equals(browser.driver.switchTo().activeElement());\n }\n\n /**\n * Dispatches an event with a particular name.\n * @param name Name of the event to be dispatched.\n */\n async dispatchEvent(name: string, data?: Record<string, EventData>): Promise<void> {\n return browser.executeScript(_dispatchEvent, name, this.element, data);\n }\n\n /** Dispatches all the events that are part of a click event sequence. */\n private async _dispatchClickEventSequence(\n args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?],\n button: string,\n ) {\n let modifiers: ModifierKeys = {};\n if (args.length && typeof args[args.length - 1] === 'object') {\n modifiers = args.pop() as ModifierKeys;\n }\n const modifierKeys = toProtractorModifierKeys(modifiers);\n\n // Omitting the offset argument to mouseMove results in clicking the center.\n // This is the default behavior we want, so we use an empty array of offsetArgs if\n // no args remain after popping the modifiers from the args passed to this function.\n const offsetArgs = (args.length === 2 ? [{x: args[0], y: args[1]}] : []) as [\n {x: number; y: number},\n ];\n\n let actions = browser.actions().mouseMove(await this.element.getWebElement(), ...offsetArgs);\n\n for (const modifierKey of modifierKeys) {\n actions = actions.keyDown(modifierKey);\n }\n actions = actions.click(button);\n for (const modifierKey of modifierKeys) {\n actions = actions.keyUp(modifierKey);\n }\n\n await actions.perform();\n }\n}\n\n/**\n * Dispatches an event with a particular name and data to an element.\n * Note that this needs to be a pure function, because it gets stringified by\n * Protractor and is executed inside the browser.\n */\nfunction _dispatchEvent(name: string, element: ElementFinder, data?: Record<string, EventData>) {\n const event = document.createEvent('Event');\n event.initEvent(name);\n\n if (data) {\n // tslint:disable-next-line:ban Have to use `Object.assign` to preserve the original object.\n Object.assign(event, data);\n }\n\n // This type has a string index signature, so we cannot access it using a dotted property access.\n element['dispatchEvent'](event);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {HarnessEnvironment, HarnessLoader, TestElement} from '@angular/cdk/testing';\nimport {by, element as protractorElement, ElementArrayFinder, ElementFinder} from 'protractor';\nimport {ProtractorElement} from './protractor-element';\n\n/**\n * Options to configure the environment.\n * @deprecated\n * @breaking-change 13.0.0\n */\nexport interface ProtractorHarnessEnvironmentOptions {\n /** The query function used to find DOM elements. */\n queryFn: (selector: string, root: ElementFinder) => ElementArrayFinder;\n}\n\n/** The default environment options. */\nconst defaultEnvironmentOptions: ProtractorHarnessEnvironmentOptions = {\n queryFn: (selector: string, root: ElementFinder) => root.all(by.css(selector)),\n};\n\n/**\n * A `HarnessEnvironment` implementation for Protractor.\n * @deprecated As of v13.0.0, this environment no longer works, as it is not\n * compatible with the new [Angular Package Format](https://angular.io/guide/angular-package-format).\n * @breaking-change 13.0.0\n */\nexport class ProtractorHarnessEnvironment extends HarnessEnvironment<ElementFinder> {\n /** The options for this environment. */\n private _options: ProtractorHarnessEnvironmentOptions;\n\n protected constructor(\n rawRootElement: ElementFinder,\n options?: ProtractorHarnessEnvironmentOptions,\n ) {\n super(rawRootElement);\n this._options = {...defaultEnvironmentOptions, ...options};\n }\n\n /** Creates a `HarnessLoader` rooted at the document root. */\n static loader(options?: ProtractorHarnessEnvironmentOptions): HarnessLoader {\n return new ProtractorHarnessEnvironment(protractorElement(by.css('body')), options);\n }\n\n /** Gets the ElementFinder corresponding to the given TestElement. */\n static getNativeElement(el: TestElement): ElementFinder {\n if (el instanceof ProtractorElement) {\n return el.element;\n }\n throw Error('This TestElement was not created by the ProtractorHarnessEnvironment');\n }\n\n /**\n * Flushes change detection and async tasks captured in the Angular zone.\n * In most cases it should not be necessary to call this manually. However, there may be some edge\n * cases where it is needed to fully flush animation events.\n */\n async forceStabilize(): Promise<void> {}\n\n /** @docs-private */\n async waitForTasksOutsideAngular(): Promise<void> {\n // TODO: figure out how we can do this for the protractor environment.\n // https://github.com/angular/components/issues/17412\n }\n\n /** Gets the root element for the document. */\n protected getDocumentRoot(): ElementFinder {\n return protractorElement(by.css('body'));\n }\n\n /** Creates a `TestElement` from a raw element. */\n protected createTestElement(element: ElementFinder): TestElement {\n return new ProtractorElement(element);\n }\n\n /** Creates a `HarnessLoader` rooted at the given raw element. */\n protected createEnvironment(element: ElementFinder): HarnessEnvironment<ElementFinder> {\n return new ProtractorHarnessEnvironment(element, this._options);\n }\n\n /**\n * Gets a list of all elements matching the given selector under this environment's root element.\n */\n protected async getAllRawElements(selector: string): Promise<ElementFinder[]> {\n const elementArrayFinder = this._options.queryFn(selector, this.rawRootElement);\n const length = await elementArrayFinder.count();\n const elements: ElementFinder[] = [];\n for (let i = 0; i < length; i++) {\n elements.push(elementArrayFinder.get(i));\n }\n return elements;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './protractor-element';\nexport * from './protractor-harness-environment';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":["protractorElement"],"mappings":";;;AAAA;;;;;;;AAmBA;AACA,MAAM,MAAM,GAAG;IACb,CAAC,OAAO,CAAC,SAAS,GAAG,GAAG,CAAC,UAAU;IACnC,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG;IACtB,CAAC,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;IAC1B,CAAC,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;IAC1B,CAAC,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO;IAC9B,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG;IACtB,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM;IAC5B,CAAC,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO;IAC9B,CAAC,OAAO,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS;IAClC,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG;IACtB,CAAC,OAAO,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI;IACxB,CAAC,OAAO,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU;IACpC,CAAC,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ;IAChC,CAAC,OAAO,CAAC,WAAW,GAAG,GAAG,CAAC,WA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/B,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1C;QACD,OAAO,QAAQ,CAAC;KACjB;;;ACjGH;;;;;;;;ACAA;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"protractor.mjs","sources":["../../../../../../../src/cdk/testing/protractor/protractor-element.ts","../../../../../../../src/cdk/testing/protractor/protractor-harness-environment.ts","../../../../../../../src/cdk/testing/protractor/public-api.ts","../../../../../../../src/cdk/testing/protractor/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n _getTextWithExcludedElements,\n ElementDimensions,\n getNoKeysSpecifiedError,\n ModifierKeys,\n TestElement,\n TestKey,\n TextOptions,\n EventData,\n} from '@angular/cdk/testing';\nimport {browser, Button, by, ElementFinder, Key} from 'protractor';\n\n/** Maps the `TestKey` constants to Protractor's `Key` constants. */\nconst keyMap = {\n [TestKey.BACKSPACE]: Key.BACK_SPACE,\n [TestKey.TAB]: Key.TAB,\n [TestKey.ENTER]: Key.ENTER,\n [TestKey.SHIFT]: Key.SHIFT,\n [TestKey.CONTROL]: Key.CONTROL,\n [TestKey.ALT]: Key.ALT,\n [TestKey.ESCAPE]: Key.ESCAPE,\n [TestKey.PAGE_UP]: Key.PAGE_UP,\n [TestKey.PAGE_DOWN]: Key.PAGE_DOWN,\n [TestKey.END]: Key.END,\n [TestKey.HOME]: Key.HOME,\n [TestKey.LEFT_ARROW]: Key.ARROW_LEFT,\n [TestKey.UP_ARROW]: Key.ARROW_UP,\n [TestKey.RIGHT_ARROW]: Key.ARROW_RIGHT,\n [TestKey.DOWN_ARROW]: Key.ARROW_DOWN,\n [TestKey.INSERT]: Key.INSERT,\n [TestKey.DELETE]: Key.DELETE,\n [TestKey.F1]: Key.F1,\n [TestKey.F2]: Key.F2,\n [TestKey.F3]: Key.F3,\n [TestKey.F4]: Key.F4,\n [TestKey.F5]: Key.F5,\n [TestKey.F6]: Key.F6,\n [TestKey.F7]: Key.F7,\n [TestKey.F8]: Key.F8,\n [TestKey.F9]: Key.F9,\n [TestKey.F10]: Key.F10,\n [TestKey.F11]: Key.F11,\n [TestKey.F12]: Key.F12,\n [TestKey.META]: Key.META,\n};\n\n/** Converts a `ModifierKeys` object to a list of Protractor `Key`s. */\nfunction toProtractorModifierKeys(modifiers: ModifierKeys): string[] {\n const result: string[] = [];\n if (modifiers.control) {\n result.push(Key.CONTROL);\n }\n if (modifiers.alt) {\n result.push(Key.ALT);\n }\n if (modifiers.shift) {\n result.push(Key.SHIFT);\n }\n if (modifiers.meta) {\n result.push(Key.META);\n }\n return result;\n}\n\n/**\n * A `TestElement` implementation for Protractor.\n * @deprecated\n * @breaking-change 13.0.0\n */\nexport class ProtractorElement implements TestElement {\n constructor(readonly element: ElementFinder) {}\n\n /** Blur the element. */\n async blur(): Promise<void> {\n return browser.executeScript('arguments[0].blur()', this.element);\n }\n\n /** Clear the element's input (for input and textarea elements only). */\n async clear(): Promise<void> {\n return this.element.clear();\n }\n\n /**\n * Click the element at the default location for the current environment. If you need to guarantee\n * the element is clicked at a specific location, consider using `click('center')` or\n * `click(x, y)` instead.\n */\n click(modifiers?: ModifierKeys): Promise<void>;\n /** Click the element at the element's center. */\n click(location: 'center', modifiers?: ModifierKeys): Promise<void>;\n /**\n * Click the element at the specified coordinates relative to the top-left of the element.\n * @param relativeX Coordinate within the element, along the X-axis at which to click.\n * @param relativeY Coordinate within the element, along the Y-axis at which to click.\n * @param modifiers Modifier keys held while clicking\n */\n click(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;\n async click(\n ...args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?]\n ): Promise<void> {\n await this._dispatchClickEventSequence(args, Button.LEFT);\n }\n\n /**\n * Right clicks on the element at the specified coordinates relative to the top-left of it.\n * @param relativeX Coordinate within the element, along the X-axis at which to click.\n * @param relativeY Coordinate within the element, along the Y-axis at which to click.\n * @param modifiers Modifier keys held while clicking\n */\n rightClick(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;\n async rightClick(\n ...args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?]\n ): Promise<void> {\n await this._dispatchClickEventSequence(args, Button.RIGHT);\n }\n\n /** Focus the element. */\n async focus(): Promise<void> {\n return browser.executeScript('arguments[0].focus()', this.element);\n }\n\n /** Get the computed value of the given CSS property for the element. */\n async getCssValue(property: string): Promise<string> {\n return this.element.getCssValue(property);\n }\n\n /** Hovers the mouse over the element. */\n async hover(): Promise<void> {\n return browser\n .actions()\n .mouseMove(await this.element.getWebElement())\n .perform();\n }\n\n /** Moves the mouse away from the element. */\n async mouseAway(): Promise<void> {\n return browser\n .actions()\n .mouseMove(await this.element.getWebElement(), {x: -1, y: -1})\n .perform();\n }\n\n /**\n * Sends the given string to the input as a series of key presses. Also fires input events\n * and attempts to add the string to the Element's value.\n */\n async sendKeys(...keys: (string | TestKey)[]): Promise<void>;\n /**\n * Sends the given string to the input as a series of key presses. Also fires input events\n * and attempts to add the string to the Element's value.\n */\n async sendKeys(modifiers: ModifierKeys, ...keys: (string | TestKey)[]): Promise<void>;\n async sendKeys(...modifiersAndKeys: any[]): Promise<void> {\n const first = modifiersAndKeys[0];\n let modifiers: ModifierKeys;\n let rest: (string | TestKey)[];\n if (first !== undefined && typeof first !== 'string' && typeof first !== 'number') {\n modifiers = first;\n rest = modifiersAndKeys.slice(1);\n } else {\n modifiers = {};\n rest = modifiersAndKeys;\n }\n\n const modifierKeys = toProtractorModifierKeys(modifiers);\n const keys = rest\n .map(k => (typeof k === 'string' ? k.split('') : [keyMap[k]]))\n .reduce((arr, k) => arr.concat(k), [])\n // Key.chord doesn't work well with geckodriver (mozilla/geckodriver#1502),\n // so avoid it if no modifier keys are required.\n .map(k => (modifierKeys.length > 0 ? Key.chord(...modifierKeys, k) : k));\n\n // Throw an error if no keys have been specified. Calling this function with no\n // keys should not result in a focus event being dispatched unexpectedly.\n if (keys.length === 0) {\n throw getNoKeysSpecifiedError();\n }\n\n return this.element.sendKeys(...keys);\n }\n\n /**\n * Gets the text from the element.\n * @param options Options that affect what text is included.\n */\n async text(options?: TextOptions): Promise<string> {\n if (options?.exclude) {\n return browser.executeScript(_getTextWithExcludedElements, this.element, options.exclude);\n }\n // We don't go through Protractor's `getText`, because it excludes text from hidden elements.\n return browser.executeScript(`return (arguments[0].textContent || '').trim()`, this.element);\n }\n\n /** Gets the value for the given attribute from the element. */\n async getAttribute(name: string): Promise<string | null> {\n return browser.executeScript(\n `return arguments[0].getAttribute(arguments[1])`,\n this.element,\n name,\n );\n }\n\n /** Checks whether the element has the given class. */\n async hasClass(name: string): Promise<boolean> {\n const classes = (await this.getAttribute('class')) || '';\n return new Set(classes.split(/\\s+/).filter(c => c)).has(name);\n }\n\n /** Gets the dimensions of the element. */\n async getDimensions(): Promise<ElementDimensions> {\n const {width, height} = await this.element.getSize();\n const {x: left, y: top} = await this.element.getLocation();\n return {width, height, left, top};\n }\n\n /** Gets the value of a property of an element. */\n async getProperty<T = any>(name: string): Promise<T> {\n return browser.executeScript(`return arguments[0][arguments[1]]`, this.element, name);\n }\n\n /** Sets the value of a property of an input. */\n async setInputValue(value: string): Promise<void> {\n return browser.executeScript(`arguments[0].value = arguments[1]`, this.element, value);\n }\n\n /** Selects the options at the specified indexes inside of a native `select` element. */\n async selectOptions(...optionIndexes: number[]): Promise<void> {\n const options = await this.element.all(by.css('option'));\n const indexes = new Set(optionIndexes); // Convert to a set to remove duplicates.\n\n if (options.length && indexes.size) {\n // Reset the value so all the selected states are cleared. We can\n // reuse the input-specific method since the logic is the same.\n await this.setInputValue('');\n\n for (let i = 0; i < options.length; i++) {\n if (indexes.has(i)) {\n // We have to hold the control key while clicking on options so that multiple can be\n // selected in multi-selection mode. The key doesn't do anything for single selection.\n await browser.actions().keyDown(Key.CONTROL).perform();\n await options[i].click();\n await browser.actions().keyUp(Key.CONTROL).perform();\n }\n }\n }\n }\n\n /** Checks whether this element matches the given selector. */\n async matchesSelector(selector: string): Promise<boolean> {\n return browser.executeScript(\n `\n return (Element.prototype.matches ||\n Element.prototype.msMatchesSelector).call(arguments[0], arguments[1])\n `,\n this.element,\n selector,\n );\n }\n\n /** Checks whether the element is focused. */\n async isFocused(): Promise<boolean> {\n return this.element.equals(browser.driver.switchTo().activeElement());\n }\n\n /**\n * Dispatches an event with a particular name.\n * @param name Name of the event to be dispatched.\n */\n async dispatchEvent(name: string, data?: Record<string, EventData>): Promise<void> {\n return browser.executeScript(_dispatchEvent, name, this.element, data);\n }\n\n /** Dispatches all the events that are part of a click event sequence. */\n private async _dispatchClickEventSequence(\n args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?],\n button: string,\n ) {\n let modifiers: ModifierKeys = {};\n if (args.length && typeof args[args.length - 1] === 'object') {\n modifiers = args.pop() as ModifierKeys;\n }\n const modifierKeys = toProtractorModifierKeys(modifiers);\n\n // Omitting the offset argument to mouseMove results in clicking the center.\n // This is the default behavior we want, so we use an empty array of offsetArgs if\n // no args remain after popping the modifiers from the args passed to this function.\n const offsetArgs = (args.length === 2 ? [{x: args[0], y: args[1]}] : []) as [\n {x: number; y: number},\n ];\n\n let actions = browser.actions().mouseMove(await this.element.getWebElement(), ...offsetArgs);\n\n for (const modifierKey of modifierKeys) {\n actions = actions.keyDown(modifierKey);\n }\n actions = actions.click(button);\n for (const modifierKey of modifierKeys) {\n actions = actions.keyUp(modifierKey);\n }\n\n await actions.perform();\n }\n}\n\n/**\n * Dispatches an event with a particular name and data to an element.\n * Note that this needs to be a pure function, because it gets stringified by\n * Protractor and is executed inside the browser.\n */\nfunction _dispatchEvent(name: string, element: ElementFinder, data?: Record<string, EventData>) {\n const event = document.createEvent('Event');\n event.initEvent(name);\n\n if (data) {\n // tslint:disable-next-line:ban Have to use `Object.assign` to preserve the original object.\n Object.assign(event, data);\n }\n\n // This type has a string index signature, so we cannot access it using a dotted property access.\n element['dispatchEvent'](event);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {HarnessEnvironment, HarnessLoader, TestElement} from '@angular/cdk/testing';\nimport {by, element as protractorElement, ElementArrayFinder, ElementFinder} from 'protractor';\nimport {ProtractorElement} from './protractor-element';\n\n/**\n * Options to configure the environment.\n * @deprecated\n * @breaking-change 13.0.0\n */\nexport interface ProtractorHarnessEnvironmentOptions {\n /** The query function used to find DOM elements. */\n queryFn: (selector: string, root: ElementFinder) => ElementArrayFinder;\n}\n\n/** The default environment options. */\nconst defaultEnvironmentOptions: ProtractorHarnessEnvironmentOptions = {\n queryFn: (selector: string, root: ElementFinder) => root.all(by.css(selector)),\n};\n\n/**\n * A `HarnessEnvironment` implementation for Protractor.\n * @deprecated As of v13.0.0, this environment no longer works, as it is not\n * compatible with the new [Angular Package Format](https://angular.io/guide/angular-package-format).\n * @breaking-change 13.0.0\n */\nexport class ProtractorHarnessEnvironment extends HarnessEnvironment<ElementFinder> {\n /** The options for this environment. */\n private _options: ProtractorHarnessEnvironmentOptions;\n\n protected constructor(\n rawRootElement: ElementFinder,\n options?: ProtractorHarnessEnvironmentOptions,\n ) {\n super(rawRootElement);\n this._options = {...defaultEnvironmentOptions, ...options};\n }\n\n /** Creates a `HarnessLoader` rooted at the document root. */\n static loader(options?: ProtractorHarnessEnvironmentOptions): HarnessLoader {\n return new ProtractorHarnessEnvironment(protractorElement(by.css('body')), options);\n }\n\n /** Gets the ElementFinder corresponding to the given TestElement. */\n static getNativeElement(el: TestElement): ElementFinder {\n if (el instanceof ProtractorElement) {\n return el.element;\n }\n throw Error('This TestElement was not created by the ProtractorHarnessEnvironment');\n }\n\n /**\n * Flushes change detection and async tasks captured in the Angular zone.\n * In most cases it should not be necessary to call this manually. However, there may be some edge\n * cases where it is needed to fully flush animation events.\n */\n async forceStabilize(): Promise<void> {}\n\n /** @docs-private */\n async waitForTasksOutsideAngular(): Promise<void> {\n // TODO: figure out how we can do this for the protractor environment.\n // https://github.com/angular/components/issues/17412\n }\n\n /** Gets the root element for the document. */\n protected getDocumentRoot(): ElementFinder {\n return protractorElement(by.css('body'));\n }\n\n /** Creates a `TestElement` from a raw element. */\n protected createTestElement(element: ElementFinder): TestElement {\n return new ProtractorElement(element);\n }\n\n /** Creates a `HarnessLoader` rooted at the given raw element. */\n protected createEnvironment(element: ElementFinder): HarnessEnvironment<ElementFinder> {\n return new ProtractorHarnessEnvironment(element, this._options);\n }\n\n /**\n * Gets a list of all elements matching the given selector under this environment's root element.\n */\n protected async getAllRawElements(selector: string): Promise<ElementFinder[]> {\n const elementArrayFinder = this._options.queryFn(selector, this.rawRootElement);\n const length = await elementArrayFinder.count();\n const elements: ElementFinder[] = [];\n for (let i = 0; i < length; i++) {\n elements.push(elementArrayFinder.get(i));\n }\n return elements;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './protractor-element';\nexport * from './protractor-harness-environment';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":["protractorElement"],"mappings":";;;AAAA;;;;;;AAMG;AAcH;AACA,MAAM,MAAM,GAAG;AACb,IAAA,CAAC,OAAO,CAAC,SAAS,GAAG,GAAG,CAAC,UAAU;AACnC,IAAA,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG;AACtB,IAAA,CAAC,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;AAC1B,IAAA,CAAC,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;AAC1B,IAAA,CAAC,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO;AAC9B,IA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AA4B,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;KACjE;AAED;;AAEG;IACO,MAAM,iBAAiB,CAAC,QAAgB,EAAA;AAChD,QAAA,MAAM,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;AAChF,QAAA,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAChD,MAAM,QAAQ,GAAoB,EAAE,CAAC;QACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/B,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,SAAA;AACD,QAAA,OAAO,QAAQ,CAAC;KACjB;AACF;;AClGD;;;;;;AAMG;;ACNH;;;;;;AAMG;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TestKey, _getTextWithExcludedElements, HarnessEnvironment } from '@angular/cdk/testing';
|
|
1
|
+
import { TestKey, getNoKeysSpecifiedError, _getTextWithExcludedElements, HarnessEnvironment } from '@angular/cdk/testing';
|
|
2
2
|
import * as webdriver from 'selenium-webdriver';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -117,7 +117,7 @@ class SeleniumWebDriverElement {
|
|
|
117
117
|
const first = modifiersAndKeys[0];
|
|
118
118
|
let modifiers;
|
|
119
119
|
let rest;
|
|
120
|
-
if (typeof first !== 'string' && typeof first !== 'number') {
|
|
120
|
+
if (first !== undefined && typeof first !== 'string' && typeof first !== 'number') {
|
|
121
121
|
modifiers = first;
|
|
122
122
|
rest = modifiersAndKeys.slice(1);
|
|
123
123
|
}
|
|
@@ -132,6 +132,11 @@ class SeleniumWebDriverElement {
|
|
|
132
132
|
// webdriver.Key.chord doesn't work well with geckodriver (mozilla/geckodriver#1502),
|
|
133
133
|
// so avoid it if no modifier keys are required.
|
|
134
134
|
.map(k => (modifierKeys.length > 0 ? webdriver.Key.chord(...modifierKeys, k) : k));
|
|
135
|
+
// Throw an error if no keys have been specified. Calling this function with no
|
|
136
|
+
// keys should not result in a focus event being dispatched unexpectedly.
|
|
137
|
+
if (keys.length === 0) {
|
|
138
|
+
throw getNoKeysSpecifiedError();
|
|
139
|
+
}
|
|
135
140
|
await this.element().sendKeys(...keys);
|
|
136
141
|
await this._stabilize();
|
|
137
142
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selenium-webdriver.mjs","sources":["../../../../../../../src/cdk/testing/selenium-webdriver/selenium-webdriver-keys.ts","../../../../../../../src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts","../../../../../../../src/cdk/testing/selenium-webdriver/selenium-web-driver-harness-environment.ts","../../../../../../../src/cdk/testing/selenium-webdriver/public-api.ts","../../../../../../../src/cdk/testing/selenium-webdriver/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ModifierKeys, TestKey} from '@angular/cdk/testing';\nimport * as webdriver from 'selenium-webdriver';\n\n/**\n * Maps the `TestKey` constants to WebDriver's `webdriver.Key` constants.\n * See https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/webdriver/key.js#L29\n */\nexport const seleniumWebDriverKeyMap = {\n [TestKey.BACKSPACE]: webdriver.Key.BACK_SPACE,\n [TestKey.TAB]: webdriver.Key.TAB,\n [TestKey.ENTER]: webdriver.Key.ENTER,\n [TestKey.SHIFT]: webdriver.Key.SHIFT,\n [TestKey.CONTROL]: webdriver.Key.CONTROL,\n [TestKey.ALT]: webdriver.Key.ALT,\n [TestKey.ESCAPE]: webdriver.Key.ESCAPE,\n [TestKey.PAGE_UP]: webdriver.Key.PAGE_UP,\n [TestKey.PAGE_DOWN]: webdriver.Key.PAGE_DOWN,\n [TestKey.END]: webdriver.Key.END,\n [TestKey.HOME]: webdriver.Key.HOME,\n [TestKey.LEFT_ARROW]: webdriver.Key.ARROW_LEFT,\n [TestKey.UP_ARROW]: webdriver.Key.ARROW_UP,\n [TestKey.RIGHT_ARROW]: webdriver.Key.ARROW_RIGHT,\n [TestKey.DOWN_ARROW]: webdriver.Key.ARROW_DOWN,\n [TestKey.INSERT]: webdriver.Key.INSERT,\n [TestKey.DELETE]: webdriver.Key.DELETE,\n [TestKey.F1]: webdriver.Key.F1,\n [TestKey.F2]: webdriver.Key.F2,\n [TestKey.F3]: webdriver.Key.F3,\n [TestKey.F4]: webdriver.Key.F4,\n [TestKey.F5]: webdriver.Key.F5,\n [TestKey.F6]: webdriver.Key.F6,\n [TestKey.F7]: webdriver.Key.F7,\n [TestKey.F8]: webdriver.Key.F8,\n [TestKey.F9]: webdriver.Key.F9,\n [TestKey.F10]: webdriver.Key.F10,\n [TestKey.F11]: webdriver.Key.F11,\n [TestKey.F12]: webdriver.Key.F12,\n [TestKey.META]: webdriver.Key.META,\n};\n\n/** Gets a list of WebDriver `Key`s for the given `ModifierKeys`. */\nexport function getSeleniumWebDriverModifierKeys(modifiers: ModifierKeys): string[] {\n const result: string[] = [];\n if (modifiers.control) {\n result.push(webdriver.Key.CONTROL);\n }\n if (modifiers.alt) {\n result.push(webdriver.Key.ALT);\n }\n if (modifiers.shift) {\n result.push(webdriver.Key.SHIFT);\n }\n if (modifiers.meta) {\n result.push(webdriver.Key.META);\n }\n return result;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n _getTextWithExcludedElements,\n ElementDimensions,\n EventData,\n ModifierKeys,\n TestElement,\n TestKey,\n TextOptions,\n} from '@angular/cdk/testing';\nimport * as webdriver from 'selenium-webdriver';\nimport {getSeleniumWebDriverModifierKeys, seleniumWebDriverKeyMap} from './selenium-webdriver-keys';\n\n/** A `TestElement` implementation for WebDriver. */\nexport class SeleniumWebDriverElement implements TestElement {\n constructor(\n readonly element: () => webdriver.WebElement,\n private _stabilize: () => Promise<void>,\n ) {}\n\n /** Blur the element. */\n async blur(): Promise<void> {\n await this._executeScript((element: HTMLElement) => element.blur(), this.element());\n await this._stabilize();\n }\n\n /** Clear the element's input (for input and textarea elements only). */\n async clear(): Promise<void> {\n await this.element().clear();\n await this._stabilize();\n }\n\n /**\n * Click the element at the default location for the current environment. If you need to guarantee\n * the element is clicked at a specific location, consider using `click('center')` or\n * `click(x, y)` instead.\n */\n click(modifiers?: ModifierKeys): Promise<void>;\n /** Click the element at the element's center. */\n click(location: 'center', modifiers?: ModifierKeys): Promise<void>;\n /**\n * Click the element at the specified coordinates relative to the top-left of the element.\n * @param relativeX Coordinate within the element, along the X-axis at which to click.\n * @param relativeY Coordinate within the element, along the Y-axis at which to click.\n * @param modifiers Modifier keys held while clicking\n */\n click(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;\n async click(\n ...args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?]\n ): Promise<void> {\n await this._dispatchClickEventSequence(args, webdriver.Button.LEFT);\n await this._stabilize();\n }\n\n /**\n * Right clicks on the element at the specified coordinates relative to the top-left of it.\n * @param relativeX Coordinate within the element, along the X-axis at which to click.\n * @param relativeY Coordinate within the element, along the Y-axis at which to click.\n * @param modifiers Modifier keys held while clicking\n */\n rightClick(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;\n async rightClick(\n ...args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?]\n ): Promise<void> {\n await this._dispatchClickEventSequence(args, webdriver.Button.RIGHT);\n await this._stabilize();\n }\n\n /** Focus the element. */\n async focus(): Promise<void> {\n await this._executeScript((element: HTMLElement) => element.focus(), this.element());\n await this._stabilize();\n }\n\n /** Get the computed value of the given CSS property for the element. */\n async getCssValue(property: string): Promise<string> {\n await this._stabilize();\n return this.element().getCssValue(property);\n }\n\n /** Hovers the mouse over the element. */\n async hover(): Promise<void> {\n await this._actions().mouseMove(this.element()).perform();\n await this._stabilize();\n }\n\n /** Moves the mouse away from the element. */\n async mouseAway(): Promise<void> {\n await this._actions().mouseMove(this.element(), {x: -1, y: -1}).perform();\n await this._stabilize();\n }\n\n /**\n * Sends the given string to the input as a series of key presses. Also fires input events\n * and attempts to add the string to the Element's value.\n */\n async sendKeys(...keys: (string | TestKey)[]): Promise<void>;\n /**\n * Sends the given string to the input as a series of key presses. Also fires input events\n * and attempts to add the string to the Element's value.\n */\n async sendKeys(modifiers: ModifierKeys, ...keys: (string | TestKey)[]): Promise<void>;\n async sendKeys(...modifiersAndKeys: any[]): Promise<void> {\n const first = modifiersAndKeys[0];\n let modifiers: ModifierKeys;\n let rest: (string | TestKey)[];\n if (typeof first !== 'string' && typeof first !== 'number') {\n modifiers = first;\n rest = modifiersAndKeys.slice(1);\n } else {\n modifiers = {};\n rest = modifiersAndKeys;\n }\n\n const modifierKeys = getSeleniumWebDriverModifierKeys(modifiers);\n const keys = rest\n .map(k => (typeof k === 'string' ? k.split('') : [seleniumWebDriverKeyMap[k]]))\n .reduce((arr, k) => arr.concat(k), [])\n // webdriver.Key.chord doesn't work well with geckodriver (mozilla/geckodriver#1502),\n // so avoid it if no modifier keys are required.\n .map(k => (modifierKeys.length > 0 ? webdriver.Key.chord(...modifierKeys, k) : k));\n\n await this.element().sendKeys(...keys);\n await this._stabilize();\n }\n\n /**\n * Gets the text from the element.\n * @param options Options that affect what text is included.\n */\n async text(options?: TextOptions): Promise<string> {\n await this._stabilize();\n if (options?.exclude) {\n return this._executeScript(_getTextWithExcludedElements, this.element(), options.exclude);\n }\n // We don't go through the WebDriver `getText`, because it excludes text from hidden elements.\n return this._executeScript(\n (element: Element) => (element.textContent || '').trim(),\n this.element(),\n );\n }\n\n /** Gets the value for the given attribute from the element. */\n async getAttribute(name: string): Promise<string | null> {\n await this._stabilize();\n return this._executeScript(\n (element: Element, attribute: string) => element.getAttribute(attribute),\n this.element(),\n name,\n );\n }\n\n /** Checks whether the element has the given class. */\n async hasClass(name: string): Promise<boolean> {\n await this._stabilize();\n const classes = (await this.getAttribute('class')) || '';\n return new Set(classes.split(/\\s+/).filter(c => c)).has(name);\n }\n\n /** Gets the dimensions of the element. */\n async getDimensions(): Promise<ElementDimensions> {\n await this._stabilize();\n const {width, height} = await this.element().getSize();\n const {x: left, y: top} = await this.element().getLocation();\n return {width, height, left, top};\n }\n\n /** Gets the value of a property of an element. */\n async getProperty<T = any>(name: string): Promise<T> {\n await this._stabilize();\n return this._executeScript(\n (element: Element, property: keyof Element) => element[property],\n this.element(),\n name,\n );\n }\n\n /** Sets the value of a property of an input. */\n async setInputValue(newValue: string): Promise<void> {\n await this._executeScript(\n (element: HTMLInputElement, value: string) => (element.value = value),\n this.element(),\n newValue,\n );\n await this._stabilize();\n }\n\n /** Selects the options at the specified indexes inside of a native `select` element. */\n async selectOptions(...optionIndexes: number[]): Promise<void> {\n await this._stabilize();\n const options = await this.element().findElements(webdriver.By.css('option'));\n const indexes = new Set(optionIndexes); // Convert to a set to remove duplicates.\n\n if (options.length && indexes.size) {\n // Reset the value so all the selected states are cleared. We can\n // reuse the input-specific method since the logic is the same.\n await this.setInputValue('');\n\n for (let i = 0; i < options.length; i++) {\n if (indexes.has(i)) {\n // We have to hold the control key while clicking on options so that multiple can be\n // selected in multi-selection mode. The key doesn't do anything for single selection.\n await this._actions().keyDown(webdriver.Key.CONTROL).perform();\n await options[i].click();\n await this._actions().keyUp(webdriver.Key.CONTROL).perform();\n }\n }\n\n await this._stabilize();\n }\n }\n\n /** Checks whether this element matches the given selector. */\n async matchesSelector(selector: string): Promise<boolean> {\n await this._stabilize();\n return this._executeScript(\n (element: Element, s: string) =>\n (Element.prototype.matches || (Element.prototype as any).msMatchesSelector).call(\n element,\n s,\n ),\n this.element(),\n selector,\n );\n }\n\n /** Checks whether the element is focused. */\n async isFocused(): Promise<boolean> {\n await this._stabilize();\n return webdriver.WebElement.equals(\n this.element(),\n this.element().getDriver().switchTo().activeElement(),\n );\n }\n\n /**\n * Dispatches an event with a particular name.\n * @param name Name of the event to be dispatched.\n */\n async dispatchEvent(name: string, data?: Record<string, EventData>): Promise<void> {\n await this._executeScript(dispatchEvent, name, this.element(), data);\n await this._stabilize();\n }\n\n /** Gets the webdriver action sequence. */\n private _actions() {\n return this.element().getDriver().actions();\n }\n\n /** Executes a function in the browser. */\n private async _executeScript<T>(script: Function, ...var_args: any[]): Promise<T> {\n return this.element()\n .getDriver()\n .executeScript(script, ...var_args);\n }\n\n /** Dispatches all the events that are part of a click event sequence. */\n private async _dispatchClickEventSequence(\n args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?],\n button: string,\n ) {\n let modifiers: ModifierKeys = {};\n if (args.length && typeof args[args.length - 1] === 'object') {\n modifiers = args.pop() as ModifierKeys;\n }\n const modifierKeys = getSeleniumWebDriverModifierKeys(modifiers);\n\n // Omitting the offset argument to mouseMove results in clicking the center.\n // This is the default behavior we want, so we use an empty array of offsetArgs if\n // no args remain after popping the modifiers from the args passed to this function.\n const offsetArgs = (args.length === 2 ? [{x: args[0], y: args[1]}] : []) as [\n {x: number; y: number},\n ];\n\n let actions = this._actions().mouseMove(this.element(), ...offsetArgs);\n\n for (const modifierKey of modifierKeys) {\n actions = actions.keyDown(modifierKey);\n }\n actions = actions.click(button);\n for (const modifierKey of modifierKeys) {\n actions = actions.keyUp(modifierKey);\n }\n\n await actions.perform();\n }\n}\n\n/**\n * Dispatches an event with a particular name and data to an element. Note that this needs to be a\n * pure function, because it gets stringified by WebDriver and is executed inside the browser.\n */\nfunction dispatchEvent(name: string, element: Element, data?: Record<string, EventData>) {\n const event = document.createEvent('Event');\n event.initEvent(name);\n // tslint:disable-next-line:ban Have to use `Object.assign` to preserve the original object.\n Object.assign(event, data || {});\n element.dispatchEvent(event);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {HarnessEnvironment, HarnessLoader, TestElement} from '@angular/cdk/testing';\nimport * as webdriver from 'selenium-webdriver';\nimport {SeleniumWebDriverElement} from './selenium-web-driver-element';\n\n/**\n * An Angular framework stabilizer function that takes a callback and calls it when the application\n * is stable, passing a boolean indicating if any work was done.\n */\ndeclare interface FrameworkStabilizer {\n (callback: (didWork: boolean) => void): void;\n}\n\ndeclare global {\n interface Window {\n /**\n * These hooks are exposed by Angular to register a callback for when the application is stable\n * (no more pending tasks).\n *\n * For the implementation, see: https://github.com/\n * angular/angular/blob/master/packages/platform-browser/src/browser/testability.ts#L30-L49\n */\n frameworkStabilizers: FrameworkStabilizer[];\n }\n}\n\n/** Options to configure the environment. */\nexport interface WebDriverHarnessEnvironmentOptions {\n /** The query function used to find DOM elements. */\n queryFn: (selector: string, root: () => webdriver.WebElement) => Promise<webdriver.WebElement[]>;\n}\n\n/** The default environment options. */\nconst defaultEnvironmentOptions: WebDriverHarnessEnvironmentOptions = {\n queryFn: async (selector: string, root: () => webdriver.WebElement) =>\n root().findElements(webdriver.By.css(selector)),\n};\n\n/**\n * This function is meant to be executed in the browser. It taps into the hooks exposed by Angular\n * and invokes the specified `callback` when the application is stable (no more pending tasks).\n */\nfunction whenStable(callback: (didWork: boolean[]) => void): void {\n Promise.all(window.frameworkStabilizers.map(stabilizer => new Promise(stabilizer))).then(\n callback,\n );\n}\n\n/**\n * This function is meant to be executed in the browser. It checks whether the Angular framework has\n * bootstrapped yet.\n */\nfunction isBootstrapped() {\n return !!window.frameworkStabilizers;\n}\n\n/** Waits for angular to be ready after the page load. */\nexport async function waitForAngularReady(wd: webdriver.WebDriver) {\n await wd.wait(() => wd.executeScript(isBootstrapped));\n await wd.executeAsyncScript(whenStable);\n}\n\n/** A `HarnessEnvironment` implementation for WebDriver. */\nexport class SeleniumWebDriverHarnessEnvironment extends HarnessEnvironment<\n () => webdriver.WebElement\n> {\n /** The options for this environment. */\n private _options: WebDriverHarnessEnvironmentOptions;\n\n /** Environment stabilization callback passed to the created test elements. */\n private _stabilizeCallback: () => Promise<void>;\n\n protected constructor(\n rawRootElement: () => webdriver.WebElement,\n options?: WebDriverHarnessEnvironmentOptions,\n ) {\n super(rawRootElement);\n this._options = {...defaultEnvironmentOptions, ...options};\n this._stabilizeCallback = () => this.forceStabilize();\n }\n\n /** Gets the ElementFinder corresponding to the given TestElement. */\n static getNativeElement(el: TestElement): webdriver.WebElement {\n if (el instanceof SeleniumWebDriverElement) {\n return el.element();\n }\n throw Error('This TestElement was not created by the WebDriverHarnessEnvironment');\n }\n\n /** Creates a `HarnessLoader` rooted at the document root. */\n static loader(\n driver: webdriver.WebDriver,\n options?: WebDriverHarnessEnvironmentOptions,\n ): HarnessLoader {\n return new SeleniumWebDriverHarnessEnvironment(\n () => driver.findElement(webdriver.By.css('body')),\n options,\n );\n }\n\n /**\n * Flushes change detection and async tasks captured in the Angular zone.\n * In most cases it should not be necessary to call this manually. However, there may be some edge\n * cases where it is needed to fully flush animation events.\n */\n async forceStabilize(): Promise<void> {\n await this.rawRootElement().getDriver().executeAsyncScript(whenStable);\n }\n\n /** @docs-private */\n async waitForTasksOutsideAngular(): Promise<void> {\n // TODO: figure out how we can do this for the webdriver environment.\n // https://github.com/angular/components/issues/17412\n }\n\n /** Gets the root element for the document. */\n protected getDocumentRoot(): () => webdriver.WebElement {\n return () => this.rawRootElement().getDriver().findElement(webdriver.By.css('body'));\n }\n\n /** Creates a `TestElement` from a raw element. */\n protected createTestElement(element: () => webdriver.WebElement): TestElement {\n return new SeleniumWebDriverElement(element, this._stabilizeCallback);\n }\n\n /** Creates a `HarnessLoader` rooted at the given raw element. */\n protected createEnvironment(\n element: () => webdriver.WebElement,\n ): HarnessEnvironment<() => webdriver.WebElement> {\n return new SeleniumWebDriverHarnessEnvironment(element, this._options);\n }\n\n // Note: This seems to be working, though we may need to re-evaluate if we encounter issues with\n // stale element references. `() => Promise<webdriver.WebElement[]>` seems like a more correct\n // return type, though supporting it would require changes to the public harness API.\n /**\n * Gets a list of all elements matching the given selector under this environment's root element.\n */\n protected async getAllRawElements(selector: string): Promise<(() => webdriver.WebElement)[]> {\n const els = await this._options.queryFn(selector, this.rawRootElement);\n return els.map((x: webdriver.WebElement) => () => x);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './selenium-web-driver-element';\nexport * from './selenium-web-driver-harness-environment';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;;;;;;;AAWA;;;;AAIO,MAAM,uBAAuB,GAAG;IACrC,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,UAAU;IAC7C,CAAC,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG;IAChC,CAAC,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK;IACpC,CAAC,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK;IACpC,CAAC,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO;IACxC,CAAC,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG;IAChC,CAAC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM;IACtC,CAAC,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO;IACxC,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,SAAS;IAC5C,CAAC,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG;IAChC,CAAC,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,GAAG,CAA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D,OAAO,IAAI,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;KACvE;;IAGS,iBAAiB,CACzB,OAAmC;QAEnC,OAAO,IAAI,mCAAmC,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;KACxE;;;;;;;IAQS,MAAM,iBAAiB,CAAC,QAAgB;QAChD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACvE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAuB,KAAK,MAAM,CAAC,CAAC,CAAC;KACtD;;;ACpJH;;;;;;;;ACAA;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"selenium-webdriver.mjs","sources":["../../../../../../../src/cdk/testing/selenium-webdriver/selenium-webdriver-keys.ts","../../../../../../../src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts","../../../../../../../src/cdk/testing/selenium-webdriver/selenium-web-driver-harness-environment.ts","../../../../../../../src/cdk/testing/selenium-webdriver/public-api.ts","../../../../../../../src/cdk/testing/selenium-webdriver/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ModifierKeys, TestKey} from '@angular/cdk/testing';\nimport * as webdriver from 'selenium-webdriver';\n\n/**\n * Maps the `TestKey` constants to WebDriver's `webdriver.Key` constants.\n * See https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/webdriver/key.js#L29\n */\nexport const seleniumWebDriverKeyMap = {\n [TestKey.BACKSPACE]: webdriver.Key.BACK_SPACE,\n [TestKey.TAB]: webdriver.Key.TAB,\n [TestKey.ENTER]: webdriver.Key.ENTER,\n [TestKey.SHIFT]: webdriver.Key.SHIFT,\n [TestKey.CONTROL]: webdriver.Key.CONTROL,\n [TestKey.ALT]: webdriver.Key.ALT,\n [TestKey.ESCAPE]: webdriver.Key.ESCAPE,\n [TestKey.PAGE_UP]: webdriver.Key.PAGE_UP,\n [TestKey.PAGE_DOWN]: webdriver.Key.PAGE_DOWN,\n [TestKey.END]: webdriver.Key.END,\n [TestKey.HOME]: webdriver.Key.HOME,\n [TestKey.LEFT_ARROW]: webdriver.Key.ARROW_LEFT,\n [TestKey.UP_ARROW]: webdriver.Key.ARROW_UP,\n [TestKey.RIGHT_ARROW]: webdriver.Key.ARROW_RIGHT,\n [TestKey.DOWN_ARROW]: webdriver.Key.ARROW_DOWN,\n [TestKey.INSERT]: webdriver.Key.INSERT,\n [TestKey.DELETE]: webdriver.Key.DELETE,\n [TestKey.F1]: webdriver.Key.F1,\n [TestKey.F2]: webdriver.Key.F2,\n [TestKey.F3]: webdriver.Key.F3,\n [TestKey.F4]: webdriver.Key.F4,\n [TestKey.F5]: webdriver.Key.F5,\n [TestKey.F6]: webdriver.Key.F6,\n [TestKey.F7]: webdriver.Key.F7,\n [TestKey.F8]: webdriver.Key.F8,\n [TestKey.F9]: webdriver.Key.F9,\n [TestKey.F10]: webdriver.Key.F10,\n [TestKey.F11]: webdriver.Key.F11,\n [TestKey.F12]: webdriver.Key.F12,\n [TestKey.META]: webdriver.Key.META,\n};\n\n/** Gets a list of WebDriver `Key`s for the given `ModifierKeys`. */\nexport function getSeleniumWebDriverModifierKeys(modifiers: ModifierKeys): string[] {\n const result: string[] = [];\n if (modifiers.control) {\n result.push(webdriver.Key.CONTROL);\n }\n if (modifiers.alt) {\n result.push(webdriver.Key.ALT);\n }\n if (modifiers.shift) {\n result.push(webdriver.Key.SHIFT);\n }\n if (modifiers.meta) {\n result.push(webdriver.Key.META);\n }\n return result;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n _getTextWithExcludedElements,\n ElementDimensions,\n EventData,\n getNoKeysSpecifiedError,\n ModifierKeys,\n TestElement,\n TestKey,\n TextOptions,\n} from '@angular/cdk/testing';\nimport * as webdriver from 'selenium-webdriver';\nimport {getSeleniumWebDriverModifierKeys, seleniumWebDriverKeyMap} from './selenium-webdriver-keys';\n\n/** A `TestElement` implementation for WebDriver. */\nexport class SeleniumWebDriverElement implements TestElement {\n constructor(\n readonly element: () => webdriver.WebElement,\n private _stabilize: () => Promise<void>,\n ) {}\n\n /** Blur the element. */\n async blur(): Promise<void> {\n await this._executeScript((element: HTMLElement) => element.blur(), this.element());\n await this._stabilize();\n }\n\n /** Clear the element's input (for input and textarea elements only). */\n async clear(): Promise<void> {\n await this.element().clear();\n await this._stabilize();\n }\n\n /**\n * Click the element at the default location for the current environment. If you need to guarantee\n * the element is clicked at a specific location, consider using `click('center')` or\n * `click(x, y)` instead.\n */\n click(modifiers?: ModifierKeys): Promise<void>;\n /** Click the element at the element's center. */\n click(location: 'center', modifiers?: ModifierKeys): Promise<void>;\n /**\n * Click the element at the specified coordinates relative to the top-left of the element.\n * @param relativeX Coordinate within the element, along the X-axis at which to click.\n * @param relativeY Coordinate within the element, along the Y-axis at which to click.\n * @param modifiers Modifier keys held while clicking\n */\n click(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;\n async click(\n ...args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?]\n ): Promise<void> {\n await this._dispatchClickEventSequence(args, webdriver.Button.LEFT);\n await this._stabilize();\n }\n\n /**\n * Right clicks on the element at the specified coordinates relative to the top-left of it.\n * @param relativeX Coordinate within the element, along the X-axis at which to click.\n * @param relativeY Coordinate within the element, along the Y-axis at which to click.\n * @param modifiers Modifier keys held while clicking\n */\n rightClick(relativeX: number, relativeY: number, modifiers?: ModifierKeys): Promise<void>;\n async rightClick(\n ...args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?]\n ): Promise<void> {\n await this._dispatchClickEventSequence(args, webdriver.Button.RIGHT);\n await this._stabilize();\n }\n\n /** Focus the element. */\n async focus(): Promise<void> {\n await this._executeScript((element: HTMLElement) => element.focus(), this.element());\n await this._stabilize();\n }\n\n /** Get the computed value of the given CSS property for the element. */\n async getCssValue(property: string): Promise<string> {\n await this._stabilize();\n return this.element().getCssValue(property);\n }\n\n /** Hovers the mouse over the element. */\n async hover(): Promise<void> {\n await this._actions().mouseMove(this.element()).perform();\n await this._stabilize();\n }\n\n /** Moves the mouse away from the element. */\n async mouseAway(): Promise<void> {\n await this._actions().mouseMove(this.element(), {x: -1, y: -1}).perform();\n await this._stabilize();\n }\n\n /**\n * Sends the given string to the input as a series of key presses. Also fires input events\n * and attempts to add the string to the Element's value.\n */\n async sendKeys(...keys: (string | TestKey)[]): Promise<void>;\n /**\n * Sends the given string to the input as a series of key presses. Also fires input events\n * and attempts to add the string to the Element's value.\n */\n async sendKeys(modifiers: ModifierKeys, ...keys: (string | TestKey)[]): Promise<void>;\n async sendKeys(...modifiersAndKeys: any[]): Promise<void> {\n const first = modifiersAndKeys[0];\n let modifiers: ModifierKeys;\n let rest: (string | TestKey)[];\n if (first !== undefined && typeof first !== 'string' && typeof first !== 'number') {\n modifiers = first;\n rest = modifiersAndKeys.slice(1);\n } else {\n modifiers = {};\n rest = modifiersAndKeys;\n }\n\n const modifierKeys = getSeleniumWebDriverModifierKeys(modifiers);\n const keys = rest\n .map(k => (typeof k === 'string' ? k.split('') : [seleniumWebDriverKeyMap[k]]))\n .reduce((arr, k) => arr.concat(k), [])\n // webdriver.Key.chord doesn't work well with geckodriver (mozilla/geckodriver#1502),\n // so avoid it if no modifier keys are required.\n .map(k => (modifierKeys.length > 0 ? webdriver.Key.chord(...modifierKeys, k) : k));\n\n // Throw an error if no keys have been specified. Calling this function with no\n // keys should not result in a focus event being dispatched unexpectedly.\n if (keys.length === 0) {\n throw getNoKeysSpecifiedError();\n }\n\n await this.element().sendKeys(...keys);\n await this._stabilize();\n }\n\n /**\n * Gets the text from the element.\n * @param options Options that affect what text is included.\n */\n async text(options?: TextOptions): Promise<string> {\n await this._stabilize();\n if (options?.exclude) {\n return this._executeScript(_getTextWithExcludedElements, this.element(), options.exclude);\n }\n // We don't go through the WebDriver `getText`, because it excludes text from hidden elements.\n return this._executeScript(\n (element: Element) => (element.textContent || '').trim(),\n this.element(),\n );\n }\n\n /** Gets the value for the given attribute from the element. */\n async getAttribute(name: string): Promise<string | null> {\n await this._stabilize();\n return this._executeScript(\n (element: Element, attribute: string) => element.getAttribute(attribute),\n this.element(),\n name,\n );\n }\n\n /** Checks whether the element has the given class. */\n async hasClass(name: string): Promise<boolean> {\n await this._stabilize();\n const classes = (await this.getAttribute('class')) || '';\n return new Set(classes.split(/\\s+/).filter(c => c)).has(name);\n }\n\n /** Gets the dimensions of the element. */\n async getDimensions(): Promise<ElementDimensions> {\n await this._stabilize();\n const {width, height} = await this.element().getSize();\n const {x: left, y: top} = await this.element().getLocation();\n return {width, height, left, top};\n }\n\n /** Gets the value of a property of an element. */\n async getProperty<T = any>(name: string): Promise<T> {\n await this._stabilize();\n return this._executeScript(\n (element: Element, property: keyof Element) => element[property],\n this.element(),\n name,\n );\n }\n\n /** Sets the value of a property of an input. */\n async setInputValue(newValue: string): Promise<void> {\n await this._executeScript(\n (element: HTMLInputElement, value: string) => (element.value = value),\n this.element(),\n newValue,\n );\n await this._stabilize();\n }\n\n /** Selects the options at the specified indexes inside of a native `select` element. */\n async selectOptions(...optionIndexes: number[]): Promise<void> {\n await this._stabilize();\n const options = await this.element().findElements(webdriver.By.css('option'));\n const indexes = new Set(optionIndexes); // Convert to a set to remove duplicates.\n\n if (options.length && indexes.size) {\n // Reset the value so all the selected states are cleared. We can\n // reuse the input-specific method since the logic is the same.\n await this.setInputValue('');\n\n for (let i = 0; i < options.length; i++) {\n if (indexes.has(i)) {\n // We have to hold the control key while clicking on options so that multiple can be\n // selected in multi-selection mode. The key doesn't do anything for single selection.\n await this._actions().keyDown(webdriver.Key.CONTROL).perform();\n await options[i].click();\n await this._actions().keyUp(webdriver.Key.CONTROL).perform();\n }\n }\n\n await this._stabilize();\n }\n }\n\n /** Checks whether this element matches the given selector. */\n async matchesSelector(selector: string): Promise<boolean> {\n await this._stabilize();\n return this._executeScript(\n (element: Element, s: string) =>\n (Element.prototype.matches || (Element.prototype as any).msMatchesSelector).call(\n element,\n s,\n ),\n this.element(),\n selector,\n );\n }\n\n /** Checks whether the element is focused. */\n async isFocused(): Promise<boolean> {\n await this._stabilize();\n return webdriver.WebElement.equals(\n this.element(),\n this.element().getDriver().switchTo().activeElement(),\n );\n }\n\n /**\n * Dispatches an event with a particular name.\n * @param name Name of the event to be dispatched.\n */\n async dispatchEvent(name: string, data?: Record<string, EventData>): Promise<void> {\n await this._executeScript(dispatchEvent, name, this.element(), data);\n await this._stabilize();\n }\n\n /** Gets the webdriver action sequence. */\n private _actions() {\n return this.element().getDriver().actions();\n }\n\n /** Executes a function in the browser. */\n private async _executeScript<T>(script: Function, ...var_args: any[]): Promise<T> {\n return this.element()\n .getDriver()\n .executeScript(script, ...var_args);\n }\n\n /** Dispatches all the events that are part of a click event sequence. */\n private async _dispatchClickEventSequence(\n args: [ModifierKeys?] | ['center', ModifierKeys?] | [number, number, ModifierKeys?],\n button: string,\n ) {\n let modifiers: ModifierKeys = {};\n if (args.length && typeof args[args.length - 1] === 'object') {\n modifiers = args.pop() as ModifierKeys;\n }\n const modifierKeys = getSeleniumWebDriverModifierKeys(modifiers);\n\n // Omitting the offset argument to mouseMove results in clicking the center.\n // This is the default behavior we want, so we use an empty array of offsetArgs if\n // no args remain after popping the modifiers from the args passed to this function.\n const offsetArgs = (args.length === 2 ? [{x: args[0], y: args[1]}] : []) as [\n {x: number; y: number},\n ];\n\n let actions = this._actions().mouseMove(this.element(), ...offsetArgs);\n\n for (const modifierKey of modifierKeys) {\n actions = actions.keyDown(modifierKey);\n }\n actions = actions.click(button);\n for (const modifierKey of modifierKeys) {\n actions = actions.keyUp(modifierKey);\n }\n\n await actions.perform();\n }\n}\n\n/**\n * Dispatches an event with a particular name and data to an element. Note that this needs to be a\n * pure function, because it gets stringified by WebDriver and is executed inside the browser.\n */\nfunction dispatchEvent(name: string, element: Element, data?: Record<string, EventData>) {\n const event = document.createEvent('Event');\n event.initEvent(name);\n // tslint:disable-next-line:ban Have to use `Object.assign` to preserve the original object.\n Object.assign(event, data || {});\n element.dispatchEvent(event);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {HarnessEnvironment, HarnessLoader, TestElement} from '@angular/cdk/testing';\nimport * as webdriver from 'selenium-webdriver';\nimport {SeleniumWebDriverElement} from './selenium-web-driver-element';\n\n/**\n * An Angular framework stabilizer function that takes a callback and calls it when the application\n * is stable, passing a boolean indicating if any work was done.\n */\ndeclare interface FrameworkStabilizer {\n (callback: (didWork: boolean) => void): void;\n}\n\ndeclare global {\n interface Window {\n /**\n * These hooks are exposed by Angular to register a callback for when the application is stable\n * (no more pending tasks).\n *\n * For the implementation, see: https://github.com/\n * angular/angular/blob/master/packages/platform-browser/src/browser/testability.ts#L30-L49\n */\n frameworkStabilizers: FrameworkStabilizer[];\n }\n}\n\n/** Options to configure the environment. */\nexport interface WebDriverHarnessEnvironmentOptions {\n /** The query function used to find DOM elements. */\n queryFn: (selector: string, root: () => webdriver.WebElement) => Promise<webdriver.WebElement[]>;\n}\n\n/** The default environment options. */\nconst defaultEnvironmentOptions: WebDriverHarnessEnvironmentOptions = {\n queryFn: async (selector: string, root: () => webdriver.WebElement) =>\n root().findElements(webdriver.By.css(selector)),\n};\n\n/**\n * This function is meant to be executed in the browser. It taps into the hooks exposed by Angular\n * and invokes the specified `callback` when the application is stable (no more pending tasks).\n */\nfunction whenStable(callback: (didWork: boolean[]) => void): void {\n Promise.all(window.frameworkStabilizers.map(stabilizer => new Promise(stabilizer))).then(\n callback,\n );\n}\n\n/**\n * This function is meant to be executed in the browser. It checks whether the Angular framework has\n * bootstrapped yet.\n */\nfunction isBootstrapped() {\n return !!window.frameworkStabilizers;\n}\n\n/** Waits for angular to be ready after the page load. */\nexport async function waitForAngularReady(wd: webdriver.WebDriver) {\n await wd.wait(() => wd.executeScript(isBootstrapped));\n await wd.executeAsyncScript(whenStable);\n}\n\n/** A `HarnessEnvironment` implementation for WebDriver. */\nexport class SeleniumWebDriverHarnessEnvironment extends HarnessEnvironment<\n () => webdriver.WebElement\n> {\n /** The options for this environment. */\n private _options: WebDriverHarnessEnvironmentOptions;\n\n /** Environment stabilization callback passed to the created test elements. */\n private _stabilizeCallback: () => Promise<void>;\n\n protected constructor(\n rawRootElement: () => webdriver.WebElement,\n options?: WebDriverHarnessEnvironmentOptions,\n ) {\n super(rawRootElement);\n this._options = {...defaultEnvironmentOptions, ...options};\n this._stabilizeCallback = () => this.forceStabilize();\n }\n\n /** Gets the ElementFinder corresponding to the given TestElement. */\n static getNativeElement(el: TestElement): webdriver.WebElement {\n if (el instanceof SeleniumWebDriverElement) {\n return el.element();\n }\n throw Error('This TestElement was not created by the WebDriverHarnessEnvironment');\n }\n\n /** Creates a `HarnessLoader` rooted at the document root. */\n static loader(\n driver: webdriver.WebDriver,\n options?: WebDriverHarnessEnvironmentOptions,\n ): HarnessLoader {\n return new SeleniumWebDriverHarnessEnvironment(\n () => driver.findElement(webdriver.By.css('body')),\n options,\n );\n }\n\n /**\n * Flushes change detection and async tasks captured in the Angular zone.\n * In most cases it should not be necessary to call this manually. However, there may be some edge\n * cases where it is needed to fully flush animation events.\n */\n async forceStabilize(): Promise<void> {\n await this.rawRootElement().getDriver().executeAsyncScript(whenStable);\n }\n\n /** @docs-private */\n async waitForTasksOutsideAngular(): Promise<void> {\n // TODO: figure out how we can do this for the webdriver environment.\n // https://github.com/angular/components/issues/17412\n }\n\n /** Gets the root element for the document. */\n protected getDocumentRoot(): () => webdriver.WebElement {\n return () => this.rawRootElement().getDriver().findElement(webdriver.By.css('body'));\n }\n\n /** Creates a `TestElement` from a raw element. */\n protected createTestElement(element: () => webdriver.WebElement): TestElement {\n return new SeleniumWebDriverElement(element, this._stabilizeCallback);\n }\n\n /** Creates a `HarnessLoader` rooted at the given raw element. */\n protected createEnvironment(\n element: () => webdriver.WebElement,\n ): HarnessEnvironment<() => webdriver.WebElement> {\n return new SeleniumWebDriverHarnessEnvironment(element, this._options);\n }\n\n // Note: This seems to be working, though we may need to re-evaluate if we encounter issues with\n // stale element references. `() => Promise<webdriver.WebElement[]>` seems like a more correct\n // return type, though supporting it would require changes to the public harness API.\n /**\n * Gets a list of all elements matching the given selector under this environment's root element.\n */\n protected async getAllRawElements(selector: string): Promise<(() => webdriver.WebElement)[]> {\n const els = await this._options.queryFn(selector, this.rawRootElement);\n return els.map((x: webdriver.WebElement) => () => x);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './selenium-web-driver-element';\nexport * from './selenium-web-driver-harness-environment';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;;;;;;AAMG;AAKH;;;AAGG;AACI,MAAM,uBAAuB,GAAG;IACrC,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,UAAU;IAC7C,CAAC,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG;IAChC,CAAC,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK;IACpC,CAAC,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK;IACpC,CAAC,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO;IACxC,CAAC,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG;IAChC,CAAC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC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AAS,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;KACtF;;AAGS,IAAA,iBAAiB,CAAC,OAAmC,EAAA;QAC7D,OAAO,IAAI,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;KACvE;;AAGS,IAAA,iBAAiB,CACzB,OAAmC,EAAA;QAEnC,OAAO,IAAI,mCAAmC,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;KACxE;;;;AAKD;;AAEG;IACO,MAAM,iBAAiB,CAAC,QAAgB,EAAA;AAChD,QAAA,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;AACvE,QAAA,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAuB,KAAK,MAAM,CAAC,CAAC,CAAC;KACtD;AACF;;ACrJD;;;;;;AAMG;;ACNH;;;;;;AAMG;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TestKey, _getTextWithExcludedElements, handleAutoChangeDetectionStatus, stopHandlingAutoChangeDetectionStatus, HarnessEnvironment } from '@angular/cdk/testing';
|
|
1
|
+
import { getNoKeysSpecifiedError, TestKey, _getTextWithExcludedElements, handleAutoChangeDetectionStatus, stopHandlingAutoChangeDetectionStatus, HarnessEnvironment } from '@angular/cdk/testing';
|
|
2
2
|
import { flush } from '@angular/core/testing';
|
|
3
3
|
import { takeWhile } from 'rxjs/operators';
|
|
4
4
|
import { BehaviorSubject } from 'rxjs';
|
|
@@ -321,7 +321,10 @@ function typeInElement(element, ...modifiersAndKeys) {
|
|
|
321
321
|
const first = modifiersAndKeys[0];
|
|
322
322
|
let modifiers;
|
|
323
323
|
let rest;
|
|
324
|
-
if (
|
|
324
|
+
if (first !== undefined &&
|
|
325
|
+
typeof first !== 'string' &&
|
|
326
|
+
first.keyCode === undefined &&
|
|
327
|
+
first.key === undefined) {
|
|
325
328
|
modifiers = first;
|
|
326
329
|
rest = modifiersAndKeys.slice(1);
|
|
327
330
|
}
|
|
@@ -336,12 +339,17 @@ function typeInElement(element, ...modifiersAndKeys) {
|
|
|
336
339
|
? k.split('').map(c => ({ keyCode: c.toUpperCase().charCodeAt(0), key: c }))
|
|
337
340
|
: [k])
|
|
338
341
|
.reduce((arr, k) => arr.concat(k), []);
|
|
342
|
+
// Throw an error if no keys have been specified. Calling this function with no
|
|
343
|
+
// keys should not result in a focus event being dispatched unexpectedly.
|
|
344
|
+
if (keys.length === 0) {
|
|
345
|
+
throw getNoKeysSpecifiedError();
|
|
346
|
+
}
|
|
339
347
|
// We simulate the user typing in a value by incrementally assigning the value below. The problem
|
|
340
348
|
// is that for some input types, the browser won't allow for an invalid value to be set via the
|
|
341
349
|
// `value` property which will always be the case when going character-by-character. If we detect
|
|
342
350
|
// such an input, we have to set the value all at once or listeners to the `input` event (e.g.
|
|
343
351
|
// the `ReactiveFormsModule` uses such an approach) won't receive the correct value.
|
|
344
|
-
const enterValueIncrementally = inputType === 'number'
|
|
352
|
+
const enterValueIncrementally = inputType === 'number'
|
|
345
353
|
? // The value can be set character by character in number inputs if it doesn't have any decimals.
|
|
346
354
|
keys.every(key => key.key !== '.' && key.keyCode !== PERIOD)
|
|
347
355
|
: incrementalInputTypes.has(inputType);
|
|
@@ -445,7 +453,14 @@ class UnitTestElement {
|
|
|
445
453
|
await this._stabilize();
|
|
446
454
|
}
|
|
447
455
|
async click(...args) {
|
|
448
|
-
|
|
456
|
+
const isDisabled = this.element.disabled === true;
|
|
457
|
+
// If the element is `disabled` and has a `disabled` property, we emit the mouse event
|
|
458
|
+
// sequence but not dispatch the `click` event. This is necessary to keep the behavior
|
|
459
|
+
// consistent with an actual user interaction. The click event is not necessarily
|
|
460
|
+
// automatically prevented by the browser. There is mismatch between Firefox and Chromium:
|
|
461
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=329509.
|
|
462
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1115661.
|
|
463
|
+
await this._dispatchMouseEventSequence(isDisabled ? null : 'click', args, 0);
|
|
449
464
|
await this._stabilize();
|
|
450
465
|
}
|
|
451
466
|
async rightClick(...args) {
|
|
@@ -467,12 +482,14 @@ class UnitTestElement {
|
|
|
467
482
|
/** Hovers the mouse over the element. */
|
|
468
483
|
async hover() {
|
|
469
484
|
this._dispatchPointerEventIfSupported('pointerenter');
|
|
485
|
+
dispatchMouseEvent(this.element, 'mouseover');
|
|
470
486
|
dispatchMouseEvent(this.element, 'mouseenter');
|
|
471
487
|
await this._stabilize();
|
|
472
488
|
}
|
|
473
489
|
/** Moves the mouse away from the element. */
|
|
474
490
|
async mouseAway() {
|
|
475
491
|
this._dispatchPointerEventIfSupported('pointerleave');
|
|
492
|
+
dispatchMouseEvent(this.element, 'mouseout');
|
|
476
493
|
dispatchMouseEvent(this.element, 'mouseleave');
|
|
477
494
|
await this._stabilize();
|
|
478
495
|
}
|
|
@@ -577,8 +594,11 @@ class UnitTestElement {
|
|
|
577
594
|
dispatchPointerEvent(this.element, name, clientX, clientY, { isPrimary: true, button });
|
|
578
595
|
}
|
|
579
596
|
}
|
|
580
|
-
/**
|
|
581
|
-
|
|
597
|
+
/**
|
|
598
|
+
* Dispatches all the events that are part of a mouse event sequence
|
|
599
|
+
* and then emits a given primary event at the end, if speciifed.
|
|
600
|
+
*/
|
|
601
|
+
async _dispatchMouseEventSequence(primaryEventName, args, button) {
|
|
582
602
|
let clientX = undefined;
|
|
583
603
|
let clientY = undefined;
|
|
584
604
|
let modifiers = {};
|
|
@@ -598,10 +618,14 @@ class UnitTestElement {
|
|
|
598
618
|
dispatchMouseEvent(this.element, 'mousedown', clientX, clientY, button, modifiers);
|
|
599
619
|
this._dispatchPointerEventIfSupported('pointerup', clientX, clientY, button);
|
|
600
620
|
dispatchMouseEvent(this.element, 'mouseup', clientX, clientY, button, modifiers);
|
|
601
|
-
|
|
621
|
+
// If a primary event name is specified, emit it after the mouse event sequence.
|
|
622
|
+
if (primaryEventName !== null) {
|
|
623
|
+
dispatchMouseEvent(this.element, primaryEventName, clientX, clientY, button, modifiers);
|
|
624
|
+
}
|
|
602
625
|
// This call to _stabilize should not be needed since the callers will already do that them-
|
|
603
626
|
// selves. Nevertheless it breaks some tests in g3 without it. It needs to be investigated
|
|
604
627
|
// why removing breaks those tests.
|
|
628
|
+
// See: https://github.com/angular/components/pull/20758/files#r520886256.
|
|
605
629
|
await this._stabilize();
|
|
606
630
|
}
|
|
607
631
|
}
|