File tree 2 files changed +37
-3
lines changed
2 files changed +37
-3
lines changed Original file line number Diff line number Diff line change 56
56
*/
57
57
data : {
58
58
type : Object ,
59
- notify : true ,
60
- readOnly : true
59
+ notify : true
61
60
}
62
61
} ,
63
62
81
80
82
81
_onFirebaseValue : function ( event ) {
83
82
this . _applyRemoteDataChange ( function ( ) {
84
- this . _setData ( event . detail . val ( ) ) ;
83
+ this . set ( 'data' , event . detail . val ( ) ) ;
85
84
} ) ;
86
85
} ,
87
86
Original file line number Diff line number Diff line change 31
31
</ firebase-document >
32
32
</ template >
33
33
</ test-fixture >
34
+ < test-fixture id ="UpdateableDocument ">
35
+ < template >
36
+ < firebase-document
37
+ location ="https://fb-element-demo.firebaseio.com/test/updateable_document "
38
+ log >
39
+ </ firebase-document >
40
+ </ template >
41
+ </ test-fixture >
34
42
< test-fixture id ="MalleableDocument ">
35
43
< template >
36
44
< firebase-document
69
77
} ) ;
70
78
} ) ;
71
79
80
+ suite ( 'document updating' , function ( ) {
81
+ setup ( function ( done ) {
82
+ firebase = fixture ( 'UpdateableDocument' ) ;
83
+ waitForEvent ( firebase , 'firebase-value' ) . then ( function ( ) {
84
+ done ( ) ;
85
+ } ) ;
86
+ } ) ;
87
+
88
+ test ( 'setting data property updates the document' , function ( done ) {
89
+ var data = { } ;
90
+ var newValue = Math . random ( ) . toString ( ) . split ( '.' ) . pop ( ) ;
91
+
92
+ data [ newValue ] = newValue ;
93
+
94
+ waitForEvent ( firebase , 'firebase-value' ) . then ( function ( ) {
95
+ expect ( firebase . data [ newValue ] ) . to . be . eql ( newValue ) ;
96
+ done ( ) ;
97
+ } ) . catch ( function ( e ) {
98
+ done ( e ) ;
99
+ } ) . then ( function ( ) {
100
+ firebase . set ( 'data.' + newValue , null ) ;
101
+ } ) ;
102
+
103
+ firebase . set ( 'data' , data ) ;
104
+ } ) ;
105
+ } ) ;
106
+
72
107
suite ( 'document manipulation' , function ( ) {
73
108
var localFirebase ;
74
109
var remoteFirebase ;
You can’t perform that action at this time.
0 commit comments