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 | */
|
---|
8 | import { __awaiter } from "tslib";
|
---|
9 | import { HarnessPredicate, ComponentHarness } from '@angular/cdk/testing';
|
---|
10 | /** Harness for interacting with a standard Material calendar cell in tests. */
|
---|
11 | export class MatCalendarCellHarness extends ComponentHarness {
|
---|
12 | constructor() {
|
---|
13 | super(...arguments);
|
---|
14 | /** Reference to the inner content element inside the cell. */
|
---|
15 | this._content = this.locatorFor('.mat-calendar-body-cell-content');
|
---|
16 | }
|
---|
17 | /**
|
---|
18 | * Gets a `HarnessPredicate` that can be used to search for a `MatCalendarCellHarness`
|
---|
19 | * that meets certain criteria.
|
---|
20 | * @param options Options for filtering which cell instances are considered a match.
|
---|
21 | * @return a `HarnessPredicate` configured with the given options.
|
---|
22 | */
|
---|
23 | static with(options = {}) {
|
---|
24 | return new HarnessPredicate(MatCalendarCellHarness, options)
|
---|
25 | .addOption('text', options.text, (harness, text) => {
|
---|
26 | return HarnessPredicate.stringMatches(harness.getText(), text);
|
---|
27 | })
|
---|
28 | .addOption('selected', options.selected, (harness, selected) => __awaiter(this, void 0, void 0, function* () {
|
---|
29 | return (yield harness.isSelected()) === selected;
|
---|
30 | }))
|
---|
31 | .addOption('active', options.active, (harness, active) => __awaiter(this, void 0, void 0, function* () {
|
---|
32 | return (yield harness.isActive()) === active;
|
---|
33 | }))
|
---|
34 | .addOption('disabled', options.disabled, (harness, disabled) => __awaiter(this, void 0, void 0, function* () {
|
---|
35 | return (yield harness.isDisabled()) === disabled;
|
---|
36 | }))
|
---|
37 | .addOption('today', options.today, (harness, today) => __awaiter(this, void 0, void 0, function* () {
|
---|
38 | return (yield harness.isToday()) === today;
|
---|
39 | }))
|
---|
40 | .addOption('inRange', options.inRange, (harness, inRange) => __awaiter(this, void 0, void 0, function* () {
|
---|
41 | return (yield harness.isInRange()) === inRange;
|
---|
42 | }))
|
---|
43 | .addOption('inComparisonRange', options.inComparisonRange, (harness, inComparisonRange) => __awaiter(this, void 0, void 0, function* () {
|
---|
44 | return (yield harness.isInComparisonRange()) === inComparisonRange;
|
---|
45 | }))
|
---|
46 | .addOption('inPreviewRange', options.inPreviewRange, (harness, inPreviewRange) => __awaiter(this, void 0, void 0, function* () {
|
---|
47 | return (yield harness.isInPreviewRange()) === inPreviewRange;
|
---|
48 | }));
|
---|
49 | }
|
---|
50 | /** Gets the text of the calendar cell. */
|
---|
51 | getText() {
|
---|
52 | return __awaiter(this, void 0, void 0, function* () {
|
---|
53 | return (yield this._content()).text();
|
---|
54 | });
|
---|
55 | }
|
---|
56 | /** Gets the aria-label of the calendar cell. */
|
---|
57 | getAriaLabel() {
|
---|
58 | return __awaiter(this, void 0, void 0, function* () {
|
---|
59 | // We're guaranteed for the `aria-label` to be defined
|
---|
60 | // since this is a private element that we control.
|
---|
61 | return (yield this.host()).getAttribute('aria-label');
|
---|
62 | });
|
---|
63 | }
|
---|
64 | /** Whether the cell is selected. */
|
---|
65 | isSelected() {
|
---|
66 | return __awaiter(this, void 0, void 0, function* () {
|
---|
67 | const host = yield this.host();
|
---|
68 | return (yield host.getAttribute('aria-selected')) === 'true';
|
---|
69 | });
|
---|
70 | }
|
---|
71 | /** Whether the cell is disabled. */
|
---|
72 | isDisabled() {
|
---|
73 | return __awaiter(this, void 0, void 0, function* () {
|
---|
74 | return this._hasState('disabled');
|
---|
75 | });
|
---|
76 | }
|
---|
77 | /** Whether the cell is currently activated using keyboard navigation. */
|
---|
78 | isActive() {
|
---|
79 | return __awaiter(this, void 0, void 0, function* () {
|
---|
80 | return this._hasState('active');
|
---|
81 | });
|
---|
82 | }
|
---|
83 | /** Whether the cell represents today's date. */
|
---|
84 | isToday() {
|
---|
85 | return __awaiter(this, void 0, void 0, function* () {
|
---|
86 | return (yield this._content()).hasClass('mat-calendar-body-today');
|
---|
87 | });
|
---|
88 | }
|
---|
89 | /** Selects the calendar cell. Won't do anything if the cell is disabled. */
|
---|
90 | select() {
|
---|
91 | return __awaiter(this, void 0, void 0, function* () {
|
---|
92 | return (yield this.host()).click();
|
---|
93 | });
|
---|
94 | }
|
---|
95 | /** Hovers over the calendar cell. */
|
---|
96 | hover() {
|
---|
97 | return __awaiter(this, void 0, void 0, function* () {
|
---|
98 | return (yield this.host()).hover();
|
---|
99 | });
|
---|
100 | }
|
---|
101 | /** Moves the mouse away from the calendar cell. */
|
---|
102 | mouseAway() {
|
---|
103 | return __awaiter(this, void 0, void 0, function* () {
|
---|
104 | return (yield this.host()).mouseAway();
|
---|
105 | });
|
---|
106 | }
|
---|
107 | /** Focuses the calendar cell. */
|
---|
108 | focus() {
|
---|
109 | return __awaiter(this, void 0, void 0, function* () {
|
---|
110 | return (yield this.host()).focus();
|
---|
111 | });
|
---|
112 | }
|
---|
113 | /** Removes focus from the calendar cell. */
|
---|
114 | blur() {
|
---|
115 | return __awaiter(this, void 0, void 0, function* () {
|
---|
116 | return (yield this.host()).blur();
|
---|
117 | });
|
---|
118 | }
|
---|
119 | /** Whether the cell is the start of the main range. */
|
---|
120 | isRangeStart() {
|
---|
121 | return __awaiter(this, void 0, void 0, function* () {
|
---|
122 | return this._hasState('range-start');
|
---|
123 | });
|
---|
124 | }
|
---|
125 | /** Whether the cell is the end of the main range. */
|
---|
126 | isRangeEnd() {
|
---|
127 | return __awaiter(this, void 0, void 0, function* () {
|
---|
128 | return this._hasState('range-end');
|
---|
129 | });
|
---|
130 | }
|
---|
131 | /** Whether the cell is part of the main range. */
|
---|
132 | isInRange() {
|
---|
133 | return __awaiter(this, void 0, void 0, function* () {
|
---|
134 | return this._hasState('in-range');
|
---|
135 | });
|
---|
136 | }
|
---|
137 | /** Whether the cell is the start of the comparison range. */
|
---|
138 | isComparisonRangeStart() {
|
---|
139 | return __awaiter(this, void 0, void 0, function* () {
|
---|
140 | return this._hasState('comparison-start');
|
---|
141 | });
|
---|
142 | }
|
---|
143 | /** Whether the cell is the end of the comparison range. */
|
---|
144 | isComparisonRangeEnd() {
|
---|
145 | return __awaiter(this, void 0, void 0, function* () {
|
---|
146 | return this._hasState('comparison-end');
|
---|
147 | });
|
---|
148 | }
|
---|
149 | /** Whether the cell is inside of the comparison range. */
|
---|
150 | isInComparisonRange() {
|
---|
151 | return __awaiter(this, void 0, void 0, function* () {
|
---|
152 | return this._hasState('in-comparison-range');
|
---|
153 | });
|
---|
154 | }
|
---|
155 | /** Whether the cell is the start of the preview range. */
|
---|
156 | isPreviewRangeStart() {
|
---|
157 | return __awaiter(this, void 0, void 0, function* () {
|
---|
158 | return this._hasState('preview-start');
|
---|
159 | });
|
---|
160 | }
|
---|
161 | /** Whether the cell is the end of the preview range. */
|
---|
162 | isPreviewRangeEnd() {
|
---|
163 | return __awaiter(this, void 0, void 0, function* () {
|
---|
164 | return this._hasState('preview-end');
|
---|
165 | });
|
---|
166 | }
|
---|
167 | /** Whether the cell is inside of the preview range. */
|
---|
168 | isInPreviewRange() {
|
---|
169 | return __awaiter(this, void 0, void 0, function* () {
|
---|
170 | return this._hasState('in-preview');
|
---|
171 | });
|
---|
172 | }
|
---|
173 | /** Returns whether the cell has a particular CSS class-based state. */
|
---|
174 | _hasState(name) {
|
---|
175 | return __awaiter(this, void 0, void 0, function* () {
|
---|
176 | return (yield this.host()).hasClass(`mat-calendar-body-${name}`);
|
---|
177 | });
|
---|
178 | }
|
---|
179 | }
|
---|
180 | MatCalendarCellHarness.hostSelector = '.mat-calendar-body-cell';
|
---|
181 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FsZW5kYXItY2VsbC1oYXJuZXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL2RhdGVwaWNrZXIvdGVzdGluZy9jYWxlbmRhci1jZWxsLWhhcm5lc3MudHMiXSwibmFtZX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