source: trip-planner-front/node_modules/@angular/cdk/esm2015/testing/testbed/unit-test-element.js@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 39.9 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { __awaiter } from "tslib";
9import * as keyCodes from '@angular/cdk/keycodes';
10import { _getTextWithExcludedElements, TestKey, } from '@angular/cdk/testing';
11import { clearElement, createFakeEvent, dispatchFakeEvent, dispatchMouseEvent, dispatchPointerEvent, isTextInput, triggerBlur, triggerFocus, typeInElement, dispatchEvent, } from './fake-events';
12/** Maps `TestKey` constants to the `keyCode` and `key` values used by native browser events. */
13const keyMap = {
14 [TestKey.BACKSPACE]: { keyCode: keyCodes.BACKSPACE, key: 'Backspace' },
15 [TestKey.TAB]: { keyCode: keyCodes.TAB, key: 'Tab' },
16 [TestKey.ENTER]: { keyCode: keyCodes.ENTER, key: 'Enter' },
17 [TestKey.SHIFT]: { keyCode: keyCodes.SHIFT, key: 'Shift' },
18 [TestKey.CONTROL]: { keyCode: keyCodes.CONTROL, key: 'Control' },
19 [TestKey.ALT]: { keyCode: keyCodes.ALT, key: 'Alt' },
20 [TestKey.ESCAPE]: { keyCode: keyCodes.ESCAPE, key: 'Escape' },
21 [TestKey.PAGE_UP]: { keyCode: keyCodes.PAGE_UP, key: 'PageUp' },
22 [TestKey.PAGE_DOWN]: { keyCode: keyCodes.PAGE_DOWN, key: 'PageDown' },
23 [TestKey.END]: { keyCode: keyCodes.END, key: 'End' },
24 [TestKey.HOME]: { keyCode: keyCodes.HOME, key: 'Home' },
25 [TestKey.LEFT_ARROW]: { keyCode: keyCodes.LEFT_ARROW, key: 'ArrowLeft' },
26 [TestKey.UP_ARROW]: { keyCode: keyCodes.UP_ARROW, key: 'ArrowUp' },
27 [TestKey.RIGHT_ARROW]: { keyCode: keyCodes.RIGHT_ARROW, key: 'ArrowRight' },
28 [TestKey.DOWN_ARROW]: { keyCode: keyCodes.DOWN_ARROW, key: 'ArrowDown' },
29 [TestKey.INSERT]: { keyCode: keyCodes.INSERT, key: 'Insert' },
30 [TestKey.DELETE]: { keyCode: keyCodes.DELETE, key: 'Delete' },
31 [TestKey.F1]: { keyCode: keyCodes.F1, key: 'F1' },
32 [TestKey.F2]: { keyCode: keyCodes.F2, key: 'F2' },
33 [TestKey.F3]: { keyCode: keyCodes.F3, key: 'F3' },
34 [TestKey.F4]: { keyCode: keyCodes.F4, key: 'F4' },
35 [TestKey.F5]: { keyCode: keyCodes.F5, key: 'F5' },
36 [TestKey.F6]: { keyCode: keyCodes.F6, key: 'F6' },
37 [TestKey.F7]: { keyCode: keyCodes.F7, key: 'F7' },
38 [TestKey.F8]: { keyCode: keyCodes.F8, key: 'F8' },
39 [TestKey.F9]: { keyCode: keyCodes.F9, key: 'F9' },
40 [TestKey.F10]: { keyCode: keyCodes.F10, key: 'F10' },
41 [TestKey.F11]: { keyCode: keyCodes.F11, key: 'F11' },
42 [TestKey.F12]: { keyCode: keyCodes.F12, key: 'F12' },
43 [TestKey.META]: { keyCode: keyCodes.META, key: 'Meta' }
44};
45/** A `TestElement` implementation for unit tests. */
46export class UnitTestElement {
47 constructor(element, _stabilize) {
48 this.element = element;
49 this._stabilize = _stabilize;
50 }
51 /** Blur the element. */
52 blur() {
53 return __awaiter(this, void 0, void 0, function* () {
54 triggerBlur(this.element);
55 yield this._stabilize();
56 });
57 }
58 /** Clear the element's input (for input and textarea elements only). */
59 clear() {
60 return __awaiter(this, void 0, void 0, function* () {
61 if (!isTextInput(this.element)) {
62 throw Error('Attempting to clear an invalid element');
63 }
64 clearElement(this.element);
65 yield this._stabilize();
66 });
67 }
68 click(...args) {
69 return __awaiter(this, void 0, void 0, function* () {
70 yield this._dispatchMouseEventSequence('click', args, 0);
71 yield this._stabilize();
72 });
73 }
74 rightClick(...args) {
75 return __awaiter(this, void 0, void 0, function* () {
76 yield this._dispatchMouseEventSequence('contextmenu', args, 2);
77 yield this._stabilize();
78 });
79 }
80 /** Focus the element. */
81 focus() {
82 return __awaiter(this, void 0, void 0, function* () {
83 triggerFocus(this.element);
84 yield this._stabilize();
85 });
86 }
87 /** Get the computed value of the given CSS property for the element. */
88 getCssValue(property) {
89 return __awaiter(this, void 0, void 0, function* () {
90 yield this._stabilize();
91 // TODO(mmalerba): Consider adding value normalization if we run into common cases where its
92 // needed.
93 return getComputedStyle(this.element).getPropertyValue(property);
94 });
95 }
96 /** Hovers the mouse over the element. */
97 hover() {
98 return __awaiter(this, void 0, void 0, function* () {
99 this._dispatchPointerEventIfSupported('pointerenter');
100 dispatchMouseEvent(this.element, 'mouseenter');
101 yield this._stabilize();
102 });
103 }
104 /** Moves the mouse away from the element. */
105 mouseAway() {
106 return __awaiter(this, void 0, void 0, function* () {
107 this._dispatchPointerEventIfSupported('pointerleave');
108 dispatchMouseEvent(this.element, 'mouseleave');
109 yield this._stabilize();
110 });
111 }
112 sendKeys(...modifiersAndKeys) {
113 return __awaiter(this, void 0, void 0, function* () {
114 const args = modifiersAndKeys.map(k => typeof k === 'number' ? keyMap[k] : k);
115 typeInElement(this.element, ...args);
116 yield this._stabilize();
117 });
118 }
119 /**
120 * Gets the text from the element.
121 * @param options Options that affect what text is included.
122 */
123 text(options) {
124 return __awaiter(this, void 0, void 0, function* () {
125 yield this._stabilize();
126 if (options === null || options === void 0 ? void 0 : options.exclude) {
127 return _getTextWithExcludedElements(this.element, options.exclude);
128 }
129 return (this.element.textContent || '').trim();
130 });
131 }
132 /** Gets the value for the given attribute from the element. */
133 getAttribute(name) {
134 return __awaiter(this, void 0, void 0, function* () {
135 yield this._stabilize();
136 return this.element.getAttribute(name);
137 });
138 }
139 /** Checks whether the element has the given class. */
140 hasClass(name) {
141 return __awaiter(this, void 0, void 0, function* () {
142 yield this._stabilize();
143 return this.element.classList.contains(name);
144 });
145 }
146 /** Gets the dimensions of the element. */
147 getDimensions() {
148 return __awaiter(this, void 0, void 0, function* () {
149 yield this._stabilize();
150 return this.element.getBoundingClientRect();
151 });
152 }
153 /** Gets the value of a property of an element. */
154 getProperty(name) {
155 return __awaiter(this, void 0, void 0, function* () {
156 yield this._stabilize();
157 return this.element[name];
158 });
159 }
160 /** Sets the value of a property of an input. */
161 setInputValue(value) {
162 return __awaiter(this, void 0, void 0, function* () {
163 this.element.value = value;
164 yield this._stabilize();
165 });
166 }
167 /** Selects the options at the specified indexes inside of a native `select` element. */
168 selectOptions(...optionIndexes) {
169 return __awaiter(this, void 0, void 0, function* () {
170 let hasChanged = false;
171 const options = this.element.querySelectorAll('option');
172 const indexes = new Set(optionIndexes); // Convert to a set to remove duplicates.
173 for (let i = 0; i < options.length; i++) {
174 const option = options[i];
175 const wasSelected = option.selected;
176 // We have to go through `option.selected`, because `HTMLSelectElement.value` doesn't
177 // allow for multiple options to be selected, even in `multiple` mode.
178 option.selected = indexes.has(i);
179 if (option.selected !== wasSelected) {
180 hasChanged = true;
181 dispatchFakeEvent(this.element, 'change');
182 }
183 }
184 if (hasChanged) {
185 yield this._stabilize();
186 }
187 });
188 }
189 /** Checks whether this element matches the given selector. */
190 matchesSelector(selector) {
191 return __awaiter(this, void 0, void 0, function* () {
192 yield this._stabilize();
193 const elementPrototype = Element.prototype;
194 return (elementPrototype['matches'] || elementPrototype['msMatchesSelector'])
195 .call(this.element, selector);
196 });
197 }
198 /** Checks whether the element is focused. */
199 isFocused() {
200 return __awaiter(this, void 0, void 0, function* () {
201 yield this._stabilize();
202 return document.activeElement === this.element;
203 });
204 }
205 /**
206 * Dispatches an event with a particular name.
207 * @param name Name of the event to be dispatched.
208 */
209 dispatchEvent(name, data) {
210 return __awaiter(this, void 0, void 0, function* () {
211 const event = createFakeEvent(name);
212 if (data) {
213 // tslint:disable-next-line:ban Have to use `Object.assign` to preserve the original object.
214 Object.assign(event, data);
215 }
216 dispatchEvent(this.element, event);
217 yield this._stabilize();
218 });
219 }
220 /**
221 * Dispatches a pointer event on the current element if the browser supports it.
222 * @param name Name of the pointer event to be dispatched.
223 * @param clientX Coordinate of the user's pointer along the X axis.
224 * @param clientY Coordinate of the user's pointer along the Y axis.
225 * @param button Mouse button that should be pressed when dispatching the event.
226 */
227 _dispatchPointerEventIfSupported(name, clientX, clientY, button) {
228 // The latest versions of all browsers we support have the new `PointerEvent` API.
229 // Though since we capture the two most recent versions of these browsers, we also
230 // need to support Safari 12 at time of writing. Safari 12 does not have support for this,
231 // so we need to conditionally create and dispatch these events based on feature detection.
232 if (typeof PointerEvent !== 'undefined' && PointerEvent) {
233 dispatchPointerEvent(this.element, name, clientX, clientY, { isPrimary: true, button });
234 }
235 }
236 /** Dispatches all the events that are part of a mouse event sequence. */
237 _dispatchMouseEventSequence(name, args, button) {
238 return __awaiter(this, void 0, void 0, function* () {
239 let clientX = undefined;
240 let clientY = undefined;
241 let modifiers = {};
242 if (args.length && typeof args[args.length - 1] === 'object') {
243 modifiers = args.pop();
244 }
245 if (args.length) {
246 const { left, top, width, height } = yield this.getDimensions();
247 const relativeX = args[0] === 'center' ? width / 2 : args[0];
248 const relativeY = args[0] === 'center' ? height / 2 : args[1];
249 // Round the computed click position as decimal pixels are not
250 // supported by mouse events and could lead to unexpected results.
251 clientX = Math.round(left + relativeX);
252 clientY = Math.round(top + relativeY);
253 }
254 this._dispatchPointerEventIfSupported('pointerdown', clientX, clientY, button);
255 dispatchMouseEvent(this.element, 'mousedown', clientX, clientY, button, modifiers);
256 this._dispatchPointerEventIfSupported('pointerup', clientX, clientY, button);
257 dispatchMouseEvent(this.element, 'mouseup', clientX, clientY, button, modifiers);
258 dispatchMouseEvent(this.element, name, clientX, clientY, button, modifiers);
259 // This call to _stabilize should not be needed since the callers will already do that them-
260 // selves. Nevertheless it breaks some tests in g3 without it. It needs to be investigated
261 // why removing breaks those tests.
262 yield this._stabilize();
263 });
264 }
265}
266//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIj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