1 // Copyright 2015 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "third_party/blink/renderer/core/html/forms/html_output_element.h" 6 7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "third_party/blink/renderer/core/dom/document.h" 9 #include "third_party/blink/renderer/core/dom/dom_token_list.h" 10 #include "third_party/blink/renderer/core/html_names.h" 11 #include "third_party/blink/renderer/platform/heap/heap.h" 12 13 namespace blink { 14 TEST(HTMLLinkElementSizesAttributeTest,setHTMLForProperty_updatesForAttribute)15TEST(HTMLLinkElementSizesAttributeTest, 16 setHTMLForProperty_updatesForAttribute) { 17 auto* document = Document::CreateForTest(); 18 auto* element = MakeGarbageCollected<HTMLOutputElement>(*document); 19 EXPECT_EQ(g_null_atom, element->FastGetAttribute(html_names::kForAttr)); 20 element->htmlFor()->setValue(" strawberry "); 21 EXPECT_EQ(" strawberry ", element->FastGetAttribute(html_names::kForAttr)); 22 } 23 TEST(HTMLOutputElementTest,setForAttribute_updatesHTMLForPropertyValue)24TEST(HTMLOutputElementTest, setForAttribute_updatesHTMLForPropertyValue) { 25 auto* document = Document::CreateForTest(); 26 auto* element = MakeGarbageCollected<HTMLOutputElement>(*document); 27 DOMTokenList* for_tokens = element->htmlFor(); 28 EXPECT_EQ(g_null_atom, for_tokens->value()); 29 element->setAttribute(html_names::kForAttr, "orange grape"); 30 EXPECT_EQ("orange grape", for_tokens->value()); 31 } 32 33 } // namespace blink 34