jsdom-browser
This module simulates behaviors of a Web browser with jsdom, and will provides implementations about layouts of view elements and windows.
This module simulates Chrome on macOS for the time being, but is implemented so as to be configurable and extendable to other browsers.
Install
$ npm install jsdom-browser --save-dev
Usage
Create a browser
const Browser = const browser =
Open a blank window
const window0 = browser window0name = 'win0'
Get a window config
const windowConfig0 = browserwindowConfig0top = 200windowConfig0left = 300 window0screenX // => 300window0screenY // => 200
Get a window already opened
window0 === browser // by indexwindow0 === browser // by namewindow0 === browser // by window config
Open a window with loading a page content
browser const window1 = browser window1 const config1 = browserconfig1
Open a child window
browser const window2 = window window2 const config2 = browserconfig2
Progress
- Screen ✓
- ScreenOrientation (Not yet)
- Window
- screen ✓
- innerWidth, innerHeight, outerWidth, outerHeight, screenX, screenY, devicePixelRatio ✓
- scrollX, scrollY, pageXOffset, pageYOffset ✓
- moveTo, moveBy, resizeTo, resizeBy ✓
- scroll, scrollTo, scrollBy ✓
- open, close ✓
- matchMedia (Not yet)
- And planning more HTMLElements ...
References
License
Copyright (C) 2017 Takayuki Sato
This program is free software under MIT License. See the file LICENSE in this distribution for more details.