@yelon/testing 12.0.13 → 12.0.17

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.
@@ -1,391 +1,391 @@
1
- /**
2
- * @license ng-yunzai(devcui@outlook.com) v12.0.13
3
- * (c) 2020 devcui https://github.com/hbyunzai/yelon/
4
- * License: MIT
5
- */
1
+ /**
2
+ * @license ng-yunzai(devcui@outlook.com) v12.0.17
3
+ * (c) 2020 devcui https://github.com/hbyunzai/yelon/
4
+ * License: MIT
5
+ */
6
6
  (function (global, factory) {
7
7
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core/testing'), require('@angular/platform-browser'), require('ng-zorro-antd/dropdown')) :
8
8
  typeof define === 'function' && define.amd ? define('@yelon/testing', ['exports', '@angular/core/testing', '@angular/platform-browser', 'ng-zorro-antd/dropdown'], factory) :
9
9
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.yelon = global.yelon || {}, global.yelon.testing = {}), global.ng.core.testing, global.ng.platformBrowser, global["ng-zorro-antd/dropdown"]));
10
10
  })(this, (function (exports, testing, platformBrowser, dropdown) { 'use strict';
11
11
 
12
- /**
13
- * @license
14
- * Copyright Google LLC All Rights Reserved.
15
- *
16
- * Use of this source code is governed by an MIT-style license that can be
17
- * found in the LICENSE file at https://angular.io/license
18
- */
19
- /** Creates a browser MouseEvent with the specified options. */
20
- function createMouseEvent(type, x, y) {
21
- if (x === void 0) { x = 0; }
22
- if (y === void 0) { y = 0; }
23
- var event = document.createEvent('MouseEvent');
24
- event.initMouseEvent(type, false /* canBubble */, false /* cancelable */, window /* view */, 0 /* detail */, x /* screenX */, y /* screenY */, x /* clientX */, y /* clientY */, false /* ctrlKey */, false /* altKey */, false /* shiftKey */, false /* metaKey */, 0 /* button */, null /* relatedTarget */);
25
- return event;
26
- }
27
- /** Creates a browser TouchEvent with the specified pointer coordinates. */
28
- function createTouchEvent(type, pageX, pageY) {
29
- if (pageX === void 0) { pageX = 0; }
30
- if (pageY === void 0) { pageY = 0; }
31
- // In favor of creating events that work for most of the browsers, the event is created
32
- // as a basic UI Event. The necessary details for the event will be set manually.
33
- var event = document.createEvent('UIEvent');
34
- var touchDetails = { pageX: pageX, pageY: pageY };
35
- event.initUIEvent(type, true, true, window, 0);
36
- // Most of the browsers don't have a "initTouchEvent" method that can be used to define
37
- // the touch details.
38
- Object.defineProperties(event, {
39
- touches: { value: [touchDetails] }
40
- });
41
- return event;
42
- }
43
- /** Dispatches a keydown event from an element. */
44
- function createKeyboardEvent(type, keyCode, target, key) {
45
- var event = document.createEvent('KeyboardEvent');
46
- // Firefox does not support `initKeyboardEvent`, but supports `initKeyEvent`.
47
- var initEventFn = (event.initKeyEvent || event.initKeyboardEvent).bind(event);
48
- var originalPreventDefault = event.preventDefault;
49
- initEventFn(type, true, true, window, 0, 0, 0, 0, 0, keyCode);
50
- // Webkit Browsers don't set the keyCode when calling the init function.
51
- // See related bug https://bugs.webkit.org/show_bug.cgi?id=16735
52
- Object.defineProperties(event, {
53
- keyCode: { get: function () { return keyCode; } },
54
- key: { get: function () { return key; } },
55
- target: { get: function () { return target; } }
56
- });
57
- // IE won't set `defaultPrevented` on synthetic events so we need to do it manually.
58
- event.preventDefault = function () {
59
- Object.defineProperty(event, 'defaultPrevented', { get: function () { return true; } });
60
- return originalPreventDefault.apply(this, arguments);
61
- };
62
- return event;
63
- }
64
- /** Creates a fake event object with any desired event type. */
65
- function createFakeEvent(type, canBubble, cancelable) {
66
- if (canBubble === void 0) { canBubble = true; }
67
- if (cancelable === void 0) { cancelable = true; }
68
- var event = document.createEvent('Event');
69
- event.initEvent(type, canBubble, cancelable);
70
- return event;
12
+ /**
13
+ * @license
14
+ * Copyright Google LLC All Rights Reserved.
15
+ *
16
+ * Use of this source code is governed by an MIT-style license that can be
17
+ * found in the LICENSE file at https://angular.io/license
18
+ */
19
+ /** Creates a browser MouseEvent with the specified options. */
20
+ function createMouseEvent(type, x, y) {
21
+ if (x === void 0) { x = 0; }
22
+ if (y === void 0) { y = 0; }
23
+ var event = document.createEvent('MouseEvent');
24
+ event.initMouseEvent(type, false /* canBubble */, false /* cancelable */, window /* view */, 0 /* detail */, x /* screenX */, y /* screenY */, x /* clientX */, y /* clientY */, false /* ctrlKey */, false /* altKey */, false /* shiftKey */, false /* metaKey */, 0 /* button */, null /* relatedTarget */);
25
+ return event;
26
+ }
27
+ /** Creates a browser TouchEvent with the specified pointer coordinates. */
28
+ function createTouchEvent(type, pageX, pageY) {
29
+ if (pageX === void 0) { pageX = 0; }
30
+ if (pageY === void 0) { pageY = 0; }
31
+ // In favor of creating events that work for most of the browsers, the event is created
32
+ // as a basic UI Event. The necessary details for the event will be set manually.
33
+ var event = document.createEvent('UIEvent');
34
+ var touchDetails = { pageX: pageX, pageY: pageY };
35
+ event.initUIEvent(type, true, true, window, 0);
36
+ // Most of the browsers don't have a "initTouchEvent" method that can be used to define
37
+ // the touch details.
38
+ Object.defineProperties(event, {
39
+ touches: { value: [touchDetails] }
40
+ });
41
+ return event;
42
+ }
43
+ /** Dispatches a keydown event from an element. */
44
+ function createKeyboardEvent(type, keyCode, target, key) {
45
+ var event = document.createEvent('KeyboardEvent');
46
+ // Firefox does not support `initKeyboardEvent`, but supports `initKeyEvent`.
47
+ var initEventFn = (event.initKeyEvent || event.initKeyboardEvent).bind(event);
48
+ var originalPreventDefault = event.preventDefault;
49
+ initEventFn(type, true, true, window, 0, 0, 0, 0, 0, keyCode);
50
+ // Webkit Browsers don't set the keyCode when calling the init function.
51
+ // See related bug https://bugs.webkit.org/show_bug.cgi?id=16735
52
+ Object.defineProperties(event, {
53
+ keyCode: { get: function () { return keyCode; } },
54
+ key: { get: function () { return key; } },
55
+ target: { get: function () { return target; } }
56
+ });
57
+ // IE won't set `defaultPrevented` on synthetic events so we need to do it manually.
58
+ event.preventDefault = function () {
59
+ Object.defineProperty(event, 'defaultPrevented', { get: function () { return true; } });
60
+ return originalPreventDefault.apply(this, arguments);
61
+ };
62
+ return event;
63
+ }
64
+ /** Creates a fake event object with any desired event type. */
65
+ function createFakeEvent(type, canBubble, cancelable) {
66
+ if (canBubble === void 0) { canBubble = true; }
67
+ if (cancelable === void 0) { cancelable = true; }
68
+ var event = document.createEvent('Event');
69
+ event.initEvent(type, canBubble, cancelable);
70
+ return event;
71
71
  }
72
72
 
73
- /**
74
- * @license
75
- * Copyright Google LLC All Rights Reserved.
76
- *
77
- * Use of this source code is governed by an MIT-style license that can be
78
- * found in the LICENSE file at https://angular.io/license
79
- */
80
- /** Utility to dispatch any event on a Node. */
81
- function dispatchEvent(node, event) {
82
- node.dispatchEvent(event);
83
- return event;
84
- }
85
- /** Shorthand to dispatch a fake event on a specified node. */
86
- function dispatchFakeEvent(node, type, canBubble) {
87
- return dispatchEvent(node, typeof type === 'string' ? createFakeEvent(type, canBubble) : type);
88
- }
89
- /** Shorthand to dispatch a keyboard event with a specified key code. */
90
- function dispatchKeyboardEvent(node, type, keyCode, target) {
91
- return dispatchEvent(node, createKeyboardEvent(type, keyCode, target));
92
- }
93
- /** Shorthand to dispatch a mouse event on the specified coordinates. */
94
- function dispatchMouseEvent(node, type, x, y, event) {
95
- if (x === void 0) { x = 0; }
96
- if (y === void 0) { y = 0; }
97
- if (event === void 0) { event = createMouseEvent(type, x, y); }
98
- return dispatchEvent(node, event);
99
- }
100
- /** Shorthand to dispatch a touch event on the specified coordinates. */
101
- function dispatchTouchEvent(node, type, x, y) {
102
- if (x === void 0) { x = 0; }
103
- if (y === void 0) { y = 0; }
104
- return dispatchEvent(node, createTouchEvent(type, x, y));
73
+ /**
74
+ * @license
75
+ * Copyright Google LLC All Rights Reserved.
76
+ *
77
+ * Use of this source code is governed by an MIT-style license that can be
78
+ * found in the LICENSE file at https://angular.io/license
79
+ */
80
+ /** Utility to dispatch any event on a Node. */
81
+ function dispatchEvent(node, event) {
82
+ node.dispatchEvent(event);
83
+ return event;
84
+ }
85
+ /** Shorthand to dispatch a fake event on a specified node. */
86
+ function dispatchFakeEvent(node, type, canBubble) {
87
+ return dispatchEvent(node, typeof type === 'string' ? createFakeEvent(type, canBubble) : type);
88
+ }
89
+ /** Shorthand to dispatch a keyboard event with a specified key code. */
90
+ function dispatchKeyboardEvent(node, type, keyCode, target) {
91
+ return dispatchEvent(node, createKeyboardEvent(type, keyCode, target));
92
+ }
93
+ /** Shorthand to dispatch a mouse event on the specified coordinates. */
94
+ function dispatchMouseEvent(node, type, x, y, event) {
95
+ if (x === void 0) { x = 0; }
96
+ if (y === void 0) { y = 0; }
97
+ if (event === void 0) { event = createMouseEvent(type, x, y); }
98
+ return dispatchEvent(node, event);
99
+ }
100
+ /** Shorthand to dispatch a touch event on the specified coordinates. */
101
+ function dispatchTouchEvent(node, type, x, y) {
102
+ if (x === void 0) { x = 0; }
103
+ if (y === void 0) { y = 0; }
104
+ return dispatchEvent(node, createTouchEvent(type, x, y));
105
105
  }
106
106
 
107
- /**
108
- * @license
109
- * Copyright Google LLC All Rights Reserved.
110
- *
111
- * Use of this source code is governed by an MIT-style license that can be
112
- * found in the LICENSE file at https://angular.io/license
113
- */
114
- /**
115
- * Focuses an input, sets its value and dispatches
116
- * the `input` event, simulating the user typing.
117
- *
118
- * @param value Value to be set on the input.
119
- * @param element Element onto which to set the value.
120
- */
121
- function typeInElement(value, element) {
122
- element.focus();
123
- element.value = value;
124
- dispatchFakeEvent(element, 'input');
107
+ /**
108
+ * @license
109
+ * Copyright Google LLC All Rights Reserved.
110
+ *
111
+ * Use of this source code is governed by an MIT-style license that can be
112
+ * found in the LICENSE file at https://angular.io/license
113
+ */
114
+ /**
115
+ * Focuses an input, sets its value and dispatches
116
+ * the `input` event, simulating the user typing.
117
+ *
118
+ * @param value Value to be set on the input.
119
+ * @param element Element onto which to set the value.
120
+ */
121
+ function typeInElement(value, element) {
122
+ element.focus();
123
+ element.value = value;
124
+ dispatchFakeEvent(element, 'input');
125
125
  }
126
126
 
127
- var DROPDOWN_MIN_TIME = 1000;
128
- /**
129
- * 触发 dropdown
130
- */
131
- function dispatchDropDown(dl, trigger, allowNull) {
132
- if (allowNull === void 0) { allowNull = true; }
133
- var directive = dl.query(platformBrowser.By.directive(dropdown.NzDropDownDirective));
134
- if (allowNull && directive == null) {
135
- return false;
136
- }
137
- var el = directive.injector.get(dropdown.NzDropDownDirective).elementRef.nativeElement;
138
- if (trigger === 'click') {
139
- dispatchFakeEvent(el, 'click');
140
- }
141
- else {
142
- dispatchFakeEvent(el, 'mouseenter');
143
- }
144
- testing.tick(DROPDOWN_MIN_TIME);
145
- return true;
127
+ var DROPDOWN_MIN_TIME = 1000;
128
+ /**
129
+ * 触发 dropdown
130
+ */
131
+ function dispatchDropDown(dl, trigger, allowNull) {
132
+ if (allowNull === void 0) { allowNull = true; }
133
+ var directive = dl.query(platformBrowser.By.directive(dropdown.NzDropDownDirective));
134
+ if (allowNull && directive == null) {
135
+ return false;
136
+ }
137
+ var el = directive.injector.get(dropdown.NzDropDownDirective).elementRef.nativeElement;
138
+ if (trigger === 'click') {
139
+ dispatchFakeEvent(el, 'click');
140
+ }
141
+ else {
142
+ dispatchFakeEvent(el, 'mouseenter');
143
+ }
144
+ testing.tick(DROPDOWN_MIN_TIME);
145
+ return true;
146
146
  }
147
147
 
148
- var PageG2DataCount = 2;
149
- var PageG2Height = 100;
150
- var PageG2 = /** @class */ (function () {
151
- function PageG2(fixture) {
152
- if (fixture === void 0) { fixture = null; }
153
- this.fixture = fixture;
154
- }
155
- Object.defineProperty(PageG2.prototype, "dl", {
156
- get: function () {
157
- return this.fixture.debugElement;
158
- },
159
- enumerable: false,
160
- configurable: true
161
- });
162
- Object.defineProperty(PageG2.prototype, "context", {
163
- get: function () {
164
- return this.fixture.componentInstance;
165
- },
166
- enumerable: false,
167
- configurable: true
168
- });
169
- Object.defineProperty(PageG2.prototype, "comp", {
170
- get: function () {
171
- return this.context['comp'];
172
- },
173
- enumerable: false,
174
- configurable: true
175
- });
176
- Object.defineProperty(PageG2.prototype, "chart", {
177
- get: function () {
178
- return this.comp.chart;
179
- },
180
- enumerable: false,
181
- configurable: true
182
- });
183
- PageG2.prototype.genModule = function (module, comp) {
184
- testing.TestBed.configureTestingModule({
185
- imports: [module],
186
- declarations: [comp]
187
- });
188
- return this;
189
- };
190
- PageG2.prototype.genComp = function (comp, dc) {
191
- if (dc === void 0) { dc = false; }
192
- this.fixture = testing.TestBed.createComponent(comp);
193
- if (dc) {
194
- this.dcFirst();
195
- }
196
- return this;
197
- };
198
- PageG2.prototype.makeModule = function (module, comp, options) {
199
- if (options === void 0) { options = { dc: true }; }
200
- this.genModule(module, comp).genComp(comp, options.dc);
201
- return this;
202
- };
203
- PageG2.prototype.dcFirst = function () {
204
- this.dc();
205
- testing.flush();
206
- testing.discardPeriodicTasks();
207
- // FIX: `Error during cleanup of component`
208
- if (this.comp && typeof this.comp.chart !== 'undefined') {
209
- spyOn(this.comp.chart, 'destroy');
210
- }
211
- return this;
212
- };
213
- PageG2.prototype.dc = function () {
214
- this.fixture.changeDetectorRef.markForCheck();
215
- this.fixture.detectChanges();
216
- return this;
217
- };
218
- PageG2.prototype.end = function () {
219
- // The 201 value is delay value
220
- testing.tick(201);
221
- testing.flush();
222
- testing.discardPeriodicTasks();
223
- return this;
224
- };
225
- PageG2.prototype.destroy = function () {
226
- this.comp.ngOnDestroy();
227
- };
228
- PageG2.prototype.newData = function (data) {
229
- this.context['data'] = data;
230
- this.dc();
231
- return this;
232
- };
233
- PageG2.prototype.getEls = function (cls) {
234
- return this.dl.nativeElement.querySelectorAll(cls);
235
- };
236
- PageG2.prototype.getEl = function (cls) {
237
- return this.dl.nativeElement.querySelector(cls);
238
- };
239
- PageG2.prototype.getController = function (type) {
240
- return this.chart.getController(type);
241
- };
242
- PageG2.prototype.isCanvas = function (stauts) {
243
- if (stauts === void 0) { stauts = true; }
244
- this.isExists('canvas', stauts);
245
- return this;
246
- };
247
- PageG2.prototype.isText = function (cls, value) {
248
- var el = this.getEl(cls);
249
- expect(el ? el.textContent.trim() : '').toBe(value);
250
- return this;
251
- };
252
- PageG2.prototype.isExists = function (cls, stauts) {
253
- if (stauts === void 0) { stauts = true; }
254
- expect(this.getEl(cls) != null).toBe(stauts);
255
- return this;
256
- };
257
- PageG2.prototype.checkOptions = function (key, value) {
258
- expect(this.chart[key]).toBe(value);
259
- return this;
260
- };
261
- PageG2.prototype.checkAttrOptions = function (type, key, value) {
262
- var x = this.chart[type][0].attributeOption[key];
263
- expect(x.field).toBe(value);
264
- return this;
265
- };
266
- PageG2.prototype.isXScalesCount = function (num) {
267
- var x = this.chart.getXScale();
268
- expect(x.values.length).toBe(num);
269
- return this;
270
- };
271
- PageG2.prototype.isYScalesCount = function (num) {
272
- var y = this.chart.getYScales();
273
- expect(y.length).toBe(1);
274
- expect(y[0].values.length).toBe(num);
275
- return this;
276
- };
277
- PageG2.prototype.isDataCount = function (type, num) {
278
- var results = this.chart[type];
279
- expect(results.length).toBeGreaterThan(0);
280
- expect(results[0].data.length).toBe(num);
281
- return this;
282
- };
283
- Object.defineProperty(PageG2.prototype, "firstDataPoint", {
284
- get: function () {
285
- return this.chart.getXY(this.context['data'][0]);
286
- },
287
- enumerable: false,
288
- configurable: true
289
- });
290
- PageG2.prototype.checkTooltip = function (_includeText, point) {
291
- if (!point) {
292
- point = this.firstDataPoint;
293
- }
294
- this.chart.showTooltip(point);
295
- expect(this.chart.getController('tooltip') != null).toBe(true);
296
- return this;
297
- };
298
- PageG2.prototype.checkClickItem = function () {
299
- var point = this.firstDataPoint;
300
- var clientPoint = this.chart.canvas.getClientByPoint(point.x, point.y);
301
- var event = new MouseEvent('click', {
302
- clientX: clientPoint.x,
303
- clientY: clientPoint.y
304
- });
305
- this.chart.canvas.get('el').dispatchEvent(event);
306
- return this;
307
- };
308
- return PageG2;
309
- }());
310
- function checkDelay(module, comp, page) {
311
- if (page === void 0) { page = null; }
312
- if (page == null) {
313
- page = new PageG2().makeModule(module, comp, { dc: false });
314
- }
315
- var context = page.context;
316
- if (typeof context.delay === 'undefined') {
317
- console.warn("You muse be dinfed \"delay\" property in test component");
318
- return;
319
- }
320
- context.delay = 100;
321
- page.dc();
322
- page.comp.ngOnDestroy();
323
- expect(page.chart == null).toBe(true);
324
- testing.tick(201);
325
- testing.discardPeriodicTasks();
148
+ var PageG2DataCount = 2;
149
+ var PageG2Height = 100;
150
+ var PageG2 = /** @class */ (function () {
151
+ function PageG2(fixture) {
152
+ if (fixture === void 0) { fixture = null; }
153
+ this.fixture = fixture;
154
+ }
155
+ Object.defineProperty(PageG2.prototype, "dl", {
156
+ get: function () {
157
+ return this.fixture.debugElement;
158
+ },
159
+ enumerable: false,
160
+ configurable: true
161
+ });
162
+ Object.defineProperty(PageG2.prototype, "context", {
163
+ get: function () {
164
+ return this.fixture.componentInstance;
165
+ },
166
+ enumerable: false,
167
+ configurable: true
168
+ });
169
+ Object.defineProperty(PageG2.prototype, "comp", {
170
+ get: function () {
171
+ return this.context['comp'];
172
+ },
173
+ enumerable: false,
174
+ configurable: true
175
+ });
176
+ Object.defineProperty(PageG2.prototype, "chart", {
177
+ get: function () {
178
+ return this.comp.chart;
179
+ },
180
+ enumerable: false,
181
+ configurable: true
182
+ });
183
+ PageG2.prototype.genModule = function (module, comp) {
184
+ testing.TestBed.configureTestingModule({
185
+ imports: [module],
186
+ declarations: [comp]
187
+ });
188
+ return this;
189
+ };
190
+ PageG2.prototype.genComp = function (comp, dc) {
191
+ if (dc === void 0) { dc = false; }
192
+ this.fixture = testing.TestBed.createComponent(comp);
193
+ if (dc) {
194
+ this.dcFirst();
195
+ }
196
+ return this;
197
+ };
198
+ PageG2.prototype.makeModule = function (module, comp, options) {
199
+ if (options === void 0) { options = { dc: true }; }
200
+ this.genModule(module, comp).genComp(comp, options.dc);
201
+ return this;
202
+ };
203
+ PageG2.prototype.dcFirst = function () {
204
+ this.dc();
205
+ testing.flush();
206
+ testing.discardPeriodicTasks();
207
+ // FIX: `Error during cleanup of component`
208
+ if (this.comp && typeof this.comp.chart !== 'undefined') {
209
+ spyOn(this.comp.chart, 'destroy');
210
+ }
211
+ return this;
212
+ };
213
+ PageG2.prototype.dc = function () {
214
+ this.fixture.changeDetectorRef.markForCheck();
215
+ this.fixture.detectChanges();
216
+ return this;
217
+ };
218
+ PageG2.prototype.end = function () {
219
+ // The 201 value is delay value
220
+ testing.tick(201);
221
+ testing.flush();
222
+ testing.discardPeriodicTasks();
223
+ return this;
224
+ };
225
+ PageG2.prototype.destroy = function () {
226
+ this.comp.ngOnDestroy();
227
+ };
228
+ PageG2.prototype.newData = function (data) {
229
+ this.context['data'] = data;
230
+ this.dc();
231
+ return this;
232
+ };
233
+ PageG2.prototype.getEls = function (cls) {
234
+ return this.dl.nativeElement.querySelectorAll(cls);
235
+ };
236
+ PageG2.prototype.getEl = function (cls) {
237
+ return this.dl.nativeElement.querySelector(cls);
238
+ };
239
+ PageG2.prototype.getController = function (type) {
240
+ return this.chart.getController(type);
241
+ };
242
+ PageG2.prototype.isCanvas = function (stauts) {
243
+ if (stauts === void 0) { stauts = true; }
244
+ this.isExists('canvas', stauts);
245
+ return this;
246
+ };
247
+ PageG2.prototype.isText = function (cls, value) {
248
+ var el = this.getEl(cls);
249
+ expect(el ? el.textContent.trim() : '').toBe(value);
250
+ return this;
251
+ };
252
+ PageG2.prototype.isExists = function (cls, stauts) {
253
+ if (stauts === void 0) { stauts = true; }
254
+ expect(this.getEl(cls) != null).toBe(stauts);
255
+ return this;
256
+ };
257
+ PageG2.prototype.checkOptions = function (key, value) {
258
+ expect(this.chart[key]).toBe(value);
259
+ return this;
260
+ };
261
+ PageG2.prototype.checkAttrOptions = function (type, key, value) {
262
+ var x = this.chart[type][0].attributeOption[key];
263
+ expect(x.field).toBe(value);
264
+ return this;
265
+ };
266
+ PageG2.prototype.isXScalesCount = function (num) {
267
+ var x = this.chart.getXScale();
268
+ expect(x.values.length).toBe(num);
269
+ return this;
270
+ };
271
+ PageG2.prototype.isYScalesCount = function (num) {
272
+ var y = this.chart.getYScales();
273
+ expect(y.length).toBe(1);
274
+ expect(y[0].values.length).toBe(num);
275
+ return this;
276
+ };
277
+ PageG2.prototype.isDataCount = function (type, num) {
278
+ var results = this.chart[type];
279
+ expect(results.length).toBeGreaterThan(0);
280
+ expect(results[0].data.length).toBe(num);
281
+ return this;
282
+ };
283
+ Object.defineProperty(PageG2.prototype, "firstDataPoint", {
284
+ get: function () {
285
+ return this.chart.getXY(this.context['data'][0]);
286
+ },
287
+ enumerable: false,
288
+ configurable: true
289
+ });
290
+ PageG2.prototype.checkTooltip = function (_includeText, point) {
291
+ if (!point) {
292
+ point = this.firstDataPoint;
293
+ }
294
+ this.chart.showTooltip(point);
295
+ expect(this.chart.getController('tooltip') != null).toBe(true);
296
+ return this;
297
+ };
298
+ PageG2.prototype.checkClickItem = function () {
299
+ var point = this.firstDataPoint;
300
+ var clientPoint = this.chart.canvas.getClientByPoint(point.x, point.y);
301
+ var event = new MouseEvent('click', {
302
+ clientX: clientPoint.x,
303
+ clientY: clientPoint.y
304
+ });
305
+ this.chart.canvas.get('el').dispatchEvent(event);
306
+ return this;
307
+ };
308
+ return PageG2;
309
+ }());
310
+ function checkDelay(module, comp, page) {
311
+ if (page === void 0) { page = null; }
312
+ if (page == null) {
313
+ page = new PageG2().makeModule(module, comp, { dc: false });
314
+ }
315
+ var context = page.context;
316
+ if (typeof context.delay === 'undefined') {
317
+ console.warn("You muse be dinfed \"delay\" property in test component");
318
+ return;
319
+ }
320
+ context.delay = 100;
321
+ page.dc();
322
+ page.comp.ngOnDestroy();
323
+ expect(page.chart == null).toBe(true);
324
+ testing.tick(201);
325
+ testing.discardPeriodicTasks();
326
326
  }
327
327
 
328
- var TestContext = /** @class */ (function () {
329
- function TestContext(fixture) {
330
- this.fixture = fixture;
331
- }
332
- Object.defineProperty(TestContext.prototype, "component", {
333
- get: function () {
334
- return this.fixture.componentInstance;
335
- },
336
- enumerable: false,
337
- configurable: true
338
- });
339
- Object.defineProperty(TestContext.prototype, "el", {
340
- get: function () {
341
- return this.fixture.debugElement.nativeElement;
342
- },
343
- enumerable: false,
344
- configurable: true
345
- });
346
- Object.defineProperty(TestContext.prototype, "dl", {
347
- get: function () {
348
- return this.fixture.debugElement;
349
- },
350
- enumerable: false,
351
- configurable: true
352
- });
353
- Object.defineProperty(TestContext.prototype, "context", {
354
- get: function () {
355
- return this.fixture.componentInstance;
356
- },
357
- enumerable: false,
358
- configurable: true
359
- });
360
- TestContext.prototype.detectChanges = function () {
361
- this.fixture.detectChanges();
362
- };
363
- TestContext.prototype.resolve = function (component) {
364
- return this.fixture.debugElement.injector.get(component);
365
- };
366
- return TestContext;
367
- }());
368
- var createTestContext = function (component) {
369
- return new TestContext(testing.TestBed.createComponent(component));
328
+ var TestContext = /** @class */ (function () {
329
+ function TestContext(fixture) {
330
+ this.fixture = fixture;
331
+ }
332
+ Object.defineProperty(TestContext.prototype, "component", {
333
+ get: function () {
334
+ return this.fixture.componentInstance;
335
+ },
336
+ enumerable: false,
337
+ configurable: true
338
+ });
339
+ Object.defineProperty(TestContext.prototype, "el", {
340
+ get: function () {
341
+ return this.fixture.debugElement.nativeElement;
342
+ },
343
+ enumerable: false,
344
+ configurable: true
345
+ });
346
+ Object.defineProperty(TestContext.prototype, "dl", {
347
+ get: function () {
348
+ return this.fixture.debugElement;
349
+ },
350
+ enumerable: false,
351
+ configurable: true
352
+ });
353
+ Object.defineProperty(TestContext.prototype, "context", {
354
+ get: function () {
355
+ return this.fixture.componentInstance;
356
+ },
357
+ enumerable: false,
358
+ configurable: true
359
+ });
360
+ TestContext.prototype.detectChanges = function () {
361
+ this.fixture.detectChanges();
362
+ };
363
+ TestContext.prototype.resolve = function (component) {
364
+ return this.fixture.debugElement.injector.get(component);
365
+ };
366
+ return TestContext;
367
+ }());
368
+ var createTestContext = function (component) {
369
+ return new TestContext(testing.TestBed.createComponent(component));
370
370
  };
371
371
 
372
- /**
373
- * 清除Cdk的窗体,以便下一次使用,一般这样使用:
374
- * ```ts
375
- * afterEach(cleanCdkOverlayHtml);
376
- * ```
377
- */
378
- function cleanCdkOverlayHtml() {
379
- var els = document.querySelectorAll('.cdk-overlay-container');
380
- if (els && els.length > 0) {
381
- els.forEach(function (el) { return (el.innerHTML = ''); });
382
- }
372
+ /**
373
+ * 清除Cdk的窗体,以便下一次使用,一般这样使用:
374
+ * ```ts
375
+ * afterEach(cleanCdkOverlayHtml);
376
+ * ```
377
+ */
378
+ function cleanCdkOverlayHtml() {
379
+ var els = document.querySelectorAll('.cdk-overlay-container');
380
+ if (els && els.length > 0) {
381
+ els.forEach(function (el) { return (el.innerHTML = ''); });
382
+ }
383
383
  }
384
384
 
385
385
  // from angular
386
386
 
387
- /**
388
- * Generated bundle index. Do not edit.
387
+ /**
388
+ * Generated bundle index. Do not edit.
389
389
  */
390
390
 
391
391
  exports.DROPDOWN_MIN_TIME = DROPDOWN_MIN_TIME;