@angular-wave/angular.ts 0.0.2 → 0.0.5

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.
@@ -4,6 +4,7 @@ import { createInjector } from "../src/injector";
4
4
  import { publishExternalAPI } from "../src/public";
5
5
  import { equals, forEach } from "../src/core/utils";
6
6
  import { browserTrigger } from "./test-utils";
7
+ import { CACHE, EXPANDO } from "../src/core/cache";
7
8
 
8
9
  describe("jqLite", () => {
9
10
  let scope;
@@ -227,18 +228,6 @@ describe("jqLite", () => {
227
228
  });
228
229
  });
229
230
 
230
- describe("_data", () => {
231
- it("should provide access to the events present on the element", () => {
232
- const element = jqLite("<i>foo</i>");
233
- // TODO: REMOVE angular becomes TESTED
234
- angular.element = jqLite;
235
- expect(angular.element._data(element[0]).events).toBeUndefined();
236
-
237
- element.on("click", () => {});
238
- expect(angular.element._data(element[0]).events.click).toBeDefined();
239
- });
240
- });
241
-
242
231
  describe("inheritedData", () => {
243
232
  it("should retrieve data attached to the current element", () => {
244
233
  const element = jqLite("<i>foo</i>");
@@ -540,7 +529,7 @@ describe("jqLite", () => {
540
529
 
541
530
  it("should not break on cleanData(), if element has no data", () => {
542
531
  const selected = jqLite([a, b, c]);
543
- spyOn(jqLite, "_data").and.returnValue(undefined);
532
+ spyOn(CACHE, "get").and.returnValue(undefined);
544
533
  expect(() => {
545
534
  jqLite.cleanData(selected);
546
535
  }).not.toThrow();
@@ -572,13 +561,13 @@ describe("jqLite", () => {
572
561
  const node = document.createElement("div");
573
562
  document.body.appendChild(node);
574
563
 
575
- expect(jqLite.hasData(node)).toBe(false);
564
+ expect(CACHE.has(node[EXPANDO])).toBe(false);
576
565
  expect(jqLite.data(node, "foo")).toBeUndefined();
577
- expect(jqLite.hasData(node)).toBe(false);
566
+ expect(CACHE.has(node[EXPANDO])).toBe(false);
578
567
 
579
568
  jqLite.data(node, "foo", "bar");
580
569
 
581
- expect(jqLite.hasData(node)).toBe(true);
570
+ expect(CACHE.has(node[EXPANDO])).toBe(true);
582
571
  expect(jqLite.data(node, "foo")).toBe("bar");
583
572
  expect(jqLite(node).data("foo")).toBe("bar");
584
573
 
@@ -593,7 +582,7 @@ describe("jqLite", () => {
593
582
  expect(jqLite.data(node, "bar")).toBeUndefined();
594
583
 
595
584
  jqLite(node).remove();
596
- expect(jqLite.hasData(node)).toBe(false);
585
+ expect(CACHE.has(node[EXPANDO])).toBe(false);
597
586
  });
598
587
 
599
588
  it("should emit $destroy event if element removed via remove()", function () {
@@ -1,6 +1,6 @@
1
1
  import { publishExternalAPI } from "../../src/public";
2
2
  import { createInjector } from "../../src/injector";
3
- import { dealoc, jqLite, JQLite } from "../../src/jqLite";
3
+ import { dealoc, JQLite } from "../../src/jqLite";
4
4
  import {
5
5
  forEach,
6
6
  isFunction,
@@ -11,6 +11,7 @@ import {
11
11
  isArray,
12
12
  } from "../../src/core/utils";
13
13
  import { countChildScopes, countWatchers } from "../../src/core/root-scope";
14
+ import { CACHE, EXPANDO } from "../../src/core/cache";
14
15
 
15
16
  function isUnknownElement(el) {
16
17
  return !!el.toString().match(/Unknown/);
@@ -13902,7 +13903,7 @@ describe("$compile", () => {
13902
13903
  firstRepeatedElem = element.children(".ng-scope").eq(0);
13903
13904
 
13904
13905
  expect(firstRepeatedElem.data("$scope")).toBeDefined();
13905
- privateData = JQLite._data(firstRepeatedElem[0]);
13906
+ privateData = CACHE.get(firstRepeatedElem[0]);
13906
13907
  expect(privateData.events).toBeDefined();
13907
13908
 
13908
13909
  expect(privateData.events.click).toBeDefined();
@@ -13918,7 +13919,7 @@ describe("$compile", () => {
13918
13919
 
13919
13920
  expect(destroyCount).toBe(2);
13920
13921
  expect(firstRepeatedElem.data("$scope")).not.toBeDefined();
13921
- privateData = JQLite._data(firstRepeatedElem[0]);
13922
+ privateData = CACHE.get(firstRepeatedElem[0]);
13922
13923
  expect(privateData && privateData.events).not.toBeDefined();
13923
13924
  }
13924
13925
 
@@ -17624,10 +17625,10 @@ describe("$compile", () => {
17624
17625
  linkedElements.remove();
17625
17626
 
17626
17627
  forEach(preCompiledChildren, (element, i) => {
17627
- expect(JQLite.hasData(element)).toBe(false, `template#${i}`);
17628
+ expect(CACHE.has(element[EXPANDO])).toBe(false, `template#${i}`);
17628
17629
  });
17629
17630
  forEach(getAll(linkedElements), (element, i) => {
17630
- expect(JQLite.hasData(element)).toBe(false, `linked#${i}`);
17631
+ expect(CACHE.has(element[EXPANDO])).toBe(false, `linked#${i}`);
17631
17632
  });
17632
17633
  }
17633
17634
 
@@ -1,7 +1,7 @@
1
1
  <!doctype html>
2
2
  <html>
3
3
  <head>
4
- <script src="../dist/build/angular.js"></script>
4
+ <script src="../legacy/build/angular.js"></script>
5
5
  </head>
6
6
  <body>
7
7
  Test: