Bug 424698. Don't treat it as a value set if a text input with a default value has its frame go away. r+sr=sicking

This commit is contained in:
Boris Zbarsky 2008-07-21 12:09:00 -07:00
Родитель 3f808a19db
Коммит 9465c876f7
3 изменённых файлов: 64 добавлений и 3 удалений

Просмотреть файл

@ -825,7 +825,6 @@ nsHTMLInputElement::TakeTextFrameValue(const nsAString& aValue)
nsMemory::Free(mValue);
}
mValue = ToNewUTF8String(aValue);
SetValueChanged(PR_TRUE);
return NS_OK;
}

Просмотреть файл

@ -108,12 +108,13 @@ _TEST_FILES = test_bug589.html \
test_bug394700.html \
test_bug395107.html \
test_bug401160.xhtml \
test_bug406596.html \
test_bug408231.html \
test_bug417760.html \
file_bug417760.png \
test_bug428135.xhtml \
test_bug406596.html \
test_bug421640.html \
test_bug424698.html \
test_bug428135.xhtml \
test_bug430351.html \
test_bug430392.html \
$(NULL)

Просмотреть файл

@ -0,0 +1,61 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=424698
-->
<head>
<title>Test for Bug 424698</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=424698">Mozilla Bug 424698</a>
<p id="display">
<input id="i1">
<input id="target">
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 424698 **/
var i = $("i1");
is(i.value, "", "Value should be empty string");
i.defaultValue = "test";
is(i.value, "test", "Setting defaultValue should work");
i.defaultValue = "test2";
is(i.value, "test2", "Setting defaultValue multiple times should work");
// Now let's hide and reshow things
i.style.display = "none";
is(i.offsetWidth, 0, "Input didn't hide?");
i.style.display = "";
isnot(i.offsetWidth, 0, "Input didn't show?");
is(i.value, "test2", "Hiding/showing should not affect value");
i.defaultValue = "test3";
is(i.value, "test3", "Setting defaultValue after hide/show should work");
// Make sure typing works ok
i = $("target");
i.focus(); // Otherwise editor gets confused when we send the key events
is(i.value, "", "Value should be empty string in second control");
sendString("2test2");
is(i.value, "2test2", 'We just typed the string "2test2"');
i.defaultValue = "2test3";
is(i.value, "2test2", "Setting defaultValue after typing should not work");
i.style.display = "none";
is(i.offsetWidth, 0, "Second input didn't hide?");
i.style.display = "";
isnot(i.offsetWidth, 0, "Second input didn't show?");
is(i.value, "2test2", "Hiding/showing second input should not affect value");
i.defaultValue = "2test4";
is(i.value, "2test2", "Setting defaultValue after hide/show should not work if we typed");
</script>
</pre>
</body>
</html>