Bug 1249400 - add a test for missed hide events in case of accessible stealing, r=yzen

This commit is contained in:
Alexander Surkov 2016-02-23 18:40:20 -05:00
parent e372eb6efb
commit 738cb3c659
2 changed files with 54 additions and 4 deletions

View File

@ -345,10 +345,17 @@ function eventQueue(aEventType)
var msg = "Test with ID = '" + this.getEventID(checker) + var msg = "Test with ID = '" + this.getEventID(checker) +
"' succeed. "; "' succeed. ";
if (checker.unexpected) if (checker.unexpected) {
ok(true, msg + "There's no unexpected " + typeStr + " event."); if (checker.todo) {
else todo(false, "Event " + typeStr + " event is still missing");
}
else {
ok(true, msg + "There's no unexpected " + typeStr + " event.");
}
}
else {
ok(true, msg + "Event " + typeStr + " was handled."); ok(true, msg + "Event " + typeStr + " was handled.");
}
} }
} }
} }
@ -371,8 +378,13 @@ function eventQueue(aEventType)
ok(false, msg + "Dupe " + typeStr + " event."); ok(false, msg + "Dupe " + typeStr + " event.");
if (checker.unexpected) { if (checker.unexpected) {
if (checker.wasCaught) if (checker.todo) {
todo(checker.wasCaught,
"Event " + typeStr + " event is still missing");
}
else if (checker.wasCaught) {
ok(false, msg + "There's unexpected " + typeStr + " event."); ok(false, msg + "There's unexpected " + typeStr + " event.");
}
} else if (!checker.wasCaught) { } else if (!checker.wasCaught) {
ok(false, msg + typeStr + " event was missed."); ok(false, msg + typeStr + " event was missed.");
} }
@ -1667,6 +1679,18 @@ function invokerChecker(aEventType, aTargetOrFunc, aTargetFuncArg, aIsAsync)
this.mTargetFuncArg = aTargetFuncArg; this.mTargetFuncArg = aTargetFuncArg;
} }
/**
* Generic invoker checker for todo events.
*/
function todo_invokerChecker(aEventType, aTargetOrFunc, aTargetFuncArg)
{
this.__proto__ = new invokerChecker(aEventType, aTargetOrFunc,
aTargetFuncArg, true);
this.unexpected = true;
this.todo = true;
}
/** /**
* Generic invoker checker for unexpected events. * Generic invoker checker for unexpected events.
*/ */

View File

@ -358,6 +358,25 @@
} }
} }
function showHiddenParentOfVisibleChild()
{
this.eventSeq = [
new todo_invokerChecker(EVENT_HIDE, getNode("c4_child")),
new invokerChecker(EVENT_SHOW, getNode("c4_middle")),
new invokerChecker(EVENT_REORDER, getNode("c4"))
];
this.invoke = function showHiddenParentOfVisibleChild_invoke()
{
getNode("c4_middle").style.visibility = 'visible';
}
this.getID = function showHiddenParentOfVisibleChild_getID()
{
return "show hidden parent of visible child";
}
}
/** /**
* Target getters. * Target getters.
*/ */
@ -484,6 +503,7 @@
gQueue.push(new test2("testContainer", "testNestedContainer")); gQueue.push(new test2("testContainer", "testNestedContainer"));
gQueue.push(new test3("testContainer")); gQueue.push(new test3("testContainer"));
gQueue.push(new insertReferredElm("testContainer3")); gQueue.push(new insertReferredElm("testContainer3"));
gQueue.push(new showHiddenParentOfVisibleChild());
gQueue.invoke(); // Will call SimpleTest.finish(); gQueue.invoke(); // Will call SimpleTest.finish();
} }
@ -544,5 +564,11 @@
</div> </div>
<div id="testContainer2"></div> <div id="testContainer2"></div>
<div id="testContainer3"></div> <div id="testContainer3"></div>
<div id="c4">
<div style="visibility:hidden" id="c4_middle">
<div style="visibility:visible" id="c4_child"></div>
</div>
</div>
</body> </body>
</html> </html>