<commit_before>odoo.define('web.test_utils_dom', function (require) {
"use strict";

var concurrency = require('web.concurrency');

/**
 * DOM Test Utils
 *
 * This module defines various utility functions to help simulate DOM events.
 *
 * Note that all methods defined in this module are exported in the main
 * testUtils file.
 */

/**
 * Returns a promise that will be resolved after the tick after the
 * nextAnimationFrame
 *
 * This is useful to guarantee that OWL has had the time to render
 *
 * @returns {Promise}
 */
function returnAfterNextAnimationFrame() {
    return new Promise((resolve) => {
        window.requestAnimationFrame(async () => {
            await concurrency.delay(0);
            resolve();
        });
    });
}

/**
 * Check if an object is an instance of EventTarget.
 *
 * @param {Object} node
 * @returns {boolean}
 */
function isEventTarget(node) {
    if (node instanceof window.top.EventTarget) {
        return true;
    }
    const contextWindow = node.defaultView || // document
        (node.ownerDocument && node.ownerDocument.defaultView); // iframe node
    return contextWindow && node instanceof contextWindow.EventTarget;
}

/**<commit_msg>[FIX] web: tests: nextTick awaits render with requestAnimationFrame<commit_after>odoo.define('web.test_utils_dom', function (require) {
"use strict";

var concurrency = require('web.concurrency');

/**
 * DOM Test Utils
 *
 * This module defines various utility functions to help simulate DOM events.
 *
 * Note that all methods defined in this module are exported in the main
 * testUtils file.
 */

/**
 * Returns a promise that will be resolved after the nextAnimationFrame after
 * the next tick
 *
 * This is useful to guarantee that OWL has had the time to render
 *
 * @returns {Promise}
 */
function returnAfterNextAnimationFrame() {
    return new Promise(async resolve => {
        await concurrency.delay(0);
        window.requestAnimationFrame(resolve);
    });
}

/**
 * Check if an object is an instance of EventTarget.
 *
 * @param {Object} node
 * @returns {boolean}
 */
function isEventTarget(node) {
    if (node instanceof window.top.EventTarget) {
        return true;
    }
    const contextWindow = node.defaultView || // document
        (node.ownerDocument && node.ownerDocument.defaultView); // iframe node
    return contextWindow && node instanceof contextWindow.EventTarget;
}

/**
{'fraction_non_alphanumeric': 0.10458333333333333, 'fraction_numerical': 0.0008333333333333334, 'mean_word_length': 3.4055045871559635, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3100707', 'n_tokens_mistral': 646, 'n_tokens_neox': 640, 'n_words': 226}