<!DOCTYPE html>
<html>
<body>
<script src="../resources/js-test-pre.js"></script>
<script>

description('A microtask checkpoint should be performed after executing each task.');

const logs = [];

if (!window.internals)
    testFailed('This test requires internals');
else {
    jsTestIsAsync = true;

    internals.queueTask('DOMManipulation', () => {
        logs.push('1.task');
    });
    internals.queueTaskToQueueMicrotask('DOMManipulation', () => {
        logs.push('2.microtask');
    });
    internals.queueTaskToQueueMicrotask('DOMManipulation', () => {
        logs.push('3.microtask');
    });
    internals.queueTask('DOMManipulation', () => {
        logs.push('4.task');
    });

    internals.queueTask('DOMManipulation', () => {
        shouldBeEqualToString('logs.join(", ")', '1.task, 2.microtask, 3.microtask, 4.task');
        finishJSTest();
    });
}

</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>
