Skip to content

Commit f4e7864

Browse files
rpond21edumserrano
andauthored
Change checkbox to handle lowercase (#199)
* Change checkbox to handle lowercase * Update tests to check for lower case 'X' on checkboxes --------- Co-authored-by: Eduardo Serrano <[email protected]>
1 parent 5aef824 commit f4e7864

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

GitHubIssueFormsParser/src/GitHubIssuesParserCli/IssueFormBodies/IssueFormItems/Checkboxes/IssueFormCheckBoxesText.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ private static List<IssueFormCheckboxOption> CreateCheckboxOptions(string option
2525
.TrimIssueText();
2626
isChecked = true;
2727
}
28+
else if (optionText.StartsWith("- [x]", StringComparison.Ordinal))
29+
{
30+
label = optionText
31+
.TrimStart([.. "- [x]"])
32+
.TrimIssueText();
33+
isChecked = true;
34+
}
2835
else if (optionText.StartsWith("- [ ]", StringComparison.Ordinal))
2936
{
3037
label = optionText

GitHubIssueFormsParser/tests/GitHubIssuesParserCli.Tests/CliIntegration/CliIntegrationTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ public async Task TemplateFilepathOptionValidation2()
117117

118118
/// <summary>
119119
/// Tests the correct value for the options that can be used with the 'parse-issue-form' command.
120+
/// This test uses an issue body where the checkboxes use both an Uppercase and Lowercase 'X' or aren't
121+
/// checked.
120122
/// </summary>
121123
[Theory]
122124
[InlineData("-i", "-t")]

GitHubIssueFormsParser/tests/GitHubIssuesParserCli.Tests/TestFiles/IssueBody.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ Another line:
2929
### Which operating systems have you used?
3030

3131
- [X] macOS
32-
- [X] Windows
32+
- [x] Windows
3333
- [ ] Linux
3434
- [ ] I don't know

0 commit comments

Comments
 (0)