0.0.9 • Published 9 years ago

XWindow v0.0.9

Weekly downloads
9
License
MIT
Repository
github
Last release
9 years ago

XWindow Build Status

  • XWindow is a wrapper for the browser object model(BOM) and provide similar interface.
  • XWindow is a proxy object for window.
  • Easy for stub. (sinon)

TODO

  • location
  • screen
  • history
  • navigator
  • document
    • cookie
  • ...

HOW-TO-USE

var XWindow = require('XWindow')

// proxy widnow object actions
// get
XWindow.location.hash() === window.location.hash

// set
XWindow.location.hash('ABC') === (window.location.hash = 'ABC') 

// unit test
var stub = sinon.stub(XWindow.location, 'hash').returns('#ABC')

// exmaple on button click
var btn = document.getElementById('test')

btn.onclick = function() {
    XWindow.location.hash('ABC') 
}

expect(stub.called).to.be.true
stub.restore()
0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago