spec/CruyffSpec.js in cruyff-0.0.1 vs spec/CruyffSpec.js in cruyff-0.1.0
- old
+ new
@@ -4,10 +4,16 @@
beforeEach(function() {
$.jasmine.inject('<div id="response"></div>');
});
+ it('should override rails handleRemote function',function(){
+ spyOn($.fn, 'handleRemoteCrud');
+ $.fn.handleRemote('element');
+ expect($.fn.handleRemoteCrud).wasCalled();
+ })
+
describe('Setup from hyperlink', function() {
beforeEach(function() {
$.jasmine.inject('<a href="spec/fixtures/view.html"\
data-type="json"\
data-method="delete"\
@@ -108,22 +114,22 @@
cruyffSettings = $.fn.cruyffSetup(element);
});
it('should render success response',function(){
runs(function() {
- $.fn.handleRemoteCrud(element);
+ element.trigger('click');
});
waits(100);
runs(function() {
expect(cruyffSettings.response).toHaveHtml('view html');
});
});
it('should render error response',function(){
element.attr('href', 'bad/url');
runs(function() {
- $.fn.handleRemoteCrud(element);
+ element.trigger('click');
});
waits(100);
runs(function() {
expect(cruyffSettings.response.html()).toContain('NS_ERROR_DOM_BAD_URI');
});
@@ -139,18 +145,18 @@
cruyffSettings = $.fn.cruyffSetup(element);
});
it('should bookmark',function() {
runs(function() {
- $.fn.handleRemoteCrud(element);
+ element.trigger('click');
});
waits(100);
runs(function() {
expect($.bbq.getState('app')).toEqual('spec/fixtures/view.html');
});
});
- it('should load browser url',function() {
+ xit('should load browser url',function() {
$.bbq.pushState('app=spec/fixtures/view.html');
expect($.fn.cruyffUrl).toEqual('spec/fixtures/view.html');
});
});