diff --git a/.maestro/enrichedInput/flows/checkbox_after_images.yaml b/.maestro/enrichedInput/flows/checkbox_after_images.yaml new file mode 100644 index 000000000..60bffc8ca --- /dev/null +++ b/.maestro/enrichedInput/flows/checkbox_after_images.yaml @@ -0,0 +1,25 @@ +appId: swmansion.enriched.example +tags: + - ios-only +--- +# PR #820 - fix(iOS): keep checkbox states after inline images +- launchApp + +- tapOn: + id: 'toggle-screen-button' + +- runFlow: + file: '../subflows/set_editor_value.yaml' + env: + VALUE: > + +

+ + + +- runFlow: + file: '../subflows/capture_or_assert_screenshot.yaml' + env: + SCREENSHOT_NAME: 'checkbox_after_images' diff --git a/.maestro/enrichedInput/screenshots/ios/checkbox_after_images.png b/.maestro/enrichedInput/screenshots/ios/checkbox_after_images.png new file mode 100644 index 000000000..798496be3 Binary files /dev/null and b/.maestro/enrichedInput/screenshots/ios/checkbox_after_images.png differ diff --git a/ios/htmlParser/HtmlParser.mm b/ios/htmlParser/HtmlParser.mm index f710a7411..c730ad019 100644 --- a/ios/htmlParser/HtmlParser.mm +++ b/ios/htmlParser/HtmlParser.mm @@ -474,7 +474,12 @@ + (NSArray *_Nonnull)getTextAndStylesFromHtml:(NSString *_Nonnull)fixedHtml // Track checkbox state if we're inside a checkbox list if (insideCheckboxList) { BOOL isChecked = [currentTagParams containsString:@"checked"]; - checkboxStates[@(plainText.length)] = @(isChecked); + // Key by the position in the final NSTextStorage, which holds one + // placeholder per preceding image that 'plainText' doesn't have + // yet. This matches the image-shifted list range the states are + // later filtered by in prepareCheckboxListStyleValue:. + checkboxStates[@(plainText.length + precedingImageCount)] = + @(isChecked); } // Record the start location so we can check if it's empty when // closing