From 801d393b18576897d1d09f1ec187f1145759cb16 Mon Sep 17 00:00:00 2001 From: Abraham Haskins Date: Tue, 16 Aug 2016 11:35:48 -0700 Subject: [PATCH 1/7] First pass --- src/FirebaseArray.js | 2 +- src/FirebaseAuth.js | 2 +- src/FirebaseObject.js | 2 +- src/firebase.js | 1 + src/firebaseAuthService.js | 2 +- src/firebaseRef.js | 2 +- src/module.js | 12 ++++++++---- src/utils.js | 2 +- tests/initialize-node.js | 3 +-- tests/unit/FirebaseArray.spec.js | 2 +- tests/unit/FirebaseAuth.spec.js | 3 ++- tests/unit/FirebaseAuthService.spec.js | 11 +++++++---- tests/unit/FirebaseObject.spec.js | 4 ++-- tests/unit/firebaseRef.spec.js | 2 +- tests/unit/utils.spec.js | 2 +- 15 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/FirebaseArray.js b/src/FirebaseArray.js index 6843511e..76719940 100644 --- a/src/FirebaseArray.js +++ b/src/FirebaseArray.js @@ -47,7 +47,7 @@ * var list = new ExtendedArray(ref); * */ - angular.module('firebase').factory('$firebaseArray', ["$log", "$firebaseUtils", "$q", + angular.module('angularfire.database').factory('$firebaseArray', ["$log", "$firebaseUtils", "$q", function($log, $firebaseUtils, $q) { /** * This constructor should probably never be called manually. It is used internally by diff --git a/src/FirebaseAuth.js b/src/FirebaseAuth.js index a4d84884..d95ea7fd 100644 --- a/src/FirebaseAuth.js +++ b/src/FirebaseAuth.js @@ -3,7 +3,7 @@ var FirebaseAuth; // Define a service which provides user authentication and management. - angular.module('firebase').factory('$firebaseAuth', [ + angular.module('angularfire.auth').factory('$firebaseAuth', [ '$q', '$firebaseUtils', function($q, $firebaseUtils) { /** * This factory returns an object allowing you to manage the client's authentication state. diff --git a/src/FirebaseObject.js b/src/FirebaseObject.js index 88cb89c5..9593f375 100644 --- a/src/FirebaseObject.js +++ b/src/FirebaseObject.js @@ -22,7 +22,7 @@ * var obj = new ExtendedObject(ref); * */ - angular.module('firebase').factory('$firebaseObject', [ + angular.module('angularfire.database').factory('$firebaseObject', [ '$parse', '$firebaseUtils', '$log', '$q', function($parse, $firebaseUtils, $log, $q) { /** diff --git a/src/firebase.js b/src/firebase.js index ba7cd220..04f7d7f5 100644 --- a/src/firebase.js +++ b/src/firebase.js @@ -6,6 +6,7 @@ /** @deprecated */ .factory("$firebase", function() { return function() { + //TODO: Update this error to speak about new module stuff throw new Error('$firebase has been removed. You may instantiate $firebaseArray and $firebaseObject ' + 'directly now. For simple write operations, just use the Firebase ref directly. ' + 'See the AngularFire 1.0.0 changelog for details: https://github.com/firebase/angularfire/releases/tag/v1.0.0'); diff --git a/src/firebaseAuthService.js b/src/firebaseAuthService.js index b08374c8..fea358b4 100644 --- a/src/firebaseAuthService.js +++ b/src/firebaseAuthService.js @@ -6,7 +6,7 @@ } FirebaseAuthService.$inject = ['$firebaseAuth']; - angular.module('firebase') + angular.module('angularfire.auth') .factory('$firebaseAuthService', FirebaseAuthService); })(); diff --git a/src/firebaseRef.js b/src/firebaseRef.js index d1ecc65d..df6db814 100644 --- a/src/firebaseRef.js +++ b/src/firebaseRef.js @@ -40,7 +40,7 @@ }; } - angular.module('firebase') + angular.module('angularfire.config') .provider('$firebaseRef', FirebaseRef); })(); diff --git a/src/module.js b/src/module.js index 1bff256b..4a3973c3 100644 --- a/src/module.js +++ b/src/module.js @@ -1,10 +1,14 @@ (function(exports) { "use strict"; -// Define the `firebase` module under which all AngularFire -// services will live. + // Define the `firebase` module under which all AngularFire + // services will live. angular.module("firebase", []) - //todo use $window + //TODO: use $window .value("Firebase", exports.Firebase); -})(window); \ No newline at end of file + angular.module("angularfire.utils", []) + angular.module("angularfire.config", []) + angular.module("angularfire.auth", ["angularfire.utils"]); + angular.module("angularfire.database", ["angularfire.utils"]); +})(window); diff --git a/src/utils.js b/src/utils.js index b4a664df..3e8c1893 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,7 +1,7 @@ (function() { 'use strict'; - angular.module('firebase') + angular.module('angularfire.utils') .factory('$firebaseConfig', ["$firebaseArray", "$firebaseObject", "$injector", function($firebaseArray, $firebaseObject, $injector) { return function(configOpts) { diff --git a/tests/initialize-node.js b/tests/initialize-node.js index 4b9b3b5d..d551fbdf 100644 --- a/tests/initialize-node.js +++ b/tests/initialize-node.js @@ -7,8 +7,7 @@ if (!process.env.ANGULARFIRE_TEST_DB_URL) { try { firebase.initializeApp({ - databaseURL: process.env.ANGULARFIRE_TEST_DB_URL, - serviceAccount: path.resolve(__dirname, './key.json') + databaseURL: process.env.ANGULARFIRE_TEST_DB_URL }); } catch (err) { console.log('Failed to initialize the Firebase SDK [Node]:', err); diff --git a/tests/unit/FirebaseArray.spec.js b/tests/unit/FirebaseArray.spec.js index acceca7a..3e225704 100644 --- a/tests/unit/FirebaseArray.spec.js +++ b/tests/unit/FirebaseArray.spec.js @@ -31,7 +31,7 @@ describe('$firebaseArray', function () { var arr, $firebaseArray, $utils, $timeout, $rootScope, $q, tick, testutils; beforeEach(function() { - module('firebase'); + module('angularfire.database'); module('testutils'); inject(function (_$firebaseArray_, $firebaseUtils, _$timeout_, _$rootScope_, _$q_, _testutils_) { testutils = _testutils_; diff --git a/tests/unit/FirebaseAuth.spec.js b/tests/unit/FirebaseAuth.spec.js index ad5f4d32..1aa423f6 100644 --- a/tests/unit/FirebaseAuth.spec.js +++ b/tests/unit/FirebaseAuth.spec.js @@ -9,7 +9,8 @@ describe('FirebaseAuth',function(){ warn:[] }; - module('firebase',function($provide){ + module('angularfire.utils'); + module('angularfire.auth',function($provide){ $provide.value('$log',{ warn:function(){ log.warn.push(Array.prototype.slice.call(arguments,0)); diff --git a/tests/unit/FirebaseAuthService.spec.js b/tests/unit/FirebaseAuthService.spec.js index 306fca17..45f3ed08 100644 --- a/tests/unit/FirebaseAuthService.spec.js +++ b/tests/unit/FirebaseAuthService.spec.js @@ -3,10 +3,13 @@ describe('$firebaseAuthService', function () { var $firebaseRefProvider; var URL = 'https://angularfire-dae2e.firebaseio.com' - beforeEach(module('firebase', function(_$firebaseRefProvider_) { - $firebaseRefProvider = _$firebaseRefProvider_; - $firebaseRefProvider.registerUrl(URL); - })); + beforeEach(function () { + module('angularfire.config'); + module('angularfire.auth', function(_$firebaseRefProvider_) { + $firebaseRefProvider = _$firebaseRefProvider_; + $firebaseRefProvider.registerUrl(URL); + }) + }); describe('', function() { diff --git a/tests/unit/FirebaseObject.spec.js b/tests/unit/FirebaseObject.spec.js index 2c161b73..9c230b08 100644 --- a/tests/unit/FirebaseObject.spec.js +++ b/tests/unit/FirebaseObject.spec.js @@ -15,7 +15,7 @@ describe('$firebaseObject', function() { error:[] }; - module('firebase'); + module('angularfire.database'); module('testutils',function($provide){ $provide.value('$log',{ error:function(){ @@ -759,7 +759,7 @@ describe('$firebaseObject', function() { expect(obj.$destroy).toHaveBeenCalledWith(error); }); }); - + var pushCounter = 1; function fakeSnap(data, pri) { diff --git a/tests/unit/firebaseRef.spec.js b/tests/unit/firebaseRef.spec.js index d022e0d6..03c7e3e4 100644 --- a/tests/unit/firebaseRef.spec.js +++ b/tests/unit/firebaseRef.spec.js @@ -4,7 +4,7 @@ describe('firebaseRef', function () { var $firebaseRefProvider; var MOCK_URL = 'https://angularfire-dae2e.firebaseio.com' - beforeEach(module('firebase', function(_$firebaseRefProvider_) { + beforeEach(module('angularfire.config', function(_$firebaseRefProvider_) { $firebaseRefProvider = _$firebaseRefProvider_; })); diff --git a/tests/unit/utils.spec.js b/tests/unit/utils.spec.js index 88510678..326307b3 100644 --- a/tests/unit/utils.spec.js +++ b/tests/unit/utils.spec.js @@ -30,7 +30,7 @@ describe('$firebaseUtils', function () { }; beforeEach(function () { - module('firebase'); + module('angularfire.utils'); module('testutils'); inject(function (_$firebaseUtils_, _$timeout_, _$rootScope_, _$q_, _testutils_) { $utils = _$firebaseUtils_; From 4b93419f925919521d11de54a39f981a355330c3 Mon Sep 17 00:00:00 2001 From: Abraham Haskins Date: Tue, 16 Aug 2016 11:46:00 -0700 Subject: [PATCH 2/7] Moves modules into folders and fixes e2e tests --- src/{ => auth}/FirebaseAuth.js | 0 src/{ => auth}/firebaseAuthService.js | 0 src/{ => config}/firebaseRef.js | 0 src/{ => database}/FirebaseArray.js | 0 src/{ => database}/FirebaseObject.js | 0 src/module.js | 4 ++-- src/{ => utils}/utils.js | 0 tests/protractor/chat/chat.js | 2 +- tests/protractor/priority/priority.js | 2 +- tests/protractor/tictactoe/tictactoe.js | 2 +- tests/protractor/todo/todo.js | 4 ++-- 11 files changed, 7 insertions(+), 7 deletions(-) rename src/{ => auth}/FirebaseAuth.js (100%) rename src/{ => auth}/firebaseAuthService.js (100%) rename src/{ => config}/firebaseRef.js (100%) rename src/{ => database}/FirebaseArray.js (100%) rename src/{ => database}/FirebaseObject.js (100%) rename src/{ => utils}/utils.js (100%) diff --git a/src/FirebaseAuth.js b/src/auth/FirebaseAuth.js similarity index 100% rename from src/FirebaseAuth.js rename to src/auth/FirebaseAuth.js diff --git a/src/firebaseAuthService.js b/src/auth/firebaseAuthService.js similarity index 100% rename from src/firebaseAuthService.js rename to src/auth/firebaseAuthService.js diff --git a/src/firebaseRef.js b/src/config/firebaseRef.js similarity index 100% rename from src/firebaseRef.js rename to src/config/firebaseRef.js diff --git a/src/FirebaseArray.js b/src/database/FirebaseArray.js similarity index 100% rename from src/FirebaseArray.js rename to src/database/FirebaseArray.js diff --git a/src/FirebaseObject.js b/src/database/FirebaseObject.js similarity index 100% rename from src/FirebaseObject.js rename to src/database/FirebaseObject.js diff --git a/src/module.js b/src/module.js index 4a3973c3..d6dae0ec 100644 --- a/src/module.js +++ b/src/module.js @@ -7,8 +7,8 @@ //TODO: use $window .value("Firebase", exports.Firebase); - angular.module("angularfire.utils", []) - angular.module("angularfire.config", []) + angular.module("angularfire.utils", []); + angular.module("angularfire.config", []); angular.module("angularfire.auth", ["angularfire.utils"]); angular.module("angularfire.database", ["angularfire.utils"]); })(window); diff --git a/src/utils.js b/src/utils/utils.js similarity index 100% rename from src/utils.js rename to src/utils/utils.js diff --git a/tests/protractor/chat/chat.js b/tests/protractor/chat/chat.js index 533104fb..4f0e51a0 100644 --- a/tests/protractor/chat/chat.js +++ b/tests/protractor/chat/chat.js @@ -1,4 +1,4 @@ -var app = angular.module('chat', ['firebase']); +var app = angular.module('chat', ['angularfire.database']); app.controller('ChatCtrl', function Chat($scope, $firebaseObject, $firebaseArray) { // Get a reference to the Firebase diff --git a/tests/protractor/priority/priority.js b/tests/protractor/priority/priority.js index 44126a02..e4e7f489 100644 --- a/tests/protractor/priority/priority.js +++ b/tests/protractor/priority/priority.js @@ -1,4 +1,4 @@ -var app = angular.module('priority', ['firebase']); +var app = angular.module('priority', ['angularfire.database']); app.controller('PriorityCtrl', function Chat($scope, $firebaseArray, $firebaseObject) { // Get a reference to the Firebase var rootRef = firebase.database().ref(); diff --git a/tests/protractor/tictactoe/tictactoe.js b/tests/protractor/tictactoe/tictactoe.js index 035a9777..6daf6bdc 100644 --- a/tests/protractor/tictactoe/tictactoe.js +++ b/tests/protractor/tictactoe/tictactoe.js @@ -1,4 +1,4 @@ -var app = angular.module('tictactoe', ['firebase']); +var app = angular.module('tictactoe', ['angularfire.database']); app.controller('TicTacToeCtrl', function Chat($scope, $firebaseObject) { $scope.board = {}; diff --git a/tests/protractor/todo/todo.js b/tests/protractor/todo/todo.js index f3c6da76..12cbadf2 100644 --- a/tests/protractor/todo/todo.js +++ b/tests/protractor/todo/todo.js @@ -1,4 +1,4 @@ -var app = angular.module('todo', ['firebase']); +var app = angular.module('todo', ['angularfire.database']); app. controller('TodoCtrl', function Todo($scope, $firebaseArray) { // Get a reference to the Firebase var rootRef = firebase.database().ref(); @@ -8,7 +8,7 @@ app. controller('TodoCtrl', function Todo($scope, $firebaseArray) { // Put the Firebase URL into the scope so the tests can grab it. $scope.url = todosRef.toString() - + // Get the todos as an array $scope.todos = $firebaseArray(todosRef); From 7c9a55e2eba3d1edd829cfb68020870a1a64112c Mon Sep 17 00:00:00 2001 From: Abraham Haskins Date: Tue, 16 Aug 2016 11:50:04 -0700 Subject: [PATCH 3/7] Removes config module --- src/config/firebaseRef.js | 46 --------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 src/config/firebaseRef.js diff --git a/src/config/firebaseRef.js b/src/config/firebaseRef.js deleted file mode 100644 index df6db814..00000000 --- a/src/config/firebaseRef.js +++ /dev/null @@ -1,46 +0,0 @@ -(function() { - "use strict"; - - function FirebaseRef() { - this.urls = null; - this.registerUrl = function registerUrl(urlOrConfig) { - - if (typeof urlOrConfig === 'string') { - this.urls = {}; - this.urls.default = urlOrConfig; - } - - if (angular.isObject(urlOrConfig)) { - this.urls = urlOrConfig; - } - - }; - - this.$$checkUrls = function $$checkUrls(urlConfig) { - if (!urlConfig) { - return new Error('No Firebase URL registered. Use firebaseRefProvider.registerUrl() in the config phase. This is required if you are using $firebaseAuthService.'); - } - if (!urlConfig.default) { - return new Error('No default Firebase URL registered. Use firebaseRefProvider.registerUrl({ default: "https://.firebaseio.com/"}).'); - } - }; - - this.$$createRefsFromUrlConfig = function $$createMultipleRefs(urlConfig) { - var refs = {}; - var error = this.$$checkUrls(urlConfig); - if (error) { throw error; } - angular.forEach(urlConfig, function(value, key) { - refs[key] = firebase.database().refFromURL(value); - }); - return refs; - }; - - this.$get = function FirebaseRef_$get() { - return this.$$createRefsFromUrlConfig(this.urls); - }; - } - - angular.module('angularfire.config') - .provider('$firebaseRef', FirebaseRef); - -})(); From 61a338a00368cd4a6a9adcac08113c30705bec20 Mon Sep 17 00:00:00 2001 From: Abraham Haskins Date: Tue, 16 Aug 2016 11:58:06 -0700 Subject: [PATCH 4/7] angularfire.* -> firebase.* --- src/auth/FirebaseAuth.js | 2 +- src/auth/firebaseAuthService.js | 2 +- src/database/FirebaseArray.js | 2 +- src/database/FirebaseObject.js | 2 +- src/database/firebaseRef.js | 46 +++++++++++++++++++++++++ src/module.js | 8 ++--- src/utils/utils.js | 2 +- tests/protractor/chat/chat.js | 2 +- tests/protractor/priority/priority.js | 2 +- tests/protractor/tictactoe/tictactoe.js | 2 +- tests/protractor/todo/todo.js | 2 +- tests/unit/FirebaseArray.spec.js | 2 +- tests/unit/FirebaseAuth.spec.js | 6 ++-- tests/unit/FirebaseAuthService.spec.js | 8 ++--- tests/unit/FirebaseObject.spec.js | 2 +- tests/unit/firebaseRef.spec.js | 3 +- tests/unit/utils.spec.js | 2 +- 17 files changed, 69 insertions(+), 26 deletions(-) create mode 100644 src/database/firebaseRef.js diff --git a/src/auth/FirebaseAuth.js b/src/auth/FirebaseAuth.js index d95ea7fd..0e1d5e4d 100644 --- a/src/auth/FirebaseAuth.js +++ b/src/auth/FirebaseAuth.js @@ -3,7 +3,7 @@ var FirebaseAuth; // Define a service which provides user authentication and management. - angular.module('angularfire.auth').factory('$firebaseAuth', [ + angular.module('firebase.auth').factory('$firebaseAuth', [ '$q', '$firebaseUtils', function($q, $firebaseUtils) { /** * This factory returns an object allowing you to manage the client's authentication state. diff --git a/src/auth/firebaseAuthService.js b/src/auth/firebaseAuthService.js index fea358b4..864580f7 100644 --- a/src/auth/firebaseAuthService.js +++ b/src/auth/firebaseAuthService.js @@ -6,7 +6,7 @@ } FirebaseAuthService.$inject = ['$firebaseAuth']; - angular.module('angularfire.auth') + angular.module('firebase.auth') .factory('$firebaseAuthService', FirebaseAuthService); })(); diff --git a/src/database/FirebaseArray.js b/src/database/FirebaseArray.js index 76719940..dac277ed 100644 --- a/src/database/FirebaseArray.js +++ b/src/database/FirebaseArray.js @@ -47,7 +47,7 @@ * var list = new ExtendedArray(ref); * */ - angular.module('angularfire.database').factory('$firebaseArray', ["$log", "$firebaseUtils", "$q", + angular.module('firebase.database').factory('$firebaseArray', ["$log", "$firebaseUtils", "$q", function($log, $firebaseUtils, $q) { /** * This constructor should probably never be called manually. It is used internally by diff --git a/src/database/FirebaseObject.js b/src/database/FirebaseObject.js index 9593f375..b9b0f168 100644 --- a/src/database/FirebaseObject.js +++ b/src/database/FirebaseObject.js @@ -22,7 +22,7 @@ * var obj = new ExtendedObject(ref); * */ - angular.module('angularfire.database').factory('$firebaseObject', [ + angular.module('firebase.database').factory('$firebaseObject', [ '$parse', '$firebaseUtils', '$log', '$q', function($parse, $firebaseUtils, $log, $q) { /** diff --git a/src/database/firebaseRef.js b/src/database/firebaseRef.js new file mode 100644 index 00000000..28e4ef75 --- /dev/null +++ b/src/database/firebaseRef.js @@ -0,0 +1,46 @@ +(function() { + "use strict"; + + function FirebaseRef() { + this.urls = null; + this.registerUrl = function registerUrl(urlOrConfig) { + + if (typeof urlOrConfig === 'string') { + this.urls = {}; + this.urls.default = urlOrConfig; + } + + if (angular.isObject(urlOrConfig)) { + this.urls = urlOrConfig; + } + + }; + + this.$$checkUrls = function $$checkUrls(urlConfig) { + if (!urlConfig) { + return new Error('No Firebase URL registered. Use firebaseRefProvider.registerUrl() in the config phase. This is required if you are using $firebaseAuthService.'); + } + if (!urlConfig.default) { + return new Error('No default Firebase URL registered. Use firebaseRefProvider.registerUrl({ default: "https://.firebaseio.com/"}).'); + } + }; + + this.$$createRefsFromUrlConfig = function $$createMultipleRefs(urlConfig) { + var refs = {}; + var error = this.$$checkUrls(urlConfig); + if (error) { throw error; } + angular.forEach(urlConfig, function(value, key) { + refs[key] = firebase.database().refFromURL(value); + }); + return refs; + }; + + this.$get = function FirebaseRef_$get() { + return this.$$createRefsFromUrlConfig(this.urls); + }; + } + + angular.module('firebase.database') + .provider('$firebaseRef', FirebaseRef); + +})(); diff --git a/src/module.js b/src/module.js index d6dae0ec..5406b4a6 100644 --- a/src/module.js +++ b/src/module.js @@ -7,8 +7,8 @@ //TODO: use $window .value("Firebase", exports.Firebase); - angular.module("angularfire.utils", []); - angular.module("angularfire.config", []); - angular.module("angularfire.auth", ["angularfire.utils"]); - angular.module("angularfire.database", ["angularfire.utils"]); + angular.module("firebase.utils", []); + angular.module("firebase.config", []); + angular.module("firebase.auth", ["firebase.utils"]); + angular.module("firebase.database", ["firebase.utils"]); })(window); diff --git a/src/utils/utils.js b/src/utils/utils.js index 3e8c1893..04217e3a 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1,7 +1,7 @@ (function() { 'use strict'; - angular.module('angularfire.utils') + angular.module('firebase.utils') .factory('$firebaseConfig', ["$firebaseArray", "$firebaseObject", "$injector", function($firebaseArray, $firebaseObject, $injector) { return function(configOpts) { diff --git a/tests/protractor/chat/chat.js b/tests/protractor/chat/chat.js index 4f0e51a0..e481168a 100644 --- a/tests/protractor/chat/chat.js +++ b/tests/protractor/chat/chat.js @@ -1,4 +1,4 @@ -var app = angular.module('chat', ['angularfire.database']); +var app = angular.module('chat', ['firebase.database']); app.controller('ChatCtrl', function Chat($scope, $firebaseObject, $firebaseArray) { // Get a reference to the Firebase diff --git a/tests/protractor/priority/priority.js b/tests/protractor/priority/priority.js index e4e7f489..b94d44c2 100644 --- a/tests/protractor/priority/priority.js +++ b/tests/protractor/priority/priority.js @@ -1,4 +1,4 @@ -var app = angular.module('priority', ['angularfire.database']); +var app = angular.module('priority', ['firebase.database']); app.controller('PriorityCtrl', function Chat($scope, $firebaseArray, $firebaseObject) { // Get a reference to the Firebase var rootRef = firebase.database().ref(); diff --git a/tests/protractor/tictactoe/tictactoe.js b/tests/protractor/tictactoe/tictactoe.js index 6daf6bdc..197ac03e 100644 --- a/tests/protractor/tictactoe/tictactoe.js +++ b/tests/protractor/tictactoe/tictactoe.js @@ -1,4 +1,4 @@ -var app = angular.module('tictactoe', ['angularfire.database']); +var app = angular.module('tictactoe', ['firebase.database']); app.controller('TicTacToeCtrl', function Chat($scope, $firebaseObject) { $scope.board = {}; diff --git a/tests/protractor/todo/todo.js b/tests/protractor/todo/todo.js index 12cbadf2..f4d6f54a 100644 --- a/tests/protractor/todo/todo.js +++ b/tests/protractor/todo/todo.js @@ -1,4 +1,4 @@ -var app = angular.module('todo', ['angularfire.database']); +var app = angular.module('todo', ['firebase.database']); app. controller('TodoCtrl', function Todo($scope, $firebaseArray) { // Get a reference to the Firebase var rootRef = firebase.database().ref(); diff --git a/tests/unit/FirebaseArray.spec.js b/tests/unit/FirebaseArray.spec.js index 3e225704..4dd30e36 100644 --- a/tests/unit/FirebaseArray.spec.js +++ b/tests/unit/FirebaseArray.spec.js @@ -31,7 +31,7 @@ describe('$firebaseArray', function () { var arr, $firebaseArray, $utils, $timeout, $rootScope, $q, tick, testutils; beforeEach(function() { - module('angularfire.database'); + module('firebase.database'); module('testutils'); inject(function (_$firebaseArray_, $firebaseUtils, _$timeout_, _$rootScope_, _$q_, _testutils_) { testutils = _testutils_; diff --git a/tests/unit/FirebaseAuth.spec.js b/tests/unit/FirebaseAuth.spec.js index 1aa423f6..6b855c96 100644 --- a/tests/unit/FirebaseAuth.spec.js +++ b/tests/unit/FirebaseAuth.spec.js @@ -8,9 +8,9 @@ describe('FirebaseAuth',function(){ log = { warn:[] }; - - module('angularfire.utils'); - module('angularfire.auth',function($provide){ + // + // module('firebase.utils'); + module('firebase.auth',function($provide){ $provide.value('$log',{ warn:function(){ log.warn.push(Array.prototype.slice.call(arguments,0)); diff --git a/tests/unit/FirebaseAuthService.spec.js b/tests/unit/FirebaseAuthService.spec.js index 45f3ed08..f83ea0d7 100644 --- a/tests/unit/FirebaseAuthService.spec.js +++ b/tests/unit/FirebaseAuthService.spec.js @@ -4,11 +4,7 @@ describe('$firebaseAuthService', function () { var URL = 'https://angularfire-dae2e.firebaseio.com' beforeEach(function () { - module('angularfire.config'); - module('angularfire.auth', function(_$firebaseRefProvider_) { - $firebaseRefProvider = _$firebaseRefProvider_; - $firebaseRefProvider.registerUrl(URL); - }) + module('firebase.auth') }); describe('', function() { @@ -21,7 +17,7 @@ describe('$firebaseAuthService', function () { }); }); - it('should exist because we called $firebaseRefProvider.registerUrl()', inject(function() { + it('should exist', inject(function() { expect($firebaseAuthService).not.toBe(null); })); diff --git a/tests/unit/FirebaseObject.spec.js b/tests/unit/FirebaseObject.spec.js index 9c230b08..9aaf79fa 100644 --- a/tests/unit/FirebaseObject.spec.js +++ b/tests/unit/FirebaseObject.spec.js @@ -15,7 +15,7 @@ describe('$firebaseObject', function() { error:[] }; - module('angularfire.database'); + module('firebase.database'); module('testutils',function($provide){ $provide.value('$log',{ error:function(){ diff --git a/tests/unit/firebaseRef.spec.js b/tests/unit/firebaseRef.spec.js index 03c7e3e4..660bef6b 100644 --- a/tests/unit/firebaseRef.spec.js +++ b/tests/unit/firebaseRef.spec.js @@ -2,9 +2,10 @@ describe('firebaseRef', function () { var $firebaseRefProvider; + //TODO: Load this from env var MOCK_URL = 'https://angularfire-dae2e.firebaseio.com' - beforeEach(module('angularfire.config', function(_$firebaseRefProvider_) { + beforeEach(module('firebase.database', function(_$firebaseRefProvider_) { $firebaseRefProvider = _$firebaseRefProvider_; })); diff --git a/tests/unit/utils.spec.js b/tests/unit/utils.spec.js index 326307b3..002556ec 100644 --- a/tests/unit/utils.spec.js +++ b/tests/unit/utils.spec.js @@ -30,7 +30,7 @@ describe('$firebaseUtils', function () { }; beforeEach(function () { - module('angularfire.utils'); + module('firebase.utils'); module('testutils'); inject(function (_$firebaseUtils_, _$timeout_, _$rootScope_, _$q_, _testutils_) { $utils = _$firebaseUtils_; From 0cd6413774603c5cf9565aeab6aa5155a3ef025f Mon Sep 17 00:00:00 2001 From: Abraham Haskins Date: Tue, 16 Aug 2016 12:00:48 -0700 Subject: [PATCH 5/7] Makes $firebase module hold everything --- src/module.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/module.js b/src/module.js index 5406b4a6..1410a67d 100644 --- a/src/module.js +++ b/src/module.js @@ -1,14 +1,14 @@ (function(exports) { "use strict"; - // Define the `firebase` module under which all AngularFire - // services will live. - angular.module("firebase", []) - //TODO: use $window - .value("Firebase", exports.Firebase); - angular.module("firebase.utils", []); angular.module("firebase.config", []); angular.module("firebase.auth", ["firebase.utils"]); angular.module("firebase.database", ["firebase.utils"]); + + // Define the `firebase` module under which all AngularFire + // services will live. + angular.module("firebase", ["firebase.utils", "firebase.config", "firebase.auth", "firebase.database"]) + //TODO: use $window + .value("Firebase", exports.Firebase); })(window); From 77b790a69d02a38e6b158160ffdb5a45901c2717 Mon Sep 17 00:00:00 2001 From: Abraham Haskins Date: Tue, 16 Aug 2016 12:21:58 -0700 Subject: [PATCH 6/7] Fix exports.Firebase to exports.firebase --- src/module.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/module.js b/src/module.js index 1410a67d..395194d5 100644 --- a/src/module.js +++ b/src/module.js @@ -10,5 +10,6 @@ // services will live. angular.module("firebase", ["firebase.utils", "firebase.config", "firebase.auth", "firebase.database"]) //TODO: use $window - .value("Firebase", exports.Firebase); + .value("Firebase", exports.firebase); + .value("firebase", exports.firebase); })(window); From d399c054dca75a5c3af26bb83aa1ee120b17e9f3 Mon Sep 17 00:00:00 2001 From: Abraham Haskins Date: Tue, 16 Aug 2016 12:28:40 -0700 Subject: [PATCH 7/7] -; --- src/module.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module.js b/src/module.js index 395194d5..b0dfac97 100644 --- a/src/module.js +++ b/src/module.js @@ -10,6 +10,6 @@ // services will live. angular.module("firebase", ["firebase.utils", "firebase.config", "firebase.auth", "firebase.database"]) //TODO: use $window - .value("Firebase", exports.firebase); + .value("Firebase", exports.firebase) .value("firebase", exports.firebase); })(window);