pjax-test.js revision 9d33ba3ba3784734226f6b4cc364589058e5ca21
// Tests that require XHR are ignored when the protocol isn't http or https,
// since the XHR requests will fail.
// -- Suite --------------------------------------------------------------------
name: 'Pjax Node Plugin',
});
// -- Lifecycle ----------------------------------------------------------------
name: 'Lifecycle',
setUp: function () {
},
tearDown: function () {
delete this.node;
},
'should plug into a Node instance': function () {
}
}));
// -- Attributes and Properties ------------------------------------------------
name: 'Attributes and Properties',
setUp: function () {
},
tearDown: function () {
delete this.node;
delete this.pjax;
},
'`contentSelector` should be null by default': function () {
},
'`controller` should default to a new controller if one is not specified': function () {
},
'`controller` should use the specified controller if one is given': function () {
var controller = new Y.Controller(),
},
'`linkSelector` should select links with class "yui3-pjax" by default': function () {
},
'`scrollToTop` should be true by default': function () {
},
'`titleSelector` should select the title tag by default': function () {
}
}));
// -- Events -------------------------------------------------------------------
name: 'Events',
_should: {
ignore: {
'`error` event should fire on Ajax error': disableXHR,
'`load` event should fire on Ajax load': disableXHR
}
},
setUp: function () {
// To avoid mucking with the URL.
},
tearDown: function () {
delete this.node;
delete this.pjax;
},
'should attach events on init in HTML5 browsers': function () {
} else {
}
},
'`error` event should fire on Ajax error': function () {
var test = this;
});
});
this.wait(1000);
},
'`error` event should be preventable': function () {
this.pjax._defCompletefn = function () {
};
e.preventDefault();
});
},
'`load` event should fire on Ajax load': function () {
var test = this;
e.preventDefault();
});
});
this.wait(1000);
},
'`load` event should be preventable': function () {
this.pjax._defCompleteFn = function () {
};
e.preventDefault();
});
},
'`navigate` event should fire when a pjax link is clicked': function () {
var event = {
button : 1,
preventDefault: function () {}
},
called = 1;
e.preventDefault();
});
// Fake click event.
},
'`navigate` event should be preventable': function () {
var called;
e.preventDefault();
});
// Fake click event.
this.pjax._onLinkClick({
button : 1,
preventDefault: function () {
called = 1;
}
});
},
'`navigate` event should not fire when a link is clicked with a button other than the left button': function () {
});
// Fake click event.
this.pjax._onLinkClick({
button : 2,
preventDefault: function () {}
});
},
'`navigate` event should not fire when a modifier key is pressed': function () {
});
// Fake click event.
this.pjax._onLinkClick({
button : 1,
ctrlKey : true,
preventDefault: function () {}
});
this.pjax._onLinkClick({
button : 1,
metaKey : true,
preventDefault: function () {}
});
}
}));
}, '@VERSION@', {
});