Skip to content

Commit 9477dea

Browse files
authored
Merge pull request #246 from morganchen12/index-array-bug
fix bug in FUIIndexArray
2 parents d17f052 + ea29977 commit 9477dea

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

FirebaseDatabaseUI/FUIQueryObserver.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ + (FUIQueryObserver *)observerForQuery:(id<FUIDataObservable>)query
5858
completion(obs, nil, error);
5959
};
6060

61-
[obs observeEventType:FIRDataEventTypeChildAdded
62-
andPreviousSiblingKeyWithBlock:observerBlock withCancelBlock:cancelBlock];
6361
[obs observeEventType:FIRDataEventTypeValue
6462
andPreviousSiblingKeyWithBlock:observerBlock withCancelBlock:cancelBlock];
6563
return obs;

FirebaseDatabaseUITests/FUIDatabaseTestUtils.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ - (FIRDatabaseHandle)observeEventType:(FIRDataEventType)eventType
176176
id value = self.contents[contentKey];
177177
FUIFakeSnapshot *snap = [[FUIFakeSnapshot alloc] initWithKey:contentKey value:value];
178178
[self sendEvent:FIRDataEventTypeChildAdded withObject:snap previousKey:previousKey error:nil];
179+
180+
// Send a value event, since this is a complete snapshot.
181+
// TODO: FUIFakeSnapshot currently only represents dictionary types, though snapshots can
182+
// have array, string, or number values as well. Tests need to be written for these.
183+
[self sendEvent:FIRDataEventTypeValue withObject:snap previousKey:previousKey error:nil];
179184
previousKey = contentKey;
180185
}
181186
}

FirebaseDatabaseUITests/FUIIndexArrayTest.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ - (void)setUp {
6060
self.index = [[FUITestObservable alloc] initWithDictionary:database()[@"index"]];
6161
self.data = [[FUITestObservable alloc] initWithDictionary:database()[@"data"]];
6262
self.array = [[FUIIndexArray alloc] initWithIndex:self.index
63-
data:self.data];
63+
data:self.data];
6464
self.arrayDelegate = [[FUIIndexArrayTestDelegate alloc] init];
6565
self.array.delegate = self.arrayDelegate;
6666
self.dict = [database() mutableCopy];

0 commit comments

Comments
 (0)