describe('Magellan', function() {
var plugin;
- var $html, $content;
+ var $html, $content;
var generateUl = function(count) {
var html = '';
});
- it('fails gracefully when target does not exist', function(done) {
+ it('fails gracefully when target does not exist', function() {
var count = 5, duration = 200;
$html = $(generateUl(count)).appendTo('body');
$content = $(generateContent(count - 1)).appendTo('body');
var hasError = false;
var targets = $html.find('a');
- if(targets.length){
+ try {
var target = $(targets).eq(-1).attr('href');
plugin.scrollToLoc(target);
- hasError.should.equal(false);
- done();
- } else {
+ }
+ catch (err) {
hasError = true;
- hasError.should.equal(false);
- done();
- }
-
+ }
+ hasError.should.equal(false);
});
});
-});
\ No newline at end of file
+});