@angular-wave/angular.ts 0.6.0 → 0.6.1

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@angular-wave/angular.ts",
3
3
  "description": "A modern, optimized and typesafe version of AngularJS",
4
4
  "license": "MIT",
5
- "version": "0.6.0",
5
+ "version": "0.6.1",
6
6
  "type": "module",
7
7
  "main": "dist/angular-ts.esm.js",
8
8
  "browser": "dist/angular-ts.umd.js",
@@ -1,4 +1,4 @@
1
- import { isUndefined } from "../../shared/utils.js";
1
+ import { kebabToCamel } from "../../shared/jqlite/jqlite.js";
2
2
 
3
3
  /**
4
4
  * @param {string} source - the name of the attribute to be observed
@@ -10,11 +10,12 @@ export function ngObserveDirective(source, prop) {
10
10
  restrict: "A",
11
11
  compile: () => (scope, element) => {
12
12
  const targetElement = element[0];
13
- if (isUndefined(prop) || prop == "") {
13
+ if (prop === "") {
14
14
  prop = source;
15
15
  }
16
- if (!scope[prop]) {
17
- scope[prop] = targetElement.getAttribute(source);
16
+ const normalized = kebabToCamel(prop);
17
+ if (!scope[normalized]) {
18
+ scope[normalized] = targetElement.getAttribute(source);
18
19
  }
19
20
 
20
21
  const observer = new MutationObserver((mutations) => {
@@ -22,8 +23,8 @@ export function ngObserveDirective(source, prop) {
22
23
  const newValue = /** @type {HTMLElement} */ (
23
24
  mutation.target
24
25
  ).getAttribute(source);
25
- if (scope[prop] !== newValue) {
26
- scope[prop] = newValue;
26
+ if (scope[normalized] !== newValue) {
27
+ scope[normalized] = newValue;
27
28
  scope.$digest();
28
29
  }
29
30
  });
@@ -89,7 +89,7 @@ describe("observe", () => {
89
89
  });
90
90
 
91
91
  it("should observe attribute changes and update the same scope name if data-update attribute is absent", () => {
92
- $scope.myProp = "";
92
+ $scope.testAttribute = "";
93
93
  const template = `<div ng-observe-test-attribute></div>`;
94
94
  element = $compile(template)($scope);
95
95
  $scope.$digest();
@@ -107,5 +107,6 @@ describe("observe", () => {
107
107
 
108
108
  mutationObserverCallback([mutationRecord]);
109
109
  expect($scope.$digest).toHaveBeenCalled();
110
+ expect($scope.testAttribute).toBe("newValue");
110
111
  });
111
112
  });
@@ -539,7 +539,13 @@ export function HttpProvider() {
539
539
  );
540
540
 
541
541
  Object.keys(defHeaders).forEach((defHeaderName) => {
542
- if (!reqHeaders[lowercase(defHeaderName)]) {
542
+ const lowercaseDefHeaderName = lowercase(defHeaderName);
543
+ const hasMatchingHeader = Object.keys(reqHeaders).some(
544
+ (reqHeaderName) => {
545
+ return lowercase(reqHeaderName) === lowercaseDefHeaderName;
546
+ },
547
+ );
548
+ if (!hasMatchingHeader) {
543
549
  reqHeaders[defHeaderName] = defHeaders[defHeaderName];
544
550
  }
545
551
  });