<commit_before>// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import "@testing-library/jest-dom/extend-expect";

// need this for async/await in tests
import "core-js/stable";
import "regenerator-runtime/runtime";

import jquery from "jquery";
window.$ = window.jQuery = jquery;
jquery.expr.pseudos.visible = function () {
    // Fix jQuery ":visible" selector always returns false in JSDOM.
    // https://github.com/jsdom/jsdom/issues/1048#issuecomment-401599392
    return true;
};

class URL {
    constructor(url) {
        this.url = url;
        this.protocol = url.split("//")[0];
    }
}
window.URL = URL;

// pat-subform
// See https://github.com/jsdom/jsdom/issues/1937#issuecomment-461810980
window.HTMLFormElement.prototype.submit = () => {};<commit_msg>maint(tests): patch dom.is_visible to work with jsDOM.<commit_after>// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import "@testing-library/jest-dom/extend-expect";

// need this for async/await in tests
import "core-js/stable";
import "regenerator-runtime/runtime";

import jquery from "jquery";
window.$ = window.jQuery = jquery;
jquery.expr.pseudos.visible = function () {
    // Fix jQuery ":visible" selector always returns false in JSDOM.
    // https://github.com/jsdom/jsdom/issues/1048#issuecomment-401599392
    return true;
};

class URL {
    constructor(url) {
        this.url = url;
        this.protocol = url.split("//")[0];
    }
}
window.URL = URL;

// pat-subform
// See https://github.com/jsdom/jsdom/issues/1937#issuecomment-461810980
window.HTMLFormElement.prototype.submit = () => {};

// patch dom.is_visible to not rely on jest-unavailable offsetWidth/Height but
// simply test on display-none, which is set by jQuery show/hide.
import dom from "@patternslib/patternslib/src/core/dom";
dom.is_visible = (el) => {
    return el.style.display !== "none";
};
{'fraction_non_alphanumeric': 0.14741219963031424, 'fraction_numerical': 0.024953789279112754, 'mean_word_length': 3.586864406779661, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 6, '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': '4180878', 'n_tokens_mistral': 717, 'n_tokens_neox': 673, 'n_words': 168}