jsdom-add-files

1.0.2 • Public • Published

jsdom-add-files

Adds local files to a HTML file input in jsdom and fires the change event. Inspired by jsdom ticket #1272

Install

npm install --save jsdom-add-files

Usage

var path = require('path');
var jsdomAddFiles = require('jsdom-add-files');

// get file input
var fileInput = document.querySelector('input[type="file"]');

// add files (automatically fires onchange event)
jsdomAddFiles(fileInput, [
    path.join(__dirname, 'file1.jpg'),
    path.join(__dirname, 'file2.jpg'),
    path.join(__dirname, 'file3.png')
]);

License

Licensed under MIT License © John Doherty

/jsdom-add-files/

    Package Sidebar

    Install

    npm i jsdom-add-files

    Weekly Downloads

    2

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    4.52 kB

    Total Files

    4

    Last publish

    Collaborators

    • john-doherty