File tree Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -326,8 +326,6 @@ <h4>[[dinosaur.__firebaseKey__]]</h4>
326
326
this . remove ( removed ) ;
327
327
} , this ) ;
328
328
329
- this . data . splice ( splice . index , splice . addedCount ) ;
330
-
331
329
added . forEach ( function ( added ) {
332
330
this . add ( added ) ;
333
331
} , this ) ;
Original file line number Diff line number Diff line change 74
74
} ,
75
75
76
76
_applyRemoteDataChange : function ( applyChange ) {
77
+ if ( this . _applyingLocalDataChanges ) {
78
+ return ;
79
+ }
77
80
this . _receivingRemoteChanges = true ;
78
81
applyChange . call ( this ) ;
79
82
this . _receivingRemoteChanges = false ;
84
87
return ;
85
88
}
86
89
90
+ this . _applyingLocalDataChanges = true ;
87
91
this . _applyLocalDataChanges ( changes ) ;
92
+ this . _applyingLocalDataChanges = false ;
88
93
} ,
89
94
90
95
_queryChanged : function ( query , oldQuery ) {
Original file line number Diff line number Diff line change 64
64
</ template >
65
65
</ test-fixture >
66
66
67
+ < test-fixture id ="BoundCollection ">
68
+ < template >
69
+ < section >
70
+ <!-- TODO(cdata): Add support for elements like `dom-bind` at the root
71
+ of the template to `test-fixture`, so that we can remove this
72
+ wrapping `section`. -->
73
+ < template is ="dom-bind ">
74
+ < template is ="dom-repeat " items ="{{data}} ">
75
+ < div > [[item.value]]</ div >
76
+ </ template >
77
+ < firebase-collection
78
+ location ="https://fb-element-demo.firebaseio.com/test/empty "
79
+ data ="{{data}} "
80
+ log >
81
+ </ firebase-collection >
82
+ </ template >
83
+ </ section >
84
+ </ template >
85
+ </ test-fixture >
86
+
67
87
< script >
68
88
suite ( '<firebase-collection>' , function ( ) {
69
89
var firebase ;
70
90
91
+ suite ( 'collection manipulation' , function ( ) {
92
+ var domBind ;
93
+ var dom ;
94
+
95
+ setup ( function ( ) {
96
+ dom = fixture ( 'BoundCollection' ) ;
97
+ domBind = dom . querySelector ( '[is=dom-bind]' ) ;
98
+ firebase = dom . querySelector ( 'firebase-collection' ) ;
99
+ } ) ;
100
+
101
+ test ( 'added values reflect 1-to-1 in the DOM' , function ( done ) {
102
+ waitForEvent ( firebase , 'firebase-value' ) . then ( function ( ) {
103
+ waitForEvent ( firebase , 'firebase-child-added' ) . then ( function ( ) {
104
+ expect ( dom . querySelectorAll ( 'div' ) . length ) . to . be . equal ( firebase . data . length ) ;
105
+ done ( ) ;
106
+ } ) ;
107
+ domBind . unshift ( 'data' , { value : 'blah' } ) ;
108
+ } ) ;
109
+ } ) ;
110
+ } ) ;
111
+
71
112
suite ( 'basic usage' , function ( ) {
72
113
setup ( function ( ) {
73
114
firebase = fixture ( 'TrivialCollection' ) ;
You can’t perform that action at this time.
0 commit comments