@@ -12,9 +12,11 @@ var firebaseApp = Firebase.initializeApp({
12
12
13
13
describe ( 'VueFire' , function ( ) {
14
14
var firebaseRef
15
+ var firebaseDb
15
16
16
17
beforeEach ( function ( done ) {
17
- firebaseRef = firebaseApp . database ( ) . ref ( )
18
+ firebaseDb = firebaseApp . database ( )
19
+ firebaseRef = firebaseDb . ref ( )
18
20
firebaseRef . remove ( function ( error ) {
19
21
if ( error ) {
20
22
done ( error )
@@ -25,6 +27,36 @@ describe('VueFire', function () {
25
27
} )
26
28
} )
27
29
30
+ describe ( 'is callable as Function' , function ( ) {
31
+ it ( 'returns correct ref on function call' , function ( done ) {
32
+ var ChildComponent = Vue . extend ( {
33
+ name : 'ChildComponent' ,
34
+ firebase : function ( ) {
35
+ expect ( this . $root . database ) . to . deep . equal ( firebaseDb )
36
+ done ( )
37
+ } ,
38
+ template : '<div>test</div>'
39
+ } )
40
+ new Vue ( {
41
+ data : function ( ) {
42
+ return {
43
+ database : firebaseDb
44
+ }
45
+ } ,
46
+ ready : function ( ) {
47
+ expect ( 'poop' ) . to . equal ( 'notpoop' )
48
+ } ,
49
+ components : {
50
+ 'child-component' : ChildComponent
51
+ } ,
52
+ template : '<div><child-component></child-component></div>'
53
+ } ) . $mount ( )
54
+ Vue . nextTick ( function ( ) {
55
+
56
+ } )
57
+ } )
58
+ } )
59
+
28
60
describe ( 'bind as Array' , function ( ) {
29
61
it ( 'throws error for invalid firebase ref' , function ( ) {
30
62
helpers . invalidFirebaseRefs . forEach ( function ( ref ) {
0 commit comments