Skip to content

Commit aeba4be

Browse files
Merge pull request #23 from angular/master
Update upstream
2 parents 5b381b5 + 30eb194 commit aeba4be

File tree

6 files changed

+28
-40
lines changed

6 files changed

+28
-40
lines changed

docs/content/guide/component.ngdoc

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -462,23 +462,14 @@ The examples use the [Jasmine](http://jasmine.github.io/) testing framework.
462462

463463
**Controller Test:**
464464
```js
465-
describe('component: heroDetail', function() {
465+
describe('HeroDetailController', function() {
466466
var $componentController;
467467

468468
beforeEach(module('heroApp'));
469469
beforeEach(inject(function(_$componentController_) {
470470
$componentController = _$componentController_;
471471
}));
472472

473-
it('should expose a `hero` object', function() {
474-
// Here we are passing actual bindings to the component
475-
var bindings = {hero: {name: 'Wolverine'}};
476-
var ctrl = $componentController('heroDetail', null, bindings);
477-
478-
expect(ctrl.hero).toBeDefined();
479-
expect(ctrl.hero.name).toBe('Wolverine');
480-
});
481-
482473
it('should call the `onDelete` binding, when deleting the hero', function() {
483474
var onDeleteSpy = jasmine.createSpy('onDelete');
484475
var bindings = {hero: {}, onDelete: onDeleteSpy};

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/ngMock/angular-mocksSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2100,7 +2100,7 @@ describe('ngMock', function() {
21002100
);
21012101

21022102

2103-
if (/chrome/.test(window.navigator.userAgent)) {
2103+
if (support.classes) {
21042104
it('should support assigning bindings to class-based controller', function() {
21052105
var called = false;
21062106
var data = [

0 commit comments

Comments
 (0)