MCPcopy Create free account
hub / github.com/Stranger6667/css-inline / test_append

Function test_append

css-inline/src/html/document.rs:552–565  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

550
551 #[test]
552 fn test_append() {
553 let mut doc = Document::with_capacity(0, 0);
554
555 let node1_id = doc.push_node(new_element());
556 let node2_id = doc.push_node(new_element());
557
558 let document_id = NodeId::document_id();
559 doc.append(document_id, node1_id);
560 doc.append(document_id, node2_id);
561
562 assert_eq!(doc[document_id].last_child, Some(node2_id));
563 assert_eq!(doc[node1_id].next_sibling, Some(node2_id));
564 assert_eq!(doc[node2_id].previous_sibling, Some(node1_id));
565 }
566
567 #[test_case(b"<!DOCTYPE html><html><head><title>Title of the document</title></head><body></body></html>")]
568 #[test_case(b"<!DOCTYPE html><html><head><title>Title of the document</title></head><body><hr></body></html>")]

Callers

nothing calls this directly

Calls 3

new_elementFunction · 0.85
push_nodeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected