Bug 1430408 - Part 1: Use Async Function in devtools/client/debugger/test/mochitest/browser_dbg_instruments-pane-collapse_keyboard.js r=pbro

This commit is contained in:
Tooru Fujisawa 2018-01-20 20:40:10 +09:00
Родитель b733a923bf
Коммит 037c33bc9a
1 изменённых файлов: 17 добавлений и 19 удалений

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

@ -9,32 +9,30 @@
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
function test() {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
Task.spawn(function* () {
let doc = aPanel.panelWin.document;
let panel = doc.getElementById("instruments-pane");
let button = doc.getElementById("instruments-pane-toggle");
ok(panel.classList.contains("pane-collapsed"),
"The instruments panel is initially in collapsed state");
async function test() {
let [aTab,, aPanel] = await initDebugger(TAB_URL);
yield togglePane(button, "Press on the toggle button to expand", panel, "VK_RETURN");
ok(!panel.classList.contains("pane-collapsed"),
"The instruments panel is in the expanded state");
let doc = aPanel.panelWin.document;
let panel = doc.getElementById("instruments-pane");
let button = doc.getElementById("instruments-pane-toggle");
ok(panel.classList.contains("pane-collapsed"),
"The instruments panel is initially in collapsed state");
yield togglePane(button, "Press on the toggle button to collapse", panel, "VK_SPACE");
ok(panel.classList.contains("pane-collapsed"),
"The instruments panel is in the collapsed state");
await togglePane(button, "Press on the toggle button to expand", panel, "VK_RETURN");
ok(!panel.classList.contains("pane-collapsed"),
"The instruments panel is in the expanded state");
closeDebuggerAndFinish(aPanel);
});
});
await togglePane(button, "Press on the toggle button to collapse", panel, "VK_SPACE");
ok(panel.classList.contains("pane-collapsed"),
"The instruments panel is in the collapsed state");
closeDebuggerAndFinish(aPanel);
}
function* togglePane(button, message, pane, keycode) {
async function togglePane(button, message, pane, keycode) {
let onTransitionEnd = once(pane, "transitionend");
info(message);
button.focus();
EventUtils.synthesizeKey(keycode, {});
yield onTransitionEnd;
await onTransitionEnd;
}