本文整理汇总了C++中HTMLFormControlElementWithState::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLFormControlElementWithState::reset方法的具体用法?C++ HTMLFormControlElementWithState::reset怎么用?C++ HTMLFormControlElementWithState::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLFormControlElementWithState
的用法示例。
在下文中一共展示了HTMLFormControlElementWithState::reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: document
TEST_F(HTMLSelectElementTest, RestoreUnmatchedFormControlState) {
// We had a bug that selectedOption() and m_lastOnChangeOption were
// mismatched in optionToBeShown(). It happened when
// restoreFormControlState() couldn't find matched OPTIONs.
// crbug.com/627833.
document().documentElement()->setInnerHTML(
"<select id='sel'>"
"<option selected>Default</option>"
"<option id='2'>222</option>"
"</select>",
ASSERT_NO_EXCEPTION);
document().view()->updateAllLifecyclePhases();
Element* element = document().getElementById("sel");
HTMLFormControlElementWithState* select = toHTMLSelectElement(element);
HTMLOptionElement* opt2 = toHTMLOptionElement(document().getElementById("2"));
toHTMLSelectElement(element)->setSelectedIndex(1);
// Save the current state.
FormControlState selectState = select->saveFormControlState();
EXPECT_EQ(2U, selectState.valueSize());
// Reset the status.
select->reset();
ASSERT_FALSE(opt2->selected());
element->removeChild(opt2);
// Restore
select->restoreFormControlState(selectState);
EXPECT_EQ(-1, toHTMLSelectElement(element)->selectedIndex());
EXPECT_EQ(nullptr, toHTMLSelectElement(element)->optionToBeShown());
}