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
38 changes: 38 additions & 0 deletions .maestro/flows/empty_lists_parsing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
appId: swmansion.enriched.example
---
# PR #542 - fix(android): parsing empty lists
# Validates that lists with empty and whitespace-only items are parsed and displayed correctly
- launchApp

- tapOn:
id: "toggle-screen-button"

- runFlow:
file: "../subflows/set_editor_value.yaml"
env:
VALUE: >
<html>
<ol>
<li>First</li>
<li> </li>
<li>Third</li>
</ol>
<ul>
<li>First</li>
<li> </li>
<li>Third</li>
</ul>
<ul data-type="checkbox">
<li>First</li>
<li> </li>
<li>Third</li>
</ul>
</html>

- tapOn:
id: "size-max-button"

- runFlow:
file: "../subflows/capture_or_assert_screenshot.yaml"
env:
SCREENSHOT_NAME: "empty_lists_parsing"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .maestro/screenshots/ios/empty_lists_parsing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,6 @@ public void endElement(String uri, String localName, String qName) {

public void characters(char[] ch, int start, int length) {
StringBuilder sb = new StringBuilder();
if (length > 0) isEmptyTag = false;

/*
* Ignore whitespace that immediately follows other whitespace;
Expand Down Expand Up @@ -871,6 +870,11 @@ public void characters(char[] ch, int start, int length) {
sb.append(c);
}
}
// Only mark the tag as non-empty if content was actually appended after
// whitespace collapsing. A space-only list item (e.g. <li> </li>) would
// have its space dropped when the preceding char is a newline, leaving
// nothing to anchor a span — the ZWS placeholder must still be inserted.
if (sb.length() > 0) isEmptyTag = false;
mSpannableStringBuilder.append(sb);
}

Expand Down
Loading