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

Function test_insert_before

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

Source from the content-addressed store, hash-verified

532
533 #[test]
534 fn test_insert_before() {
535 let mut doc = Document::with_capacity(0, 0);
536
537 let node1_id = doc.push_node(new_element());
538 let node2_id = doc.push_node(new_element());
539 let new_node_id = doc.push_node(new_element());
540
541 let document_id = NodeId::document_id();
542 doc.append(document_id, node1_id);
543 doc.append(document_id, node2_id);
544
545 doc.insert_before(node2_id, new_node_id);
546
547 assert_eq!(doc[node2_id].previous_sibling, Some(new_node_id));
548 assert_eq!(doc[new_node_id].next_sibling, Some(node2_id));
549 }
550
551 #[test]
552 fn test_append() {

Callers

nothing calls this directly

Calls 4

new_elementFunction · 0.85
insert_beforeMethod · 0.80
push_nodeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected