@dbg-riskit/angular-testing 9999.9999.9999-rc.41311 → 9999.9999.9999-rc.445048
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/{esm2020 → esm2022}/lib/definitions/data.table.definition.mjs +11 -11
- package/{esm2020 → esm2022}/lib/definitions/download.menu.page.mjs +6 -6
- package/{esm2020 → esm2022}/lib/definitions/highlighter.directive.page.mjs +5 -5
- package/{esm2020 → esm2022}/lib/definitions/layout.component.page.mjs +6 -6
- package/{esm2020 → esm2022}/lib/definitions/message.page.mjs +6 -6
- package/{esm2020 → esm2022}/lib/stubs/auth/auth.routing.flow.service.stub.mjs +4 -4
- package/{esm2020 → esm2022}/lib/stubs/auth/auth.service.stub.mjs +4 -4
- package/{esm2020 → esm2022}/lib/stubs/auth/well.known.service.stub.mjs +4 -4
- package/{esm2020 → esm2022}/lib/stubs/http.service.stub.mjs +7 -7
- package/{esm2020 → esm2022}/lib/stubs/login.menu.stub.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/stubs/router/activated.route.stub.mjs +4 -4
- package/{esm2020 → esm2022}/lib/stubs/router/router.link.stub.mjs +4 -4
- package/esm2022/lib/stubs/router/router.module.stub.mjs +44 -0
- package/{esm2020 → esm2022}/lib/stubs/router/router.outlet.stub.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/stubs/router/router.stub.mjs +4 -4
- package/esm2022/lib/testing.module.mjs +50 -0
- package/{fesm2020 → fesm2022}/dbg-riskit-angular-testing.mjs +76 -79
- package/fesm2022/dbg-riskit-angular-testing.mjs.map +1 -0
- package/lib/definitions/data.table.definition.d.ts +1 -1
- package/lib/definitions/download.menu.page.d.ts +1 -1
- package/lib/definitions/highlighter.directive.page.d.ts +1 -1
- package/lib/definitions/layout.component.page.d.ts +1 -1
- package/lib/definitions/message.page.d.ts +1 -1
- package/lib/stubs/login.menu.stub.component.d.ts +1 -1
- package/lib/stubs/router/router.link.stub.d.ts +1 -1
- package/lib/stubs/router/router.module.stub.d.ts +1 -1
- package/lib/stubs/router/router.outlet.stub.component.d.ts +1 -1
- package/package.json +21 -27
- package/esm2020/lib/stubs/router/router.module.stub.mjs +0 -45
- package/esm2020/lib/testing.module.mjs +0 -52
- package/fesm2015/dbg-riskit-angular-testing.mjs +0 -1544
- package/fesm2015/dbg-riskit-angular-testing.mjs.map +0 -1
- package/fesm2020/dbg-riskit-angular-testing.mjs.map +0 -1
- /package/{esm2020 → esm2022}/dbg-riskit-angular-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/by.util.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/definitions/link.definition.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/definitions/link.only.page.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/definitions/login.menu.page.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/definitions/login.page.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/definitions/message.def.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/definitions/page.base.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/environment.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/events.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/utils.mjs +0 -0
- /package/{esm2020 → esm2022}/public_api.mjs +0 -0
- /package/{dbg-riskit-angular-testing.d.ts → index.d.ts} +0 -0
|
@@ -1,1544 +0,0 @@
|
|
|
1
|
-
import '@dbg-riskit/angular-polyfill';
|
|
2
|
-
import 'zone.js/testing';
|
|
3
|
-
import { getTestBed, tick, discardPeriodicTasks, TestBed } from '@angular/core/testing';
|
|
4
|
-
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
|
|
5
|
-
import * as i0 from '@angular/core';
|
|
6
|
-
import { EventEmitter, Injectable, Component, Directive, Input, Inject, NgModule } from '@angular/core';
|
|
7
|
-
import { MatMenuTrigger, MatMenuItem } from '@angular/material/menu';
|
|
8
|
-
import { By } from '@angular/platform-browser';
|
|
9
|
-
import * as i1 from '@dbg-riskit/angular-file';
|
|
10
|
-
import { CSVFileDownloadDirective, FileDownloadDirective, FileModule } from '@dbg-riskit/angular-file';
|
|
11
|
-
import * as fileSaver from 'file-saver';
|
|
12
|
-
import * as i1$2 from '@dbg-riskit/angular-view';
|
|
13
|
-
import { RISK_INITIAL_LOAD_SELECTOR, RISK_NO_DATA_SELECTOR, LayoutComponent, NoopAnimationMessageComponent, RISK_GOOD_SELECTOR, RISK_ERROR_SELECTOR, RISK_INFO_SELECTOR, RISK_MESSAGE_SELECTOR, RISK_WARN_SELECTOR, RISK_UPDATE_FAILED_SELECTOR, CommonViewModule, NoopAnimationsCommonViewModule } from '@dbg-riskit/angular-view';
|
|
14
|
-
export { LayoutComponent, NoopAnimationMessageComponent, NoopAnimationsCommonViewModule } from '@dbg-riskit/angular-view';
|
|
15
|
-
import { throwError, of, timer, EMPTY, BehaviorSubject } from 'rxjs';
|
|
16
|
-
import { switchMap, defaultIfEmpty, map } from 'rxjs/operators';
|
|
17
|
-
import { MatCard } from '@angular/material/card';
|
|
18
|
-
import { MatButton, MatAnchor } from '@angular/material/button';
|
|
19
|
-
import { MatButtonToggle } from '@angular/material/button-toggle';
|
|
20
|
-
import { MatIcon } from '@angular/material/icon';
|
|
21
|
-
import { MatTooltip } from '@angular/material/tooltip';
|
|
22
|
-
import { secureRandom, globalScope } from '@dbg-riskit/common';
|
|
23
|
-
import * as i1$1 from '@dbg-riskit/angular-datatable';
|
|
24
|
-
import { PagingComponent, DataTableRowDetailExpanderComponent, HIGHLIGHTER_CLASS, DataTableComponent, HighlighterDirective, DataTableModule } from '@dbg-riskit/angular-datatable';
|
|
25
|
-
import { MatSidenavContainer, MatSidenav } from '@angular/material/sidenav';
|
|
26
|
-
import { MatToolbar } from '@angular/material/toolbar';
|
|
27
|
-
import { Router, NavigationEnd, UrlSegmentGroup, UrlSegment, ActivatedRoute, RouterModule } from '@angular/router';
|
|
28
|
-
import * as i1$3 from '@dbg-riskit/angular-auth';
|
|
29
|
-
import { AuthRoutingFlowService, AUTH_CONFIG, AuthService } from '@dbg-riskit/angular-auth';
|
|
30
|
-
import { AUTH_PROVIDER } from '@dbg-riskit/angular-common';
|
|
31
|
-
|
|
32
|
-
// Has to be first in this order
|
|
33
|
-
const COMPILE_TIMEOUT_INTERVAL = Math.pow(2, 31) - 1;
|
|
34
|
-
function initTestEnvironment() {
|
|
35
|
-
Error.stackTraceLimit = 10;
|
|
36
|
-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
|
|
37
|
-
// TODO: Quick fix for memory leaks
|
|
38
|
-
window.addEventListener = () => {
|
|
39
|
-
return;
|
|
40
|
-
};
|
|
41
|
-
window.document.addEventListener = () => {
|
|
42
|
-
return;
|
|
43
|
-
};
|
|
44
|
-
// First, initialize the Angular testing environment.
|
|
45
|
-
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
|
|
46
|
-
teardown: { destroyAfterEach: false }
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** Button events to pass to `DebugElement.triggerEventHandler` for RouterLink event handler */
|
|
51
|
-
const BUTTON_CLICK_EVENTS = {
|
|
52
|
-
left: { button: 0 },
|
|
53
|
-
right: { button: 2 }
|
|
54
|
-
};
|
|
55
|
-
/** Simulate element click. Defaults to mouse left-button click event. */
|
|
56
|
-
function click(el, eventObj = BUTTON_CLICK_EVENTS.left) {
|
|
57
|
-
if (el instanceof HTMLElement) {
|
|
58
|
-
el.click();
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
el.triggerEventHandler('click', eventObj);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function setNgModelValue(element, value, realAsync = false) {
|
|
65
|
-
if (!(element.nativeElement instanceof HTMLInputElement)) {
|
|
66
|
-
throw new Error('Not an instance of HTMLInputElement');
|
|
67
|
-
}
|
|
68
|
-
const input = element.nativeElement;
|
|
69
|
-
input.value = value;
|
|
70
|
-
dispatchEvent(input, 'input'); // tell Angular
|
|
71
|
-
if (!realAsync) {
|
|
72
|
-
tick();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
function setNgModelSelectValue(element, selectedIndex, realAsync = false) {
|
|
76
|
-
if (!(element.nativeElement instanceof HTMLSelectElement)) {
|
|
77
|
-
throw new Error('Not an instance of HTMLInputElement');
|
|
78
|
-
}
|
|
79
|
-
const input = element.nativeElement;
|
|
80
|
-
input.selectedIndex = selectedIndex;
|
|
81
|
-
dispatchEvent(input, 'change'); // tell Angular
|
|
82
|
-
if (!realAsync) {
|
|
83
|
-
tick();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function dispatchEvent(element, eventName) {
|
|
87
|
-
if (element instanceof HTMLElement) {
|
|
88
|
-
element.dispatchEvent(newEvent(eventName));
|
|
89
|
-
}
|
|
90
|
-
else if (element instanceof Window) {
|
|
91
|
-
element.dispatchEvent(newEvent(eventName));
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
element.nativeElement.dispatchEvent(newEvent(eventName));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Create custom DOM event the old fashioned way
|
|
99
|
-
*
|
|
100
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/Event/initEvent
|
|
101
|
-
* Although officially deprecated, some browsers (phantom) don't accept the preferred "new Event(eventName)"
|
|
102
|
-
*/
|
|
103
|
-
function newEvent(eventName, bubbles = false, cancelable = false) {
|
|
104
|
-
const evt = document.createEvent('CustomEvent'); // MUST be 'CustomEvent'
|
|
105
|
-
evt.initCustomEvent(eventName, bubbles, cancelable, null);
|
|
106
|
-
return evt;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const FAKE_HTTP_ASYNC_TIMEOUT = 1000;
|
|
110
|
-
class HttpServiceStub {
|
|
111
|
-
constructor() {
|
|
112
|
-
this.value = [];
|
|
113
|
-
this.error = [];
|
|
114
|
-
this.unauthorized = new EventEmitter();
|
|
115
|
-
}
|
|
116
|
-
returnValue(value) {
|
|
117
|
-
this.value.push(value);
|
|
118
|
-
}
|
|
119
|
-
popReturnValue() {
|
|
120
|
-
return this.value.pop();
|
|
121
|
-
}
|
|
122
|
-
shiftReturnValue() {
|
|
123
|
-
return this.value.shift();
|
|
124
|
-
}
|
|
125
|
-
throwError(value) {
|
|
126
|
-
this.error.push(value);
|
|
127
|
-
}
|
|
128
|
-
get(request) {
|
|
129
|
-
if (this.error.length) {
|
|
130
|
-
const error = this.error.shift();
|
|
131
|
-
return throwError(error);
|
|
132
|
-
}
|
|
133
|
-
const value = this.value.shift();
|
|
134
|
-
return of(value);
|
|
135
|
-
}
|
|
136
|
-
post(request) {
|
|
137
|
-
return this.get(request);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
HttpServiceStub.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: HttpServiceStub, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
141
|
-
HttpServiceStub.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: HttpServiceStub });
|
|
142
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: HttpServiceStub, decorators: [{
|
|
143
|
-
type: Injectable
|
|
144
|
-
}] });
|
|
145
|
-
class HttpAsyncServiceStub extends HttpServiceStub {
|
|
146
|
-
get(request, auth = true) {
|
|
147
|
-
return timer(FAKE_HTTP_ASYNC_TIMEOUT).pipe(switchMap(() => super.get(request)));
|
|
148
|
-
}
|
|
149
|
-
post(request) {
|
|
150
|
-
return this.get(request);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
HttpAsyncServiceStub.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: HttpAsyncServiceStub, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
154
|
-
HttpAsyncServiceStub.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: HttpAsyncServiceStub });
|
|
155
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: HttpAsyncServiceStub, decorators: [{
|
|
156
|
-
type: Injectable
|
|
157
|
-
}] });
|
|
158
|
-
|
|
159
|
-
class MessageComponentDef {
|
|
160
|
-
constructor(debugElement) {
|
|
161
|
-
this.debugElement = debugElement;
|
|
162
|
-
if (debugElement == null) {
|
|
163
|
-
throw new Error('Debug element not found!');
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
get text() {
|
|
167
|
-
return this.debugElement.query(By.directive(MatCard)).nativeElement.textContent.replace(/\n\s*/g, ' ')
|
|
168
|
-
.replace(/\r\s*/g, ' ').trim();
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
class Page {
|
|
173
|
-
constructor(fixture) {
|
|
174
|
-
this.fixture = fixture;
|
|
175
|
-
this._timeOffset = 0;
|
|
176
|
-
this.debugElement = fixture.debugElement;
|
|
177
|
-
this.component = this.debugElement.componentInstance;
|
|
178
|
-
}
|
|
179
|
-
detectChanges(millis = 0) {
|
|
180
|
-
this.fixture.detectChanges();
|
|
181
|
-
tick(millis);
|
|
182
|
-
this._timeOffset += millis;
|
|
183
|
-
}
|
|
184
|
-
advanceAndDetectChanges(millis = 0) {
|
|
185
|
-
tick(millis);
|
|
186
|
-
this._timeOffset += millis;
|
|
187
|
-
this.detectChanges();
|
|
188
|
-
}
|
|
189
|
-
advanceHTTP() {
|
|
190
|
-
this.advanceAndDetectChanges(FAKE_HTTP_ASYNC_TIMEOUT);
|
|
191
|
-
}
|
|
192
|
-
advanceAndDetectChangesUsingOffset(millis) {
|
|
193
|
-
this.advanceAndDetectChanges(millis - this._timeOffset);
|
|
194
|
-
this.resetTimeOffset();
|
|
195
|
-
}
|
|
196
|
-
resetTimeOffset() {
|
|
197
|
-
this._timeOffset = 0;
|
|
198
|
-
}
|
|
199
|
-
destroy() {
|
|
200
|
-
this.fixture.destroy();
|
|
201
|
-
try {
|
|
202
|
-
// Move a lot into fututre ;)
|
|
203
|
-
tick(60 * 60 * 1000);
|
|
204
|
-
discardPeriodicTasks();
|
|
205
|
-
}
|
|
206
|
-
catch (ignore) {
|
|
207
|
-
// Nothing to do...
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
class PageWithLoading extends Page {
|
|
212
|
-
constructor(fixture) {
|
|
213
|
-
super(fixture);
|
|
214
|
-
}
|
|
215
|
-
get initialLoadComponent() {
|
|
216
|
-
const element = this.debugElement.query(By.css(RISK_INITIAL_LOAD_SELECTOR));
|
|
217
|
-
if (element) {
|
|
218
|
-
return new MessageComponentDef(element);
|
|
219
|
-
}
|
|
220
|
-
return null;
|
|
221
|
-
}
|
|
222
|
-
get noDataComponent() {
|
|
223
|
-
const element = this.debugElement.query(By.css(RISK_NO_DATA_SELECTOR));
|
|
224
|
-
if (element) {
|
|
225
|
-
return new MessageComponentDef(element);
|
|
226
|
-
}
|
|
227
|
-
return null;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
class CSVDownloadMenuPage extends Page {
|
|
232
|
-
constructor(fixture) {
|
|
233
|
-
super(fixture);
|
|
234
|
-
}
|
|
235
|
-
get downloadWindowsLink() {
|
|
236
|
-
// Open the menu first
|
|
237
|
-
click(this.debugElement.query(By.directive(MatMenuTrigger)));
|
|
238
|
-
this.detectChanges(500);
|
|
239
|
-
return new DownloadLink(this.debugElement.queryAll(By.directive(MatMenuItem))[0], this);
|
|
240
|
-
}
|
|
241
|
-
get downloadUnixLink() {
|
|
242
|
-
// Open the menu first
|
|
243
|
-
click(this.debugElement.query(By.directive(MatMenuTrigger)));
|
|
244
|
-
this.detectChanges(500);
|
|
245
|
-
return new DownloadLink(this.debugElement.queryAll(By.directive(MatMenuItem))[1], this);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
class DownloadLink {
|
|
249
|
-
constructor(element, page) {
|
|
250
|
-
this.element = element;
|
|
251
|
-
this.page = page;
|
|
252
|
-
}
|
|
253
|
-
click() {
|
|
254
|
-
this.setupBlobConstructorSpy();
|
|
255
|
-
this.setupSaveBlobSpy();
|
|
256
|
-
click(this.element);
|
|
257
|
-
this.page.detectChanges();
|
|
258
|
-
}
|
|
259
|
-
get blobSpy() {
|
|
260
|
-
this.setupBlobConstructorSpy();
|
|
261
|
-
return this._blobSpy;
|
|
262
|
-
}
|
|
263
|
-
setupBlobConstructorSpy() {
|
|
264
|
-
if (!this._blobSpy) {
|
|
265
|
-
let downloadDirective;
|
|
266
|
-
try {
|
|
267
|
-
downloadDirective = this.element.injector.get(CSVFileDownloadDirective);
|
|
268
|
-
}
|
|
269
|
-
catch (_) {
|
|
270
|
-
downloadDirective = this.element.injector.get(FileDownloadDirective);
|
|
271
|
-
}
|
|
272
|
-
this._blobSpy = spyOn(downloadDirective, 'createBlob').and.callThrough();
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
get saveSpy() {
|
|
276
|
-
this.setupSaveBlobSpy();
|
|
277
|
-
return this._saveBlobSpy;
|
|
278
|
-
}
|
|
279
|
-
setupSaveBlobSpy() {
|
|
280
|
-
if (!this._saveBlobSpy) {
|
|
281
|
-
this._saveBlobSpy = spyOn(fileSaver, 'saveAs');
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
class DownloadTestComponent {
|
|
286
|
-
}
|
|
287
|
-
DownloadTestComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: DownloadTestComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
288
|
-
DownloadTestComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.6", type: DownloadTestComponent, selector: "ng-component", ngImport: i0, template: `
|
|
289
|
-
<a [risk-download]="data"
|
|
290
|
-
[risk-download-content-type]="contentType"
|
|
291
|
-
[risk-download-filename]="filename">Download</a>
|
|
292
|
-
`, isInline: true, directives: [{ type: i1.FileDownloadDirective, selector: "[risk-download]", inputs: ["risk-download", "risk-download-content-type", "risk-download-filename"] }] });
|
|
293
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: DownloadTestComponent, decorators: [{
|
|
294
|
-
type: Component,
|
|
295
|
-
args: [{
|
|
296
|
-
template: `
|
|
297
|
-
<a [risk-download]="data"
|
|
298
|
-
[risk-download-content-type]="contentType"
|
|
299
|
-
[risk-download-filename]="filename">Download</a>
|
|
300
|
-
`
|
|
301
|
-
}]
|
|
302
|
-
}] });
|
|
303
|
-
class DownloadTestComponentPage extends Page {
|
|
304
|
-
constructor(fixture) {
|
|
305
|
-
super(fixture);
|
|
306
|
-
}
|
|
307
|
-
get downloadLink() {
|
|
308
|
-
return new DownloadLink(this.debugElement.query(By.directive(FileDownloadDirective)), this);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
class DataTableDefinition {
|
|
313
|
-
constructor(debugElement, page) {
|
|
314
|
-
this.debugElement = debugElement;
|
|
315
|
-
this.page = page;
|
|
316
|
-
}
|
|
317
|
-
get component() {
|
|
318
|
-
return this.debugElement.componentInstance;
|
|
319
|
-
}
|
|
320
|
-
get data() {
|
|
321
|
-
return this.component.plainData;
|
|
322
|
-
}
|
|
323
|
-
get element() {
|
|
324
|
-
return this.debugElement.query(By.css('.risk-data-table-wrapper > table'));
|
|
325
|
-
}
|
|
326
|
-
get header() {
|
|
327
|
-
return new TableHeader(this.debugElement.query((de) => de.references.mainHeader), this.page);
|
|
328
|
-
}
|
|
329
|
-
get sorting() {
|
|
330
|
-
return new TableSorting(this, this.page);
|
|
331
|
-
}
|
|
332
|
-
get body() {
|
|
333
|
-
return new TableBody(this.debugElement.query((de) => de.references.mainBody), this.page);
|
|
334
|
-
}
|
|
335
|
-
get footer() {
|
|
336
|
-
return new TableFooter(this.debugElement.query((de) => de.references.mainFooter));
|
|
337
|
-
}
|
|
338
|
-
get recordsCount() {
|
|
339
|
-
return new RecordsCount(this.debugElement.query(By.css('.risk-data-table-page-count')));
|
|
340
|
-
}
|
|
341
|
-
get pager() {
|
|
342
|
-
return new Pager(this.debugElement.query(By.directive(PagingComponent)), this.page);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
// <editor-fold defaultstate="collapsed" desc="Table header">
|
|
346
|
-
class TableHeader {
|
|
347
|
-
constructor(element, page) {
|
|
348
|
-
this.element = element;
|
|
349
|
-
this.page = page;
|
|
350
|
-
}
|
|
351
|
-
get rows() {
|
|
352
|
-
return this.element.queryAll(By.css('tr')).map((element) => {
|
|
353
|
-
return new TableHeaderRow(element, this.page);
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
get cells() {
|
|
357
|
-
return this.element.queryAll(By.css('th')).map((element) => {
|
|
358
|
-
return new TableHeaderCell(element, this.page);
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
class TableHeaderRow {
|
|
363
|
-
constructor(element, page) {
|
|
364
|
-
this.element = element;
|
|
365
|
-
this.page = page;
|
|
366
|
-
}
|
|
367
|
-
get cells() {
|
|
368
|
-
return this.element.queryAll(By.css('th')).map((element) => {
|
|
369
|
-
return new TableHeaderCell(element, this.page);
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
class TableHeaderCell {
|
|
374
|
-
constructor(element, page) {
|
|
375
|
-
this.element = element;
|
|
376
|
-
this.page = page;
|
|
377
|
-
}
|
|
378
|
-
get sortingHandle() {
|
|
379
|
-
const handle = this.element.query(By.directive(MatButton));
|
|
380
|
-
if (handle) {
|
|
381
|
-
return new SortingHandle(this.page, handle);
|
|
382
|
-
}
|
|
383
|
-
return null;
|
|
384
|
-
}
|
|
385
|
-
get tooltip() {
|
|
386
|
-
const handle = this.element.query(By.directive(MatTooltip));
|
|
387
|
-
if (handle) {
|
|
388
|
-
return handle.injector.get(MatTooltip).message;
|
|
389
|
-
}
|
|
390
|
-
return null;
|
|
391
|
-
}
|
|
392
|
-
get title() {
|
|
393
|
-
const textNode = this.element.childNodes.find((node) => node.nativeNode.nodeType === Node.TEXT_NODE);
|
|
394
|
-
if (textNode != null) {
|
|
395
|
-
return textNode
|
|
396
|
-
.nativeNode.textContent.trim();
|
|
397
|
-
}
|
|
398
|
-
return '';
|
|
399
|
-
}
|
|
400
|
-
get colspan() {
|
|
401
|
-
return this.element.nativeElement.colspan;
|
|
402
|
-
}
|
|
403
|
-
get rowspan() {
|
|
404
|
-
return this.element.nativeElement.rowspan;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
// <editor-fold defaultstate="collapsed" desc="Sorting">
|
|
408
|
-
class TableSorting {
|
|
409
|
-
constructor(table, page) {
|
|
410
|
-
this.table = table;
|
|
411
|
-
this.page = page;
|
|
412
|
-
}
|
|
413
|
-
get handles() {
|
|
414
|
-
const handles = this.table.debugElement.query((de) => de.references.mainHeader)
|
|
415
|
-
.queryAll(By.directive(MatButton));
|
|
416
|
-
if (!handles) {
|
|
417
|
-
return [];
|
|
418
|
-
}
|
|
419
|
-
return handles.map((handle) => {
|
|
420
|
-
return new SortingHandle(this.page, handle);
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
get detailRowHandles() {
|
|
424
|
-
const handles = this.table.debugElement.query(By.css('.risk-data-table-detail')).query(By.css('thead'))
|
|
425
|
-
.queryAll(By.directive(MatButton));
|
|
426
|
-
if (!handles) {
|
|
427
|
-
return null;
|
|
428
|
-
}
|
|
429
|
-
return handles.map((handle) => {
|
|
430
|
-
return new SortingHandle(this.page, handle);
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
get currentOrdering() {
|
|
434
|
-
return this.table.component.ordering;
|
|
435
|
-
}
|
|
436
|
-
checkSorting(firstNRows = this.table.component.rows.length, criterium) {
|
|
437
|
-
// WARN: call data once as it calls .map on all table rows
|
|
438
|
-
const data = this.table.data;
|
|
439
|
-
let ordering;
|
|
440
|
-
if (criterium) {
|
|
441
|
-
ordering = [criterium].concat(this.table.component._defaultOrdering);
|
|
442
|
-
}
|
|
443
|
-
else {
|
|
444
|
-
ordering = this.currentOrdering;
|
|
445
|
-
}
|
|
446
|
-
for (let i = 1; i < Math.min(data.length, firstNRows); i++) {
|
|
447
|
-
ordering.some((criteria) => {
|
|
448
|
-
//noinspection EqualityComparisonWithCoercionJS
|
|
449
|
-
const valueA = criteria.get(data[i - 1]);
|
|
450
|
-
const valueB = criteria.get(data[i]);
|
|
451
|
-
if (valueA == null && valueB == null) {
|
|
452
|
-
return false;
|
|
453
|
-
}
|
|
454
|
-
expect(valueA).not.toBeNull();
|
|
455
|
-
expect(valueA).not.toBeUndefined();
|
|
456
|
-
if (valueB != null) {
|
|
457
|
-
if (criteria.descending) {
|
|
458
|
-
expect(valueA >= valueB)
|
|
459
|
-
.toBeTruthy('Expect: ' + valueA + ' >= '
|
|
460
|
-
+ valueB);
|
|
461
|
-
}
|
|
462
|
-
else {
|
|
463
|
-
expect(valueA <= valueB)
|
|
464
|
-
.toBeTruthy('Expect: ' + valueA + ' <= '
|
|
465
|
-
+ valueB);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return valueA !== valueB;
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
class SortingHandle {
|
|
474
|
-
constructor(page, handle) {
|
|
475
|
-
this.page = page;
|
|
476
|
-
this.handle = handle;
|
|
477
|
-
}
|
|
478
|
-
click() {
|
|
479
|
-
click(this.handle);
|
|
480
|
-
this.page.detectChanges();
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
// </editor-fold>
|
|
484
|
-
// </editor-fold>
|
|
485
|
-
// <editor-fold defaultstate="collapsed" desc="Table body">
|
|
486
|
-
class TableBody {
|
|
487
|
-
constructor(element, page) {
|
|
488
|
-
this.element = element;
|
|
489
|
-
this.page = page;
|
|
490
|
-
}
|
|
491
|
-
get rows() {
|
|
492
|
-
return this.element.queryAll((de) => de.references.masterRow).map((element) => {
|
|
493
|
-
return new TableBodyRow(element, this.page);
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
get cells() {
|
|
497
|
-
let cells = [];
|
|
498
|
-
this.element.queryAll((de) => de.references.masterRow).forEach((row) => {
|
|
499
|
-
cells = cells.concat(row.queryAll(By.css('td')).map((cell) => {
|
|
500
|
-
return new TableBodyCell(cell);
|
|
501
|
-
}));
|
|
502
|
-
});
|
|
503
|
-
return cells;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
class TableBodyRow {
|
|
507
|
-
constructor(element, page) {
|
|
508
|
-
this.element = element;
|
|
509
|
-
this.page = page;
|
|
510
|
-
}
|
|
511
|
-
expandRow() {
|
|
512
|
-
click(this.element);
|
|
513
|
-
this.page.detectChanges();
|
|
514
|
-
}
|
|
515
|
-
get expander() {
|
|
516
|
-
return new RowExpander(this.element.query(By.directive(DataTableRowDetailExpanderComponent)).query(By.directive(MatAnchor)));
|
|
517
|
-
}
|
|
518
|
-
get cells() {
|
|
519
|
-
return this.element.queryAll(By.css('td')).map((element) => {
|
|
520
|
-
return new TableBodyCell(element);
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
get rowDetail() {
|
|
524
|
-
const parent = this.element.parent;
|
|
525
|
-
if (parent != null) {
|
|
526
|
-
const next = parent.children[parent.children.indexOf(this.element) + 1];
|
|
527
|
-
if (next && !next.references.masterRow) {
|
|
528
|
-
return new TableBodyDetail(next, this.page);
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
return null;
|
|
532
|
-
}
|
|
533
|
-
get highlighted() {
|
|
534
|
-
return this.element.nativeElement.classList.contains(HIGHLIGHTER_CLASS);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
class RowExpander {
|
|
538
|
-
constructor(element) {
|
|
539
|
-
this.element = element;
|
|
540
|
-
}
|
|
541
|
-
get icon() {
|
|
542
|
-
return this.element.query(By.directive(MatIcon)).nativeElement.textContent.trim();
|
|
543
|
-
}
|
|
544
|
-
get opened() {
|
|
545
|
-
return this.icon === 'expand_less';
|
|
546
|
-
}
|
|
547
|
-
get closed() {
|
|
548
|
-
return this.icon === 'expand_more';
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
class TableBodyCell {
|
|
552
|
-
constructor(element) {
|
|
553
|
-
this.element = element;
|
|
554
|
-
}
|
|
555
|
-
get colspan() {
|
|
556
|
-
return this.element.nativeElement.colspan;
|
|
557
|
-
}
|
|
558
|
-
get rowspan() {
|
|
559
|
-
return this.element.nativeElement.rowspan;
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
// <editor-fold defaultstate="collapsed" desc="Row detail">
|
|
563
|
-
class TableBodyDetail {
|
|
564
|
-
constructor(element, page) {
|
|
565
|
-
this.element = element;
|
|
566
|
-
this.page = page;
|
|
567
|
-
}
|
|
568
|
-
header() {
|
|
569
|
-
return new TableHeader(this.element.query(By.css('thead')), this.page);
|
|
570
|
-
}
|
|
571
|
-
get body() {
|
|
572
|
-
return new TableBodyDetailBody(this.element.query(By.css('tbody')));
|
|
573
|
-
}
|
|
574
|
-
get highlighted() {
|
|
575
|
-
return this.element.nativeElement.classList.contains(HIGHLIGHTER_CLASS);
|
|
576
|
-
}
|
|
577
|
-
get colspan() {
|
|
578
|
-
return this.element.children[0].nativeElement.colspan;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
class TableBodyDetailBody {
|
|
582
|
-
constructor(element) {
|
|
583
|
-
this.element = element;
|
|
584
|
-
}
|
|
585
|
-
get rows() {
|
|
586
|
-
return this.element.queryAll(By.css('tr')).map((element) => {
|
|
587
|
-
return new TableBodyDetailRow(element);
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
get cells() {
|
|
591
|
-
let cells = [];
|
|
592
|
-
this.element.queryAll(By.css('tr')).forEach((row) => {
|
|
593
|
-
cells = cells.concat(row.queryAll(By.css('td')).map((cell) => {
|
|
594
|
-
return new TableBodyCell(cell);
|
|
595
|
-
}));
|
|
596
|
-
});
|
|
597
|
-
return cells;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
class TableBodyDetailRow {
|
|
601
|
-
constructor(element) {
|
|
602
|
-
this.element = element;
|
|
603
|
-
}
|
|
604
|
-
get cells() {
|
|
605
|
-
return this.element.queryAll(By.css('td')).map((element) => {
|
|
606
|
-
return new TableBodyCell(element);
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
// </editor-fold>
|
|
611
|
-
// </editor-fold>
|
|
612
|
-
// <editor-fold defaultstate="collapsed" desc="Table footer">
|
|
613
|
-
class TableFooter {
|
|
614
|
-
constructor(element) {
|
|
615
|
-
this.element = element;
|
|
616
|
-
}
|
|
617
|
-
get rows() {
|
|
618
|
-
return this.element.queryAll(By.css('tr')).map((element) => {
|
|
619
|
-
return new TableFooterRow(element);
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
get cells() {
|
|
623
|
-
let cells = [];
|
|
624
|
-
this.element.queryAll(By.css('tr')).forEach((row) => {
|
|
625
|
-
cells = cells.concat(row.queryAll(By.css('th')).map((cell) => {
|
|
626
|
-
return new TableBodyCell(cell);
|
|
627
|
-
}));
|
|
628
|
-
});
|
|
629
|
-
return cells;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
class TableFooterRow {
|
|
633
|
-
constructor(element) {
|
|
634
|
-
this.element = element;
|
|
635
|
-
}
|
|
636
|
-
get cells() {
|
|
637
|
-
return this.element.queryAll(By.css('th')).map((element) => {
|
|
638
|
-
return new TableBodyCell(element);
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
// </editor-fold>
|
|
643
|
-
class RecordsCount {
|
|
644
|
-
constructor(element) {
|
|
645
|
-
this.element = element;
|
|
646
|
-
}
|
|
647
|
-
get message() {
|
|
648
|
-
return this.element.nativeElement.textContent;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
class Pager {
|
|
652
|
-
constructor(element, page) {
|
|
653
|
-
this.element = element;
|
|
654
|
-
this.page = page;
|
|
655
|
-
}
|
|
656
|
-
get pageButtons() {
|
|
657
|
-
return this.element.queryAll(By.directive(MatButtonToggle));
|
|
658
|
-
}
|
|
659
|
-
expectLeadingButtonsDisabled() {
|
|
660
|
-
for (let i = 0; i < 2; i++) {
|
|
661
|
-
expect(this.pageButtons[i].classes['mat-button-toggle-disabled'])
|
|
662
|
-
.toBe(true, 'First two are disabled.');
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
expectLeadingButtonsNotDisabled() {
|
|
666
|
-
for (let i = 0; i < 2; i++) {
|
|
667
|
-
expect(this.pageButtons[i].classes['mat-button-toggle-disabled'])
|
|
668
|
-
.not.toBe(true, 'First two are not disabled.');
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
expectTrailingButtonsDisabled() {
|
|
672
|
-
for (let i = this.pageButtons.length - 1; i > this.pageButtons.length - 3; i--) {
|
|
673
|
-
expect(this.pageButtons[i].classes['mat-button-toggle-disabled'])
|
|
674
|
-
.toBe(true, 'Last two are disabled.');
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
expectTrailingButtonsNotDisabled() {
|
|
678
|
-
for (let i = this.pageButtons.length - 1; i > this.pageButtons.length - 3; i--) {
|
|
679
|
-
expect(this.pageButtons[i].classes['mat-button-toggle-disabled'])
|
|
680
|
-
.not.toBe(true, 'Last two are not disabled.');
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
expectButtonNumbers(numbers) {
|
|
684
|
-
for (let i = 0; i < numbers.length; i++) {
|
|
685
|
-
expect(this.pageButtons[i + 2].query(By.css('.mat-button-toggle-label-content'))
|
|
686
|
-
.nativeElement.textContent.trim())
|
|
687
|
-
.toEqual(numbers[i] + '', 'Button numbers are correct');
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
expectButtonActive(index) {
|
|
691
|
-
expect(this.pageButtons[index].classes['mat-button-toggle-checked'])
|
|
692
|
-
.toBe(true, 'Button is active.');
|
|
693
|
-
}
|
|
694
|
-
click(index) {
|
|
695
|
-
click(this.pageButtons[index].query(By.css('.mat-button-toggle-label-content')).nativeElement);
|
|
696
|
-
this.page.detectChanges();
|
|
697
|
-
this.page.advanceAndDetectChanges();
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
function chceckSorting(page, criteria) {
|
|
701
|
-
page.dataTable.sorting.checkSorting(150);
|
|
702
|
-
page.dataTable.sorting.handles.forEach((handle, index) => {
|
|
703
|
-
// Tigger sort based on a handle
|
|
704
|
-
handle.click();
|
|
705
|
-
page.detectChanges();
|
|
706
|
-
// Check the sorting
|
|
707
|
-
page.dataTable.sorting.checkSorting(150, {
|
|
708
|
-
get: criteria[index]
|
|
709
|
-
});
|
|
710
|
-
// Tigger sort based on a handle
|
|
711
|
-
handle.click();
|
|
712
|
-
page.detectChanges();
|
|
713
|
-
// Check the sorting
|
|
714
|
-
page.dataTable.sorting.checkSorting(150, {
|
|
715
|
-
get: criteria[index],
|
|
716
|
-
descending: true
|
|
717
|
-
});
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
class DataTableDefinitionHosted extends Page {
|
|
721
|
-
constructor(fixture) {
|
|
722
|
-
super(fixture);
|
|
723
|
-
}
|
|
724
|
-
get dataTable() {
|
|
725
|
-
return new DataTableDefinition(this.debugElement.query(By.directive(DataTableComponent)), this);
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
class TestDataTableHostComponent {
|
|
729
|
-
constructor() {
|
|
730
|
-
this.data = [];
|
|
731
|
-
for (let i = 0; i < 500; i++) {
|
|
732
|
-
this.data.push({
|
|
733
|
-
value1: Math.floor(secureRandom() * 20) + ' - value 1',
|
|
734
|
-
value2: Math.floor(secureRandom() * 20) + ' - value 2',
|
|
735
|
-
value3: Math.floor(secureRandom() * 20) + ' - value 3'
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
this.footer = this.data[0];
|
|
739
|
-
}
|
|
740
|
-
get defaultOrdering() {
|
|
741
|
-
return [
|
|
742
|
-
{
|
|
743
|
-
get: (record) => {
|
|
744
|
-
return record.value3;
|
|
745
|
-
},
|
|
746
|
-
descending: true
|
|
747
|
-
},
|
|
748
|
-
(record) => {
|
|
749
|
-
return record.value2;
|
|
750
|
-
}
|
|
751
|
-
];
|
|
752
|
-
}
|
|
753
|
-
get valueGetter() {
|
|
754
|
-
return (record) => {
|
|
755
|
-
return record.value1;
|
|
756
|
-
};
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
TestDataTableHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: TestDataTableHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
760
|
-
TestDataTableHostComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.6", type: TestDataTableHostComponent, selector: "ng-component", ngImport: i0, template: `
|
|
761
|
-
<risk-data-table [data]="data"
|
|
762
|
-
[footer]="footer"
|
|
763
|
-
[pageSize]="20"
|
|
764
|
-
[defaultOrdering]="defaultOrdering"
|
|
765
|
-
[striped]="true">
|
|
766
|
-
<risk-data-table-column title="Test Column 1"
|
|
767
|
-
[sortingKey]="valueGetter">
|
|
768
|
-
<ng-template let-record="row" risk-data-table-cell>
|
|
769
|
-
{{record.value1}}
|
|
770
|
-
</ng-template>
|
|
771
|
-
</risk-data-table-column>
|
|
772
|
-
<risk-data-table-column>
|
|
773
|
-
<ng-template risk-data-table-cell let-record="row" let-expanded="expanded">
|
|
774
|
-
<risk-data-table-detail-expander [expanded]="expanded"></risk-data-table-detail-expander>
|
|
775
|
-
</ng-template>
|
|
776
|
-
<ng-template risk-data-table-footer-cell let-footer="footer">
|
|
777
|
-
{{footer.value1}}
|
|
778
|
-
</ng-template>
|
|
779
|
-
</risk-data-table-column>
|
|
780
|
-
<!-- Sub detail -->
|
|
781
|
-
<risk-data-table-detail-row>
|
|
782
|
-
<risk-data-table-column-group>
|
|
783
|
-
<risk-data-table-column title="Test Detail Column 1"
|
|
784
|
-
[sortingKey]="valueGetter">
|
|
785
|
-
<ng-template risk-data-table-cell let-record="row">
|
|
786
|
-
{{record.value1}}
|
|
787
|
-
</ng-template>
|
|
788
|
-
</risk-data-table-column>
|
|
789
|
-
</risk-data-table-column-group>
|
|
790
|
-
<risk-data-table-column-group>
|
|
791
|
-
<risk-data-table-column title="Test Detail Column 2">
|
|
792
|
-
<ng-template risk-data-table-cell let-record="row">
|
|
793
|
-
{{record.value2}}
|
|
794
|
-
</ng-template>
|
|
795
|
-
</risk-data-table-column>
|
|
796
|
-
<risk-data-table-column title="Test Detail Column 3">
|
|
797
|
-
<ng-template risk-data-table-cell let-record="row">
|
|
798
|
-
{{record.value3}}
|
|
799
|
-
</ng-template>
|
|
800
|
-
</risk-data-table-column>
|
|
801
|
-
</risk-data-table-column-group>
|
|
802
|
-
<risk-data-table-column-group></risk-data-table-column-group>
|
|
803
|
-
</risk-data-table-detail-row>
|
|
804
|
-
</risk-data-table>`, isInline: true, components: [{ type: i1$1.DataTableComponent, selector: "risk-data-table", inputs: ["footer", "pageSize", "striped", "showFooter", "allowEmpty", "trackByRowKey", "highlighting", "stickyHeader", "stickyHeaderOffsetTopPx", "data", "defaultOrdering"], exportAs: ["dataTable"] }, { type: i1$1.DataTableRowDetailExpanderComponent, selector: "risk-data-table-detail-expander", inputs: ["expanded"] }], directives: [{ type: i1$1.ɵDataTableColumnDirective, selector: "risk-data-table-column", inputs: ["title", "sortingKey", "tooltip", "contentAlign", "headerAlign", "footerAlign", "class"] }, { type: i1$1.ɵDataTableColumnCellDirective, selector: "[risk-data-table-cell]" }, { type: i1$1.ɵDataTableColumnFooterDirective, selector: "[risk-data-table-footer-cell]" }, { type: i1$1.ɵDataTableRowDetailDirective, selector: "risk-data-table-detail-row" }, { type: i1$1.ɵDataTableColumnGroupDirective, selector: "risk-data-table-column-group" }] });
|
|
805
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: TestDataTableHostComponent, decorators: [{
|
|
806
|
-
type: Component,
|
|
807
|
-
args: [{
|
|
808
|
-
template: `
|
|
809
|
-
<risk-data-table [data]="data"
|
|
810
|
-
[footer]="footer"
|
|
811
|
-
[pageSize]="20"
|
|
812
|
-
[defaultOrdering]="defaultOrdering"
|
|
813
|
-
[striped]="true">
|
|
814
|
-
<risk-data-table-column title="Test Column 1"
|
|
815
|
-
[sortingKey]="valueGetter">
|
|
816
|
-
<ng-template let-record="row" risk-data-table-cell>
|
|
817
|
-
{{record.value1}}
|
|
818
|
-
</ng-template>
|
|
819
|
-
</risk-data-table-column>
|
|
820
|
-
<risk-data-table-column>
|
|
821
|
-
<ng-template risk-data-table-cell let-record="row" let-expanded="expanded">
|
|
822
|
-
<risk-data-table-detail-expander [expanded]="expanded"></risk-data-table-detail-expander>
|
|
823
|
-
</ng-template>
|
|
824
|
-
<ng-template risk-data-table-footer-cell let-footer="footer">
|
|
825
|
-
{{footer.value1}}
|
|
826
|
-
</ng-template>
|
|
827
|
-
</risk-data-table-column>
|
|
828
|
-
<!-- Sub detail -->
|
|
829
|
-
<risk-data-table-detail-row>
|
|
830
|
-
<risk-data-table-column-group>
|
|
831
|
-
<risk-data-table-column title="Test Detail Column 1"
|
|
832
|
-
[sortingKey]="valueGetter">
|
|
833
|
-
<ng-template risk-data-table-cell let-record="row">
|
|
834
|
-
{{record.value1}}
|
|
835
|
-
</ng-template>
|
|
836
|
-
</risk-data-table-column>
|
|
837
|
-
</risk-data-table-column-group>
|
|
838
|
-
<risk-data-table-column-group>
|
|
839
|
-
<risk-data-table-column title="Test Detail Column 2">
|
|
840
|
-
<ng-template risk-data-table-cell let-record="row">
|
|
841
|
-
{{record.value2}}
|
|
842
|
-
</ng-template>
|
|
843
|
-
</risk-data-table-column>
|
|
844
|
-
<risk-data-table-column title="Test Detail Column 3">
|
|
845
|
-
<ng-template risk-data-table-cell let-record="row">
|
|
846
|
-
{{record.value3}}
|
|
847
|
-
</ng-template>
|
|
848
|
-
</risk-data-table-column>
|
|
849
|
-
</risk-data-table-column-group>
|
|
850
|
-
<risk-data-table-column-group></risk-data-table-column-group>
|
|
851
|
-
</risk-data-table-detail-row>
|
|
852
|
-
</risk-data-table>`
|
|
853
|
-
}]
|
|
854
|
-
}], ctorParameters: function () { return []; } });
|
|
855
|
-
|
|
856
|
-
class HighLighterDirectiveTestComponent {
|
|
857
|
-
trackBy(index, row) {
|
|
858
|
-
return row.rowData;
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
HighLighterDirectiveTestComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: HighLighterDirectiveTestComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
862
|
-
HighLighterDirectiveTestComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.6", type: HighLighterDirectiveTestComponent, selector: "ng-component", ngImport: i0, template: `
|
|
863
|
-
<div [risk-data-table-highlighter]="trackBy" [risk-data-table-highlighter-context]="context"></div>`, isInline: true, directives: [{ type: i1$1.HighlighterDirective, selector: "[risk-data-table-highlighter]", inputs: ["risk-data-table-highlighter", "risk-data-table-highlighter-context"] }] });
|
|
864
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: HighLighterDirectiveTestComponent, decorators: [{
|
|
865
|
-
type: Component,
|
|
866
|
-
args: [{
|
|
867
|
-
template: `
|
|
868
|
-
<div [risk-data-table-highlighter]="trackBy" [risk-data-table-highlighter-context]="context"></div>`
|
|
869
|
-
}]
|
|
870
|
-
}] });
|
|
871
|
-
class HighLighterDirectivePage extends Page {
|
|
872
|
-
constructor(fixture) {
|
|
873
|
-
super(fixture);
|
|
874
|
-
}
|
|
875
|
-
get highlightedElement() {
|
|
876
|
-
return this.debugElement.query(By.directive(HighlighterDirective));
|
|
877
|
-
}
|
|
878
|
-
get classList() {
|
|
879
|
-
return this.highlightedElement.nativeElement.classList;
|
|
880
|
-
}
|
|
881
|
-
get highlighter() {
|
|
882
|
-
return this.highlightedElement.injector.get(HighlighterDirective);
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
// @dynamic
|
|
887
|
-
class ByUtil {
|
|
888
|
-
static and(...predicates) {
|
|
889
|
-
return (val) => {
|
|
890
|
-
return predicates.every((predicate) => predicate(val));
|
|
891
|
-
};
|
|
892
|
-
}
|
|
893
|
-
static or(...predicates) {
|
|
894
|
-
return (val) => {
|
|
895
|
-
return predicates.some((predicate) => predicate(val));
|
|
896
|
-
};
|
|
897
|
-
}
|
|
898
|
-
static not(predicate) {
|
|
899
|
-
return (val) => {
|
|
900
|
-
return !predicate(val);
|
|
901
|
-
};
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
class LayoutComponentDefinition {
|
|
906
|
-
constructor(debugElement, page) {
|
|
907
|
-
this.debugElement = debugElement;
|
|
908
|
-
this.page = page;
|
|
909
|
-
}
|
|
910
|
-
get component() {
|
|
911
|
-
return this.debugElement.componentInstance;
|
|
912
|
-
}
|
|
913
|
-
get headToolbar() {
|
|
914
|
-
return this.debugElement.query(ByUtil.and(By.directive(MatToolbar), By.css('.mat-elevation-z2')));
|
|
915
|
-
}
|
|
916
|
-
get logo() {
|
|
917
|
-
return this.headToolbar.query(By.css('.risk-layout-logo'));
|
|
918
|
-
}
|
|
919
|
-
get menu() {
|
|
920
|
-
return this.headToolbar.queryAll(ByUtil.or(By.css('[menu-horizontal]'), By.css('risk-layout-horizontal')));
|
|
921
|
-
}
|
|
922
|
-
get sideNavContainer() {
|
|
923
|
-
return this.debugElement.query(By.directive(MatSidenavContainer));
|
|
924
|
-
}
|
|
925
|
-
get sideNav() {
|
|
926
|
-
return this.sideNavContainer.query(By.directive(MatSidenav));
|
|
927
|
-
}
|
|
928
|
-
openSideNav() {
|
|
929
|
-
this.sideNav.componentInstance.open();
|
|
930
|
-
this.page.advanceAndDetectChanges();
|
|
931
|
-
}
|
|
932
|
-
closeSideNav() {
|
|
933
|
-
this.sideNav.componentInstance.close();
|
|
934
|
-
this.page.advanceAndDetectChanges(1);
|
|
935
|
-
}
|
|
936
|
-
get sideNavMenu() {
|
|
937
|
-
return this.sideNav.queryAll(ByUtil.or(By.css('[menu-vertical]'), By.css('risk-layout-vertical')));
|
|
938
|
-
}
|
|
939
|
-
get content() {
|
|
940
|
-
return this.sideNavContainer.query(By.css('.risk-layout-content'));
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
class TestLayoutComponentHostPage extends Page {
|
|
944
|
-
get layoutComponent() {
|
|
945
|
-
return new LayoutComponentDefinition(this.debugElement.query(By.directive(LayoutComponent)), this);
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
class TestLayoutHostComponent {
|
|
949
|
-
}
|
|
950
|
-
TestLayoutHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: TestLayoutHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
951
|
-
TestLayoutHostComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.6", type: TestLayoutHostComponent, selector: "ng-component", ngImport: i0, template: `
|
|
952
|
-
<risk-layout>
|
|
953
|
-
<!-- menu-horizontal -->
|
|
954
|
-
<risk-layout-horizontal>
|
|
955
|
-
HorizontalMenu
|
|
956
|
-
</risk-layout-horizontal>
|
|
957
|
-
<!-- menu-horizontal -->
|
|
958
|
-
|
|
959
|
-
<!-- menu-vertical -->
|
|
960
|
-
<risk-layout-vertical>
|
|
961
|
-
Vertical menu
|
|
962
|
-
</risk-layout-vertical>
|
|
963
|
-
|
|
964
|
-
<span>Content</span>
|
|
965
|
-
</risk-layout>
|
|
966
|
-
`, isInline: true, components: [{ type: i1$2.LayoutComponent, selector: "risk-layout", inputs: ["smallScreenMenuVisible", "smallScreenWidth", "footerVisible", "toolbarBackgroundColor", "backgroundColor"] }], directives: [{ type: i1$2.HorizontalLayoutDirective, selector: "risk-layout-horizontal" }, { type: i1$2.VerticalLayoutDirective, selector: "risk-layout-vertical" }] });
|
|
967
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: TestLayoutHostComponent, decorators: [{
|
|
968
|
-
type: Component,
|
|
969
|
-
args: [{
|
|
970
|
-
template: `
|
|
971
|
-
<risk-layout>
|
|
972
|
-
<!-- menu-horizontal -->
|
|
973
|
-
<risk-layout-horizontal>
|
|
974
|
-
HorizontalMenu
|
|
975
|
-
</risk-layout-horizontal>
|
|
976
|
-
<!-- menu-horizontal -->
|
|
977
|
-
|
|
978
|
-
<!-- menu-vertical -->
|
|
979
|
-
<risk-layout-vertical>
|
|
980
|
-
Vertical menu
|
|
981
|
-
</risk-layout-vertical>
|
|
982
|
-
|
|
983
|
-
<span>Content</span>
|
|
984
|
-
</risk-layout>
|
|
985
|
-
`
|
|
986
|
-
}]
|
|
987
|
-
}] });
|
|
988
|
-
|
|
989
|
-
class RouterLinkStubDirective {
|
|
990
|
-
constructor(injector) {
|
|
991
|
-
this.navigatedTo = null;
|
|
992
|
-
this._urlTree = null;
|
|
993
|
-
this.routerStub = injector.get(Router, null);
|
|
994
|
-
}
|
|
995
|
-
ngOnChanges() {
|
|
996
|
-
if (this.linkParams && this.routerStub) {
|
|
997
|
-
this._urlTree = this.routerStub.getURLTree(this.linkParams);
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
onClick() {
|
|
1001
|
-
this.navigatedTo = this.linkParams;
|
|
1002
|
-
if (this.routerStub) {
|
|
1003
|
-
if (Array.isArray(this.navigatedTo)) {
|
|
1004
|
-
this.routerStub.navigate(this.navigatedTo);
|
|
1005
|
-
}
|
|
1006
|
-
else {
|
|
1007
|
-
this.routerStub.navigateByUrl(this.navigatedTo);
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
get urlTree() {
|
|
1012
|
-
return this._urlTree;
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
RouterLinkStubDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: RouterLinkStubDirective, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1016
|
-
RouterLinkStubDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.6", type: RouterLinkStubDirective, selector: "[routerLink]", inputs: { linkParams: ["routerLink", "linkParams"] }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
|
|
1017
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: RouterLinkStubDirective, decorators: [{
|
|
1018
|
-
type: Directive,
|
|
1019
|
-
args: [{
|
|
1020
|
-
/* eslint-disable @angular-eslint/directive-selector */
|
|
1021
|
-
selector: '[routerLink]',
|
|
1022
|
-
/* eslint-enable */
|
|
1023
|
-
host: {
|
|
1024
|
-
'(click)': 'onClick()'
|
|
1025
|
-
}
|
|
1026
|
-
}]
|
|
1027
|
-
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { linkParams: [{
|
|
1028
|
-
type: Input,
|
|
1029
|
-
args: ['routerLink']
|
|
1030
|
-
}] } });
|
|
1031
|
-
|
|
1032
|
-
class LinkDefinition {
|
|
1033
|
-
constructor(page, link) {
|
|
1034
|
-
this.page = page;
|
|
1035
|
-
this.link = link;
|
|
1036
|
-
}
|
|
1037
|
-
get stub() {
|
|
1038
|
-
return this.link.injector.get(RouterLinkStubDirective);
|
|
1039
|
-
}
|
|
1040
|
-
get text() {
|
|
1041
|
-
return this.link.nativeElement.textContent.trim();
|
|
1042
|
-
}
|
|
1043
|
-
click() {
|
|
1044
|
-
click(this.link.nativeElement);
|
|
1045
|
-
this.page.advanceAndDetectChanges();
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
class LinkOnlyPage extends Page {
|
|
1050
|
-
constructor(fixture) {
|
|
1051
|
-
super(fixture);
|
|
1052
|
-
}
|
|
1053
|
-
get link() {
|
|
1054
|
-
return new LinkDefinition(this, this.debugElement.query(By.directive(RouterLinkStubDirective)));
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
class LoginMenuPage extends Page {
|
|
1059
|
-
get menuTrigger() {
|
|
1060
|
-
return this.debugElement.query(By.directive(MatMenuTrigger));
|
|
1061
|
-
}
|
|
1062
|
-
clickMenuTrigger() {
|
|
1063
|
-
click(this.menuTrigger);
|
|
1064
|
-
this.waitForMenu();
|
|
1065
|
-
}
|
|
1066
|
-
waitForMenu() {
|
|
1067
|
-
this.detectChanges(500);
|
|
1068
|
-
}
|
|
1069
|
-
get loginLink() {
|
|
1070
|
-
return new LinkDefinition(this, this.debugElement.query(ByUtil.and(By.directive(MatMenuItem), (value) => value.nativeElement.textContent.trim().endsWith('Login'))));
|
|
1071
|
-
}
|
|
1072
|
-
get logoutLink() {
|
|
1073
|
-
return new LinkDefinition(this, this.debugElement.query(ByUtil.and(By.directive(MatMenuItem), (value) => value.nativeElement.textContent.trim().endsWith('Logout'))));
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
class LoginPage extends Page {
|
|
1078
|
-
constructor(fixture) {
|
|
1079
|
-
super(fixture);
|
|
1080
|
-
}
|
|
1081
|
-
get formElement() {
|
|
1082
|
-
return this.debugElement.query(By.css('form'));
|
|
1083
|
-
}
|
|
1084
|
-
get usernameElement() {
|
|
1085
|
-
return this.formElement.query(By.css('input[name=username]'));
|
|
1086
|
-
}
|
|
1087
|
-
set username(username) {
|
|
1088
|
-
setNgModelValue(this.usernameElement, username);
|
|
1089
|
-
}
|
|
1090
|
-
get passwordElement() {
|
|
1091
|
-
return this.formElement.query(By.css('input[name=password]'));
|
|
1092
|
-
}
|
|
1093
|
-
set password(password) {
|
|
1094
|
-
setNgModelValue(this.passwordElement, password);
|
|
1095
|
-
}
|
|
1096
|
-
get loginButtonElement() {
|
|
1097
|
-
return this.formElement.query(By.directive(MatButton));
|
|
1098
|
-
}
|
|
1099
|
-
get successMessage() {
|
|
1100
|
-
const debugElement = this.debugElement.query(ByUtil.and(By.directive(NoopAnimationMessageComponent), By.css(RISK_GOOD_SELECTOR)));
|
|
1101
|
-
if (!debugElement) {
|
|
1102
|
-
return null;
|
|
1103
|
-
}
|
|
1104
|
-
return new MessageComponentDef(debugElement);
|
|
1105
|
-
}
|
|
1106
|
-
get errorMessage() {
|
|
1107
|
-
const debugElement = this.debugElement.query(ByUtil.or(ByUtil.and(By.directive(NoopAnimationMessageComponent), By.css(RISK_ERROR_SELECTOR)), By.css('h3')));
|
|
1108
|
-
if (!debugElement) {
|
|
1109
|
-
return null;
|
|
1110
|
-
}
|
|
1111
|
-
return new MessageComponentDef(debugElement);
|
|
1112
|
-
}
|
|
1113
|
-
clickLogin() {
|
|
1114
|
-
click(this.loginButtonElement.nativeElement);
|
|
1115
|
-
tick();
|
|
1116
|
-
this.detectChanges();
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
class TestMessageHostComponent {
|
|
1121
|
-
constructor() {
|
|
1122
|
-
this.message = 'custom message';
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
TestMessageHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: TestMessageHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1126
|
-
TestMessageHostComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.6", type: TestMessageHostComponent, selector: "ng-component", ngImport: i0, template: `
|
|
1127
|
-
<risk-error [message]="message"></risk-error>
|
|
1128
|
-
<risk-good [message]="message"></risk-good>
|
|
1129
|
-
<risk-info [message]="message"></risk-info>
|
|
1130
|
-
<risk-message [message]="message"></risk-message>
|
|
1131
|
-
<risk-warn [message]="message"></risk-warn>
|
|
1132
|
-
<risk-initial-load [message]="message"></risk-initial-load>
|
|
1133
|
-
<risk-update-failed [message]="message"></risk-update-failed>
|
|
1134
|
-
<risk-no-data [message]="message"></risk-no-data>
|
|
1135
|
-
`, isInline: true, components: [{ type: i1$2.MessageComponent, selector: "risk-error, risk-good, risk-info, risk-message, risk-warn, risk-initial-load, risk-no-data, risk-update-failed", inputs: ["message"] }] });
|
|
1136
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: TestMessageHostComponent, decorators: [{
|
|
1137
|
-
type: Component,
|
|
1138
|
-
args: [{
|
|
1139
|
-
template: `
|
|
1140
|
-
<risk-error [message]="message"></risk-error>
|
|
1141
|
-
<risk-good [message]="message"></risk-good>
|
|
1142
|
-
<risk-info [message]="message"></risk-info>
|
|
1143
|
-
<risk-message [message]="message"></risk-message>
|
|
1144
|
-
<risk-warn [message]="message"></risk-warn>
|
|
1145
|
-
<risk-initial-load [message]="message"></risk-initial-load>
|
|
1146
|
-
<risk-update-failed [message]="message"></risk-update-failed>
|
|
1147
|
-
<risk-no-data [message]="message"></risk-no-data>
|
|
1148
|
-
`
|
|
1149
|
-
}]
|
|
1150
|
-
}] });
|
|
1151
|
-
class MessageHostedPage extends Page {
|
|
1152
|
-
constructor(fixture) {
|
|
1153
|
-
super(fixture);
|
|
1154
|
-
}
|
|
1155
|
-
get error() {
|
|
1156
|
-
return new MessageComponentDef(this.debugElement.query(By.css(RISK_ERROR_SELECTOR)));
|
|
1157
|
-
}
|
|
1158
|
-
get good() {
|
|
1159
|
-
return new MessageComponentDef(this.debugElement.query(By.css(RISK_GOOD_SELECTOR)));
|
|
1160
|
-
}
|
|
1161
|
-
get info() {
|
|
1162
|
-
return new MessageComponentDef(this.debugElement.query(By.css(RISK_INFO_SELECTOR)));
|
|
1163
|
-
}
|
|
1164
|
-
get message() {
|
|
1165
|
-
return new MessageComponentDef(this.debugElement.query(By.css(RISK_MESSAGE_SELECTOR)));
|
|
1166
|
-
}
|
|
1167
|
-
get warn() {
|
|
1168
|
-
return new MessageComponentDef(this.debugElement.query(By.css(RISK_WARN_SELECTOR)));
|
|
1169
|
-
}
|
|
1170
|
-
get initialLoad() {
|
|
1171
|
-
return new MessageComponentDef(this.debugElement.query(By.css(RISK_INITIAL_LOAD_SELECTOR)));
|
|
1172
|
-
}
|
|
1173
|
-
get noData() {
|
|
1174
|
-
return new MessageComponentDef(this.debugElement.query(By.css(RISK_NO_DATA_SELECTOR)));
|
|
1175
|
-
}
|
|
1176
|
-
get updateFailed() {
|
|
1177
|
-
return new MessageComponentDef(this.debugElement.query(By.css(RISK_UPDATE_FAILED_SELECTOR)));
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
|
-
const storage = { authRequestedPath: null };
|
|
1182
|
-
class AuthRoutingFlowServiceStub extends AuthRoutingFlowService {
|
|
1183
|
-
constructor(authServiceStub, authConfig) {
|
|
1184
|
-
super(null, null, { loggedIn: of(null) }, storage, authConfig, null);
|
|
1185
|
-
this.authServiceStub = authServiceStub;
|
|
1186
|
-
// cleanup
|
|
1187
|
-
storage.authRequestedPath = null;
|
|
1188
|
-
}
|
|
1189
|
-
logout(state) {
|
|
1190
|
-
return this.authServiceStub.logout().pipe(defaultIfEmpty(0), map(() => true));
|
|
1191
|
-
}
|
|
1192
|
-
login(username, password) {
|
|
1193
|
-
return this.authServiceStub.directLogin(username, password);
|
|
1194
|
-
}
|
|
1195
|
-
loginViaService() {
|
|
1196
|
-
return this.authServiceStub.loginViaAuthService();
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
AuthRoutingFlowServiceStub.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: AuthRoutingFlowServiceStub, deps: [{ token: AUTH_PROVIDER }, { token: AUTH_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1200
|
-
AuthRoutingFlowServiceStub.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: AuthRoutingFlowServiceStub });
|
|
1201
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: AuthRoutingFlowServiceStub, decorators: [{
|
|
1202
|
-
type: Injectable
|
|
1203
|
-
}], ctorParameters: function () {
|
|
1204
|
-
return [{ type: i1$3.AuthService, decorators: [{
|
|
1205
|
-
type: Inject,
|
|
1206
|
-
args: [AUTH_PROVIDER]
|
|
1207
|
-
}] }, { type: undefined, decorators: [{
|
|
1208
|
-
type: Inject,
|
|
1209
|
-
args: [AUTH_CONFIG]
|
|
1210
|
-
}] }];
|
|
1211
|
-
} });
|
|
1212
|
-
|
|
1213
|
-
const WELL_KNOWN = {
|
|
1214
|
-
endpoints: {
|
|
1215
|
-
auth: '/auth',
|
|
1216
|
-
token: '/token',
|
|
1217
|
-
logout: '/logout'
|
|
1218
|
-
},
|
|
1219
|
-
issuer: 'risk-auth'
|
|
1220
|
-
};
|
|
1221
|
-
class WellKnownServiceStub {
|
|
1222
|
-
get wellKnown() {
|
|
1223
|
-
return of(WELL_KNOWN);
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
WellKnownServiceStub.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: WellKnownServiceStub, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1227
|
-
WellKnownServiceStub.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: WellKnownServiceStub });
|
|
1228
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: WellKnownServiceStub, decorators: [{
|
|
1229
|
-
type: Injectable
|
|
1230
|
-
}] });
|
|
1231
|
-
|
|
1232
|
-
class AuthServiceStub extends AuthService {
|
|
1233
|
-
constructor() {
|
|
1234
|
-
super({}, new WellKnownServiceStub(), null, null, null);
|
|
1235
|
-
}
|
|
1236
|
-
get loggedIn() {
|
|
1237
|
-
return of(!!this.user);
|
|
1238
|
-
}
|
|
1239
|
-
get userProfile() {
|
|
1240
|
-
return of({
|
|
1241
|
-
name: this.user
|
|
1242
|
-
});
|
|
1243
|
-
}
|
|
1244
|
-
loginViaAuthService() {
|
|
1245
|
-
return of(true);
|
|
1246
|
-
}
|
|
1247
|
-
checkLocationForLoginData() {
|
|
1248
|
-
return of(true);
|
|
1249
|
-
}
|
|
1250
|
-
directLogin(username, password) {
|
|
1251
|
-
this.user = username;
|
|
1252
|
-
this.emitLoginStatusChange(true);
|
|
1253
|
-
return of(true);
|
|
1254
|
-
}
|
|
1255
|
-
logout() {
|
|
1256
|
-
this.emitLoginStatusChange(false);
|
|
1257
|
-
delete this.user;
|
|
1258
|
-
return EMPTY;
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
AuthServiceStub.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: AuthServiceStub, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1262
|
-
AuthServiceStub.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: AuthServiceStub });
|
|
1263
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: AuthServiceStub, decorators: [{
|
|
1264
|
-
type: Injectable
|
|
1265
|
-
}], ctorParameters: function () { return []; } });
|
|
1266
|
-
|
|
1267
|
-
class LoginMenuStubComponent {
|
|
1268
|
-
constructor() {
|
|
1269
|
-
this.orientation = 'row';
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
LoginMenuStubComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: LoginMenuStubComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1273
|
-
LoginMenuStubComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.6", type: LoginMenuStubComponent, selector: "login-menu, risk-login-menu", inputs: { orientation: "orientation" }, ngImport: i0, template: '', isInline: true });
|
|
1274
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: LoginMenuStubComponent, decorators: [{
|
|
1275
|
-
type: Component,
|
|
1276
|
-
args: [{
|
|
1277
|
-
selector: 'login-menu, risk-login-menu',
|
|
1278
|
-
template: ''
|
|
1279
|
-
}]
|
|
1280
|
-
}], propDecorators: { orientation: [{
|
|
1281
|
-
type: Input
|
|
1282
|
-
}] } });
|
|
1283
|
-
|
|
1284
|
-
class ActivatedRouteStub {
|
|
1285
|
-
constructor() {
|
|
1286
|
-
// Test parameters
|
|
1287
|
-
this._testParams = {};
|
|
1288
|
-
// ActivatedRoute.params is Observable
|
|
1289
|
-
this.subject = new BehaviorSubject(this.testParams);
|
|
1290
|
-
this.params = this.subject.asObservable();
|
|
1291
|
-
}
|
|
1292
|
-
get testParams() {
|
|
1293
|
-
return this._testParams;
|
|
1294
|
-
}
|
|
1295
|
-
set testParams(params) {
|
|
1296
|
-
this._testParams = params;
|
|
1297
|
-
this.subject.next(params);
|
|
1298
|
-
}
|
|
1299
|
-
// ActivatedRoute.snapshot.params
|
|
1300
|
-
get snapshot() {
|
|
1301
|
-
return { params: this.testParams };
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
ActivatedRouteStub.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: ActivatedRouteStub, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1305
|
-
ActivatedRouteStub.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: ActivatedRouteStub });
|
|
1306
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: ActivatedRouteStub, decorators: [{
|
|
1307
|
-
type: Injectable
|
|
1308
|
-
}] });
|
|
1309
|
-
|
|
1310
|
-
class RouterOutletStubComponent {
|
|
1311
|
-
}
|
|
1312
|
-
RouterOutletStubComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: RouterOutletStubComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1313
|
-
RouterOutletStubComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.6", type: RouterOutletStubComponent, selector: "router-outlet", ngImport: i0, template: '', isInline: true });
|
|
1314
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: RouterOutletStubComponent, decorators: [{
|
|
1315
|
-
type: Component,
|
|
1316
|
-
args: [{
|
|
1317
|
-
/* eslint-disable @angular-eslint/component-selector */
|
|
1318
|
-
selector: 'router-outlet',
|
|
1319
|
-
/* eslint-enable */
|
|
1320
|
-
template: ''
|
|
1321
|
-
}]
|
|
1322
|
-
}] });
|
|
1323
|
-
|
|
1324
|
-
class Snapshot {
|
|
1325
|
-
constructor(stub) {
|
|
1326
|
-
this.stub = stub;
|
|
1327
|
-
}
|
|
1328
|
-
get url() {
|
|
1329
|
-
return this.stub.getCurrentURL();
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
// @dynamic
|
|
1333
|
-
class RouterStub {
|
|
1334
|
-
constructor() {
|
|
1335
|
-
this.id = 0;
|
|
1336
|
-
this.navigated = true;
|
|
1337
|
-
this.currentUrlTree = this.createUrlTree(['/dashboard']);
|
|
1338
|
-
this.routerState = {
|
|
1339
|
-
snapshot: new Snapshot(this)
|
|
1340
|
-
};
|
|
1341
|
-
this.events = new EventEmitter();
|
|
1342
|
-
}
|
|
1343
|
-
getURLTree(url) {
|
|
1344
|
-
if (Array.isArray(url)) {
|
|
1345
|
-
return this.createUrlTree(url);
|
|
1346
|
-
}
|
|
1347
|
-
if (url instanceof Object) {
|
|
1348
|
-
return url;
|
|
1349
|
-
}
|
|
1350
|
-
return this.createUrlTree(url.split('/'));
|
|
1351
|
-
}
|
|
1352
|
-
navigateByUrl(url) {
|
|
1353
|
-
this.currentUrlTree = this.getURLTree(url);
|
|
1354
|
-
this.emitNavigate();
|
|
1355
|
-
return url;
|
|
1356
|
-
}
|
|
1357
|
-
navigate(commands, extras) {
|
|
1358
|
-
this.currentUrlTree = this.getURLTree(commands);
|
|
1359
|
-
this.emitNavigate();
|
|
1360
|
-
return [commands, extras];
|
|
1361
|
-
}
|
|
1362
|
-
emitNavigate() {
|
|
1363
|
-
this.id++;
|
|
1364
|
-
const urlString = this.getCurrentURL();
|
|
1365
|
-
this.events.emit(new NavigationEnd(this.id, urlString, urlString));
|
|
1366
|
-
}
|
|
1367
|
-
isActive(url) {
|
|
1368
|
-
return this.getCurrentURL().indexOf(RouterStub.serializeUrl(url)) !== -1;
|
|
1369
|
-
}
|
|
1370
|
-
getCurrentURL() {
|
|
1371
|
-
return RouterStub.serializeUrl(this.currentUrlTree);
|
|
1372
|
-
}
|
|
1373
|
-
createUrlTree(commands, extras) {
|
|
1374
|
-
const _b = extras || {};
|
|
1375
|
-
const queryParams = _b.queryParams || {};
|
|
1376
|
-
const fragment = _b.fragment || '';
|
|
1377
|
-
return {
|
|
1378
|
-
root: new UrlSegmentGroup(commands.map((command) => {
|
|
1379
|
-
return new UrlSegment(command, {});
|
|
1380
|
-
}), {}),
|
|
1381
|
-
queryParams,
|
|
1382
|
-
fragment,
|
|
1383
|
-
queryParamMap: Object.assign(Object.assign({}, new Map()), { getAll: () => [], keys: [] })
|
|
1384
|
-
};
|
|
1385
|
-
}
|
|
1386
|
-
static serializeUrl(url) {
|
|
1387
|
-
return url.root.segments.map((segment) => segment.path).join('/');
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
RouterStub.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: RouterStub, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1391
|
-
RouterStub.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: RouterStub });
|
|
1392
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: RouterStub, decorators: [{
|
|
1393
|
-
type: Injectable
|
|
1394
|
-
}] });
|
|
1395
|
-
|
|
1396
|
-
function stubRouter(customOverrides) {
|
|
1397
|
-
const override = {
|
|
1398
|
-
set: {
|
|
1399
|
-
imports: [],
|
|
1400
|
-
declarations: [
|
|
1401
|
-
RouterLinkStubDirective,
|
|
1402
|
-
RouterOutletStubComponent
|
|
1403
|
-
],
|
|
1404
|
-
providers: [
|
|
1405
|
-
{
|
|
1406
|
-
provide: Router,
|
|
1407
|
-
useClass: RouterStub
|
|
1408
|
-
},
|
|
1409
|
-
{
|
|
1410
|
-
provide: ActivatedRoute,
|
|
1411
|
-
useClass: ActivatedRouteStub
|
|
1412
|
-
}
|
|
1413
|
-
],
|
|
1414
|
-
exports: [
|
|
1415
|
-
RouterLinkStubDirective,
|
|
1416
|
-
RouterOutletStubComponent
|
|
1417
|
-
],
|
|
1418
|
-
entryComponents: []
|
|
1419
|
-
}
|
|
1420
|
-
};
|
|
1421
|
-
if (customOverrides) {
|
|
1422
|
-
if (customOverrides.add) {
|
|
1423
|
-
override.add = customOverrides.add;
|
|
1424
|
-
}
|
|
1425
|
-
if (customOverrides.set) {
|
|
1426
|
-
Object.assign(override.set, customOverrides.set);
|
|
1427
|
-
}
|
|
1428
|
-
if (customOverrides.remove) {
|
|
1429
|
-
override.remove = customOverrides.remove;
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
return TestBed.overrideModule(RouterModule, override);
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
function disableMaterialAnimations(ngModule) {
|
|
1436
|
-
TestBed.overrideModule(ngModule, {
|
|
1437
|
-
remove: {
|
|
1438
|
-
imports: [CommonViewModule]
|
|
1439
|
-
},
|
|
1440
|
-
add: {
|
|
1441
|
-
imports: [NoopAnimationsCommonViewModule]
|
|
1442
|
-
}
|
|
1443
|
-
});
|
|
1444
|
-
}
|
|
1445
|
-
function compileTestBed(compileFunction, destroyFunction, stubMatchMedia = true) {
|
|
1446
|
-
let matchMedia;
|
|
1447
|
-
beforeEach((done) => {
|
|
1448
|
-
if (stubMatchMedia) {
|
|
1449
|
-
matchMedia = window.matchMedia;
|
|
1450
|
-
window.matchMedia = fakeMatchMedia();
|
|
1451
|
-
}
|
|
1452
|
-
compileFunction()
|
|
1453
|
-
.then(done)
|
|
1454
|
-
.catch((err) => {
|
|
1455
|
-
done.fail(err);
|
|
1456
|
-
});
|
|
1457
|
-
}, COMPILE_TIMEOUT_INTERVAL);
|
|
1458
|
-
afterEach(() => {
|
|
1459
|
-
if (destroyFunction) {
|
|
1460
|
-
destroyFunction();
|
|
1461
|
-
}
|
|
1462
|
-
if (stubMatchMedia) {
|
|
1463
|
-
window.matchMedia = matchMedia;
|
|
1464
|
-
}
|
|
1465
|
-
}, COMPILE_TIMEOUT_INTERVAL);
|
|
1466
|
-
}
|
|
1467
|
-
function fakeMatchMedia(matches = false) {
|
|
1468
|
-
return (mediaQuery) => ({
|
|
1469
|
-
matches,
|
|
1470
|
-
media: mediaQuery,
|
|
1471
|
-
onchange: () => null,
|
|
1472
|
-
addListener: () => null,
|
|
1473
|
-
addEventListener: () => null,
|
|
1474
|
-
removeListener: () => null,
|
|
1475
|
-
removeEventListener: () => null,
|
|
1476
|
-
dispatchEvent: () => true
|
|
1477
|
-
});
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
class TestingModule {
|
|
1481
|
-
}
|
|
1482
|
-
TestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: TestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1483
|
-
TestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: TestingModule, declarations: [DownloadTestComponent,
|
|
1484
|
-
TestDataTableHostComponent,
|
|
1485
|
-
HighLighterDirectiveTestComponent,
|
|
1486
|
-
TestLayoutHostComponent,
|
|
1487
|
-
RouterLinkStubDirective,
|
|
1488
|
-
TestMessageHostComponent,
|
|
1489
|
-
LoginMenuStubComponent,
|
|
1490
|
-
RouterOutletStubComponent], imports: [CommonViewModule,
|
|
1491
|
-
FileModule,
|
|
1492
|
-
DataTableModule] });
|
|
1493
|
-
TestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: TestingModule, imports: [[
|
|
1494
|
-
CommonViewModule,
|
|
1495
|
-
FileModule,
|
|
1496
|
-
DataTableModule
|
|
1497
|
-
]] });
|
|
1498
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: TestingModule, decorators: [{
|
|
1499
|
-
type: NgModule,
|
|
1500
|
-
args: [{
|
|
1501
|
-
imports: [
|
|
1502
|
-
CommonViewModule,
|
|
1503
|
-
FileModule,
|
|
1504
|
-
DataTableModule
|
|
1505
|
-
],
|
|
1506
|
-
declarations: [
|
|
1507
|
-
DownloadTestComponent,
|
|
1508
|
-
TestDataTableHostComponent,
|
|
1509
|
-
HighLighterDirectiveTestComponent,
|
|
1510
|
-
TestLayoutHostComponent,
|
|
1511
|
-
RouterLinkStubDirective,
|
|
1512
|
-
TestMessageHostComponent,
|
|
1513
|
-
LoginMenuStubComponent,
|
|
1514
|
-
RouterOutletStubComponent
|
|
1515
|
-
]
|
|
1516
|
-
}]
|
|
1517
|
-
}] });
|
|
1518
|
-
|
|
1519
|
-
// WARNING: Do not change order in this file!!! Environment has to be first as it includes polyfills
|
|
1520
|
-
// Add CachedResourceProviderImpl to compiler configuration
|
|
1521
|
-
if ('beforeEach' in globalScope && globalScope.beforeEach) {
|
|
1522
|
-
globalScope.beforeEach(() => {
|
|
1523
|
-
// Disable logging in Safari as the Selenium WebDriver is not working there correctly....
|
|
1524
|
-
if ('navigator' in globalScope) {
|
|
1525
|
-
const ua = globalScope.navigator.userAgent.toLowerCase();
|
|
1526
|
-
if ('spyOn' in globalScope && globalScope.spyOn
|
|
1527
|
-
&& ua.indexOf('safari') > -1
|
|
1528
|
-
&& ua.indexOf('chrome') === -1) {
|
|
1529
|
-
globalScope.spyOn(console, 'log').and.stub();
|
|
1530
|
-
globalScope.spyOn(console, 'info').and.stub();
|
|
1531
|
-
globalScope.spyOn(console, 'warn').and.stub();
|
|
1532
|
-
globalScope.spyOn(console, 'debug').and.stub();
|
|
1533
|
-
globalScope.spyOn(console, 'error').and.stub();
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
});
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
/**
|
|
1540
|
-
* Generated bundle index. Do not edit.
|
|
1541
|
-
*/
|
|
1542
|
-
|
|
1543
|
-
export { ActivatedRouteStub, AuthRoutingFlowServiceStub, AuthServiceStub, BUTTON_CLICK_EVENTS, ByUtil, COMPILE_TIMEOUT_INTERVAL, CSVDownloadMenuPage, DataTableDefinition, DataTableDefinitionHosted, DownloadLink, DownloadTestComponent, DownloadTestComponentPage, FAKE_HTTP_ASYNC_TIMEOUT, HighLighterDirectivePage, HighLighterDirectiveTestComponent, HttpAsyncServiceStub, HttpServiceStub, LayoutComponentDefinition, LinkDefinition, LinkOnlyPage, LoginMenuPage, LoginMenuStubComponent, LoginPage, MessageComponentDef, MessageHostedPage, Page, PageWithLoading, Pager, RecordsCount, RouterLinkStubDirective, RouterOutletStubComponent, RouterStub, RowExpander, Snapshot, SortingHandle, TableBody, TableBodyCell, TableBodyDetail, TableBodyDetailBody, TableBodyDetailRow, TableBodyRow, TableFooter, TableFooterRow, TableHeader, TableHeaderCell, TableHeaderRow, TableSorting, TestDataTableHostComponent, TestLayoutComponentHostPage, TestLayoutHostComponent, TestMessageHostComponent, TestingModule, WELL_KNOWN, WellKnownServiceStub, chceckSorting, click, compileTestBed, disableMaterialAnimations, dispatchEvent, initTestEnvironment, newEvent, setNgModelSelectValue, setNgModelValue, storage, stubRouter };
|
|
1544
|
-
//# sourceMappingURL=dbg-riskit-angular-testing.mjs.map
|