File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
src/test/java/org/jsoup/nodes Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 7
7
import org .jsoup .select .NodeVisitor ;
8
8
import org .junit .jupiter .api .Test ;
9
9
10
+ import java .util .Collections ;
10
11
import java .util .List ;
11
12
12
13
import static org .jsoup .parser .Parser .*;
@@ -175,6 +176,22 @@ public void handlesAbsOnProtocolessAbsoluteUris() {
175
176
assertEquals ("One <em>foo</em> three" , p .html ());
176
177
}
177
178
179
+ /**
180
+ * test case for
181
+ * <a href="https://github.com/jhy/jsoup/issues/2212">Issue #2212</a>
182
+ */
183
+ @ Test public void testReplaceTwice () {
184
+ Document doc = Jsoup .parse ("<p><span>Child One</span><span>Child Two</span><span>Child Three</span><span>Child Four</span></p>" );
185
+ Elements children = doc .select ("p" ).first ().children ();
186
+ // first swap 0 and 1
187
+ children .set (0 , children .set (1 , children .get (0 )));
188
+ // then swap 1 and 2
189
+ children .set (2 , children .set (1 , children .get (2 )));
190
+
191
+ assertEquals ("Child TwoChild ThreeChild OneChild Four" ,
192
+ TextUtil .stripNewlines (children .html ()));
193
+ }
194
+
178
195
@ Test public void ownerDocument () {
179
196
Document doc = Jsoup .parse ("<p>Hello" );
180
197
Element p = doc .select ("p" ).first ();
You can’t perform that action at this time.
0 commit comments