Bug 665677 test_bug330705-2.xul should ensure that the first box gets focus before doing test r=smaug

This commit is contained in:
Masayuki Nakano 2011-12-08 09:58:26 +09:00
Родитель 4a573899c2
Коммит 853ced0ced
1 изменённых файлов: 15 добавлений и 5 удалений

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

@ -18,15 +18,25 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=330705
<![CDATA[
SimpleTest.waitForExplicitFinish();
var isFocused = false;
function doTest() {
document.getElementsByTagName('box')[1].blur();
setTimeout(function () {
ok(isFocused,
"The first box element is still focused after blur() has been called on the second box element");
SimpleTest.finish();
}, 100);
}
function onLoad() {
var isFocused = false;
var box = document.getElementsByTagName('box')[0];
box.addEventListener('focus', function() { isFocused = true; }, true);
box.addEventListener('focus', function() {
isFocused = true;
setTimeout(doTest, 0);
}, true);
box.addEventListener('blur', function() { isFocused = false;}, true);
box.focus();
document.getElementsByTagName('box')[1].blur();
ok(isFocused == true, "The first box element is still focused after blur() has been called on the second box element");
SimpleTest.finish();
}
addLoadEvent(onLoad);