JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://sinonjs.org/releases/sinon-1.7.3.js"></script>
JavaScript
sinon.stub($.prototype, 'width').returns(900);
// "900"
$('body').append('<div>Window width from stubbed function: ' + $(window).width() + '</div>');
// restoring original function
$.prototype.width.restore();
// real window width
$('body').append('<div>Real window width: ' + $(window).width() + '</div>');