()
| 68 | } |
| 69 | |
| 70 | override render(): Promise<string> { |
| 71 | const choices = this.props.choices.map((choice) => { |
| 72 | const choiceText = this.engine.replaceVariables(choice.Text); |
| 73 | |
| 74 | if (typeof choice.Clickable === 'function') { |
| 75 | return new Promise<string>((resolve) => { |
| 76 | this.engine.assertAsync(choice.Clickable!, this.engine).then(() => { |
| 77 | resolve(`<button data-do="${choice.Do}" ${choice.Class ? `class="${choice.Class}"` : ''} data-choice="${choice._key}">${choiceText}</button>`); |
| 78 | }).catch(() => { |
| 79 | resolve(`<button data-do="${choice.Do}" ${choice.Class ? `class="${choice.Class}"` : ''} data-choice="${choice._key}" disabled>${choiceText}</button>`); |
| 80 | }); |
| 81 | }); |
| 82 | } |
| 83 | return Promise.resolve(`<button data-do="${choice.Do}" ${choice.Class ? `class="${choice.Class}"` : ''} data-choice="${choice._key}">${choiceText}</button>`); |
| 84 | }); |
| 85 | |
| 86 | return Promise.all(choices).then((choiceButtons) => ` |
| 87 | <div data-content="wrapper"> |
| 88 | ${choiceButtons.join('')} |
| 89 | </div> |
| 90 | `); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | export default ChoiceContainer; |
nothing calls this directly
no test coverage detected