Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/botbuilder-dialogs/src/prompts/choicePrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class ChoicePrompt extends Prompt<FoundChoice> {
const choices: any[] = (this.style === ListStyle.suggestedAction ? ChoiceFactory.toChoices(options.choices) : options.choices) || [];
const channelId: string = context.activity.channelId;
const choiceOptions: ChoiceFactoryOptions = this.choiceOptions || this.choiceDefaults[locale];
const choiceStyle: ListStyle = options.style || this.style;
const choiceStyle: ListStyle = options.style === 0 ? 0 : options.style || this.style;
if (isRetry && options.retryPrompt) {
prompt = this.appendChoices(options.retryPrompt, channelId, choices, choiceStyle, choiceOptions);
} else {
Expand Down
33 changes: 33 additions & 0 deletions libraries/botbuilder-dialogs/tests/choicePrompt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,39 @@ describe('ChoicePrompt', function () {
.assertReply('red');
});

it('should appropriately apply ListStyle.none when set via PromptOptions', async function () {
const adapter = new TestAdapter(async (turnContext) => {
const dc = await dialogs.createContext(turnContext);

const results = await dc.continueDialog();
if (results.status === DialogTurnStatus.empty) {
await dc.prompt('prompt', {
prompt: 'Please choose a color.',
choices: stringChoices,
style: ListStyle.none
});
} else if (results.status === DialogTurnStatus.complete) {
const selectedChoice = results.result;
await turnContext.sendActivity(selectedChoice.value);
}
await convoState.saveChanges(turnContext);
});
// Create new ConversationState with MemoryStorage and register the state as middleware.
const convoState = new ConversationState(new MemoryStorage());

// Create a DialogState property, DialogSet and ChoicePrompt.
const dialogState = convoState.createProperty('dialogState');
const dialogs = new DialogSet(dialogState);
const choicePrompt = new ChoicePrompt('prompt');

dialogs.add(choicePrompt);

await adapter.send('Hello')
.assertReply('Please choose a color.')
.send(answerMessage)
.assertReply('red');
});

it('should send custom retryPrompt.', async function () {
const adapter = new TestAdapter(async (turnContext) => {
const dc = await dialogs.createContext(turnContext);
Expand Down