Skip to content

Commit e404265

Browse files
committed
2 parents d80bbd5 + e1dd00e commit e404265

File tree

11 files changed

+710
-329
lines changed

11 files changed

+710
-329
lines changed

docs/content/error/$http/badjsonp.ngdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ value is `JSON_CALLBACK`.
99

1010
`$http` JSONP requests need to attach a callback query parameter to the URL. The name of this
1111
parameter is specified in the configuration object (or in the defaults) via the `jsonpCallbackParam`
12-
property. You must not provide your own parameter with this name in the configuratio of the request.
12+
property. You must not provide your own parameter with this name in the configuration of the request.
1313

1414
In previous versions of AngularJS, you specified where to add the callback parameter value via the
1515
`JSON_CALLBACK` placeholder. This is no longer allowed.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@
5656
"gulp-sourcemaps": "^1.2.2",
5757
"gulp-uglify": "^1.0.1",
5858
"gulp-util": "^3.0.1",
59-
"jasmine-core": "^2.4.0",
59+
"jasmine-core": "2.5.2",
6060
"jasmine-node": "^2.0.0",
6161
"jasmine-reporters": "^2.2.0",
6262
"jquery": "^3.2.1",
63-
"karma": "^1.1.2",
64-
"karma-browserstack-launcher": "^1.0.1",
65-
"karma-chrome-launcher": "^1.0.1",
66-
"karma-firefox-launcher": "^1.0.0",
67-
"karma-jasmine": "^1.0.2",
68-
"karma-junit-reporter": "^1.1.0",
63+
"karma": "^1.7.0",
64+
"karma-browserstack-launcher": "^1.2.0",
65+
"karma-chrome-launcher": "^2.1.1",
66+
"karma-firefox-launcher": "^1.0.1",
67+
"karma-jasmine": "^1.1.0",
68+
"karma-junit-reporter": "^1.2.0",
6969
"karma-ng-scenario": "^1.0.0",
70-
"karma-sauce-launcher": "^1.0.0",
70+
"karma-sauce-launcher": "^1.1.0",
7171
"karma-script-launcher": "^1.0.0",
7272
"load-grunt-tasks": "^3.5.0",
7373
"lodash": "~2.4.1",

src/ng/http.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ function $HttpParamSerializerJQLikeProvider() {
110110
return parts.join('&');
111111

112112
function serialize(toSerialize, prefix, topLevel) {
113-
if (toSerialize === null || isUndefined(toSerialize)) return;
114113
if (isArray(toSerialize)) {
115114
forEach(toSerialize, function(value, index) {
116115
serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']');
@@ -123,7 +122,8 @@ function $HttpParamSerializerJQLikeProvider() {
123122
(topLevel ? '' : ']'));
124123
});
125124
} else {
126-
parts.push(encodeUriQuery(prefix) + '=' + encodeUriQuery(serializeValue(toSerialize)));
125+
parts.push(encodeUriQuery(prefix) + '=' +
126+
(toSerialize == null ? '' : encodeUriQuery(serializeValue(toSerialize))));
127127
}
128128
}
129129
};

test/.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
"browserSupportsCssAnimations": false,
177177
"browserTrigger": false,
178178
"jqLiteCacheSize": false,
179-
"createAsync": false
179+
"createAsync": false,
180+
"support": false
180181
}
181182
}

test/auto/injectorSpec.js

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict';
22

3-
/* globals support: false */
4-
53
describe('injector.modules', function() {
64
it('should expose the loaded module info on the instance injector', function() {
75
var test1 = angular.module('test1', ['test2']).info({ version: '1.1' });
@@ -327,26 +325,24 @@ describe('injector', function() {
327325
expect(instance.aVal()).toEqual('a-value');
328326
});
329327

330-
if (/chrome/.test(window.navigator.userAgent)) {
331-
they('should detect ES6 classes regardless of whitespace/comments ($prop)', [
332-
'class Test {}',
333-
'class Test{}',
334-
'class //<--ES6 stuff\nTest {}',
335-
'class//<--ES6 stuff\nTest {}',
336-
'class {}',
337-
'class{}',
338-
'class //<--ES6 stuff\n {}',
339-
'class//<--ES6 stuff\n {}',
340-
'class/* Test */{}',
341-
'class /* Test */ {}'
342-
], function(classDefinition) {
343-
// eslint-disable-next-line no-eval
344-
var Clazz = eval('(' + classDefinition + ')');
345-
var instance = injector.invoke(Clazz);
346-
347-
expect(instance).toEqual(jasmine.any(Clazz));
348-
});
349-
}
328+
they('should detect ES6 classes regardless of whitespace/comments ($prop)', [
329+
'class Test {}',
330+
'class Test{}',
331+
'class //<--ES6 stuff\nTest {}',
332+
'class//<--ES6 stuff\nTest {}',
333+
'class {}',
334+
'class{}',
335+
'class //<--ES6 stuff\n {}',
336+
'class//<--ES6 stuff\n {}',
337+
'class/* Test */{}',
338+
'class /* Test */ {}'
339+
], function(classDefinition) {
340+
// eslint-disable-next-line no-eval
341+
var Clazz = eval('(' + classDefinition + ')');
342+
var instance = injector.invoke(Clazz);
343+
344+
expect(instance).toEqual(jasmine.any(Clazz));
345+
});
350346
}
351347
});
352348

test/helpers/testabilityPatch.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
if (window.bindJQuery) bindJQuery();
55

66
var supportTests = {
7-
classes: '(class {})',
7+
classes: '/^class\\b/.test((class C {}).toString())',
88
fatArrow: 'a => a',
99
ES6Function: '({ fn(x) { return; } })'
1010
};
@@ -15,8 +15,7 @@ for (var prop in supportTests) {
1515
if (supportTests.hasOwnProperty(prop)) {
1616
try {
1717
// eslint-disable-next-line no-eval
18-
eval(supportTests[prop]);
19-
support[prop] = true;
18+
support[prop] = !!eval(supportTests[prop]);
2019
} catch (e) {
2120
support[prop] = false;
2221
}

test/ng/compileSpec.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6175,10 +6175,10 @@ describe('$compile', function() {
61756175
});
61766176

61776177
it('should eventually expose isolate scope variables on ES6 class controller with controllerAs when bindToController is true', function() {
6178-
if (!/chrome/i.test(window.navigator.userAgent)) return;
6178+
if (!support.classes) return;
61796179
var controllerCalled = false;
61806180
// eslint-disable-next-line no-eval
6181-
var Controller = eval(
6181+
var Controller = eval('(\n' +
61826182
'class Foo {\n' +
61836183
' constructor($scope) {}\n' +
61846184
' $onInit() {\n' +
@@ -6194,7 +6194,8 @@ describe('$compile', function() {
61946194
' expect(this.fn()).toBe(\'called!\');\n' +
61956195
' controllerCalled = true;\n' +
61966196
' }\n' +
6197-
'}');
6197+
'}\n' +
6198+
')');
61986199
spyOn(Controller.prototype, '$onInit').and.callThrough();
61996200

62006201
module(function($compileProvider) {

test/ng/httpSpec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,5 +2306,11 @@ describe('$http param serializers', function() {
23062306
'a%5B%5D=b&a%5B%5D=c&d%5B0%5D%5Be%5D=f&d%5B0%5D%5Bg%5D=h&d%5B%5D=i&d%5B2%5D%5Bj%5D=k');
23072307
//a[]=b&a[]=c&d[0][e]=f&d[0][g]=h&d[]=i&d[2][j]=k
23082308
});
2309+
2310+
it('should serialize `null` and `undefined` elements as empty', function() {
2311+
expect(jqrSer({items:['foo', 'bar', null, undefined, 'baz'], x: null, y: undefined})).toEqual(
2312+
'items%5B%5D=foo&items%5B%5D=bar&items%5B%5D=&items%5B%5D=&items%5B%5D=baz&x=&y=');
2313+
//items[]=foo&items[]=bar&items[]=&items[]=&items[]=baz&x=&y=
2314+
});
23092315
});
23102316
});

0 commit comments

Comments
 (0)