Skip to content

Commit 1eb383a

Browse files
committed
Update to RC (#149)
* feat(list): Add methods to FirebaseListObservable * feat(list): .remove() should remove the whole list if no param is provided * chore(utils): Add utils for runtime type checking * feat(list): Accept url or ref * chore(utils): function for checking for url or firebase ref * feat(object): Accept a ref for .object() * fix(auth): login() with Password provides credentials * fix(auth): Add expires to FirebaseAuthState * fix(auth): Add PasswordCredentials interface * feat(auth): Add createUser method on auth * fix(auth): Add expires in original declaration * feat(querying) Add Querying API * feat(querying) * lots of fixes to query * feat(querying): Awesome dynamic querying * feat(querying): Tests for querying * chore(querying): Remove commented out code * feat(build): Change build for local typescript * fix(database): Trigger observer error from .on() cancel callback * fix(query): Feedback from jeffbcross * fix(querying): Newline * chore(version): Update to rc * chore(version): Upgrade rxjs to beta 6 * chore(merge): Clean up merge conflics * fix(typings): Provide more specific typings
1 parent 62c1607 commit 1eb383a

27 files changed

+198
-192
lines changed

angularfire2-2.0.0-alpha.16.tgz

-24.3 KB
Binary file not shown.

karma-test-shim.js

+88-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,88 @@
1-
import {BrowserDomAdapter} from 'angular2/platform/browser';
2-
BrowserDomAdapter.makeCurrent();
1+
/*global jasmine, __karma__, window*/
2+
Error.stackTraceLimit = Infinity;
3+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
4+
5+
__karma__.loaded = function () {
6+
};
7+
8+
9+
function isJsFile(path) {
10+
return path.slice(-3) == '.js';
11+
}
12+
13+
function isSpecFile(path) {
14+
return path.slice(-7) == 'spec.js';
15+
}
16+
17+
function isBuiltFile(path) {
18+
var builtPath = '/base/dist/';
19+
return isJsFile(path) && (path.substr(0, builtPath.length) == builtPath);
20+
}
21+
22+
var allSpecFiles = Object.keys(window.__karma__.files)
23+
.filter(isSpecFile)
24+
.filter(isBuiltFile);
25+
26+
// Load our SystemJS configuration.
27+
System.config({
28+
baseURL: '/base'
29+
});
30+
31+
System.config(
32+
{
33+
map: {
34+
'rxjs': 'node_modules/rxjs',
35+
'@angular': 'node_modules/@angular',
36+
firebase: 'node_modules/firebase/lib/firebase-web.js',
37+
'app': 'dist'
38+
},
39+
packages: {
40+
'app': {
41+
main: 'main.js',
42+
defaultExtension: 'js'
43+
},
44+
'@angular/core': {
45+
main: 'index.js',
46+
defaultExtension: 'js'
47+
},
48+
'@angular/compiler': {
49+
main: 'index.js',
50+
defaultExtension: 'js'
51+
},
52+
'@angular/common': {
53+
main: 'index.js',
54+
defaultExtension: 'js'
55+
},
56+
'@angular/platform-browser': {
57+
main: 'index.js',
58+
defaultExtension: 'js'
59+
},
60+
'@angular/platform-browser-dynamic': {
61+
main: 'index.js',
62+
defaultExtension: 'js'
63+
},
64+
'rxjs': {
65+
main: 'Rx.js',
66+
defaultExtension: 'js'
67+
}
68+
}
69+
});
70+
71+
Promise.all([
72+
System.import('@angular/core/testing'),
73+
System.import('@angular/platform-browser-dynamic/testing')
74+
]).then(function (providers) {
75+
var testing = providers[0];
76+
var testingBrowser = providers[1];
77+
78+
testing.setBaseTestProviders(testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
79+
testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
80+
81+
}).then(function() {
82+
// Finally, load all spec files.
83+
// This will run the tests directly.
84+
return Promise.all(
85+
allSpecFiles.map(function (moduleName) {
86+
return System.import(moduleName);
87+
}));
88+
}).then(__karma__.start, __karma__.error);

karma.conf.js

+30-107
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,51 @@
11
// Karma configuration
2-
// Generated on Wed Jan 20 2016 06:08:48 GMT-0800 (PST)
3-
42
module.exports = function(config) {
53
config.set({
64

7-
plugins: [
8-
require('./tools/test-server'),
9-
require('karma-jasmine'),
10-
require('karma-chrome-launcher'),
11-
require('karma-firefox-launcher'),
12-
require('karma-systemjs'),
13-
require('karma-mocha-reporter')
14-
],
15-
16-
systemjs: {
17-
config: {
18-
map: {
19-
rxjs: 'node_modules/rxjs',
20-
angular2: 'node_modules/angular2',
21-
'zone.js': 'node_modules/zone.js/lib',
22-
firebase: 'node_modules/firebase/lib/firebase-web.js',
23-
'mock-promises': 'node_modules/mock-promises/lib/mock-promises.js',
24-
'reflect-metadata': 'node_modules/reflect-metadata/temp/Reflect.js',
25-
},
26-
packages: {
27-
'traceur': {
28-
defaultExtension: 'js'
29-
},
30-
'angular2': {
31-
defaultExtension: 'js'
32-
},
33-
'dist': {
34-
defaultExtension: 'js'
35-
},
36-
'zone.js': {
37-
defaultExtension: 'js'
38-
},
39-
'reflect-metadata': {
40-
format: 'global'
41-
},
42-
'rxjs': {
43-
main: 'Rx.js',
44-
defaultExtension: 'js'
45-
}
46-
}
47-
}
48-
},
49-
50-
// base path that will be used to resolve all patterns (eg. files, exclude)
515
basePath: '',
526

7+
frameworks: ['jasmine'],
538

54-
// frameworks to use
55-
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
56-
frameworks: ['systemjs', 'jasmine'],
57-
58-
59-
// list of files / patterns to load in the browser
609
files: [
61-
'node_modules/traceur/traceur.+(js|map)',
62-
{pattern: 'node_modules/systemjs/dist/**/*.map', included: false, watched: false},
63-
{pattern: 'node_modules/angular2/**/*.+(js|map)', included: false, watched: false},
64-
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: false, watched: false},
65-
{pattern: 'node_modules/reflect-metadata/**/*.+(js|map)', included: false, watched: false},
66-
{pattern: 'node_modules/reflect-metadata/temp/Reflect.js', included: true, watched: false},
67-
{pattern: 'node_modules/zone.js/lib/**/*.js', included: false, watched: false},
68-
'node_modules/zone.js/lib/zone.js',
69-
{pattern: 'karma-test-shim.js', included: true, watched: true},
70-
{pattern: 'node_modules/rxjs/**/*.+(js|map)', included: false, watched: false},
71-
{pattern: 'node_modules/firebase/lib/firebase-web.js', included: false, watched: false},
72-
{pattern: 'node_modules/mock-promises/lib/mock-promises.js', included: false, watched: false},
73-
{pattern: 'dist/**/*.js', included: false, watched: true},
74-
{pattern: 'src/**/*.ts', included: false, watched: false},
75-
'dist/**/*.spec.js',
76-
'dist/*.spec.js',
77-
{pattern: 'dist/**/*.js.map', included: false, watched: false},
78-
],
10+
// Polyfills.
11+
'node_modules/es6-shim/es6-shim.js',
7912

13+
'node_modules/reflect-metadata/Reflect.js',
8014

81-
// list of files to exclude
82-
exclude: [
83-
],
15+
// System.js for module loading
16+
'node_modules/systemjs/dist/system-polyfills.js',
17+
'node_modules/systemjs/dist/system.src.js',
8418

19+
// Zone.js dependencies
20+
'node_modules/zone.js/dist/zone.js',
21+
'node_modules/zone.js/dist/jasmine-patch.js',
22+
'node_modules/zone.js/dist/async-test.js',
8523

86-
// preprocess matching files before serving them to the browser
87-
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
88-
preprocessors: {
89-
},
24+
// RxJs.
25+
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
26+
{ pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },
9027

9128

92-
// test results reporter to use
93-
// possible values: 'dots', 'progress'
94-
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
95-
reporters: ['mocha'],
29+
{pattern: 'karma-test-shim.js', included: true, watched: true},
30+
{pattern: 'built/test/matchers.js', included: true, watched: true},
9631

32+
// paths loaded via module imports
33+
// Angular itself
34+
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: true},
35+
{pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: true},
9736

98-
// web server port
37+
{pattern: 'node_modules/firebase/lib/firebase-web.js', included: false, watched: false},
38+
{pattern: 'node_modules/mock-promises/lib/mock-promises.js', included: false, watched: false},
39+
{pattern: 'dist/**/*.js', included: false, watched: true},
40+
{pattern: 'dist/**/*.js.map', included: false, watched: false}
41+
],
42+
43+
reporters: ['mocha'],
9944
port: 9876,
100-
101-
102-
// enable / disable colors in the output (reporters and logs)
10345
colors: true,
104-
105-
106-
// level of logging
107-
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
10846
logLevel: config.LOG_INFO,
109-
110-
111-
// enable / disable watching file and executing tests whenever any file changes
11247
autoWatch: true,
113-
114-
115-
// start these browsers
116-
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
117-
browsers: ['Firefox'],
118-
119-
120-
// Continuous Integration mode
121-
// if true, Karma captures browsers, runs the tests and exits
122-
singleRun: false,
123-
124-
// Concurrency level
125-
// how many browser should be started simultaneous
126-
concurrency: Infinity
48+
browsers: ['Chrome'],
49+
singleRun: false
12750
})
128-
}
51+
};

package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angularfire2",
3-
"version": "2.0.0-alpha.16",
3+
"version": "2.0.0-alpha.17",
44
"description": "",
55
"main": "./dist/angularfire2.js",
66
"jsnext:main": "./dist/es6/angularfire2.js",
@@ -29,9 +29,13 @@
2929
},
3030
"homepage": "https://github.com/angular/indy#readme",
3131
"dependencies": {
32-
"angular2": ">=2.0.0-beta.14 <2.0.0-rc.1",
32+
"@angular/core": "2.0.0-rc.1",
33+
"@angular/platform-browser": "2.0.0-rc.1",
34+
"@angular/common": "2.0.0-rc.1",
35+
"@angular/compiler": "2.0.0-rc.1",
36+
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
3337
"firebase": "2.4.2",
34-
"rxjs": "5.0.0-beta.2"
38+
"rxjs": "5.0.0-beta.6"
3539
},
3640
"devDependencies": {
3741
"es6-module-loader": "^0.17.10",

src/angularfire2.spec.ts

+13-10
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import {
77
beforeEachProviders,
88
expect,
99
inject,
10-
injectAsync
11-
} from 'angular2/testing';
12-
import {Injector, provide, Provider} from 'angular2/core';
10+
injectAsync,
11+
async
12+
} from '@angular/core/testing';
13+
import {ReflectiveInjector, provide, Provider} from '@angular/core';
1314
import {
1415
AngularFire,
1516
FirebaseObjectObservable,
@@ -43,7 +44,7 @@ describe('angularfire', () => {
4344

4445

4546
it('should be injectable via FIREBASE_PROVIDERS', () => {
46-
var injector = Injector.resolveAndCreate([FIREBASE_PROVIDERS, defaultFirebase(localServerUrl)]);
47+
var injector = ReflectiveInjector.resolveAndCreate([FIREBASE_PROVIDERS, defaultFirebase(localServerUrl)]);
4748
expect(injector.get(AngularFire)).toBeAnInstanceOf(AngularFire);
4849
});
4950

@@ -104,23 +105,25 @@ describe('angularfire', () => {
104105
});
105106

106107

107-
it('should return an observable of the path', injectAsync([AngularFire], (af:AngularFire) => {
108+
it('should return an observable of the path', (done: any) => {
108109
return (<any>observable)._ref.set({title: 'how to firebase?'})
109110
.then(() => observable.take(1).toPromise())
110111
.then((data:any) => {
111112
expect(data).toEqual({title: 'how to firebase?'});
113+
done();
112114
});
113-
}));
115+
});
114116

115117

116-
it('should preserve snapshot if preserveSnapshot option specified', injectAsync([AngularFire], (af:AngularFire) => {
118+
it('should preserve snapshot if preserveSnapshot option specified', (done: any) => {
117119
observable = af.object(`list-of-questions/`, {preserveSnapshot: true});
118120
return (<any>observable)._ref.set({title: 'how to firebase?'})
119121
.then(() => observable.take(1).toPromise())
120122
.then((data:any) => {
121123
expect(data.val()).toEqual({title: 'how to firebase?'});
124+
done();
122125
});
123-
}));
126+
});
124127
});
125128

126129

@@ -135,7 +138,7 @@ describe('angularfire', () => {
135138

136139
describe('FIREBASE_REF', () => {
137140
it('should provide a FirebaseRef for the FIREBASE_REF binding', () => {
138-
var injector = Injector.resolveAndCreate([
141+
var injector = ReflectiveInjector.resolveAndCreate([
139142
provide(FirebaseUrl, {
140143
useValue: localServerUrl
141144
}),
@@ -153,7 +156,7 @@ describe('angularfire', () => {
153156

154157

155158
it('should inject a FIR reference', () => {
156-
const injector = Injector.resolveAndCreate([defaultFirebase(localServerUrl), FIREBASE_PROVIDERS]);
159+
const injector = ReflectiveInjector.resolveAndCreate([defaultFirebase(localServerUrl), FIREBASE_PROVIDERS]);
157160
expect(injector.get(FirebaseRef).toString()).toBe(localServerUrl);
158161
});
159162
});

src/angularfire2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {APP_INITIALIZER, Inject, Injectable, OpaqueToken, provide, Provider} from 'angular2/core';
1+
import {APP_INITIALIZER, Inject, Injectable, OpaqueToken, provide, Provider} from '@angular/core';
22
import {FirebaseAuth, firebaseAuthConfig} from './providers/auth';
33
import * as Firebase from 'firebase';
44
import {FirebaseListObservable} from './utils/firebase_list_observable';

src/angularfire2_worker_app.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {provide} from 'angular2/core';
1+
import {provide} from '@angular/core';
22
import {COMMON_PROVIDERS} from './angularfire2';
33
import {AuthBackend} from './providers/auth_backend';
44
import {WebWorkerFirebaseAuth} from './providers/web_workers/worker/auth';

src/angularfire2_worker_render.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {provide} from 'angular2/core';
1+
import {provide} from '@angular/core';
22
import {COMMON_PROVIDERS} from './angularfire2';
33
import {FirebaseSdkAuthBackend} from './providers/firebase_sdk_auth_backend';
44
import {WebWorkerFirebaseAuth} from './providers/web_workers/worker/auth';

src/database/database.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Inject, Injectable} from 'angular2/core';
1+
import {Inject, Injectable} from '@angular/core';
22
import {FirebaseUrl} from '../tokens';
33
import {FirebaseListObservable} from '../utils/firebase_list_observable';
44
import {FirebaseObjectObservable} from '../utils/firebase_object_observable';

src/providers/auth.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference path="../../manual_typings/manual_typings.d.ts" />
22

3-
import {expect, describe, it, iit, beforeEach} from 'angular2/testing';
4-
import {Injector, provide, Provider} from 'angular2/core';
3+
import {expect, describe, it, iit, beforeEach} from '@angular/core/testing';
4+
import {ReflectiveInjector, provide, Provider} from '@angular/core';
55
import {Observable} from 'rxjs/Observable'
66
import {
77
FIREBASE_PROVIDERS,
@@ -19,7 +19,7 @@ import * as Firebase from 'firebase';
1919
import * as mockPromises from 'mock-promises';
2020

2121
describe('FirebaseAuth', () => {
22-
let injector: Injector = null;
22+
let injector: ReflectiveInjector = null;
2323
let ref: Firebase = null;
2424
let authData: any = null;
2525
let authCb: any = null;
@@ -56,7 +56,7 @@ describe('FirebaseAuth', () => {
5656
beforeEach(() => {
5757
authData = null;
5858
authCb = null;
59-
injector = Injector.resolveAndCreate([
59+
injector = ReflectiveInjector.resolveAndCreate([
6060
provide(FirebaseUrl, {
6161
useValue: 'https://angularfire2-auth.firebaseio-demo.com/'
6262
}),

0 commit comments

Comments
 (0)