From 443c773e4b3948fd025603ef9fa7ff9e2c0df415 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 6 Nov 2018 16:03:52 +0200 Subject: [PATCH 1/5] chore(package): fix scripts for Node 10.x on Windows --- package.json | 5 +++++ yarn.lock | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index b674a91bcaa0..1e25cc44728e 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,11 @@ "stringmap": "^0.2.2" }, "dependencies": {}, + "resolutions": { + "//1": "`natives@1.1.0` does not work with Node.js 10.x on Windows 10", + "//2": "(E.g. see https://github.com/gulpjs/gulp/issues/2162.)", + "natives": "1.1.3" + }, "commitplease": { "style": "angular", "nohook": true diff --git a/yarn.lock b/yarn.lock index 551675822fb2..268669168f1c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5750,10 +5750,10 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" -natives@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.0.tgz#e9ff841418a6b2ec7a495e939984f78f163e6e31" - integrity sha1-6f+EFBimsux6SV6TmYT3jxY+bjE= +natives@1.1.3, natives@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.3.tgz#44a579be64507ea2d6ed1ca04a9415915cf75558" + integrity sha512-BZGSYV4YOLxzoTK73l0/s/0sH9l8SHs2ocReMH1f8JYSh5FUWu4ZrKCpJdRkWXV6HFR/pZDz7bwWOVAY07q77g== natural-compare@^1.4.0: version "1.4.0" From 6268e84f79fbb1995485ba79528ab29a6c247106 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 6 Nov 2018 16:05:12 +0200 Subject: [PATCH 2/5] chore(docs): fix rendering of methods' `this` type --- docs/config/templates/ngdoc/lib/methods.template.html | 2 +- docs/config/templates/ngdoc/lib/this.template.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/config/templates/ngdoc/lib/methods.template.html b/docs/config/templates/ngdoc/lib/methods.template.html index 9f449f97cfba..ea9218a568b7 100644 --- a/docs/config/templates/ngdoc/lib/methods.template.html +++ b/docs/config/templates/ngdoc/lib/methods.template.html @@ -17,7 +17,7 @@

Parameters

{% endif %} {% if method.this %} -

Method's {% code %}this{% endcode %}

+

Method's `this`

{$ method.this | marked $} {% endif %} diff --git a/docs/config/templates/ngdoc/lib/this.template.html b/docs/config/templates/ngdoc/lib/this.template.html index 24881972b561..1829c1b374d6 100644 --- a/docs/config/templates/ngdoc/lib/this.template.html +++ b/docs/config/templates/ngdoc/lib/this.template.html @@ -1,4 +1,4 @@ {% if doc.this %} -

Method's {% code %}this{% endcode %}

+

Method's `this`

{$ doc.this | marked $} -{% endif %} \ No newline at end of file +{% endif %} From 7568d59b0a58ca3606da5e30202250baa426f733 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 6 Nov 2018 16:06:26 +0200 Subject: [PATCH 3/5] chore(i18n): fix UCD extraction for Node 10.x Previously (e.g. Node.js 8.x), the 3rd argument to `fs.writeFile()` (i.e. the callback) could be undefined. On Node.js 10.x, this throws an error. This commit fixes it by switching to `fs.writeFileSync()` which seems to have been the original intention (based on the sorrounding code). --- i18n/ucd/src/extract.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/ucd/src/extract.js b/i18n/ucd/src/extract.js index ae8493fd2b74..bc6736597d77 100644 --- a/i18n/ucd/src/extract.js +++ b/i18n/ucd/src/extract.js @@ -20,7 +20,7 @@ function main() { } catch (e) { fs.mkdirSync(__dirname + '/../../../src/ngParseExt'); } - fs.writeFile(__dirname + '/../../../src/ngParseExt/ucd.js', code); + fs.writeFileSync(__dirname + '/../../../src/ngParseExt/ucd.js', code); } } From c76c3d49c9d306b5cad0020af58fb00418a97024 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Thu, 8 Nov 2018 12:41:10 +0200 Subject: [PATCH 4/5] test($compile): fix incorrect markup in tests --- test/ng/compileSpec.js | 14 +++++++------- test/ng/ngPropSpec.js | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 48b5e565e088..2dd80560509c 100644 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -11703,37 +11703,37 @@ describe('$compile', function() { // All interpolations are disallowed. $rootScope.onClickJs = ''; expect(function() { - $compile(''); }).toThrowMinErr( '$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed'); expect(function() { - $compile(''); }).toThrowMinErr( '$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed'); expect(function() { - $compile(''); }).toThrowMinErr( '$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed'); expect(function() { - $compile(''); }).toThrowMinErr( '$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed'); })); it('should pass through arbitrary values on onXYZ event attributes that contain a hyphen', inject(function($compile, $rootScope) { - element = $compile('')($rootScope); $rootScope.onClickJs = 'javascript:doSomething()'; $rootScope.$apply(); expect(element.attr('on-click')).toEqual('javascript:doSomething()'); })); it('should pass through arbitrary values on "on" and "data-on" attributes', inject(function($compile, $rootScope) { - element = $compile('')($rootScope); $rootScope.dataOnVar = 'data-on text'; $rootScope.$apply(); expect(element.attr('data-on')).toEqual('data-on text'); - element = $compile('')($rootScope); $rootScope.onVar = 'on text'; $rootScope.$apply(); expect(element.attr('on')).toEqual('on text'); diff --git a/test/ng/ngPropSpec.js b/test/ng/ngPropSpec.js index 71bf67a5a5fb..9b4f9fab0637 100644 --- a/test/ng/ngPropSpec.js +++ b/test/ng/ngPropSpec.js @@ -147,11 +147,11 @@ describe('ngProp*', function() { it('should disallow property binding to onclick', inject(function($compile, $rootScope) { // All event prop bindings are disallowed. expect(function() { - $compile(''); }).toThrowMinErr( '$compile', 'nodomevents', 'Property bindings for HTML DOM event properties are disallowed'); expect(function() { - $compile(''); }).toThrowMinErr( '$compile', 'nodomevents', 'Property bindings for HTML DOM event properties are disallowed'); })); From 3d46e2c0b4364a5fd364e79861c846e5f4b1a97a Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Thu, 8 Nov 2018 12:57:35 +0200 Subject: [PATCH 5/5] test(ngOn*): add tests for binding to camelCased event names --- test/ng/ngOnSpec.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/ng/ngOnSpec.js b/test/ng/ngOnSpec.js index 9da918e881c2..30dd92778392 100644 --- a/test/ng/ngOnSpec.js +++ b/test/ng/ngOnSpec.js @@ -155,4 +155,34 @@ describe('ngOn* event binding', function() { expect(attrs.$attr.ngOnTitle).toBe('ng-on-title'); }); }); + + it('should correctly bind to kebab-cased event names', inject(function($compile, $rootScope) { + var element = $compile('')($rootScope); + var cb = $rootScope.cb = jasmine.createSpy('ng-on cb'); + $rootScope.$digest(); + + element.triggerHandler('foobar'); + element.triggerHandler('fooBar'); + element.triggerHandler('foo_bar'); + element.triggerHandler('foo:bar'); + expect(cb).not.toHaveBeenCalled(); + + element.triggerHandler('foo-bar'); + expect(cb).toHaveBeenCalled(); + })); + + it('should correctly bind to camelCased event names', inject(function($compile, $rootScope) { + var element = $compile('')($rootScope); + var cb = $rootScope.cb = jasmine.createSpy('ng-on cb'); + $rootScope.$digest(); + + element.triggerHandler('foobar'); + element.triggerHandler('foo-bar'); + element.triggerHandler('foo_bar'); + element.triggerHandler('foo:bar'); + expect(cb).not.toHaveBeenCalled(); + + element.triggerHandler('fooBar'); + expect(cb).toHaveBeenCalled(); + })); });