@angular-wave/angular.ts 0.0.8 → 0.0.9

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.
@@ -133,11 +133,11 @@ describe("binding", () => {
133
133
  $rootScope.$apply();
134
134
  expect(form[0].outerHTML).toBe(
135
135
  "<ul>" +
136
- "<!-- ngRepeat: item in model.items -->" +
136
+ "<!---->" +
137
137
  '<li ng-repeat="item in model.items" ng-bind="item.a">A</li>' +
138
- "<!-- end ngRepeat: item in model.items -->" +
138
+ "<!---->" +
139
139
  '<li ng-repeat="item in model.items" ng-bind="item.a">B</li>' +
140
- "<!-- end ngRepeat: item in model.items -->" +
140
+ "<!---->" +
141
141
  "</ul>",
142
142
  );
143
143
 
@@ -145,13 +145,13 @@ describe("binding", () => {
145
145
  $rootScope.$apply();
146
146
  expect(form[0].outerHTML).toBe(
147
147
  "<ul>" +
148
- "<!-- ngRepeat: item in model.items -->" +
148
+ "<!---->" +
149
149
  '<li ng-repeat="item in model.items" ng-bind="item.a">C</li>' +
150
- "<!-- end ngRepeat: item in model.items -->" +
150
+ "<!---->" +
151
151
  '<li ng-repeat="item in model.items" ng-bind="item.a">A</li>' +
152
- "<!-- end ngRepeat: item in model.items -->" +
152
+ "<!---->" +
153
153
  '<li ng-repeat="item in model.items" ng-bind="item.a">B</li>' +
154
- "<!-- end ngRepeat: item in model.items -->" +
154
+ "<!---->" +
155
155
  "</ul>",
156
156
  );
157
157
 
@@ -159,11 +159,11 @@ describe("binding", () => {
159
159
  $rootScope.$apply();
160
160
  expect(form[0].outerHTML).toBe(
161
161
  "<ul>" +
162
- "<!-- ngRepeat: item in model.items -->" +
162
+ "<!---->" +
163
163
  '<li ng-repeat="item in model.items" ng-bind="item.a">A</li>' +
164
- "<!-- end ngRepeat: item in model.items -->" +
164
+ "<!---->" +
165
165
  '<li ng-repeat="item in model.items" ng-bind="item.a">B</li>' +
166
- "<!-- end ngRepeat: item in model.items -->" +
166
+ "<!---->" +
167
167
  "</ul>",
168
168
  );
169
169
 
@@ -182,9 +182,9 @@ describe("binding", () => {
182
182
  $rootScope.$apply();
183
183
  expect(element[0].outerHTML).toBe(
184
184
  "<ul>" +
185
- "<!-- ngRepeat: item in model.items -->" +
185
+ "<!---->" +
186
186
  '<li ng-repeat="item in model.items"><span ng-bind="item.a">A</span></li>' +
187
- "<!-- end ngRepeat: item in model.items -->" +
187
+ "<!---->" +
188
188
  "</ul>",
189
189
  );
190
190
  });
@@ -257,19 +257,19 @@ describe("binding", () => {
257
257
 
258
258
  expect(element[0].outerHTML).toBe(
259
259
  `<div>` +
260
- `<!-- ngRepeat: m in model -->` +
260
+ `<!---->` +
261
261
  `<div ng-repeat="m in model" name="a">` +
262
- `<!-- ngRepeat: i in m.item -->` +
263
- `<ul name="a1" ng-repeat="i in m.item"></ul><!-- end ngRepeat: i in m.item -->` +
264
- `<ul name="a2" ng-repeat="i in m.item"></ul><!-- end ngRepeat: i in m.item -->` +
265
- `</div><!-- end ngRepeat: m in model -->` +
262
+ `<!---->` +
263
+ `<ul name="a1" ng-repeat="i in m.item"></ul><!---->` +
264
+ `<ul name="a2" ng-repeat="i in m.item"></ul><!---->` +
265
+ `</div><!---->` +
266
266
  `<div ng-repeat="m in model" name="b">` +
267
- `<!-- ngRepeat: i in m.item -->` +
267
+ `<!---->` +
268
268
  `<ul name="b1" ng-repeat="i in m.item"></ul>` +
269
- `<!-- end ngRepeat: i in m.item -->` +
269
+ `<!---->` +
270
270
  `<ul name="b2" ng-repeat="i in m.item"></ul>` +
271
- `<!-- end ngRepeat: i in m.item --></div>` +
272
- `<!-- end ngRepeat: m in model --></div>`,
271
+ `<!----></div>` +
272
+ `<!----></div>`,
273
273
  );
274
274
  });
275
275
 
@@ -475,11 +475,11 @@ describe("binding", () => {
475
475
  $rootScope.$apply();
476
476
  expect(element[0].outerHTML).toBe(
477
477
  "<ul>" +
478
- "<!-- ngRepeat: (k,v) in {a:0,b:1} -->" +
478
+ "<!---->" +
479
479
  '<li ng-repeat="(k,v) in {a:0,b:1}" ng-bind="k + v">a0</li>' +
480
- "<!-- end ngRepeat: (k,v) in {a:0,b:1} -->" +
480
+ "<!---->" +
481
481
  '<li ng-repeat="(k,v) in {a:0,b:1}" ng-bind="k + v">b1</li>' +
482
- "<!-- end ngRepeat: (k,v) in {a:0,b:1} -->" +
482
+ "<!---->" +
483
483
  "</ul>",
484
484
  );
485
485
  });
@@ -1684,62 +1684,6 @@ describe("jqLite", () => {
1684
1684
  });
1685
1685
  });
1686
1686
 
1687
- describe("one", () => {
1688
- it("should only fire the callback once", () => {
1689
- const element = jqLite(a);
1690
- const spy = jasmine.createSpy("click");
1691
-
1692
- element.one("click", spy);
1693
- browserTrigger(element, "click");
1694
- expect(spy).toHaveBeenCalled();
1695
-
1696
- browserTrigger(element, "click");
1697
- expect(spy).toHaveBeenCalled();
1698
- });
1699
-
1700
- it("should deregister when off is called", () => {
1701
- const element = jqLite(a);
1702
- const spy = jasmine.createSpy("click");
1703
-
1704
- element.one("click", spy);
1705
- element.off("click", spy);
1706
-
1707
- browserTrigger(element, "click");
1708
- expect(spy).not.toHaveBeenCalled();
1709
- });
1710
-
1711
- it("should return the same event object just as on() does", () => {
1712
- const element = jqLite(a);
1713
- let eventA;
1714
- let eventB;
1715
- element.on("click", (event) => {
1716
- eventA = event;
1717
- });
1718
- element.one("click", (event) => {
1719
- eventB = event;
1720
- });
1721
-
1722
- browserTrigger(element, "click");
1723
- expect(eventA).toEqual(eventB);
1724
- });
1725
-
1726
- it("should not remove other event handlers of the same type after execution", () => {
1727
- const element = jqLite(a);
1728
- const calls = [];
1729
- element.one("click", (event) => {
1730
- calls.push("one");
1731
- });
1732
- element.on("click", (event) => {
1733
- calls.push("on");
1734
- });
1735
-
1736
- browserTrigger(element, "click");
1737
- browserTrigger(element, "click");
1738
-
1739
- expect(calls).toEqual(["one", "on", "on"]);
1740
- });
1741
- });
1742
-
1743
1687
  describe("replaceWith", () => {
1744
1688
  it("should replaceWith", () => {
1745
1689
  const root = jqLite("<div>").html("before-<div></div>after");
@@ -577,9 +577,7 @@ describe("ngMessages", () => {
577
577
  $rootScope.$digest(); // The next digest triggers the error
578
578
 
579
579
  // Make sure removing the element triggers the deregistration in ngMessages
580
- expect(trim(deregisterSpy.calls.mostRecent().args[0].nodeValue)).toBe(
581
- "ngMessage: a",
582
- );
580
+ expect(trim(deregisterSpy.calls.mostRecent().args[0].nodeValue)).toBe("");
583
581
  expect(messageChildren(element).length).toBe(0);
584
582
  });
585
583
 
@@ -619,7 +617,7 @@ describe("ngMessages", () => {
619
617
 
620
618
  // Make sure removing the element triggers the deregistration in ngMessages
621
619
  expect(trim(deregisterSpy.calls.mostRecent().args[0].nodeValue)).toBe(
622
- "ngMessage: b",
620
+ "",
623
621
  );
624
622
  expect(messageChildren(element).length).toBe(1);
625
623
  expect(trim(element.text())).toEqual("A");
@@ -5,11 +5,15 @@
5
5
  <script type="module" src="../src/index.js"></script>
6
6
  </head>
7
7
  <body ng-app>
8
- <div>
8
+ <div ng-init='list = [{ name: "x" }, { name: "y" }, { name: "z" }]'>
9
9
  <label>Name:</label>
10
10
  <input type="text" ng-model="yourName" placeholder="Enter a name here" />
11
11
  <hr />
12
12
  <h1>Hello {{yourName}}!</h1>
13
+
14
+ <ul ng-repeat="i in list">
15
+ <li>{{ i.name }}</li>
16
+ </ul>
13
17
  </div>
14
18
  </body>
15
19
  </html>
@@ -3576,7 +3576,7 @@ describe("$compile", () => {
3576
3576
 
3577
3577
  $compile(el);
3578
3578
 
3579
- expect(el[0].innerHTML).toEqual("<!-- myTranscluder: -->");
3579
+ expect(el[0].innerHTML).toEqual("<!---->");
3580
3580
  });
3581
3581
 
3582
3582
  it("includes directive attribute value in comment", () => {
@@ -3590,7 +3590,7 @@ describe("$compile", () => {
3590
3590
 
3591
3591
  $compile(el);
3592
3592
 
3593
- expect(el[0].innerHTML).toEqual("<!-- myTranscluder: 42 -->");
3593
+ expect(el[0].innerHTML).toEqual("<!---->");
3594
3594
  });
3595
3595
 
3596
3596
  it("calls directive compile and link with comment", () => {
@@ -4541,50 +4541,6 @@ describe("$compile", () => {
4541
4541
  expect($rootScope.valueOne).toBe(51);
4542
4542
  expect($rootScope.valueTwo).toBe(51);
4543
4543
  });
4544
-
4545
- it("allows configuring $onChanges TTL", () => {
4546
- let compileProvider;
4547
- window.angular.module("myModule", [
4548
- function ($compileProvider) {
4549
- expect($compileProvider.onChangesTtl()).toBe(10);
4550
- $compileProvider.onChangesTtl(50);
4551
- compileProvider = $compileProvider;
4552
- expect($compileProvider.onChangesTtl()).toBe(50);
4553
- $compileProvider.component("myComponent", {
4554
- bindings: {
4555
- input: "<",
4556
- increment: "=",
4557
- },
4558
- controller: function () {
4559
- this.$onChanges = function () {
4560
- if (this.increment) {
4561
- this.increment = this.increment + 1;
4562
- }
4563
- };
4564
- },
4565
- });
4566
- },
4567
- ]);
4568
- reloadModules();
4569
- var watchSpy = jasmine.createSpy();
4570
- $rootScope.$watch(watchSpy);
4571
-
4572
- var el = $(
4573
- "<div>" +
4574
- '<my-component input="valueOne" increment="valueTwo"></my-component>' +
4575
- '<my-component input="valueTwo" increment="valueOne"></my-component>' +
4576
- "</div>",
4577
- );
4578
- $compile(el)($rootScope);
4579
- $rootScope.$apply();
4580
-
4581
- $rootScope.valueOne = 42;
4582
- $rootScope.valueTwo = 42;
4583
- $rootScope.$apply();
4584
- expect($rootScope.valueOne).toBe(91);
4585
- expect($rootScope.valueTwo).toBe(91);
4586
- compileProvider.onChangesTtl(10);
4587
- });
4588
4544
  });
4589
4545
 
4590
4546
  describe("configuration", () => {
@@ -4654,18 +4610,6 @@ describe("$compile", () => {
4654
4610
  ]);
4655
4611
  });
4656
4612
 
4657
- it("should allow onChangesTtl to be configured", () => {
4658
- createInjector([
4659
- "ng",
4660
- ($compileProvider) => {
4661
- expect($compileProvider.onChangesTtl()).toBe(10); // the default
4662
- $compileProvider.onChangesTtl(2);
4663
- expect($compileProvider.onChangesTtl()).toBe(2);
4664
- $compileProvider.onChangesTtl(10);
4665
- },
4666
- ]);
4667
- });
4668
-
4669
4613
  it("should register a directive", () => {
4670
4614
  myModule.directive("div", () => ({
4671
4615
  restrict: "EA",
@@ -12193,7 +12137,7 @@ describe("$compile", () => {
12193
12137
  if (element.parent().length) {
12194
12138
  expect(expectedController).toBeDefined();
12195
12139
  expect(controller).toBe(expectedController);
12196
- expect(controller.foo).toBe("bar");
12140
+ expect(controller.foo).toEqual("bar");
12197
12141
  log.push("done");
12198
12142
  }
12199
12143
  },
@@ -13681,7 +13625,6 @@ describe("$compile", () => {
13681
13625
  // destroyedScope.$destroy();
13682
13626
  // const clone = template(destroyedScope, () => {});
13683
13627
  // $rootScope.$digest();
13684
- // debugger
13685
13628
  // // expect(linkFn).not.toHaveBeenCalled();
13686
13629
  // // clone.remove();
13687
13630
  // });
@@ -17734,26 +17677,4 @@ describe("$compile", () => {
17734
17677
  );
17735
17678
  });
17736
17679
  });
17737
-
17738
- describe("$$createComment", () => {
17739
- it("should create empty comments if `debugInfoEnabled` is false", () => {
17740
- module.config(($compileProvider) => {
17741
- $compileProvider.debugInfoEnabled(false);
17742
- });
17743
- initInjector("test1");
17744
-
17745
- const comment = $compile.$$createComment("foo", "bar");
17746
- expect(comment.data).toBe("");
17747
- });
17748
-
17749
- it("should create descriptive comments if `debugInfoEnabled` is true", () => {
17750
- module.config(($compileProvider) => {
17751
- $compileProvider.debugInfoEnabled(true);
17752
- });
17753
-
17754
- initInjector("test1");
17755
- const comment = $compile.$$createComment("foo", "bar");
17756
- expect(comment.data).toBe(" foo: bar ");
17757
- });
17758
- });
17759
17680
  });
@@ -1076,43 +1076,6 @@ describe("ngRepeat", () => {
1076
1076
  }, 300);
1077
1077
  });
1078
1078
 
1079
- it("should add separator comments after each item", () => {
1080
- const check = function () {
1081
- const children = element.find("div");
1082
- expect(children.length).toBe(3);
1083
-
1084
- // Note: COMMENT_NODE === 8
1085
- expect(children[0].nextSibling.nodeType).toBe(8);
1086
- expect(children[0].nextSibling.nodeValue).toBe(
1087
- " end ngRepeat: val in values ",
1088
- );
1089
- expect(children[1].nextSibling.nodeType).toBe(8);
1090
- expect(children[1].nextSibling.nodeValue).toBe(
1091
- " end ngRepeat: val in values ",
1092
- );
1093
- expect(children[2].nextSibling.nodeType).toBe(8);
1094
- expect(children[2].nextSibling.nodeValue).toBe(
1095
- " end ngRepeat: val in values ",
1096
- );
1097
- };
1098
-
1099
- scope.values = [1, 2, 3];
1100
-
1101
- element = $compile(
1102
- "<div>" +
1103
- '<div ng-repeat="val in values">val:{{val}};</div>' +
1104
- "</div>",
1105
- )(scope);
1106
-
1107
- scope.$digest();
1108
- check();
1109
-
1110
- scope.values.shift();
1111
- scope.values.push(4);
1112
- scope.$digest();
1113
- check();
1114
- });
1115
-
1116
1079
  it("should remove whole block even if the number of elements inside it changes", () => {
1117
1080
  scope.values = [1, 2, 3];
1118
1081
 
@@ -29,9 +29,7 @@ describe("ngSwitch", () => {
29
29
  '<div ng-switch-when="true">true:{{name}}</div>' +
30
30
  "</div>",
31
31
  )($scope);
32
- expect(element[0].innerHTML).toEqual(
33
- "<!-- ngSwitchWhen: 1 --><!-- ngSwitchWhen: 2 --><!-- ngSwitchWhen: true -->",
34
- );
32
+ expect(element[0].innerHTML).toEqual("<!----><!----><!---->");
35
33
  $scope.select = 1;
36
34
  $scope.$apply();
37
35
  expect(element.text()).toEqual("first:");
@@ -58,12 +56,7 @@ describe("ngSwitch", () => {
58
56
  '<li ng-switch-when="true">true:{{name}}</li>' +
59
57
  "</ul>",
60
58
  )($scope);
61
- expect(element[0].innerHTML).toEqual(
62
- "<!-- ngSwitchWhen: 1 -->" +
63
- "<!-- ngSwitchWhen: 1 -->" +
64
- "<!-- ngSwitchWhen: 2 -->" +
65
- "<!-- ngSwitchWhen: true -->",
66
- );
59
+ expect(element[0].innerHTML).toEqual("<!----><!----><!----><!---->");
67
60
  $scope.select = 1;
68
61
  $scope.$apply();
69
62
  expect(element.text()).toEqual("first:, first too:");
package/types/jqlite.d.ts CHANGED
@@ -56,30 +56,6 @@ interface JQLite {
56
56
  */
57
57
  attr(attributes: Object): this;
58
58
 
59
- /**
60
- * Attach a handler to an event for the elements.
61
- *
62
- * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
63
- * @param handler A function to execute each time the event is triggered.
64
- * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler}
65
- */
66
- bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): this;
67
- /**
68
- * Attach a handler to an event for the elements.
69
- *
70
- * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
71
- * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
72
- * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-preventBubble}
73
- */
74
- bind(eventType: string, preventBubble: boolean): this;
75
- /**
76
- * Attach a handler to an event for the elements.
77
- *
78
- * @param events An object containing one or more DOM event types and functions to execute for them.
79
- * @see {@link https://api.jquery.com/bind/#bind-events}
80
- */
81
- bind(events: any): this;
82
-
83
59
  /**
84
60
  * Get the children of each element in the set of matched elements, optionally filtered by a selector.
85
61
  *
@@ -276,60 +252,6 @@ interface JQLite {
276
252
  */
277
253
  off(events: { [key: string]: any }, selector?: string): this;
278
254
 
279
- /**
280
- * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
281
- *
282
- * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
283
- * @param handler A function to execute at the time the event is triggered.
284
- * @see {@link https://api.jquery.com/one/#one-events-data-handler}
285
- */
286
- one(events: string, handler: (eventObject: JQueryEventObject) => any): this;
287
- /**
288
- * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
289
- *
290
- * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
291
- * @param data An object containing data that will be passed to the event handler.
292
- * @param handler A function to execute at the time the event is triggered.
293
- * @see {@link https://api.jquery.com/one/#one-events-data-handler}
294
- */
295
- one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): this;
296
- /**
297
- * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
298
- *
299
- * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
300
- * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
301
- * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
302
- * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler}
303
- */
304
- one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): this;
305
- /**
306
- * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
307
- *
308
- * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
309
- * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
310
- * @param data Data to be passed to the handler in event.data when an event is triggered.
311
- * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
312
- * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler}
313
- */
314
- one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): this;
315
- /**
316
- * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
317
- *
318
- * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
319
- * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.
320
- * @param data Data to be passed to the handler in event.data when an event occurs.
321
- * @see {@link https://api.jquery.com/one/#one-events-selector-data}
322
- */
323
- one(events: { [key: string]: any }, selector?: string, data?: any): this;
324
- /**
325
- * Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
326
- *
327
- * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
328
- * @param data Data to be passed to the handler in event.data when an event occurs.
329
- * @see {@link https://api.jquery.com/one/#one-events-selector-data}
330
- */
331
- one(events: { [key: string]: any }, data?: any): this;
332
-
333
255
  /**
334
256
  * Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
335
257
  *