Skip to content

Commit

Permalink
Update to RC (#149)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
davideast committed May 5, 2016
1 parent 62c1607 commit 1eb383a
Show file tree
Hide file tree
Showing 27 changed files with 198 additions and 192 deletions.
Binary file removed angularfire2-2.0.0-alpha.16.tgz
Binary file not shown.
90 changes: 88 additions & 2 deletions karma-test-shim.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,88 @@
import {BrowserDomAdapter} from 'angular2/platform/browser';
BrowserDomAdapter.makeCurrent();
/*global jasmine, __karma__, window*/
Error.stackTraceLimit = Infinity;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;

__karma__.loaded = function () {
};


function isJsFile(path) {
return path.slice(-3) == '.js';
}

function isSpecFile(path) {
return path.slice(-7) == 'spec.js';
}

function isBuiltFile(path) {
var builtPath = '/base/dist/';
return isJsFile(path) && (path.substr(0, builtPath.length) == builtPath);
}

var allSpecFiles = Object.keys(window.__karma__.files)
.filter(isSpecFile)
.filter(isBuiltFile);

// Load our SystemJS configuration.
System.config({
baseURL: '/base'
});

System.config(
{
map: {
'rxjs': 'node_modules/rxjs',
'@angular': 'node_modules/@angular',
firebase: 'node_modules/firebase/lib/firebase-web.js',
'app': 'dist'
},
packages: {
'app': {
main: 'main.js',
defaultExtension: 'js'
},
'@angular/core': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/compiler': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/common': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/platform-browser': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/platform-browser-dynamic': {
main: 'index.js',
defaultExtension: 'js'
},
'rxjs': {
main: 'Rx.js',
defaultExtension: 'js'
}
}
});

Promise.all([
System.import('@angular/core/testing'),
System.import('@angular/platform-browser-dynamic/testing')
]).then(function (providers) {
var testing = providers[0];
var testingBrowser = providers[1];

testing.setBaseTestProviders(testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);

}).then(function() {
// Finally, load all spec files.
// This will run the tests directly.
return Promise.all(
allSpecFiles.map(function (moduleName) {
return System.import(moduleName);
}));
}).then(__karma__.start, __karma__.error);
137 changes: 30 additions & 107 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,128 +1,51 @@
// Karma configuration
// Generated on Wed Jan 20 2016 06:08:48 GMT-0800 (PST)

module.exports = function(config) {
config.set({

plugins: [
require('./tools/test-server'),
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-firefox-launcher'),
require('karma-systemjs'),
require('karma-mocha-reporter')
],

systemjs: {
config: {
map: {
rxjs: 'node_modules/rxjs',
angular2: 'node_modules/angular2',
'zone.js': 'node_modules/zone.js/lib',
firebase: 'node_modules/firebase/lib/firebase-web.js',
'mock-promises': 'node_modules/mock-promises/lib/mock-promises.js',
'reflect-metadata': 'node_modules/reflect-metadata/temp/Reflect.js',
},
packages: {
'traceur': {
defaultExtension: 'js'
},
'angular2': {
defaultExtension: 'js'
},
'dist': {
defaultExtension: 'js'
},
'zone.js': {
defaultExtension: 'js'
},
'reflect-metadata': {
format: 'global'
},
'rxjs': {
main: 'Rx.js',
defaultExtension: 'js'
}
}
}
},

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',

frameworks: ['jasmine'],

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['systemjs', 'jasmine'],


// list of files / patterns to load in the browser
files: [
'node_modules/traceur/traceur.+(js|map)',
{pattern: 'node_modules/systemjs/dist/**/*.map', included: false, watched: false},
{pattern: 'node_modules/angular2/**/*.+(js|map)', included: false, watched: false},
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: false, watched: false},
{pattern: 'node_modules/reflect-metadata/**/*.+(js|map)', included: false, watched: false},
{pattern: 'node_modules/reflect-metadata/temp/Reflect.js', included: true, watched: false},
{pattern: 'node_modules/zone.js/lib/**/*.js', included: false, watched: false},
'node_modules/zone.js/lib/zone.js',
{pattern: 'karma-test-shim.js', included: true, watched: true},
{pattern: 'node_modules/rxjs/**/*.+(js|map)', included: false, watched: false},
{pattern: 'node_modules/firebase/lib/firebase-web.js', included: false, watched: false},
{pattern: 'node_modules/mock-promises/lib/mock-promises.js', included: false, watched: false},
{pattern: 'dist/**/*.js', included: false, watched: true},
{pattern: 'src/**/*.ts', included: false, watched: false},
'dist/**/*.spec.js',
'dist/*.spec.js',
{pattern: 'dist/**/*.js.map', included: false, watched: false},
],
// Polyfills.
'node_modules/es6-shim/es6-shim.js',

'node_modules/reflect-metadata/Reflect.js',

// list of files to exclude
exclude: [
],
// System.js for module loading
'node_modules/systemjs/dist/system-polyfills.js',
'node_modules/systemjs/dist/system.src.js',

// Zone.js dependencies
'node_modules/zone.js/dist/zone.js',
'node_modules/zone.js/dist/jasmine-patch.js',
'node_modules/zone.js/dist/async-test.js',

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


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

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

// web server port
{pattern: 'node_modules/firebase/lib/firebase-web.js', included: false, watched: false},
{pattern: 'node_modules/mock-promises/lib/mock-promises.js', included: false, watched: false},
{pattern: 'dist/**/*.js', included: false, watched: true},
{pattern: 'dist/**/*.js.map', included: false, watched: false}
],

reporters: ['mocha'],
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Firefox'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
browsers: ['Chrome'],
singleRun: false
})
}
};
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angularfire2",
"version": "2.0.0-alpha.16",
"version": "2.0.0-alpha.17",
"description": "",
"main": "./dist/angularfire2.js",
"jsnext:main": "./dist/es6/angularfire2.js",
Expand Down Expand Up @@ -29,9 +29,13 @@
},
"homepage": "https://github.com/angular/indy#readme",
"dependencies": {
"angular2": ">=2.0.0-beta.14 <2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"firebase": "2.4.2",
"rxjs": "5.0.0-beta.2"
"rxjs": "5.0.0-beta.6"
},
"devDependencies": {
"es6-module-loader": "^0.17.10",
Expand Down
23 changes: 13 additions & 10 deletions src/angularfire2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import {
beforeEachProviders,
expect,
inject,
injectAsync
} from 'angular2/testing';
import {Injector, provide, Provider} from 'angular2/core';
injectAsync,
async
} from '@angular/core/testing';
import {ReflectiveInjector, provide, Provider} from '@angular/core';
import {
AngularFire,
FirebaseObjectObservable,
Expand Down Expand Up @@ -43,7 +44,7 @@ describe('angularfire', () => {


it('should be injectable via FIREBASE_PROVIDERS', () => {
var injector = Injector.resolveAndCreate([FIREBASE_PROVIDERS, defaultFirebase(localServerUrl)]);
var injector = ReflectiveInjector.resolveAndCreate([FIREBASE_PROVIDERS, defaultFirebase(localServerUrl)]);
expect(injector.get(AngularFire)).toBeAnInstanceOf(AngularFire);
});

Expand Down Expand Up @@ -104,23 +105,25 @@ describe('angularfire', () => {
});


it('should return an observable of the path', injectAsync([AngularFire], (af:AngularFire) => {
it('should return an observable of the path', (done: any) => {
return (<any>observable)._ref.set({title: 'how to firebase?'})
.then(() => observable.take(1).toPromise())
.then((data:any) => {
expect(data).toEqual({title: 'how to firebase?'});
done();
});
}));
});


it('should preserve snapshot if preserveSnapshot option specified', injectAsync([AngularFire], (af:AngularFire) => {
it('should preserve snapshot if preserveSnapshot option specified', (done: any) => {
observable = af.object(`list-of-questions/`, {preserveSnapshot: true});
return (<any>observable)._ref.set({title: 'how to firebase?'})
.then(() => observable.take(1).toPromise())
.then((data:any) => {
expect(data.val()).toEqual({title: 'how to firebase?'});
done();
});
}));
});
});


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

describe('FIREBASE_REF', () => {
it('should provide a FirebaseRef for the FIREBASE_REF binding', () => {
var injector = Injector.resolveAndCreate([
var injector = ReflectiveInjector.resolveAndCreate([
provide(FirebaseUrl, {
useValue: localServerUrl
}),
Expand All @@ -153,7 +156,7 @@ describe('angularfire', () => {


it('should inject a FIR reference', () => {
const injector = Injector.resolveAndCreate([defaultFirebase(localServerUrl), FIREBASE_PROVIDERS]);
const injector = ReflectiveInjector.resolveAndCreate([defaultFirebase(localServerUrl), FIREBASE_PROVIDERS]);
expect(injector.get(FirebaseRef).toString()).toBe(localServerUrl);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/angularfire2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {APP_INITIALIZER, Inject, Injectable, OpaqueToken, provide, Provider} from 'angular2/core';
import {APP_INITIALIZER, Inject, Injectable, OpaqueToken, provide, Provider} from '@angular/core';
import {FirebaseAuth, firebaseAuthConfig} from './providers/auth';
import * as Firebase from 'firebase';
import {FirebaseListObservable} from './utils/firebase_list_observable';
Expand Down
2 changes: 1 addition & 1 deletion src/angularfire2_worker_app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {provide} from 'angular2/core';
import {provide} from '@angular/core';
import {COMMON_PROVIDERS} from './angularfire2';
import {AuthBackend} from './providers/auth_backend';
import {WebWorkerFirebaseAuth} from './providers/web_workers/worker/auth';
Expand Down
2 changes: 1 addition & 1 deletion src/angularfire2_worker_render.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {provide} from 'angular2/core';
import {provide} from '@angular/core';
import {COMMON_PROVIDERS} from './angularfire2';
import {FirebaseSdkAuthBackend} from './providers/firebase_sdk_auth_backend';
import {WebWorkerFirebaseAuth} from './providers/web_workers/worker/auth';
Expand Down
2 changes: 1 addition & 1 deletion src/database/database.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Inject, Injectable} from 'angular2/core';
import {Inject, Injectable} from '@angular/core';
import {FirebaseUrl} from '../tokens';
import {FirebaseListObservable} from '../utils/firebase_list_observable';
import {FirebaseObjectObservable} from '../utils/firebase_object_observable';
Expand Down
8 changes: 4 additions & 4 deletions src/providers/auth.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference path="../../manual_typings/manual_typings.d.ts" />

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

describe('FirebaseAuth', () => {
let injector: Injector = null;
let injector: ReflectiveInjector = null;
let ref: Firebase = null;
let authData: any = null;
let authCb: any = null;
Expand Down Expand Up @@ -56,7 +56,7 @@ describe('FirebaseAuth', () => {
beforeEach(() => {
authData = null;
authCb = null;
injector = Injector.resolveAndCreate([
injector = ReflectiveInjector.resolveAndCreate([
provide(FirebaseUrl, {
useValue: 'https://angularfire2-auth.firebaseio-demo.com/'
}),
Expand Down
Loading

0 comments on commit 1eb383a

Please sign in to comment.