bug 1322422 use assertSnapshots() to log failures better r=Ehsan

MozReview-Commit-ID: 54WgoCdKjMX

--HG--
extra : rebase_source : 1ab5cccb586edad9f3a30c90f413124df006820f
This commit is contained in:
Karl Tomlinson 2016-12-06 22:38:23 -10:00
Родитель 88fdac7c7f
Коммит 4c027cc4bc
1 изменённых файлов: 26 добавлений и 14 удалений

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

@ -33,12 +33,8 @@ add_task(function*() {
document.body.clientWidth;
window.Screenshots.rtl = window.snapshotWindow(window);
RTLRef.parentNode.removeChild(RTLRef);
window.Screenshots.get = function(dir, flip) {
if (flip) {
return this[dir == "rtl" ? "ltr" : "rtl"];
} else {
return this[dir];
}
window.Screenshots.get = function(dir) {
return this[dir];
};
});
@ -68,21 +64,32 @@ add_task(function*() {
document.getElementById("content").appendChild(t);
document.body.clientWidth;
var s1 = window.snapshotWindow(window);
ok(window.compareSnapshots(s1, window.Screenshots.get(initialDir, false), true)[0],
"Textarea should appear correctly before switching the direction (" + initialDir + ")");
window.ok = ok; // for assertSnapshots
window.
assertSnapshots(s1, window.Screenshots.get(initialDir), true,
/* fuzz = */ null,
"Textarea before switching the direction from " +
initialDir,
"Reference " + initialDir + " textarea");
t.focus();
is(window.inputEventCount, 0, "input event count must be 0 before");
});
yield simulateCtrlShiftX(aBrowser);
yield ContentTask.spawn(aBrowser, {initialDir}, function({initialDir}) {
var window = content.window.wrappedJSObject;
is(window.t.getAttribute("dir"), initialDir == "ltr" ? "rtl" : "ltr", "The dir attribute must be correctly updated");
var expectedDir = initialDir == "ltr" ? "rtl" : "ltr"
is(window.t.getAttribute("dir"), expectedDir,
"The dir attribute must be correctly updated");
is(window.inputEventCount, 1, "input event count must be 1 after");
window.t.blur();
var s2 = window.snapshotWindow(window);
ok(window.compareSnapshots(s2, window.Screenshots.get(initialDir, true), true)[0],
"Textarea should appear correctly after switching the direction (" + initialDir + ")");
window.ok = ok; // for assertSnapshots
window.
assertSnapshots(s2, window.Screenshots.get(expectedDir), true,
/* fuzz = */ null,
"Textarea after switching the direction from " +
initialDir,
"Reference " + expectedDir + " textarea");
window.t.focus();
is(window.inputEventCount, 1, "input event count must be 1 before");
});
@ -94,8 +101,13 @@ add_task(function*() {
is(window.t.getAttribute("dir"), initialDir == "ltr" ? "ltr" : "rtl", "The dir attribute must be correctly updated");
window.t.blur();
var s3 = window.snapshotWindow(window);
ok(window.compareSnapshots(s3, window.Screenshots.get(initialDir, false), true)[0],
"Textarea should appear correctly after switching back the direction (" + initialDir + ")");
window.ok = ok; // for assertSnapshots
window.
assertSnapshots(s3, window.Screenshots.get(initialDir), true,
/* fuzz = */ null,
"Textarea after switching back the direction to " +
initialDir,
"Reference " + initialDir + " textarea");
window.t.parentNode.removeChild(window.t);
});
}