Skip to content

Commit

Permalink
feat(*): Support for RC6
Browse files Browse the repository at this point in the history
Closes #604
Closes #613
  • Loading branch information
timwright35 authored and sebholstein committed Sep 2, 2016
1 parent fadcf03 commit c50bc92
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 74 deletions.
49 changes: 33 additions & 16 deletions karma-systemjs-config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,44 @@
(function (global) {
var paths = {
// paths serve as alias
'npm:': 'base/node_modules/'
};
var map = {
'rxjs': 'base/node_modules/rxjs',
'@angular': 'base/node_modules/@angular'
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',

// angular testing umd bundles
'@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
'@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
'@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
'@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
'@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
'@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
'@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',
'@angular/forms/testing': 'npm:@angular/forms/bundles/forms-testing.umd.js',

// other libraries
'rxjs': 'npm:rxjs',
};
var packages = {
'rxjs': { defaultExtension: 'js' },
rxjs: {
defaultExtension: 'js'
}
};
var packageNames = [
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/platform-browser',
'@angular/platform-browser-dynamic'
];
packageNames.forEach(function (pkgName) {
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
});
var config = {
map: map,
packages: packages
paths: paths,
map: map,
packages: packages
};
if (global.filterSystemConfig) {
global.filterSystemConfig(config);
global.filterSystemConfig(config);
}
System.config(config);
})(this);
21 changes: 12 additions & 9 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@ module.exports = function(config) {
},
files: [
{pattern: 'node_modules/core-js/client/core.js', included: true, watched: true},
{pattern: 'node_modules/zone.js/dist/zone.js', included: true, watched: true},
// Needed for async testsing {https://github.com/angular/angular/issues/8232}
{pattern: 'node_modules/zone.js/dist/async-test.js', included: true, watched: true},
'node_modules/reflect-metadata/Reflect.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/zone.js/dist/long-stack-trace-zone.js',
'node_modules/zone.js/dist/proxy.js',
'node_modules/zone.js/dist/sync-test.js',
'node_modules/zone.js/dist/jasmine-patch.js',
'node_modules/zone.js/dist/async-test.js',
'node_modules/zone.js/dist/fake-async-test.js',
{pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: true, watched: false },
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},

{pattern: 'karma-systemjs-config.js', included: true, watched: true},

{pattern: 'node_modules/rxjs/**/*', included: false, watched: false},
{pattern: 'node_modules/@angular/common/**/*', included: false, watched: false},
{pattern: 'node_modules/@angular/core/**/*', included: false, watched: false},
{pattern: 'node_modules/@angular/platform-browser/**/*', included: false, watched: false},
{pattern: 'node_modules/@angular/compiler/**/*', included: false, watched: false},
{pattern: 'node_modules/@angular/platform-browser-dynamic/**/*', included: false, watched: false},
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false},
{pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false},
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: false},
{pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false},

{pattern: 'karma-test-shim.js', included: true, watched: true},

Expand Down
32 changes: 15 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@
},
"homepage": "https://github.com/SebastianM/angular2-google-maps#readme",
"dependencies": {
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12"
"@angular/common": "2.0.0-rc.6",
"@angular/compiler": "2.0.0-rc.6",
"@angular/core": "2.0.0-rc.6",
"@angular/platform-browser": "2.0.0-rc.6",
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
"rxjs": "5.0.0-beta.11",
"zone.js": "^0.6.17"
},
"devDependencies": {
"babel-eslint": "6.0.4",
Expand Down Expand Up @@ -64,21 +63,20 @@
"run-sequence": "1.2.2",
"systemjs": "0.19.29",
"tslint": "3.13.0",
"typescript": "1.8.10",
"typescript": "^2.0.2",
"typings": "1.0.4",
"watchify": "3.7.0"
},
"jspm": {
"jspmNodeConversion": false,
"dependencies": {
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12"
"@angular/common": "2.0.0-rc.6",
"@angular/compiler": "2.0.0-rc.6",
"@angular/core": "2.0.0-rc.6",
"@angular/platform-browser": "2.0.0-rc.6",
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
"rxjs": "5.0.0-beta.11",
"zone.js": "^0.6.17"
}
}
}
3 changes: 2 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default {
'rxjs/Subject': 'Rx',
'rxjs/observable/PromiseObservable': 'Rx',
'rxjs/operator/toPromise': 'Rx.Observable.prototype',
'rxjs/Observable': 'Rx'
'rxjs/Observable': 'Rx',
'rxjs/Rx': 'Rx'
}
}
4 changes: 2 additions & 2 deletions src/core/core-module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ModuleWithProviders, NgModule, Provider, provide} from '@angular/core';
import {ModuleWithProviders, NgModule, Provider} from '@angular/core';

import {SebmGoogleMap} from './directives/google-map';
import {SebmGoogleMapCircle} from './directives/google-map-circle';
Expand Down Expand Up @@ -27,7 +27,7 @@ export class AgmCoreModule {
*/
static forRoot(lazyMapsAPILoaderConfig?: LazyMapsAPILoaderConfigLiteral): ModuleWithProviders {
const providers: Provider[] =
[...BROWSER_GLOBALS_PROVIDERS, provide(MapsAPILoader, {useClass: LazyMapsAPILoader})];
[...BROWSER_GLOBALS_PROVIDERS, {provide: MapsAPILoader, useClass: LazyMapsAPILoader}];
if (lazyMapsAPILoaderConfig) {
providers.push(provideLazyMapsAPILoaderConfig(lazyMapsAPILoaderConfig));
}
Expand Down
7 changes: 4 additions & 3 deletions src/core/services/maps-api-loader/lazy-maps-api-loader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Inject, Injectable, Optional, Provider, provide} from '@angular/core';
import {Inject, Injectable, Optional, Provider} from '@angular/core';

import {DOCUMENT_GLOBAL, WINDOW_GLOBAL} from '../../utils/browser-globals';

Expand Down Expand Up @@ -183,7 +183,8 @@ export class LazyMapsAPILoader extends MapsAPILoader {
*/
export function provideLazyMapsAPILoaderConfig(confLiteral: LazyMapsAPILoaderConfigLiteral):
Provider {
return provide(LazyMapsAPILoaderConfig, {
return {
provide: LazyMapsAPILoaderConfig,
useFactory: () => {
const config = new LazyMapsAPILoaderConfig();
// todo(sebastian): deprecate LazyMapsAPILoader class
Expand All @@ -198,5 +199,5 @@ export function provideLazyMapsAPILoaderConfig(confLiteral: LazyMapsAPILoaderCon
config.region = config.region || DEFAULT_CONFIGURATION.region;
return config;
}
});
};
}
4 changes: 2 additions & 2 deletions src/core/utils/browser-globals.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {OpaqueToken, Provider, provide} from '@angular/core';
import {OpaqueToken, Provider} from '@angular/core';

export const WINDOW_GLOBAL = new OpaqueToken('angular2-google-maps window_global');
export const DOCUMENT_GLOBAL = new OpaqueToken('angular2-google-maps document_global');

export const BROWSER_GLOBALS_PROVIDERS: Provider[] =
[provide(WINDOW_GLOBAL, {useValue: window}), provide(DOCUMENT_GLOBAL, {useValue: document})];
[{provide: WINDOW_GLOBAL, useValue: window}, {provide: DOCUMENT_GLOBAL, useValue: document}];
18 changes: 10 additions & 8 deletions test/services/managers/marker-manager.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NgZone} from '@angular/core';
import {addProviders, async, inject} from '@angular/core/testing';
import {TestBed, async, inject} from '@angular/core/testing';

import {SebmGoogleMapMarker} from '../../../src/core/directives/google-map-marker';
import {GoogleMapsAPIWrapper} from '../../../src/core/services/google-maps-api-wrapper';
Expand All @@ -9,13 +9,15 @@ import {MarkerManager} from '../../../src/core/services/managers/marker-manager'
export function main() {
describe('MarkerManager', () => {
beforeEach(() => {
addProviders([
{provide: NgZone, useFactory: () => new NgZone({enableLongStackTrace: true})},
MarkerManager, SebmGoogleMapMarker, {
provide: GoogleMapsAPIWrapper,
useValue: jasmine.createSpyObj('GoogleMapsAPIWrapper', ['createMarker'])
}
]);
TestBed.configureTestingModule({
providers: [
{provide: NgZone, useFactory: () => new NgZone({enableLongStackTrace: true})},
MarkerManager, SebmGoogleMapMarker, {
provide: GoogleMapsAPIWrapper,
useValue: jasmine.createSpyObj('GoogleMapsAPIWrapper', ['createMarker'])
}
]
});
});

describe('Create a new marker', () => {
Expand Down
18 changes: 10 additions & 8 deletions test/services/managers/polyline-manager.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NgZone} from '@angular/core';
import {addProviders, inject} from '@angular/core/testing';
import {TestBed, inject} from '@angular/core/testing';

import {SebmGoogleMapPolyline} from '../../../src/core/directives/google-map-polyline';
import {GoogleMapsAPIWrapper} from '../../../src/core/services/google-maps-api-wrapper';
Expand All @@ -9,13 +9,15 @@ import {PolylineManager} from '../../../src/core/services/managers/polyline-mana
export function main() {
describe('PolylineManager', () => {
beforeEach(() => {
addProviders([
{provide: NgZone, useFactory: () => new NgZone({enableLongStackTrace: true})},
PolylineManager, SebmGoogleMapPolyline, {
provide: GoogleMapsAPIWrapper,
useValue: jasmine.createSpyObj('GoogleMapsAPIWrapper', ['createPolyline'])
}
]);
TestBed.configureTestingModule({
providers: [
{provide: NgZone, useFactory: () => new NgZone({enableLongStackTrace: true})},
PolylineManager, SebmGoogleMapPolyline, {
provide: GoogleMapsAPIWrapper,
useValue: jasmine.createSpyObj('GoogleMapsAPIWrapper', ['createPolyline'])
}
]
});
});

describe('Create a new polyline', () => {
Expand Down
18 changes: 10 additions & 8 deletions test/services/maps-api-loader/lazy-maps-api-loader.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {addProviders, inject} from '@angular/core/testing';
import {TestBed, inject} from '@angular/core/testing';

import {LazyMapsAPILoader} from '../../../src/core/services/maps-api-loader/lazy-maps-api-loader';
import {MapsAPILoader} from '../../../src/core/services/maps-api-loader/maps-api-loader';
Expand All @@ -7,13 +7,15 @@ import {DOCUMENT_GLOBAL, WINDOW_GLOBAL} from '../../../src/core/utils/browser-gl
export function main() {
describe('Service: LazyMapsAPILoader', () => {
beforeEach(() => {
addProviders([
{provide: MapsAPILoader, useClass: LazyMapsAPILoader},
{provide: WINDOW_GLOBAL, useValue: {}}, {
provide: DOCUMENT_GLOBAL,
useValue: jasmine.createSpyObj<Document>('Document', ['createElement'])
}
]);
TestBed.configureTestingModule({
providers: [
{provide: MapsAPILoader, useClass: LazyMapsAPILoader},
{provide: WINDOW_GLOBAL, useValue: {}}, {
provide: DOCUMENT_GLOBAL,
useValue: jasmine.createSpyObj<Document>('Document', ['createElement'])
}
]
});
});

it('should create the default script URL',
Expand Down

0 comments on commit c50bc92

Please sign in to comment.