From: Nicolas Coden Date: Sun, 4 Mar 2018 22:50:05 +0000 (+0100) Subject: tests: revert to systematic test of magellan graceful failure X-Git-Tag: v6.6.0~3^2~283^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2a1f1302;p=thirdparty%2Ffoundation%2Ffoundation-sites.git tests: revert to systematic test of magellan graceful failure Partially revert e89d85cbf4328c8d925a64bde7e2525c88841d5a Test Magellan.scrollToLoc systematically as it should _never_ throw an error when target does not exists. --- diff --git a/test/javascript/components/magellan.js b/test/javascript/components/magellan.js index 37713356e..8e70b727f 100644 --- a/test/javascript/components/magellan.js +++ b/test/javascript/components/magellan.js @@ -1,6 +1,6 @@ describe('Magellan', function() { var plugin; - var $html, $content; + var $html, $content; var generateUl = function(count) { var html = ''; @@ -68,7 +68,7 @@ describe('Magellan', function() { }); - 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'); @@ -78,19 +78,16 @@ describe('Magellan', function() { 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 +});