chromium/third_party/blink/renderer/core/dom/shadow_including_tree_order_traversal_test.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/dom/shadow_including_tree_order_traversal.h"

#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "third_party/blink/renderer/core/dom/node_traversal.h"
#include "third_party/blink/renderer/core/dom/text.h"
#include "third_party/blink/renderer/core/html/html_element.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h"

namespace blink {
namespace {

ShadowIncludingTreeOrderTraversalTest;
ElementsAre;

// Traverses `traversal_range` and collects the element ids of the `Element`s it
// discovers. If a node is a shadow root, it collects the string "shadow"
// instead.
Vector<String> GatherElementIdsFromTraversalRange(auto traversal_range) {
  Vector<String> ids;
  for (Node& node : traversal_range) {
    if (auto* el = DynamicTo<Element>(node)) {
      ids.push_back(el->GetIdAttribute());
    } else if (node.IsShadowRoot()) {
      ids.push_back("shadow");
    }
  }
  return ids;
}

void RemoveWhiteSpaceOnlyTextNodes(ContainerNode& container) {}

TEST_F(ShadowIncludingTreeOrderTraversalTest, Next) {}

TEST_F(ShadowIncludingTreeOrderTraversalTest, DescendantsOf) {}

TEST_F(ShadowIncludingTreeOrderTraversalTest, ChildrenOf) {}

}  // namespace
}  // namespace blink