Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(async function() {
dom = await JSDOM.fromFile(path.resolve(this.context.publicDir, 'about', './index.html'));
});
beforeEach(async function() {
dom = await JSDOM.fromFile(path.resolve(this.context.publicDir, 'index.html'));
});
before(async function() {
dom = await JSDOM.fromFile(path.resolve(this.context.publicDir, 'index.html'));
});
beforeEach(async function() {
dom = await JSDOM.fromFile(path.resolve(this.context.publicDir, 'about', './index.html'));
});
before(async function() {
dom = await JSDOM.fromFile(path.resolve(this.context.publicDir, 'index.html'));
});
tape('event-listener: it supports capturing an event', function(test) {
test.plan(1);
JSDOM.fromFile('tests/resources/testcase-event-listener.html').then(function(dom) {
var window = dom.window;
global.document = window.document;
global.window = window;
var numCallbacksCalled = 0;
function callback() {
numCallbacksCalled++;
}
var events = new EventListener(document.body);
events.on('blur', '.some-class', callback);
var event = new window.FocusEvent('blur', { bubbles: false, view: window });
document.querySelector('.another-class').dispatchEvent(event);
public async goto(url: string): Promise {
await this.quit();
const options: FromFileOptions = {runScripts: 'dangerously'};
this._jsdom = /file:\/\//.test(url)
? await JSDOM.fromFile(url.slice(7), options)
: await JSDOM.fromURL(url, options);
}
module.exports.updateHTML = (username, opts) => {
const { includeFork, twitter, linkedin, medium, dribbble } = opts;
//add data to assets/index.html
jsdom
.fromFile(`${__dirname}/assets/index.html`, options)
.then(function(dom) {
let window = dom.window,
document = window.document;
(async () => {
try {
console.log("Building HTML/CSS...");
const repos = await getRepos(username, opts);
for (var i = 0; i < repos.length; i++) {
let element;
if (repos[i].fork == false) {
element = document.getElementById("work_section");
} else if (includeFork == true) {
document.getElementById("forks").style.display = "block";
element = document.getElementById("forks_section");
new Promise(async (resolve, reject) => {
try {
const host = process.env.E2E_URL || 'http://www.example.org/spa:3000';
const url = `${host}#${feature}`;
let window;
if (process.env.E2E_FILE) {
window = (
await JSDOM.fromFile(file, {
pretendToBeVisual: true,
resources: fileResourceLoader,
runScripts: 'dangerously',
url,
})
).window;
} else {
window = (
await JSDOM.fromURL(url, {
pretendToBeVisual: true,
resources: 'usable',
runScripts: 'dangerously',
})
).window;
}
async generateBundle({ format, dir }, bundle) {
if (format !== 'es') return;
const dom = await JSDOM.fromFile(index);
const createLinkFromChunk = compose(
createLinkElement(dom),
createLinkHref((typeof prefix !== "undefined") ? prefix : dir),
getPath,
);
const appendToDom = link =>
dom.window.document.head.appendChild(link);
await getPreloadChunks(shouldPreload, bundle)
.then(map(createLinkFromChunk))
.then(map(appendToDom));
await writeFile(path.resolve(index), dom.serialize(), 'utf-8')
}