summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/html/forms/html_select_element_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/html/forms/html_select_element_test.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/html/forms/html_select_element_test.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/core/html/forms/html_select_element_test.cc b/chromium/third_party/blink/renderer/core/html/forms/html_select_element_test.cc
index f92a9abb963..9a0133c5b2d 100644
--- a/chromium/third_party/blink/renderer/core/html/forms/html_select_element_test.cc
+++ b/chromium/third_party/blink/renderer/core/html/forms/html_select_element_test.cc
@@ -50,6 +50,11 @@ class HTMLSelectElementTest : public PageTestBase {
return select->isConnected();
}
+ String MenuListLabel() const {
+ auto* select = To<HTMLSelectElement>(GetDocument().body()->firstChild());
+ return select->InnerElement().textContent();
+ }
+
private:
bool original_delegates_flag_;
};
@@ -564,6 +569,39 @@ TEST_F(HTMLSelectElementTest, SelectMultipleOptionsByPopup) {
EXPECT_FALSE(FirstSelectIsConnectedAfterSelectMultiple(Vector<int>{1}))
<< "Onchange handler should be executed.";
}
+
+ // Check if the label is correctly updated.
+ {
+ SetHtmlInnerHTML(
+ "<select multiple>"
+ "<option selected>o0</option><option selected>o1</option></select>");
+ EXPECT_EQ("2 selected", MenuListLabel());
+ EXPECT_TRUE(FirstSelectIsConnectedAfterSelectMultiple(Vector<int>{1}));
+ EXPECT_EQ("o1", MenuListLabel());
+ }
+}
+
+TEST_F(HTMLSelectElementTest, IntrinsicInlineSizeOverflow) {
+ // crbug.com/1068338
+ // This test passes if UBSAN doesn't complain.
+ SetHtmlInnerHTML(
+ "<select style='word-spacing:1073741824em;'>"
+ "<option>abc def</option></select>");
+ GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kTest);
+}
+
+TEST_F(HTMLSelectElementTest, AddingNotOwnedOption) {
+ // crbug.com/1077556
+ auto& doc = GetDocument();
+ SetHtmlInnerHTML("<select>");
+ auto* select = To<HTMLSelectElement>(doc.body()->firstChild());
+ // Append <div><optgroup></optgroup></div> to the SELECT.
+ // We can't do it with the HTML parser.
+ auto* optgroup = doc.CreateRawElement(html_names::kOptgroupTag);
+ select->appendChild(doc.CreateRawElement(html_names::kDivTag))
+ ->appendChild(optgroup);
+ optgroup->appendChild(doc.CreateRawElement(html_names::kOptionTag));
+ // This test passes if the above appendChild() doesn't cause a DCHECK failure.
}
} // namespace blink