chromium/third_party/blink/renderer/core/html/forms/html_select_list_element_test.cc

// Copyright 2023 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/html/forms/html_select_list_element.h"

#include "base/run_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/web/web_autofill_state.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/renderer/core/css/properties/longhands.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/html/forms/html_button_element.h"
#include "third_party/blink/renderer/core/html/forms/html_listbox_element.h"
#include "third_party/blink/renderer/core/html/forms/html_option_element.h"
#include "third_party/blink/renderer/core/loader/empty_clients.h"
#include "third_party/blink/renderer/core/script/classic_script.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h"

namespace blink {
namespace {

void CheckOptions(HeapVector<Member<HTMLOptionElement>> options,
                  const std::vector<std::string>& expected_option_values) {}

// ChromeClient which counts invocations of
// SelectOrSelectListFieldOptionsChanged().
class OptionsChangedCounterChromeClient : public EmptyChromeClient {};

}  // anonymous namespace

class HTMLSelectListElementTest : public PageTestBase {};

// Tests that HtmlSelectListElement::SetAutofillValue() doesn't change the
// `interacted_state_` attribute of the field.
TEST_F(HTMLSelectListElementTest, SetAutofillValuePreservesEditedState) {}

// Test that SelectListElement::GetListItems() return value is updated upon
// adding <option>s.
TEST_F(HTMLSelectListElementTest, GetListItemsAdd) {}

// Test that SelectListElement::GetListItems() return value is updated upon
// removing <option>.
TEST_F(HTMLSelectListElementTest, GetListItemsRemove) {}

// Test that blink::ChromeClient::SelectOrSelectListFieldOptionsChanged() is
// called when <option> is added to <selectlist>.
TEST_F(HTMLSelectListElementTest, NotifyClientListItemAdd) {}

// Test that blink::ChromeClient::SelectOrSelectListFieldOptionsChanged() is
// called when <option> is removed from <selectlist>.
TEST_F(HTMLSelectListElementTest, NotifyClientListItemRemove) {}

// Test behavior of HTMLSelectListElement::OwnerSelectList() if selectlist uses
// custom parts.
TEST_F(HTMLSelectListElementTest, OwnerSelectList_PartsCustomSlots) {}

// Test that HTMLSelectListElement::SetSuggestedValue() does not affect
// HTMLSelectListElement::selectedOption().
TEST_F(HTMLSelectListElementTest, SetSuggestedValue) {}

// Test that passing an empty string to
// HTMLSelectListElement::SetSuggestedValue() clears autofill preview state.
TEST_F(HTMLSelectListElementTest, SetSuggestedValueEmptyString) {}

// Test that HTMLSelectListElement::SetSuggestedOption() is a noop if the
// passed-in value does not match any of the <option>s.
TEST_F(HTMLSelectListElementTest, SetSuggestedValueNoMatchingOption) {}

// Test that HTMLSelectListElement::setValue() clears the suggested option.
TEST_F(HTMLSelectListElementTest, SuggestedValueClearedWhenValueSet) {}

Color GetBorderColorForSuggestedOptionPopover(HTMLSelectListElement* element) {}

// Test HTMLSelectListElement preview popover inherits border color from the
// button when the <selectlist> button has a custom color.
TEST_F(HTMLSelectListElementTest, PreviewButtonHasCustomBorder) {}

// Test HTMLSelectListElement preview popover inherits border color from the
// button when the <selectlist> button has an autofill-specific custom color.
TEST_F(HTMLSelectListElementTest, PreviewButtonHasCustomAutofillBorder) {}

// Test HTMLSelectListElement preview popover uses default color and does not
// inherit color from selectlist button when selectlist button does not specify
// a custom border color.
TEST_F(HTMLSelectListElementTest, PreviewButtonHasNoCustomBorder) {}

}  // namespace blink