diff options
Diffstat (limited to 'SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m')
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m index c663205e2..1ee9d5afd 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m @@ -6,6 +6,7 @@ #import "SDLGlobals.h" #import "SDLMenuManager.h" +#import "SDLMenuShowOperation.h" #import "SDLMenuReplaceOperation.h" #import "TestConnectionManager.h" @@ -17,6 +18,12 @@ @end +@interface SDLMenuShowOperation() + +@property (strong, nonatomic, nullable) SDLMenuCell *submenuCell; + +@end + @interface SDLMenuManager() @property (weak, nonatomic) id<SDLConnectionManagerType> connectionManager; @@ -269,6 +276,22 @@ describe(@"menu manager", ^{ expect(canSendRPC).to(equal(YES)); }); + // should queue an open menu operation for a copied submenu cell + it(@"should queue an open menu operation for a copied submenu cell and match the original cell id", ^ { + submenuCell.cellId = 1; + testManager.menuCells = @[submenuCell]; + + SDLMenuCell *copiedCell = [[SDLMenuCell alloc] initWithTitle:@"Test 3" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil submenuLayout:nil subCells:@[textOnlyCell]]; + + BOOL canSendRPC = [testManager openMenu:copiedCell]; + SDLMenuShowOperation *showOperation = (SDLMenuShowOperation *)testManager.transactionQueue.operations[1]; + + expect(showOperation.submenuCell.cellId).to(equal(submenuCell.cellId)); + expect(showOperation.submenuCell.cellId).toNot(equal(copiedCell.cellId)); + expect(testManager.transactionQueue.operationCount).to(equal(2)); + expect(canSendRPC).to(equal(YES)); + }); + it(@"should cancel the first task if a second is queued", ^{ testManager.menuCells = @[submenuCell]; [testManager openMenu:nil]; |