TEST_F(HTMLSelectElementTest, DefaultToolTip) { document().documentElement()->setInnerHTML("<select size=4><option value="">Placeholder</option><optgroup><option>o2</option></optgroup></select>", ASSERT_NO_EXCEPTION); document().view()->updateAllLifecyclePhases(); HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChild()); Element* option = toElement(select->firstChild()); Element* optgroup = toElement(option->nextSibling()); EXPECT_EQ(String(), select->defaultToolTip()) << "defaultToolTip for SELECT without FORM and without required attribute should return null string."; EXPECT_EQ(select->defaultToolTip(), option->defaultToolTip()); EXPECT_EQ(select->defaultToolTip(), optgroup->defaultToolTip()); select->setBooleanAttribute(HTMLNames::requiredAttr, true); EXPECT_EQ("<<ValidationValueMissingForSelect>>", select->defaultToolTip()) << "defaultToolTip for SELECT without FORM and with required attribute should return a valueMissing message."; EXPECT_EQ(select->defaultToolTip(), option->defaultToolTip()); EXPECT_EQ(select->defaultToolTip(), optgroup->defaultToolTip()); HTMLFormElement* form = HTMLFormElement::create(document()); document().body()->appendChild(form); form->appendChild(select); EXPECT_EQ("<<ValidationValueMissingForSelect>>", select->defaultToolTip()) << "defaultToolTip for SELECT with FORM and required attribute should return a valueMissing message."; EXPECT_EQ(select->defaultToolTip(), option->defaultToolTip()); EXPECT_EQ(select->defaultToolTip(), optgroup->defaultToolTip()); form->setBooleanAttribute(HTMLNames::novalidateAttr, true); EXPECT_EQ(String(), select->defaultToolTip()) << "defaultToolTip for SELECT with FORM[novalidate] and required attribute should return null string."; EXPECT_EQ(select->defaultToolTip(), option->defaultToolTip()); EXPECT_EQ(select->defaultToolTip(), optgroup->defaultToolTip()); option->remove(); optgroup->remove(); EXPECT_EQ(String(), option->defaultToolTip()); EXPECT_EQ(String(), optgroup->defaultToolTip()); }
static void autofocusAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { INC_STATS("DOM.HTMLSelectElement.autofocus._set"); HTMLSelectElement* imp = V8HTMLSelectElement::toNative(info.Holder()); bool v = value->BooleanValue(); imp->setBooleanAttribute(WebCore::HTMLNames::autofocusAttr, v); return; }
void setJSHTMLSelectElementRequired(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(thisObject); HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl()); imp->setBooleanAttribute(WebCore::HTMLNames::requiredAttr, value.toBoolean(exec)); }