summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2019-05-30 16:09:11 -0400
committerJoel Fischer <joeljfischer@gmail.com>2019-05-30 16:09:11 -0400
commit0f3f75911ae30e9ed9f5cc9403ae57c71536541c (patch)
treefd8e19407bc590d9b19fe2b43c185291dec3fe4b
parent3a8bd00d7b10689a178b6ae575656dcd53945e31 (diff)
downloadsdl_ios-0f3f75911ae30e9ed9f5cc9403ae57c71536541c.tar.gz
Fix position not being set on SDLChoiceSet VRHelpListbugfix/issue_1291_fix_choiceset_helplist_position
-rw-r--r--SmartDeviceLink/SDLChoiceSet.m8
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetSpec.m13
2 files changed, 21 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLChoiceSet.m b/SmartDeviceLink/SDLChoiceSet.m
index b7aa12388..0892e611d 100644
--- a/SmartDeviceLink/SDLChoiceSet.m
+++ b/SmartDeviceLink/SDLChoiceSet.m
@@ -123,6 +123,14 @@ static SDLChoiceSetLayout _defaultLayout = SDLChoiceSetLayoutList;
_defaultLayout = defaultLayout;
}
+- (void)setHelpList:(nullable NSArray<SDLVRHelpItem *> *)helpList {
+ _helpList = helpList;
+
+ for (NSUInteger i = 0; i < _helpList.count; i++) {
+ _helpList[i].position = @(i + 1);
+ }
+}
+
#pragma mark - Etc.
- (NSString *)description {
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetSpec.m
index c89a969be..bce012034 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetSpec.m
@@ -69,6 +69,7 @@ describe(@"an SDLChoiceSet", ^{
expect(testChoiceSet.timeoutPrompt).to(equal([SDLTTSChunk textChunksFromString:testTimeoutPrompt]));
expect(testChoiceSet.helpPrompt).to(equal([SDLTTSChunk textChunksFromString:testHelpPrompt]));
expect(testChoiceSet.helpList).to(equal(@[testHelpItem]));
+ expect(testChoiceSet.helpList.firstObject.position).to(equal(1));
expect(testChoiceSet.delegate).to(equal(testDelegate));
expect(testChoiceSet.choices).to(equal(@[testCell]));
});
@@ -150,6 +151,18 @@ describe(@"an SDLChoiceSet", ^{
});
});
});
+
+ describe(@"setting data", ^{
+ beforeEach(^{
+ testChoiceSet = [[SDLChoiceSet alloc] init];
+ });
+
+ it(@"should properly set help list position", ^{
+ testChoiceSet.helpList = @[testHelpItem];
+
+ expect(testHelpItem.position).to(equal(1));
+ });
+ });
});
QuickSpecEnd