Add test coverage for DOM traversal