summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2021-08-25 12:04:38 -0400
committerJoel Fischer <joeljfischer@gmail.com>2021-08-25 12:04:38 -0400
commit61a48afdd4c586af5fef97638d3e250402167a21 (patch)
tree72fedaab098326bbeb580bb5b5512d96025376d9
parentcae62c6718a668e5836e5b5f0f18d2fa84536dcb (diff)
downloadsdl_ios-61a48afdd4c586af5fef97638d3e250402167a21.tar.gz
Add test for transferring handlers
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceOperationSpec.m12
1 files changed, 11 insertions, 1 deletions
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceOperationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceOperationSpec.m
index 3b61af06a..bb3c662bb 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceOperationSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceOperationSpec.m
@@ -704,14 +704,21 @@ describe(@"a menu replace operation", ^{
});
context(@"when cells remain the same", ^{
+ __block BOOL secondHandlerCalled = NO;
+
beforeEach(^{
+ secondHandlerCalled = NO;
+
testCurrentMenu = [[NSArray alloc] initWithArray:@[textOnlyCell, textOnlyCell2, textAndImageCell] copyItems:YES];
[SDLMenuReplaceUtilities addIdsToMenuCells:testCurrentMenu parentId:ParentIdNotFound];
+ textOnlyCell.handler = ^(SDLTriggerSource triggerSource) {
+ secondHandlerCalled = YES;
+ };
testNewMenu = [[NSArray alloc] initWithArray:@[textOnlyCell, textOnlyCell2, textAndImageCell] copyItems:YES];
});
- it(@"should send dynamic deletes first then dynamic adds when cells stay the same", ^{
+ it(@"should not send deletes or adds, but should transfer handlers", ^{
testOp = [[SDLMenuReplaceOperation alloc] initWithConnectionManager:testConnectionManager fileManager:testFileManager windowCapability:testWindowCapability menuConfiguration:testMenuConfiguration currentMenu:testCurrentMenu updatedMenu:testNewMenu compatibilityModeEnabled:NO currentMenuUpdatedHandler:testCurrentMenuUpdatedBlock];
[testOp start];
@@ -727,6 +734,9 @@ describe(@"a menu replace operation", ^{
expect(testOp.isFinished).to(beTrue());
expect(resultError).to(beNil());
expect(resultMenuCells).to(haveCount(3));
+
+ resultMenuCells[0].handler(SDLTriggerSourceMenu);
+ expect(secondHandlerCalled).to(beTrue());
});
});
});