From b2a1f1302ecd7acb5f707af9927110acb0401694 Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Sun, 4 Mar 2018 23:50:05 +0100 Subject: [PATCH] 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. --- test/javascript/components/magellan.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) 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 +}); -- 2.47.2