@angular-wave/angular.ts 0.0.20 → 0.0.21

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/index.html CHANGED
@@ -17,7 +17,6 @@
17
17
  <!-- <script src="dist/angular-ts.umd.js"></script> -->
18
18
  <!-- include spec files here... -->
19
19
 
20
- <script type="module" src="test/directive/a.spec.js"></script>
21
20
  <script type="module" src="test/directive/boolean.spec.js"></script>
22
21
  <script type="module" src="test/directive/form.spec.js"></script>
23
22
  <script type="module" src="test/directive/input.spec.js"></script>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@angular-wave/angular.ts",
3
3
  "license": "MIT",
4
- "version": "0.0.20",
4
+ "version": "0.0.21",
5
5
  "type": "module",
6
6
  "main": "dist/angular-ts.esm.js",
7
7
  "browser": "dist/angular-ts.umd.js",
package/src/core/q.js CHANGED
@@ -328,7 +328,7 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
328
328
  }
329
329
 
330
330
  function Deferred() {
331
- const promise = (this.promise = new Promise());
331
+ const promise = (this.promise = new QPromise());
332
332
  // Non prototype methods necessary to support unbound execution :/
333
333
  this.resolve = function (val) {
334
334
  resolvePromise(promise, val);
@@ -341,11 +341,11 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
341
341
  };
342
342
  }
343
343
 
344
- function Promise() {
344
+ function QPromise() {
345
345
  this.$$state = { status: 0 };
346
346
  }
347
347
 
348
- extend(Promise.prototype, {
348
+ extend(QPromise.prototype, {
349
349
  then(onFulfilled, onRejected, progressBack) {
350
350
  if (
351
351
  isUndefined(onFulfilled) &&
@@ -354,7 +354,7 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
354
354
  ) {
355
355
  return this;
356
356
  }
357
- const result = new Promise();
357
+ const result = new QPromise();
358
358
 
359
359
  this.$$state.pending = this.$$state.pending || [];
360
360
  this.$$state.pending.push([
@@ -572,7 +572,7 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
572
572
  * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.
573
573
  */
574
574
  function reject(reason) {
575
- const result = new Promise();
575
+ const result = new QPromise();
576
576
  rejectPromise(result, reason);
577
577
  return result;
578
578
  }
@@ -608,7 +608,7 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
608
608
  */
609
609
 
610
610
  function when(value, callback, errback, progressBack) {
611
- const result = new Promise();
611
+ const result = new QPromise();
612
612
  resolvePromise(result, value);
613
613
  return result.then(callback, errback, progressBack);
614
614
  }
@@ -646,7 +646,7 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
646
646
  */
647
647
 
648
648
  function all(promises) {
649
- const result = new Promise();
649
+ const result = new QPromise();
650
650
  let counter = 0;
651
651
  const results = Array.isArray(promises) ? [] : {};
652
652
 
@@ -699,7 +699,7 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
699
699
  throw $qMinErr("norslvr", "Expected resolverFn, got '{0}'", resolver);
700
700
  }
701
701
 
702
- const promise = new Promise();
702
+ const promise = new QPromise();
703
703
 
704
704
  function resolveFn(value) {
705
705
  resolvePromise(promise, value);
@@ -716,7 +716,7 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
716
716
 
717
717
  // Let's make the instanceof operator work for promises, so that
718
718
  // `new $q(fn) instanceof $q` would evaluate to true.
719
- $Q.prototype = Promise.prototype;
719
+ $Q.prototype = QPromise.prototype;
720
720
 
721
721
  $Q.defer = defer;
722
722
  $Q.reject = reject;
@@ -28,7 +28,7 @@ export function SanitizeUriProvider() {
28
28
  * to the DOM it is inactive and potentially malicious code will not be executed.
29
29
  *
30
30
  * @param {RegExp=} regexp New regexp to trust urls with.
31
- * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
31
+ * @returns {RegExp|ng.ICompileProvider} Current RegExp if called without value or self for
32
32
  * chaining otherwise.
33
33
  */
34
34
  this.aHrefSanitizationTrustedUrlList = function (regexp) {
package/src/core/sce.js CHANGED
@@ -487,7 +487,7 @@ export function $SceDelegateProvider() {
487
487
  );
488
488
  } else if (type === SCE_CONTEXTS.HTML) {
489
489
  // htmlSanitizer throws its own error when no sanitizer is available.
490
- return htmlSanitizer(maybeTrusted);
490
+ return htmlSanitizer();
491
491
  }
492
492
  // Default error when the $sce service has no way to make the input safe.
493
493
  throw $sceMinErr(
package/src/public.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { $CompileProvider } from "./core/compile";
2
- import { htmlAnchorDirective } from "./directive/a";
3
2
  import {
4
3
  inputDirective,
5
4
  ngValueDirective,
@@ -117,7 +116,6 @@ export function publishExternalAPI() {
117
116
  $provide
118
117
  .provider("$compile", $CompileProvider)
119
118
  .directive({
120
- a: htmlAnchorDirective,
121
119
  input: inputDirective,
122
120
  textarea: inputDirective,
123
121
  form: formDirective,
@@ -1,192 +0,0 @@
1
- import { publishExternalAPI } from "../../src/public";
2
- import { createInjector } from "../../src/injector";
3
- import { dealoc, jqLite } from "../../src/jqLite";
4
- import { valueFn, isDefined } from "../../src/shared/utils";
5
-
6
- describe("a", () => {
7
- let element;
8
- let $compile;
9
- let $rootScope;
10
-
11
- beforeEach(() => {
12
- publishExternalAPI();
13
- createInjector([
14
- "ng",
15
- function ($compileProvider) {
16
- $compileProvider
17
- .directive(
18
- "linkTo",
19
- valueFn({
20
- restrict: "A",
21
- template:
22
- '<div class="my-link"><a href="{{destination}}">{{destination}}</a></div>',
23
- replace: true,
24
- scope: {
25
- destination: "@linkTo",
26
- },
27
- }),
28
- )
29
- .directive(
30
- "linkNot",
31
- valueFn({
32
- restrict: "A",
33
- template:
34
- '<div class="my-link"><a href>{{destination}}</a></div>',
35
- replace: true,
36
- scope: {
37
- destination: "@linkNot",
38
- },
39
- }),
40
- );
41
- },
42
- ]).invoke((_$compile_, _$rootScope_) => {
43
- $compile = _$compile_;
44
- $rootScope = _$rootScope_;
45
- });
46
- });
47
-
48
- afterEach(() => {
49
- dealoc(element);
50
- });
51
-
52
- it("should prevent default action to be executed when href is empty", () => {
53
- const orgLocation = window.document.location.href;
54
- let preventDefaultCalled = false;
55
- let event;
56
-
57
- element = $compile('<a href="">empty link</a>')($rootScope);
58
-
59
- event = window.document.createEvent("MouseEvent");
60
- event.initMouseEvent(
61
- "click",
62
- true,
63
- true,
64
- window,
65
- 0,
66
- 0,
67
- 0,
68
- 0,
69
- 0,
70
- false,
71
- false,
72
- false,
73
- false,
74
- 0,
75
- null,
76
- );
77
-
78
- event.preventDefaultOrg = event.preventDefault;
79
- event.preventDefault = function () {
80
- preventDefaultCalled = true;
81
- if (this.preventDefaultOrg) this.preventDefaultOrg();
82
- };
83
-
84
- element[0].dispatchEvent(event);
85
-
86
- expect(preventDefaultCalled).toEqual(true);
87
-
88
- expect(window.document.location.href).toEqual(orgLocation);
89
- });
90
-
91
- it("should not link and hookup an event if href is present at compile", () => {
92
- const jq = jqLite;
93
- element = jq('<a href="//a.com">hello@you</a>');
94
- const linker = $compile(element);
95
-
96
- spyOn(jq.prototype, "on");
97
-
98
- linker($rootScope);
99
-
100
- expect(jq.prototype.on).not.toHaveBeenCalled();
101
- });
102
-
103
- it("should not preventDefault if anchor element is replaced with href-containing element", () => {
104
- spyOn(jqLite.prototype, "on").and.callThrough();
105
- element = $compile('<a link-to="https://www.google.com">')($rootScope);
106
- $rootScope.$digest();
107
-
108
- const child = element.children("a");
109
- const preventDefault = jasmine.createSpy("preventDefault");
110
-
111
- child.triggerHandler({
112
- type: "click",
113
- preventDefault,
114
- });
115
-
116
- expect(preventDefault).not.toHaveBeenCalled();
117
- });
118
-
119
- it("should preventDefault if anchor element is replaced with element without href attribute", () => {
120
- spyOn(jqLite.prototype, "on").and.callThrough();
121
- element = $compile('<a link-not="https://www.google.com">')($rootScope);
122
- $rootScope.$digest();
123
-
124
- const child = element.children("a");
125
- const preventDefault = jasmine.createSpy("preventDefault");
126
-
127
- child.triggerHandler({
128
- type: "click",
129
- preventDefault,
130
- });
131
-
132
- expect(preventDefault).toHaveBeenCalled();
133
- });
134
-
135
- if (isDefined(window.SVGElement)) {
136
- describe("SVGAElement", () => {
137
- it("should prevent default action to be executed when href is empty", () => {
138
- const orgLocation = window.document.location.href;
139
- let preventDefaultCalled = false;
140
- let event;
141
- let child;
142
-
143
- element = $compile('<svg><a xlink:href="">empty link</a></svg>')(
144
- $rootScope,
145
- );
146
- child = element.children("a");
147
-
148
- event = window.document.createEvent("MouseEvent");
149
- event.initMouseEvent(
150
- "click",
151
- true,
152
- true,
153
- window,
154
- 0,
155
- 0,
156
- 0,
157
- 0,
158
- 0,
159
- false,
160
- false,
161
- false,
162
- false,
163
- 0,
164
- null,
165
- );
166
-
167
- event.preventDefaultOrg = event.preventDefault;
168
- event.preventDefault = function () {
169
- preventDefaultCalled = true;
170
- if (this.preventDefaultOrg) this.preventDefaultOrg();
171
- };
172
-
173
- child[0].dispatchEvent(event);
174
-
175
- expect(preventDefaultCalled).toEqual(true);
176
- expect(window.document.location.href).toEqual(orgLocation);
177
- });
178
-
179
- it("should not link and hookup an event if xlink:href is present at compile", () => {
180
- const jq = jqLite;
181
- element = jq('<svg><a xlink:href="bobby">hello@you</a></svg>');
182
- const linker = $compile(element);
183
-
184
- spyOn(jq.prototype, "on");
185
-
186
- linker($rootScope);
187
-
188
- expect(jq.prototype.on).not.toHaveBeenCalled();
189
- });
190
- });
191
- }
192
- });