OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/html/HTMLOutputElement.h" | 5 #include "core/html/HTMLOutputElement.h" |
6 | 6 |
7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
8 #include "core/dom/DOMSettableTokenList.h" | 8 #include "core/dom/DOMTokenList.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 TEST(HTMLLinkElementSizesAttributeTest, setHTMLForProperty_updatesForAttribute) | 14 TEST(HTMLLinkElementSizesAttributeTest, setHTMLForProperty_updatesForAttribute) |
15 { | 15 { |
16 RefPtrWillBeRawPtr<Document> document = Document::create(); | 16 RefPtrWillBeRawPtr<Document> document = Document::create(); |
17 RefPtrWillBeRawPtr<HTMLOutputElement> element = HTMLOutputElement::create(*d
ocument, /* form: */ nullptr); | 17 RefPtrWillBeRawPtr<HTMLOutputElement> element = HTMLOutputElement::create(*d
ocument, /* form: */ nullptr); |
18 EXPECT_EQ(nullAtom, element->getAttribute(HTMLNames::forAttr)); | 18 EXPECT_EQ(nullAtom, element->getAttribute(HTMLNames::forAttr)); |
19 element->htmlFor()->setValue(" strawberry "); | 19 element->htmlFor()->setValue(" strawberry "); |
20 EXPECT_EQ(" strawberry ", element->getAttribute(HTMLNames::forAttr)); | 20 EXPECT_EQ(" strawberry ", element->getAttribute(HTMLNames::forAttr)); |
21 } | 21 } |
22 | 22 |
23 TEST(HTMLOutputElementTest, setForAttribute_updatesHTMLForPropertyValue) | 23 TEST(HTMLOutputElementTest, setForAttribute_updatesHTMLForPropertyValue) |
24 { | 24 { |
25 RefPtrWillBeRawPtr<Document> document = Document::create(); | 25 RefPtrWillBeRawPtr<Document> document = Document::create(); |
26 RefPtrWillBeRawPtr<HTMLOutputElement> element = HTMLOutputElement::create(*d
ocument, nullptr); | 26 RefPtrWillBeRawPtr<HTMLOutputElement> element = HTMLOutputElement::create(*d
ocument, nullptr); |
27 RefPtrWillBeRawPtr<DOMSettableTokenList> forTokens = element->htmlFor(); | 27 RefPtrWillBeRawPtr<DOMTokenList> forTokens = element->htmlFor(); |
28 EXPECT_EQ(nullAtom, forTokens->value()); | 28 EXPECT_EQ(nullAtom, forTokens->value()); |
29 element->setAttribute(HTMLNames::forAttr, "orange grape"); | 29 element->setAttribute(HTMLNames::forAttr, "orange grape"); |
30 EXPECT_EQ("orange grape", forTokens->value()); | 30 EXPECT_EQ("orange grape", forTokens->value()); |
31 } | 31 } |
32 | 32 |
33 } // namespace blink | 33 } // namespace blink |
OLD | NEW |