@angular-wave/angular.ts 0.0.52 → 0.0.53

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,17 +1,36 @@
1
- xdescribe("$animate", () => {
1
+ import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
2
+ import { publishExternalAPI } from "../../public";
3
+ import { Angular } from "../../loader";
4
+ import { isObject } from "../../shared/utils";
5
+ import { isFunction } from "../../shared/utils";
6
+ import { createInjector } from "../../injector";
7
+
8
+ describe("$animate", () => {
2
9
  describe("without animation", () => {
10
+ let dummy = window.document.getElementById("dummy");
3
11
  let element;
12
+ let $compile;
4
13
  let $rootElement;
5
-
6
- beforeEach(
7
- module(
8
- () =>
9
- function ($compile, _$rootElement_, $rootScope) {
10
- element = $compile("<div></div>")($rootScope);
11
- $rootElement = _$rootElement_;
12
- },
13
- ),
14
- );
14
+ let $rootScope;
15
+ let defaultModule;
16
+ let injector;
17
+ let $animate;
18
+
19
+ beforeEach(() => {
20
+ window.angular = new Angular();
21
+ publishExternalAPI();
22
+ defaultModule = window.angular.module("defaultModule", ["ng"]);
23
+ injector = window.angular.bootstrap(dummy, ["defaultModule"]);
24
+ injector.invoke(
25
+ (_$compile_, _$rootElement_, _$rootScope_, _$animate_) => {
26
+ $compile = _$compile_;
27
+ $rootScope = _$rootScope_;
28
+ element = $compile("<div></div>")($rootScope);
29
+ $rootElement = _$rootElement_;
30
+ $animate = _$animate_;
31
+ },
32
+ );
33
+ });
15
34
 
16
35
  it("should add element at the start of enter animation", () => {
17
36
  const child = $compile("<div></div>")($rootScope);
@@ -51,36 +70,36 @@ xdescribe("$animate", () => {
51
70
 
52
71
  it("should apply styles instantly to the element", () => {
53
72
  $animate.animate(element, { color: "rgb(0, 0, 0)" });
54
- expect(element[0].stype.color).toBe("rgb(0, 0, 0)");
73
+ expect(element[0].style.color).toBe("rgb(0, 0, 0)");
55
74
 
56
75
  $animate.animate(
57
76
  element,
58
77
  { color: "rgb(255, 0, 0)" },
59
78
  { color: "rgb(0, 255, 0)" },
60
79
  );
61
- expect(element[0].stype.color).toBe("rgb(0, 255, 0)");
80
+ expect(element[0].style.color).toBe("rgb(0, 255, 0)");
62
81
  });
63
82
 
64
83
  it("should still perform DOM operations even if animations are disabled (post-digest)", () => {
65
84
  $animate.enabled(false);
66
- expect(element).toBeShown();
85
+ expect(element[0].classList.contains("ng-hide")).toBeFalse();
67
86
  $animate.addClass(element, "ng-hide");
68
87
  $rootScope.$digest();
69
- expect(element).toBeHidden();
88
+ expect(element[0].classList.contains("ng-hide")).toBeTrue();
70
89
  });
71
90
 
72
91
  it("should run each method and return a promise", () => {
73
92
  const element = JQLite("<div></div>");
74
93
  const move = JQLite("<div></div>");
75
- const parent = JQLite($document[0].body);
94
+ const parent = JQLite(document.body);
76
95
  parent.append(move);
77
96
 
78
- expect($animate.enter(element, parent)).toBeAPromise();
79
- expect($animate.move(element, move)).toBeAPromise();
80
- expect($animate.addClass(element, "on")).toBeAPromise();
81
- expect($animate.removeClass(element, "off")).toBeAPromise();
82
- expect($animate.setClass(element, "on", "off")).toBeAPromise();
83
- expect($animate.leave(element)).toBeAPromise();
97
+ expect($animate.enter(element, parent).then).toBeDefined();
98
+ expect($animate.move(element, move).then).toBeDefined();
99
+ expect($animate.addClass(element, "on").then).toBeDefined();
100
+ expect($animate.removeClass(element, "off").then).toBeDefined();
101
+ expect($animate.setClass(element, "on", "off").then).toBeDefined();
102
+ expect($animate.leave(element).then).toBeDefined();
84
103
  });
85
104
 
86
105
  it("should provide the `enabled` and `cancel` methods", () => {
@@ -98,42 +117,40 @@ xdescribe("$animate", () => {
98
117
  const svg = JQLite("<svg><rect></rect></svg>");
99
118
  const rect = svg.children();
100
119
  $animate.enabled(false);
101
- expect(rect).toBeShown();
120
+ expect(rect[0].classList.contains("ng-hide")).toBeFalse();
102
121
  $animate.addClass(rect, "ng-hide");
103
122
  $rootScope.$digest();
104
- expect(rect).toBeHidden();
123
+ expect(rect[0].classList.contains("ng-hide")).toBeTrue();
105
124
  $animate.removeClass(rect, "ng-hide");
106
125
  $rootScope.$digest();
107
- expect(rect).not.toBeHidden();
126
+ expect(rect[0].classList.contains("ng-hide")).toBeFalse();
108
127
  });
109
128
 
110
129
  it("should throw error on wrong selector", () => {
111
- module(($animateProvider) => {
112
- expect(() => {
113
- $animateProvider.register("abc", null);
114
- }).toThrow(
115
- "$animate",
116
- "notcsel",
117
- "Expecting class selector starting with '.' got 'abc'.",
118
- );
119
- });
130
+ createInjector([
131
+ "ng",
132
+ ($animateProvider) => {
133
+ expect(() => {
134
+ $animateProvider.register("abc", null);
135
+ }).toThrowError(/notcsel/);
136
+ },
137
+ ]);
120
138
  });
121
139
 
122
140
  it("should register the animation and be available for lookup", () => {
123
141
  let provider;
124
- module(($animateProvider) => {
125
- provider = $animateProvider;
126
- });
127
- () => {
128
- // by using hasOwnProperty we know for sure that the lookup object is an empty object
129
- // instead of inheriting properties from its original prototype.
130
- expect(provider.$$registeredAnimations.hasOwnProperty).toBeFalsy();
131
-
132
- provider.register(".filter", () => {});
133
- expect(provider.$$registeredAnimations.filter).toBe(
134
- ".filter-animation",
135
- );
136
- };
142
+ createInjector([
143
+ "ng",
144
+ ($animateProvider) => {
145
+ provider = $animateProvider;
146
+ },
147
+ ]);
148
+ // by using hasOwnProperty we know for sure that the lookup object is an empty object
149
+ // instead of inheriting properties from its original prototype.
150
+ expect(provider.$$registeredAnimations.hasOwnProperty).toBeFalsy();
151
+
152
+ provider.register(".filter", () => {});
153
+ expect(provider.$$registeredAnimations.filter).toBe(".filter-animation");
137
154
  });
138
155
 
139
156
  it("should apply and retain inline styles on the element that is animated", () => {
@@ -204,7 +221,7 @@ xdescribe("$animate", () => {
204
221
  $animate.removeClass(element, "ng-hide");
205
222
  $rootScope.$digest();
206
223
 
207
- expect(element).not.toHaveClass("ng-hide");
224
+ expect(element[0].classList.contains("ng-hide")).toBeFalse();
208
225
  });
209
226
 
210
227
  it("should avoid cancelling out remove/add if the element does not contain the class", () => {
@@ -214,13 +231,13 @@ xdescribe("$animate", () => {
214
231
  $animate.addClass(element, "ng-hide");
215
232
  $rootScope.$digest();
216
233
 
217
- expect(element).toHaveClass("ng-hide");
234
+ expect(element[0].classList.contains("ng-hide")).toBeTrue();
218
235
  });
219
236
 
220
237
  ["enter", "move"].forEach((method) => {
221
238
  it('should accept an unwrapped "parent" element for the $prop event', () => {
222
239
  const element = JQLite("<div></div>");
223
- const parent = $document[0].createElement("div");
240
+ const parent = document.createElement("div");
224
241
  $rootElement.append(parent);
225
242
 
226
243
  $animate[method](element, parent);
@@ -231,7 +248,7 @@ xdescribe("$animate", () => {
231
248
  ["enter", "move"].forEach((method) => {
232
249
  it('should accept an unwrapped "after" element for the $prop event', () => {
233
250
  const element = JQLite("<div></div>");
234
- const after = $document[0].createElement("div");
251
+ const after = document.createElement("div");
235
252
  $rootElement.append(after);
236
253
 
237
254
  $animate[method](element, null, after);
@@ -250,14 +267,24 @@ xdescribe("$animate", () => {
250
267
  ].forEach((event) => {
251
268
  it("$prop() should operate using a native DOM element", () => {
252
269
  const captureSpy = jasmine.createSpy();
253
-
254
- module(($provide) => {
255
- $provide.value("$$animateQueue", {
270
+ dealoc(dummy);
271
+ publishExternalAPI();
272
+ defaultModule = window.angular
273
+ .module("defaultModule", ["ng"])
274
+ .value("$$animateQueue", {
256
275
  push: captureSpy,
257
276
  });
258
- });
277
+ injector = window.angular.bootstrap(dummy, ["defaultModule"]);
278
+ injector.invoke(
279
+ (_$compile_, _$rootElement_, _$rootScope_, _$animate_) => {
280
+ $compile = _$compile_;
281
+ $rootScope = _$rootScope_;
282
+ $rootElement = _$rootElement_;
283
+ $animate = _$animate_;
284
+ },
285
+ );
259
286
 
260
- const element = JQLite("<div></div>");
287
+ element = JQLite("<div></div>");
261
288
  const parent2 = JQLite("<div></div>");
262
289
  const parent = $rootElement;
263
290
  parent.append(parent2);
@@ -321,286 +348,167 @@ xdescribe("$animate", () => {
321
348
  expect(isObject(optionsArg)).toBeTruthy();
322
349
  });
323
350
  });
324
- });
325
-
326
- it("should not issue a call to addClass if the provided class value is not a string or array", () => {
327
- () => {
328
- const spy = spyOn(window, "jqLiteAddClass").and.callThrough();
329
351
 
330
- const element = JQLite("<div></div>");
331
- const parent = $rootElement;
352
+ it("should not break postDigest for subsequent elements if addClass contains non-valid CSS class names", () => {
353
+ const element1 = JQLite("<div></div>");
354
+ const element2 = JQLite("<div></div>");
332
355
 
333
- $animate.enter(element, parent, null, { addClass: () => {} });
356
+ $animate.enter(element1, $rootElement, null, { addClass: " " });
357
+ $animate.enter(element2, $rootElement, null, { addClass: "valid-name" });
334
358
  $rootScope.$digest();
335
- expect(spy).not.toHaveBeenCalled();
336
359
 
337
- $animate.leave(element, { addClass: true });
338
- $rootScope.$digest();
339
- expect(spy).not.toHaveBeenCalled();
340
-
341
- $animate.enter(element, parent, null, { addClass: "fatias" });
342
- $rootScope.$digest();
343
- expect(spy).toHaveBeenCalled();
344
- };
345
- });
346
-
347
- it("should not break postDigest for subsequent elements if addClass contains non-valid CSS class names", () => {
348
- const element1 = JQLite("<div></div>");
349
- const element2 = JQLite("<div></div>");
350
-
351
- $animate.enter(element1, $rootElement, null, { addClass: " " });
352
- $animate.enter(element2, $rootElement, null, { addClass: "valid-name" });
353
- $rootScope.$digest();
354
-
355
- expect(
356
- element2[0].classList.contains(ist.contains("valid-name")),
357
- ).toBeTruthy();
358
- });
359
-
360
- it("should not issue a call to removeClass if the provided class value is not a string or array", () => {
361
- () => {
362
- const spy = spyOn(window, "jqLiteRemoveClass").and.callThrough();
360
+ expect(element2[0].classList.contains("valid-name")).toBeTruthy();
361
+ });
363
362
 
363
+ it("should not alter the provided options input in any way throughout the animation", () => {
364
364
  const element = JQLite("<div></div>");
365
365
  const parent = $rootElement;
366
366
 
367
- $animate.enter(element, parent, null, { removeClass: () => {} });
368
- $rootScope.$digest();
369
- expect(spy).not.toHaveBeenCalled();
367
+ const initialOptions = {
368
+ from: { height: "50px" },
369
+ to: { width: "50px" },
370
+ addClass: "one",
371
+ removeClass: "two",
372
+ };
370
373
 
371
- $animate.leave(element, { removeClass: true });
372
- $rootScope.$digest();
373
- expect(spy).not.toHaveBeenCalled();
374
+ const copiedOptions = structuredClone(initialOptions);
375
+ expect(copiedOptions).toEqual(initialOptions);
374
376
 
375
- element[0].classList.add("fatias");
376
- $animate.enter(element, parent, null, { removeClass: "fatias" });
377
- $rootScope.$digest();
378
- expect(spy).toHaveBeenCalled();
379
- };
380
- });
377
+ const runner = $animate.enter(element, parent, null, copiedOptions);
378
+ expect(copiedOptions).toEqual(initialOptions);
381
379
 
382
- it("should not alter the provided options input in any way throughout the animation", () => {
383
- const element = JQLite("<div></div>");
384
- const parent = $rootElement;
380
+ $rootScope.$digest();
381
+ expect(copiedOptions).toEqual(initialOptions);
382
+ });
385
383
 
386
- const initialOptions = {
387
- from: { height: "50px" },
388
- to: { width: "50px" },
389
- addClass: "one",
390
- removeClass: "two",
391
- };
384
+ describe("CSS class DOM manipulation", () => {
385
+ let element;
386
+ let addClass;
387
+ let removeClass;
392
388
 
393
- const copiedOptions = structuredClone(initialOptions);
394
- expect(copiedOptions).toEqual(initialOptions);
389
+ afterEach(() => {
390
+ dealoc(element);
391
+ });
395
392
 
396
- const runner = $animate.enter(element, parent, null, copiedOptions);
397
- expect(copiedOptions).toEqual(initialOptions);
393
+ it("should defer class manipulation until end of digest", () => {
394
+ element = JQLite("<p>test</p>");
398
395
 
399
- $rootScope.$digest();
400
- expect(copiedOptions).toEqual(initialOptions);
401
- });
396
+ $rootScope.$apply(() => {
397
+ $animate.addClass(element, "test-class1");
398
+ expect(element[0].classList.contains("test-class1")).toBeFalse();
402
399
 
403
- describe("CSS class DOM manipulation", () => {
404
- let element;
405
- let addClass;
406
- let removeClass;
400
+ $animate.removeClass(element, "test-class1");
407
401
 
408
- afterEach(() => {
409
- dealoc(element);
410
- });
402
+ $animate.addClass(element, "test-class2");
403
+ expect(element[0].classList.contains("test-class2")).toBeFalse();
411
404
 
412
- function setupClassManipulationSpies() {
413
- () => {
414
- addClass = spyOn(window, "jqLiteAddClass").and.callThrough();
415
- removeClass = spyOn(window, "jqLiteRemoveClass").and.callThrough();
416
- };
417
- }
418
-
419
- function setupClassManipulationLogger(log) {
420
- () => {
421
- const _addClass = JQLiteAddClass;
422
- addClass = spyOn(window, "jqLiteAddClass").and.callFake(
423
- (element, classes) => {
424
- let names = classes;
425
- if (Object.prototype.toString.call(classes) === "[object Array]")
426
- names = classes.join(" ");
427
- log(`addClass(${names})`);
428
- return _addClass(element, classes);
429
- },
430
- );
405
+ $animate.setClass(element, "test-class3", "test-class4");
406
+ expect(element[0].classList.contains("test-class3")).toBeFalse();
407
+ expect(element[0].classList.contains("test-class4")).toBeFalse();
408
+ });
431
409
 
432
- const _removeClass = JQLiteRemoveClass;
433
- removeClass = spyOn(window, "jqLiteRemoveClass").and.callFake(
434
- (element, classes) => {
435
- let names = classes;
436
- if (Object.prototype.toString.call(classes) === "[object Array]")
437
- names = classes.join(" ");
438
- log(`removeClass(${names})`);
439
- return _removeClass(element, classes);
440
- },
441
- );
442
- };
443
- }
410
+ expect(element[0].classList.contains("test-class1")).toBeFalse();
411
+ expect(element[0].classList.contains("test-class4")).toBeFalse();
412
+ expect(element[0].classList.contains("test-class2")).toBeTrue();
413
+ expect(element[0].classList.contains("test-class3")).toBeTrue();
414
+ });
444
415
 
445
- it("should defer class manipulation until end of digest", () => {
446
- setupClassManipulationLogger(log);
447
- element = JQLite("<p>test</p>");
416
+ it("should defer class manipulation until postDigest when outside of digest", () => {
417
+ element = JQLite('<p class="test-class4">test</p>');
448
418
 
449
- $rootScope.$apply(() => {
450
419
  $animate.addClass(element, "test-class1");
451
- expect(element).not.toHaveClass("test-class1");
452
-
453
420
  $animate.removeClass(element, "test-class1");
454
-
455
421
  $animate.addClass(element, "test-class2");
456
- expect(element).not.toHaveClass("test-class2");
457
-
458
422
  $animate.setClass(element, "test-class3", "test-class4");
459
- expect(element).not.toHaveClass("test-class3");
460
- expect(element).not.toHaveClass("test-class4");
461
- expect(log).toEqual([]);
423
+ $rootScope.$digest();
424
+ expect(element[0].classList.contains("test-class1")).toBeFalse();
425
+ expect(element[0].classList.contains("test-class2")).toBeTrue();
426
+ expect(element[0].classList.contains("test-class3")).toBeTrue();
462
427
  });
463
428
 
464
- expect(element).not.toHaveClass("test-class1");
465
- expect(element).not.toHaveClass("test-class4");
466
- expect(element).toHaveClass("test-class2");
467
- expect(element).toHaveClass("test-class3");
468
- expect(log).toEqual(["addClass(test-class2 test-class3)"]);
469
- expect(addClass).toHaveBeenCalledTimes(1);
470
- expect(removeClass).not.toHaveBeenCalled();
471
- });
472
-
473
- it("should defer class manipulation until postDigest when outside of digest", () => {
474
- setupClassManipulationLogger(log);
475
- element = JQLite('<p class="test-class4">test</p>');
429
+ it("should perform class manipulation in expected order at end of digest", () => {
430
+ element = JQLite('<p class="test-class3">test</p>');
476
431
 
477
- $animate.addClass(element, "test-class1");
478
- $animate.removeClass(element, "test-class1");
479
- $animate.addClass(element, "test-class2");
480
- $animate.setClass(element, "test-class3", "test-class4");
432
+ $rootScope.$apply(() => {
433
+ $animate.addClass(element, "test-class1");
434
+ $animate.addClass(element, "test-class2");
435
+ $animate.removeClass(element, "test-class1");
436
+ $animate.removeClass(element, "test-class3");
437
+ $animate.addClass(element, "test-class3");
438
+ });
439
+ expect(element[0].classList.contains("test-class3")).toBeTrue();
440
+ });
481
441
 
482
- expect(log).toEqual([]);
483
- $rootScope.$digest();
442
+ it("should return a promise which is resolved on a different turn", () => {
443
+ element = JQLite('<p class="test2">test</p>');
484
444
 
485
- expect(log).toEqual([
486
- "addClass(test-class2 test-class3)",
487
- "removeClass(test-class4)",
488
- ]);
489
- expect(element).not.toHaveClass("test-class1");
490
- expect(element).toHaveClass("test-class2");
491
- expect(element).toHaveClass("test-class3");
492
- expect(addClass).toHaveBeenCalledTimes(1);
493
- expect(removeClass).toHaveBeenCalledTimes(1);
494
- });
445
+ $animate.addClass(element, "test1");
446
+ $animate.removeClass(element, "test2");
495
447
 
496
- it("should perform class manipulation in expected order at end of digest", () => {
497
- element = JQLite('<p class="test-class3">test</p>');
448
+ $rootScope.$digest();
449
+ element = JQLite('<p class="test4">test</p>');
498
450
 
499
- setupClassManipulationLogger(log);
451
+ $rootScope.$apply(() => {
452
+ $animate.addClass(element, "test3");
453
+ $animate.removeClass(element, "test4");
454
+ });
500
455
 
501
- $rootScope.$apply(() => {
502
- $animate.addClass(element, "test-class1");
503
- $animate.addClass(element, "test-class2");
504
- $animate.removeClass(element, "test-class1");
505
- $animate.removeClass(element, "test-class3");
506
- $animate.addClass(element, "test-class3");
456
+ expect(element[0].classList.contains("test3")).toBeTrue();
507
457
  });
508
- expect(log).toEqual(["addClass(test-class2)"]);
509
- });
510
458
 
511
- it("should return a promise which is resolved on a different turn", () => {
512
- element = JQLite('<p class="test2">test</p>');
459
+ it("should defer class manipulation until end of digest for SVG", () => {
460
+ if (!window.SVGElement) return;
513
461
 
514
- $animate.addClass(element, "test1").then(log.fn("addClass(test1)"));
515
- $animate.removeClass(element, "test2").then(log.fn("removeClass(test2)"));
462
+ element = JQLite("<svg><g></g></svg>");
463
+ const target = element.children().eq(0);
516
464
 
517
- $rootScope.$digest();
518
- expect(log).toEqual([]);
519
- $$rAF.flush();
520
- $rootScope.$digest();
521
- expect(log).toEqual(["addClass(test1)", "removeClass(test2)"]);
465
+ $rootScope.$apply(() => {
466
+ $animate.addClass(target, "test-class1");
522
467
 
523
- log.reset();
524
- element = JQLite('<p class="test4">test</p>');
468
+ $animate.removeClass(target, "test-class1");
525
469
 
526
- $rootScope.$apply(() => {
527
- $animate.addClass(element, "test3").then(log.fn("addClass(test3)"));
528
- $animate
529
- .removeClass(element, "test4")
530
- .then(log.fn("removeClass(test4)"));
531
- });
470
+ $animate.addClass(target, "test-class2");
471
+ expect(target[0].classList.contains("test-class2")).toBeFalse();
532
472
 
533
- $$rAF.flush();
534
- $rootScope.$digest();
535
- expect(log).toEqual(["addClass(test3)", "removeClass(test4)"]);
536
- });
473
+ $animate.setClass(target, "test-class3", "test-class4");
474
+ expect(target[0].classList.contains("test-class3")).toBeFalse();
475
+ expect(target[0].classList.contains("test-class4")).toBeFalse();
476
+ });
537
477
 
538
- it("should defer class manipulation until end of digest for SVG", () => {
539
- if (!window.SVGElement) return;
540
- setupClassManipulationSpies();
541
- element = JQLite("<svg><g></g></svg>");
542
- const target = element.children().eq(0);
478
+ expect(target[0].classList.contains("test-class2")).toBeTrue();
479
+ });
543
480
 
544
- $rootScope.$apply(() => {
545
- $animate.addClass(target, "test-class1");
546
- expect(target).not.toHaveClass("test-class1");
481
+ it("should defer class manipulation until postDigest when outside of digest for SVG", () => {
482
+ if (!window.SVGElement) return;
547
483
 
484
+ element = JQLite('<svg><g class="test-class4"></g></svg>');
485
+ const target = element.children().eq(0);
486
+ debugger;
487
+ $animate.addClass(target, "test-class1");
548
488
  $animate.removeClass(target, "test-class1");
549
-
550
489
  $animate.addClass(target, "test-class2");
551
- expect(target).not.toHaveClass("test-class2");
552
-
553
490
  $animate.setClass(target, "test-class3", "test-class4");
554
- expect(target).not.toHaveClass("test-class3");
555
- expect(target).not.toHaveClass("test-class4");
556
- });
557
-
558
- expect(target).not.toHaveClass("test-class1");
559
- expect(target).toHaveClass("test-class2");
560
- expect(addClass).toHaveBeenCalledTimes(1);
561
- expect(removeClass).not.toHaveBeenCalled();
562
- });
563
-
564
- it("should defer class manipulation until postDigest when outside of digest for SVG", () => {
565
- if (!window.SVGElement) return;
566
- setupClassManipulationLogger(log);
567
- element = JQLite('<svg><g class="test-class4"></g></svg>');
568
- const target = element.children().eq(0);
569
491
 
570
- $animate.addClass(target, "test-class1");
571
- $animate.removeClass(target, "test-class1");
572
- $animate.addClass(target, "test-class2");
573
- $animate.setClass(target, "test-class3", "test-class4");
492
+ $rootScope.$digest();
574
493
 
575
- expect(log).toEqual([]);
576
- $rootScope.$digest();
577
-
578
- expect(log).toEqual([
579
- "addClass(test-class2 test-class3)",
580
- "removeClass(test-class4)",
581
- ]);
582
- expect(target).not.toHaveClass("test-class1");
583
- expect(target).toHaveClass("test-class2");
584
- expect(target).toHaveClass("test-class3");
585
- expect(addClass).toHaveBeenCalledTimes(1);
586
- expect(removeClass).toHaveBeenCalledTimes(1);
587
- });
588
-
589
- it("should perform class manipulation in expected order at end of digest for SVG", () => {
590
- if (!window.SVGElement) return;
591
- element = JQLite('<svg><g class="test-class3"></g></svg>');
592
- const target = element.children().eq(0);
593
-
594
- setupClassManipulationLogger(log);
494
+ expect(target[0].classList.contains("test-class2")).toBeTrue();
495
+ expect(target[0].classList.contains("test-class3")).toBeTrue();
496
+ });
595
497
 
596
- $rootScope.$apply(() => {
597
- $animate.addClass(target, "test-class1");
598
- $animate.addClass(target, "test-class2");
599
- $animate.removeClass(target, "test-class1");
600
- $animate.removeClass(target, "test-class3");
601
- $animate.addClass(target, "test-class3");
498
+ it("should perform class manipulation in expected order at end of digest for SVG", () => {
499
+ if (!window.SVGElement) return;
500
+ element = JQLite('<svg><g class="test-class3"></g></svg>');
501
+ const target = element.children().eq(0);
502
+
503
+ $rootScope.$apply(() => {
504
+ $animate.addClass(target, "test-class1");
505
+ $animate.addClass(target, "test-class2");
506
+ $animate.removeClass(target, "test-class1");
507
+ $animate.removeClass(target, "test-class3");
508
+ $animate.addClass(target, "test-class3");
509
+ });
510
+ expect(target[0].classList.contains("test-class3")).toBeTrue();
602
511
  });
603
- expect(log).toEqual(["addClass(test-class2)"]);
604
512
  });
605
513
  });
606
514
  });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Apply inline styles to element
3
+ * @param {HTMLElement} element
4
+ * @param {Object<string, string>} styles
5
+ */
6
+ export function addInlineStyles(element, styles) {
7
+ for (const property in styles) {
8
+ element.style[property] = styles[property];
9
+ }
10
+ }
@@ -12,7 +12,7 @@
12
12
  */
13
13
  export function CoreAnimateCssProvider(): void;
14
14
  export class CoreAnimateCssProvider {
15
- $get: (string | (($$AnimateRunner: any) => (element: any, initialOptions: any) => {
15
+ $get: (string | (($$AnimateRunner: any) => (element: import("../../shared/jqlite/jqlite").JQLite, initialOptions: any) => {
16
16
  start: () => any;
17
17
  end: () => any;
18
18
  }))[];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Apply inline styles to element
3
+ * @param {HTMLElement} element
4
+ * @param {Object<string, string>} styles
5
+ */
6
+ export function addInlineStyles(element: HTMLElement, styles: {
7
+ [x: string]: string;
8
+ }): void;