poller.start(function () { $.mockjax.clear() $.mockjax({ url: endpoint, responseText: [{ id: 'fed-123-abc', name: 'third integration', fingerprint: 'foo', rows: [{ link: { url: 'http://www.example.com', text: 'initial link 2' } }] }] }) setTimeout(function () { $('.addon-container').length.should.equal(2) $('.addon-container:first').text().should.match(/initial link 1/) $('.addon-container:last').text().should.match(/initial link 2/) poller.stop() return done() }, 1000) })
poller.start(function () { $.mockjax.clear() $.mockjax({ url: endpoint, responseText: [{ id: 'abc-123-abc', name: 'third integration', fingerprint: 'bar', rows: [{ link: { url: 'http://www.example.com', text: 'replaced link' } }] }] }) setTimeout(function () { $('.addon-container').length.should.equal(1) $('.addon-container').text().should.match(/replaced link/) poller.stop() return done() }, 1000) })
teardown: function () { $.mockjax.clear(); }
$.mockjaxClear = function(i) { window.console && window.console.warn && window.console.warn( 'DEPRECATED: The $.mockjaxClear() method has been deprecated in 1.6.0. Please use $.mockjax.clear() as the older function will be removed soon!' ); $.mockjax.clear(); };
beforeEach(function (cb) { document.body.innerHTML = '<ul class="box" id="npm-addon-box"></ul>' $.mockjax.clear() return cb() })