Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: Source/core/html/HTMLFormControlElementTest.cpp

Issue 616443002: Implement :valid and :invalid pseudoclass for <form> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout tests, apply feedback from Keishi, add support for removing/inserting elements into the … Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "core/html/HTMLFormControlElement.h" 6 #include "core/html/HTMLFormControlElement.h"
7 7
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/html/HTMLDocument.h" 9 #include "core/html/HTMLDocument.h"
10 #include "core/html/HTMLInputElement.h" 10 #include "core/html/HTMLInputElement.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 EXPECT_EQ(RTL, messageDir); 60 EXPECT_EQ(RTL, messageDir);
61 EXPECT_EQ(RTL, subMessageDir); 61 EXPECT_EQ(RTL, subMessageDir);
62 62
63 input->setCustomValidity(String::fromUTF8("Main message.")); 63 input->setCustomValidity(String::fromUTF8("Main message."));
64 message = input->validationMessage().stripWhiteSpace(); 64 message = input->validationMessage().stripWhiteSpace();
65 input->findCustomValidationMessageTextDirection(message, messageDir, subMess age, subMessageDir); 65 input->findCustomValidationMessageTextDirection(message, messageDir, subMess age, subMessageDir);
66 EXPECT_EQ(LTR, messageDir); 66 EXPECT_EQ(LTR, messageDir);
67 EXPECT_EQ(RTL, subMessageDir); 67 EXPECT_EQ(RTL, subMessageDir);
68 } 68 }
69 69
70 TEST_F(HTMLFormControlElementTest, isValidElement)
71 {
72 document().documentElement()->setInnerHTML("<body><input required id=input1> <input required id=input2 value=0></body>", ASSERT_NO_EXCEPTION);
73 document().view()->updateLayoutAndStyleIfNeededRecursive();
74
75 HTMLInputElement* input1 = toHTMLInputElement(document().getElementById("inp ut1"));
76 HTMLInputElement* input2 = toHTMLInputElement(document().getElementById("inp ut2"));
77
78 EXPECT_FALSE(input1->isValidElement());
79 EXPECT_TRUE(input2->isValidElement());
70 } 80 }
81
82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698