Код: Выделить всё
import $ from 'jquery';
$(function(){
$(".main #subMain").on("click", function(e){
e.preventDefault();
var block = $("div.next").parents(".head").first();
block.find(".main_styles").attr("hidden", false);
block.insertAfter(".footer-section");
$([document.documentElement, document.body]).animate({
scrollTop: $("div.next").offset().top
}, 1000);
});
});
Код: Выделить всё
require('../file_name.js');
import $ from 'jquery'
describe("Test helppage", () => {
test("testing ", () => {
return new window.Promise((done) => {
document.body.innerHTML = `
Text
`;
const onDomContentLoadedCallback = async () => {
($('.main #submain')).trigger('click');
document.removeEventListener("DOMContentLoaded", onDomContentLoadedCallback);
done();
};
document.addEventListener("DOMContentLoaded", onDomContentLoadedCallback);
document.dispatchEvent(
new Event("DOMContentLoaded", {
bubbles: true,
cancelable: true,
})
);
});
});
});
Подробнее здесь: https://stackoverflow.com/questions/793 ... n-function
Мобильная версия