File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
src/Html2OpenXml/Expressions Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ public override IEnumerable<OpenXmlElement> Interpret (ParsingContext context)
81
81
// doesn't ends/starts with a whitespace
82
82
if ( text . Length == 0 && prevIsPhrasing && nextIsPhrasing
83
83
&& ( endsWithSpace || startsWithSpace )
84
- && ! ( node . PreviousSibling ! . TextContent [ node . PreviousSibling ! . TextContent . Length - 1 ] . IsWhiteSpaceCharacter ( )
84
+ && ! ( node . PreviousSibling ! . TextContent . Length == 0
85
+ || node . PreviousSibling ! . TextContent [ node . PreviousSibling ! . TextContent . Length - 1 ] . IsWhiteSpaceCharacter ( )
85
86
|| node . NextSibling ! . TextContent [ 0 ] . IsWhiteSpaceCharacter ( )
86
87
) )
87
88
{
Original file line number Diff line number Diff line change @@ -39,12 +39,13 @@ public void ConsecutiveDivs_ReturnsMultipleParagraphs ()
39
39
[ TestCase ( "<span> Hello \r \n World! </span>" ) ]
40
40
[ TestCase ( "<span> Hello\r \n \r \n World! </span>" ) ]
41
41
[ TestCase ( "<div><u>Hello World! </u></div>" ) ]
42
+ [ TestCase ( "<hr>\n <span>Hello World!</span>" ) ]
42
43
public void Multiline_ReturnsCollapsedText ( string html )
43
44
{
44
45
var elements = converter . Parse ( html ) ;
45
- Assert . That ( elements , Has . Count . EqualTo ( 1 ) ) ;
46
+ Assert . That ( elements , Has . Count . GreaterThanOrEqualTo ( 1 ) ) ;
46
47
Assert . That ( elements , Has . All . TypeOf < Paragraph > ( ) ) ;
47
- Assert . That ( elements [ 0 ] . InnerText , Is . EqualTo ( "Hello World!" ) ) ;
48
+ Assert . That ( elements . Last ( ) . InnerText , Is . EqualTo ( "Hello World!" ) ) ;
48
49
}
49
50
50
51
[ TestCase ( "h1" ) ]
You can’t perform that action at this time.
0 commit comments