Skip to content

Instantly share code, notes, and snippets.

@khaosdoctor
Created July 12, 2017 02:26
Show Gist options
  • Save khaosdoctor/a4bf17871de5e6a17718eba7ec7e7b96 to your computer and use it in GitHub Desktop.
Save khaosdoctor/a4bf17871de5e6a17718eba7ec7e7b96 to your computer and use it in GitHub Desktop.
Fake timer example
{
setUp: function () {
this.clock = sinon.useFakeTimers();
},
tearDown: function () {
this.clock.restore();
},
describe('Deve usar um timmer de 510ms fixo', (assert) => {
var el = jQuery("<div></div>");
el.appendTo(document.body);
el.animate({ height: "200px", width: "200px" });
this.clock.tick(510);
assertEquals("200px", el.css("height"));
assertEquals("200px", el.css("width"));
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment