From 0a22d26904ca30a767b967ce58ec446d484a7b03 Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 4 Jan 2021 19:19:24 -0500 Subject: [PATCH] use new jasmine pattern for catch errors in async code --- test/jasmine/assets/domain_ref/components.js | 2 +- test/jasmine/bundle_tests/choropleth_test.js | 5 +- .../bundle_tests/dynamic_import_test.js | 5 +- test/jasmine/bundle_tests/mathjax_test.js | 14 +- test/jasmine/bundle_tests/no_webgl_test.js | 20 +- test/jasmine/tests/animate_test.js | 96 +++--- test/jasmine/tests/annotations_test.js | 88 ++--- test/jasmine/tests/axes_test.js | 194 ++++------- test/jasmine/tests/bar_test.js | 158 +++------ test/jasmine/tests/barpolar_test.js | 4 +- test/jasmine/tests/box_test.js | 16 +- test/jasmine/tests/calcdata_test.js | 128 +++---- test/jasmine/tests/carpet_test.js | 41 +-- test/jasmine/tests/cartesian_interact_test.js | 105 +++--- test/jasmine/tests/cartesian_test.js | 62 ++-- test/jasmine/tests/choropleth_test.js | 38 +-- test/jasmine/tests/choroplethmapbox_test.js | 6 +- test/jasmine/tests/click_test.js | 89 ++--- test/jasmine/tests/colorbar_test.js | 38 +-- test/jasmine/tests/colorscale_test.js | 23 +- test/jasmine/tests/command_test.js | 26 +- test/jasmine/tests/cone_test.js | 20 +- test/jasmine/tests/config_test.js | 120 +++---- test/jasmine/tests/contour_test.js | 17 +- test/jasmine/tests/contourgl_test.js | 8 +- test/jasmine/tests/densitymapbox_test.js | 9 +- .../jasmine/tests/domain_ref_interact_test.js | 11 +- test/jasmine/tests/domain_ref_test.js | 5 +- test/jasmine/tests/download_test.js | 32 +- test/jasmine/tests/draw_newshape_test.js | 29 +- test/jasmine/tests/drawing_test.js | 11 +- test/jasmine/tests/errorbars_test.js | 7 +- test/jasmine/tests/finance_test.js | 46 +-- test/jasmine/tests/frame_api_test.js | 62 ++-- test/jasmine/tests/funnel_test.js | 68 ++-- test/jasmine/tests/funnelarea_test.js | 116 +++---- test/jasmine/tests/fx_test.js | 4 +- test/jasmine/tests/geo_test.js | 86 ++--- test/jasmine/tests/gl2d_click_test.js | 47 +-- test/jasmine/tests/gl2d_plot_interact_test.js | 50 +-- test/jasmine/tests/gl3d_hover_click_test.js | 53 +-- test/jasmine/tests/gl3d_plot_interact_test.js | 128 +++---- test/jasmine/tests/gl3dlayout_test.js | 5 +- test/jasmine/tests/heatmap_test.js | 20 +- test/jasmine/tests/histogram2d_test.js | 26 +- test/jasmine/tests/histogram_test.js | 26 +- test/jasmine/tests/hover_label_test.js | 311 ++++++------------ test/jasmine/tests/hover_spikeline_test.js | 71 ++-- test/jasmine/tests/image_test.js | 50 +-- test/jasmine/tests/indicator_test.js | 50 +-- test/jasmine/tests/isosurface_test.js | 20 +- test/jasmine/tests/layout_images_test.js | 50 +-- test/jasmine/tests/legend_scroll_test.js | 20 +- test/jasmine/tests/legend_test.js | 91 ++--- test/jasmine/tests/lib_test.js | 8 +- test/jasmine/tests/localize_test.js | 29 +- test/jasmine/tests/mapbox_test.js | 105 ++---- test/jasmine/tests/mesh3d_test.js | 62 ++-- test/jasmine/tests/modebar_test.js | 36 +- test/jasmine/tests/page_test.js | 4 +- test/jasmine/tests/parcats_test.js | 78 ++--- test/jasmine/tests/parcoords_test.js | 125 +++---- test/jasmine/tests/pie_test.js | 158 +++------ test/jasmine/tests/plot_api_react_test.js | 134 +++----- test/jasmine/tests/plot_api_test.js | 179 ++++------ test/jasmine/tests/plot_interact_test.js | 23 +- test/jasmine/tests/plot_promise_test.js | 17 +- test/jasmine/tests/plots_test.js | 62 ++-- test/jasmine/tests/pointcloud_test.js | 14 +- test/jasmine/tests/polar_test.js | 80 ++--- test/jasmine/tests/range_selector_test.js | 20 +- test/jasmine/tests/range_slider_test.js | 86 ++--- test/jasmine/tests/sankey_test.js | 102 ++---- test/jasmine/tests/scatter3d_test.js | 20 +- test/jasmine/tests/scatter_test.js | 76 ++--- test/jasmine/tests/scattergeo_test.js | 41 +-- test/jasmine/tests/scattergl_select_test.js | 47 +-- test/jasmine/tests/scattergl_test.js | 51 +-- test/jasmine/tests/scattermapbox_test.js | 38 +-- test/jasmine/tests/scatterpolar_test.js | 4 +- test/jasmine/tests/scatterpolargl_test.js | 22 +- test/jasmine/tests/scatterternary_test.js | 14 +- test/jasmine/tests/select_test.js | 179 ++++------ test/jasmine/tests/shapes_test.js | 77 ++--- test/jasmine/tests/sliders_test.js | 19 +- test/jasmine/tests/snapshot_test.js | 24 +- test/jasmine/tests/splom_test.js | 48 +-- test/jasmine/tests/streamtube_test.js | 41 +-- test/jasmine/tests/sunburst_test.js | 91 ++--- test/jasmine/tests/surface_test.js | 23 +- test/jasmine/tests/table_test.js | 44 +-- test/jasmine/tests/template_test.js | 17 +- test/jasmine/tests/ternary_test.js | 44 +-- test/jasmine/tests/titles_test.js | 113 +++---- test/jasmine/tests/toimage_test.js | 46 +-- .../jasmine/tests/transform_aggregate_test.js | 38 +-- test/jasmine/tests/transform_filter_test.js | 32 +- test/jasmine/tests/transform_groupby_test.js | 50 +-- test/jasmine/tests/transform_multi_test.js | 55 ++-- test/jasmine/tests/transform_sort_test.js | 11 +- test/jasmine/tests/transition_test.js | 60 ++-- test/jasmine/tests/treemap_test.js | 66 ++-- test/jasmine/tests/updatemenus_test.js | 47 +-- test/jasmine/tests/violin_test.js | 19 +- test/jasmine/tests/volume_test.js | 20 +- test/jasmine/tests/waterfall_test.js | 74 ++--- 106 files changed, 1967 insertions(+), 3733 deletions(-) diff --git a/test/jasmine/assets/domain_ref/components.js b/test/jasmine/assets/domain_ref/components.js index 13c70e58809..b4b896c179a 100644 --- a/test/jasmine/assets/domain_ref/components.js +++ b/test/jasmine/assets/domain_ref/components.js @@ -7,7 +7,7 @@ // test, we need a description of the test and the promise doing the test // itself. In this case, it needs to tell jasmine if it passed or failed, so we // pass in an assert function that the promise can call. Then in jasmine, the -// promise is followed by .catch(failTest).then(done) +// promise is followed by .then(done, done.fail) 'use strict'; var Plotly = require('../../../../lib/index'); diff --git a/test/jasmine/bundle_tests/choropleth_test.js b/test/jasmine/bundle_tests/choropleth_test.js index 3667b996b39..38d4e5604c3 100644 --- a/test/jasmine/bundle_tests/choropleth_test.js +++ b/test/jasmine/bundle_tests/choropleth_test.js @@ -5,7 +5,7 @@ var PlotlyChoropleth = require('@lib/choropleth'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var LONG_TIMEOUT_INTERVAL = 5 * jasmine.DEFAULT_TIMEOUT_INTERVAL; @@ -32,7 +32,6 @@ describe('Bundle with choropleth', function() { expect(nodes.size()).toEqual(4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); }); diff --git a/test/jasmine/bundle_tests/dynamic_import_test.js b/test/jasmine/bundle_tests/dynamic_import_test.js index 93f160f7b64..031b02b9cbd 100644 --- a/test/jasmine/bundle_tests/dynamic_import_test.js +++ b/test/jasmine/bundle_tests/dynamic_import_test.js @@ -3,7 +3,7 @@ var Plotly = require('@lib/core'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + describe('Dynamic @lib/ module imports', function() { var gd; @@ -34,7 +34,6 @@ describe('Dynamic @lib/ module imports', function() { expect(polarLayer.size()).toBe(1, 'one polar layer'); expect(polarLayer.selectAll('.trace').size()).toBe(1, 'one scatterpolar trace'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/bundle_tests/mathjax_test.js b/test/jasmine/bundle_tests/mathjax_test.js index 816db4e4237..092b1400be6 100644 --- a/test/jasmine/bundle_tests/mathjax_test.js +++ b/test/jasmine/bundle_tests/mathjax_test.js @@ -3,7 +3,7 @@ var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + describe('Test MathJax:', function() { var mathJaxScriptTag; @@ -95,8 +95,7 @@ describe('Test MathJax:', function() { }, { xCategories: longCats }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should scoot x-axis title (with MathJax) below x-axis ticks', function(done) { @@ -115,8 +114,7 @@ describe('Test MathJax:', function() { }, { xCategories: longCats }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should scoot x-axis title below x-axis ticks (with MathJax)', function(done) { @@ -136,8 +134,7 @@ describe('Test MathJax:', function() { }, { xCategories: longTexCats }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should scoot x-axis title (with MathJax) below x-axis ticks (with MathJax)', function(done) { @@ -157,8 +154,7 @@ describe('Test MathJax:', function() { }, { xCategories: longTexCats }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/bundle_tests/no_webgl_test.js b/test/jasmine/bundle_tests/no_webgl_test.js index 29489ba7958..10a22e858c5 100644 --- a/test/jasmine/bundle_tests/no_webgl_test.js +++ b/test/jasmine/bundle_tests/no_webgl_test.js @@ -2,7 +2,7 @@ var Plotly = require('@lib'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + describe('Plotly w/o WebGL support:', function() { var gd; @@ -34,8 +34,7 @@ describe('Plotly w/o WebGL support:', function() { .then(function() { checkNoWebGLMsg(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('gl2d subplots', function(done) { @@ -47,8 +46,7 @@ describe('Plotly w/o WebGL support:', function() { .then(function() { checkNoWebGLMsg(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('scattergl subplots', function(done) { @@ -77,8 +75,7 @@ describe('Plotly w/o WebGL support:', function() { .then(function() { checkNoWebGLMsg(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('scatterpolargl subplots', function(done) { @@ -90,8 +87,7 @@ describe('Plotly w/o WebGL support:', function() { .then(function() { checkNoWebGLMsg(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('splom subplots', function(done) { @@ -103,8 +99,7 @@ describe('Plotly w/o WebGL support:', function() { .then(function() { checkNoWebGLMsg(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('parcoords subplots', function(done) { @@ -116,7 +111,6 @@ describe('Plotly w/o WebGL support:', function() { .then(function() { checkNoWebGLMsg(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/animate_test.js b/test/jasmine/tests/animate_test.js index f569dee0b23..e012e64c428 100644 --- a/test/jasmine/tests/animate_test.js +++ b/test/jasmine/tests/animate_test.js @@ -176,11 +176,11 @@ describe('Test animate API', function() { // traces are [0, 1]: expect(args[3]).toEqual([0, 1]); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('rejects if a frame is not found', function(done) { - Plotly.animate(gd, ['foobar'], animOpts).then(failTest).then(done, done); + Plotly.animate(gd, ['foobar'], animOpts).then(done, done); }); it('treats objects as frames', function(done) { @@ -188,7 +188,7 @@ describe('Test animate API', function() { Plotly.animate(gd, frame, animOpts).then(function() { expect(Plots.transition.calls.count()).toEqual(1); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('treats a list of objects as frames', function(done) { @@ -205,56 +205,56 @@ describe('Test animate API', function() { expect(Plots.transition.calls.count()).toEqual(2); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('animates all frames if list is null', function(done) { Plotly.animate(gd, null, animOpts).then(function() { verifyFrameTransitionOrder(gd, ['base', 'frame0', 'frame1', 'frame2', 'frame3']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('animates all frames if list is undefined', function(done) { Plotly.animate(gd, undefined, animOpts).then(function() { verifyFrameTransitionOrder(gd, ['base', 'frame0', 'frame1', 'frame2', 'frame3']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('animates to a single frame', function(done) { Plotly.animate(gd, ['frame0'], animOpts).then(function() { expect(Plots.transition.calls.count()).toEqual(1); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('animates to an empty list', function(done) { Plotly.animate(gd, [], animOpts).then(function() { expect(Plots.transition.calls.count()).toEqual(0); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('animates to a list of frames', function(done) { Plotly.animate(gd, ['frame0', 'frame1'], animOpts).then(function() { expect(Plots.transition.calls.count()).toEqual(2); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('animates frames by group', function(done) { Plotly.animate(gd, 'even-frames', animOpts).then(function() { expect(Plots.transition.calls.count()).toEqual(2); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('animates frames in the correct order', function(done) { Plotly.animate(gd, ['frame0', 'frame2', 'frame1', 'frame3'], animOpts).then(function() { verifyFrameTransitionOrder(gd, ['frame0', 'frame2', 'frame1', 'frame3']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('accepts a single animationOpts', function(done) { @@ -262,7 +262,7 @@ describe('Test animate API', function() { var calls = Plots.transition.calls; expect(calls.argsFor(0)[5].duration).toEqual(1.12345); expect(calls.argsFor(1)[5].duration).toEqual(1.12345); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('accepts an array of animationOpts', function(done) { @@ -275,7 +275,7 @@ describe('Test animate API', function() { expect(calls.argsFor(1)[4].duration).toEqual(5.4321); expect(calls.argsFor(0)[5].duration).toEqual(1.123); expect(calls.argsFor(1)[5].duration).toEqual(1.456); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('falls back to animationOpts[0] if not enough supplied in array', function(done) { @@ -288,7 +288,7 @@ describe('Test animate API', function() { expect(calls.argsFor(1)[4].duration).toEqual(2.345); expect(calls.argsFor(0)[5].duration).toEqual(1.123); expect(calls.argsFor(1)[5].duration).toEqual(1.123); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('chains animations as promises', function(done) { @@ -297,7 +297,7 @@ describe('Test animate API', function() { }).then(function() { verifyFrameTransitionOrder(gd, ['frame0', 'frame1', 'frame2', 'frame3']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('emits plotly_animated before the promise is resolved', function(done) { @@ -308,7 +308,7 @@ describe('Test animate API', function() { Plotly.animate(gd, ['frame0'], animOpts).then(function() { expect(animated).toBe(true); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('emits plotly_animated as each animation in a sequence completes', function(done) { @@ -335,7 +335,7 @@ describe('Test animate API', function() { }).then(function() { expect(test1).toBe(1); expect(test2).toBe(1); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('resolves at the end of each animation sequence', function(done) { @@ -344,7 +344,7 @@ describe('Test animate API', function() { }).then(function() { verifyFrameTransitionOrder(gd, ['frame0', 'frame2', 'frame0', 'frame2', 'frame1', 'frame3']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); } @@ -365,7 +365,7 @@ describe('Test animate API', function() { Plotly.animate(gd, ['frame0', 'frame2', 'frame1', 'frame3'], animOpts).then(function() { verifyFrameTransitionOrder(gd, ['frame3', 'frame1', 'frame2', 'frame0']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('animates a group in reverse', function(done) { @@ -373,7 +373,7 @@ describe('Test animate API', function() { Plotly.animate(gd, 'even-frames', animOpts).then(function() { verifyFrameTransitionOrder(gd, ['frame2', 'frame0']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); @@ -397,7 +397,7 @@ describe('Test animate API', function() { }).then(function() { verifyFrameTransitionOrder(gd, ['frame1', 'frame2', 'frame3']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('plays from the start when current frame = last frame', function(done) { @@ -413,7 +413,7 @@ describe('Test animate API', function() { ]); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('animates in reverse starting at the current frame', function(done) { @@ -426,7 +426,7 @@ describe('Test animate API', function() { }).then(function() { verifyFrameTransitionOrder(gd, ['frame1', 'frame0', 'base']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('plays in reverse from the end when current frame = first frame', function(done) { @@ -443,7 +443,7 @@ describe('Test animate API', function() { ]); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); @@ -470,7 +470,7 @@ describe('Test animate API', function() { Plotly.animate(gd, ['frame2'], Lib.extendFlat(animOpts, {mode: 'immediate'})).then(function() { expect(interrupted).toBe(true); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('queues successive animations', function(done) { @@ -489,7 +489,7 @@ describe('Test animate API', function() { Plotly.animate(gd, 'odd-frames', {transition: {duration: 16}}).then(delay(10)).then(function() { expect(ends).toEqual(1); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('an empty list with immediate dumps previous frames', function(done) { @@ -497,7 +497,7 @@ describe('Test animate API', function() { Plotly.animate(gd, [], {mode: 'immediate'}).then(function() { expect(Plots.transition.calls.count()).toEqual(1); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('animates groups in the correct order', function(done) { @@ -505,7 +505,7 @@ describe('Test animate API', function() { Plotly.animate(gd, 'odd-frames', animOpts).then(function() { verifyFrameTransitionOrder(gd, ['frame0', 'frame2', 'frame1', 'frame3']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('drops queued frames when immediate = true', function(done) { @@ -513,7 +513,7 @@ describe('Test animate API', function() { Plotly.animate(gd, 'odd-frames', Lib.extendFlat(animOpts, {mode: 'immediate'})).then(function() { verifyFrameTransitionOrder(gd, ['frame0', 'frame1', 'frame3']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('animates frames and groups in sequence', function(done) { @@ -521,7 +521,7 @@ describe('Test animate API', function() { Plotly.animate(gd, ['frame0', 'frame2', 'frame1', 'frame3'], animOpts).then(function() { verifyFrameTransitionOrder(gd, ['frame0', 'frame2', 'frame0', 'frame2', 'frame1', 'frame3']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('rejects when an animation is interrupted', function(done) { @@ -534,7 +534,7 @@ describe('Test animate API', function() { expect(interrupted).toBe(true); verifyFrameTransitionOrder(gd, ['frame0', 'frame2']); verifyQueueEmpty(gd); - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); @@ -553,7 +553,7 @@ describe('Test animate API', function() { frame: {duration: 1} }).then(function() { expect(frames).toEqual(['frame0', 'frame1', null, null]); - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); @@ -568,7 +568,7 @@ describe('Test animate API', function() { // Transition timing: expect(Plots.transition.calls.argsFor(0)[5].duration).toEqual(50); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('limits the transition duration to <= frame duration (matching per-config)', function(done) { @@ -583,7 +583,7 @@ describe('Test animate API', function() { // Transition timing: expect(Plots.transition.calls.argsFor(0)[5].duration).toEqual(50); expect(Plots.transition.calls.argsFor(1)[5].duration).toEqual(40); - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); }); @@ -615,7 +615,7 @@ describe('Animate API details', function() { {frame: {redraw: true, duration: dur}, transition: {duration: dur}} ).then(function() { expect(redraws).toBe(1); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('forces a relayout after layout animations', function(done) { @@ -633,7 +633,7 @@ describe('Animate API details', function() { expect(relayouts).toBe(1); expect(restyles).toBe(0); expect(redraws).toBe(0); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('triggers plotly_animated after a single layout animation', function(done) { @@ -679,7 +679,7 @@ describe('Animate API details', function() { }).then(function() { // Confirm the result: expect(gd.data[0].x).toEqual([8, 7, 6]); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('ignores null and undefined frames', function(done) { @@ -694,7 +694,7 @@ describe('Animate API details', function() { // Check unused frames did not affect the current frame: expect(gd._fullLayout._currentFrame).toEqual('frame0'); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('null frames should not break everything', function(done) { @@ -703,7 +703,7 @@ describe('Animate API details', function() { Plotly.animate(gd, null, { frame: {duration: 0}, transition: {duration: 0} - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); @@ -746,8 +746,7 @@ describe('Animating multiple axes', function() { expect(gd._fullLayout.yaxis.range).toEqual([2, 3]); expect(gd._fullLayout.yaxis2.range).toEqual([1, 2]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates ranges of secondary axes (date + category case)', function(done) { @@ -795,8 +794,7 @@ describe('Animating multiple axes', function() { expect(gd._fullLayout.xaxis.range).toEqual(['2018-06-01', '2019-06-01']); expect(gd._fullLayout.xaxis2.range).toEqual([0.5, 1.5]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not leak axis update from subplot to subplot', function(done) { @@ -863,8 +861,7 @@ describe('Animating multiple axes', function() { xaxis: [-10, 10], xaxis2: [-20, 20], xaxis3: [-30, 30], yaxis: [-10, 10], yaxis2: [-20, 20], yaxis3: [-30, 30] })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -894,7 +891,7 @@ describe('non-animatable fallback', function() { }], {frame: {duration: 0}}); }).then(function() { expect(gd.data[0].y).toEqual([6, 4, 5]); - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); @@ -927,7 +924,7 @@ describe('animating scatter traces', function() { }], {transition: {duration: 0}, frame: {duration: 0, redraw: false}}); }).then(function() { expect(trace.node().style.opacity).toEqual('0.1'); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('computes calcdata correctly when transforms are present', function(done) { @@ -949,7 +946,7 @@ describe('animating scatter traces', function() { return Plotly.animate(gd, ['frame2'], {frame: {duration: 200, redraw: false}}); }).then(function() { expect(gd.calcdata[0][0].y).toEqual(3); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('should animate axis ranges using the less number of steps', function(done) { @@ -1023,7 +1020,6 @@ describe('animating scatter traces', function() { expect(calls.length).toBe(1, 'just one Registry.call call'); expect(calls[0].args[0]).toBe('relayout', 'called Registry.call with'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/annotations_test.js b/test/jasmine/tests/annotations_test.js index eed4798a6fe..c8d468fe269 100644 --- a/test/jasmine/tests/annotations_test.js +++ b/test/jasmine/tests/annotations_test.js @@ -12,7 +12,7 @@ var DBLCLICKDELAY = require('@src/plot_api/plot_config').dfltConfig.doubleClickD var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var drag = require('../assets/drag'); var mouseEvent = require('../assets/mouse_event'); var click = require('../assets/click'); @@ -287,8 +287,7 @@ describe('annotations relayout', function() { expect(countAnnotations()).toEqual(0); expect(Loggers.warn).not.toHaveBeenCalled(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should sort correctly when index>10', function(done) { @@ -314,8 +313,7 @@ describe('annotations relayout', function() { expect(annotations[i].text).toBe(i); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able update annotations', function(done) { @@ -355,8 +353,7 @@ describe('annotations relayout', function() { assertText(0, 'hello'); assertUpdateObj(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can update several annotations and add and delete in one call', function(done) { @@ -415,8 +412,7 @@ describe('annotations relayout', function() { expect(Loggers.warn).not.toHaveBeenCalled(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); [ @@ -437,8 +433,7 @@ describe('annotations relayout', function() { // we could test the results here, but they're ambiguous and/or undefined so why bother? // the important thing is the developer is warned that something went wrong. }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -482,8 +477,7 @@ describe('annotations relayout', function() { expect(annos[2].yref).toBe('paper'); expect(Loggers.warn).not.toHaveBeenCalled(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -561,8 +555,7 @@ describe('annotations log/linear axis changes', function() { .then(function() { expect(gd.layout.annotations[0].y).toBe(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('keeps the same data value if the axis type is changed without position', function(done) { @@ -605,8 +598,7 @@ describe('annotations log/linear axis changes', function() { expect(gd.layout.annotations[1].y).toBe(1); expect(gd.layout.annotations[1].ay).toBe(2.5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -751,8 +743,7 @@ describe('annotations autorange', function() { // are visible after zooming in assertVisible([3, 7, 9, 15, 16, 17]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('catches bad xref/yref', function(done) { @@ -776,8 +767,7 @@ describe('annotations autorange', function() { [-1.38, 8.29], [-0.85, 5.14] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should propagate axis autorange changes when axis ranges are set', function(done) { @@ -813,8 +803,7 @@ describe('annotations autorange', function() { .then(function() { _assert('auto rng / small tx', [-0.18, 3.035], [0.84, 3.365]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not error out on subplots w/o visible traces', function(done) { @@ -835,8 +824,7 @@ describe('annotations autorange', function() { expect(gd._fullLayout.yaxis.range).toBeCloseToArray([0.091, 0.335], 1, 'y rng'); assertVisible([0, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -963,8 +951,7 @@ describe('annotation clicktoshow', function() { // finally click each one off .then(clickAndCheck({newPts: [[1, 2]], newCTS: true, on: [2], step: 15})) .then(clickAndCheck({newPts: [[2, 3]], newCTS: true, on: [], step: 16})) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works on date and log axes', function(done) { @@ -987,8 +974,7 @@ describe('annotation clicktoshow', function() { expect(gd._fullLayout.yaxis.type).toBe('log'); }) .then(clickAndCheck({newPts: [['2016-01-02', 1]], newCTS: true, on: [0]})) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works on category axes', function(done) { @@ -1019,8 +1005,7 @@ describe('annotation clicktoshow', function() { }) .then(clickAndCheck({newPts: [['b', 2]], newCTS: true, on: [0], step: 1})) .then(clickAndCheck({newPts: [['c', 3]], newCTS: true, on: [1], step: 2})) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1174,8 +1159,7 @@ describe('annotation effects', function() { return checkDragging(textDrag, bbox.width / 2, bbox.height / 2, 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('also works paper-referenced with explicit anchors and no arrow', function(done) { @@ -1194,8 +1178,7 @@ describe('annotation effects', function() { // with offsets 0, 0 because the anchor doesn't change now return checkDragging(textDrag, 0, 0, 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works paper-referenced with arrows', function(done) { @@ -1213,8 +1196,7 @@ describe('annotation effects', function() { return checkDragging(arrowDrag, 0, 0, 1); }) .then(checkTextDrag) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works data-referenced with no arrow', function(done) { @@ -1228,8 +1210,7 @@ describe('annotation effects', function() { .then(function() { return checkDragging(textDrag, 0, 0, 100); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works data-referenced with arrow', function(done) { @@ -1245,8 +1226,7 @@ describe('annotation effects', function() { return checkDragging(arrowDrag, 0, 0, 100); }) .then(checkTextDrag) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works date string data-referenced with no arrow', function(done) { @@ -1277,8 +1257,7 @@ describe('annotation effects', function() { expect(gd._fullLayout.annotations[0].x).toBe('2018-01-29 13:29:41.4857'); expect(gd._fullLayout.annotations[0].y).toBe('2017-02-02 13:28:35.6572'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works date sting data-referenced with arrow', function(done) { @@ -1311,8 +1290,7 @@ describe('annotation effects', function() { // must be different fonts altering autoranging expect(gd._fullLayout.annotations[0].y.substr(0, 10)).toBe('2017-02-02'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should only make the clippaths it needs and delete others', function(done) { @@ -1343,8 +1321,7 @@ describe('annotation effects', function() { .then(function() { expect(d3.select(gd).selectAll('.annclip').size()).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function _click(pos, opts) { @@ -1500,8 +1477,7 @@ describe('annotation effects', function() { return assertHoverLabels([[pos0, 'bananas'], [pos1, 'chicken'], [pos2, '']], '0 and 1'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); // Currently annotations do *not* support right-click. @@ -1537,8 +1513,7 @@ describe('annotation effects', function() { eventType: 'click' }]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should register clicks even in editable:true mode', function(done) { @@ -1587,8 +1562,7 @@ describe('annotation effects', function() { eventType: 'mousedown' }]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('makes the whole text box a link if the link is the whole text', function(done) { @@ -1621,8 +1595,7 @@ describe('annotation effects', function() { checkBoxLink(2, true); checkBoxLink(3, false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should remove annotations if offscreen during axis drag', function(done) { @@ -1671,8 +1644,7 @@ describe('annotation effects', function() { })) .then(fns.end); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1750,6 +1722,6 @@ describe('animating annotations', function() { 'rgb(172, 172, 172)' ]); assertImages([img2]); - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); diff --git a/test/jasmine/tests/axes_test.js b/test/jasmine/tests/axes_test.js index 0fc627284ab..c559c9ac4f6 100644 --- a/test/jasmine/tests/axes_test.js +++ b/test/jasmine/tests/axes_test.js @@ -20,7 +20,7 @@ var ONEWEEK = numerical.ONEWEEK; var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var negateIf = require('../assets/negate_if'); var selectButton = require('../assets/modebar_button'); var supplyDefaults = require('../assets/supply_defaults'); @@ -1478,8 +1478,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.autorange).toBe(true); expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.07, 1.07]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1520,8 +1519,7 @@ describe('Test axes', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-0.5, 1.5], 5); expect(gd.layout.yaxis.range).toBeCloseToArray([-0.5, 1.5], 5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function assertRangeDomain(axName, range, domainIn, domainOut, msg) { @@ -1640,8 +1638,7 @@ describe('Test axes', function() { assertRangeDomain('xaxis', [0, 1], [0, 1], [0, 0.25]); assertRangeDomain('yaxis', [-0.5, 1.5], [0, 1], [0, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('autoranges consistently with padding', function(done) { @@ -1686,8 +1683,7 @@ describe('Test axes', function() { assertRangeDomain('xaxis2', xAutorange, [0.5, 1], [0.5, 1]); assertRangeDomain('yaxis2', yAutorange, [0, 1], [0.225, 0.775]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can constrain date axes', function(done) { @@ -1718,8 +1714,7 @@ describe('Test axes', function() { assertRangeDomain('xaxis', ['2000-11-05 12:17:08.5714', '2002-02-26 11:42:51.4286'], [0, 1], [0.225, 0.775]); assertRangeDomain('yaxis', ['2000-11-27 05:42:51.4286', '2002-02-04 18:17:08.5714'], [0, 1], [0, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can constrain category axes', function(done) { @@ -1747,8 +1742,7 @@ describe('Test axes', function() { assertRangeDomain('xaxis', [-0.095238095, 1.095238095], [0, 1], [0, 1]); assertRangeDomain('yaxis', [-0.1547619, 1.1547619], [0, 1], [0.225, 0.775]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can constrain log axes', function(done) { @@ -1777,8 +1771,7 @@ describe('Test axes', function() { assertRangeDomain('xaxis', [-0.095238095, 1.095238095], [0, 1], [0, 1]); assertRangeDomain('yaxis', [-0.1547619, 1.1547619], [0, 1], [0.225, 0.775]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can react from different layout *grid* settings', function(done) { @@ -1840,8 +1833,7 @@ describe('Test axes', function() { assertRangeDomain('xaxis2', rng, [0.256410, 0.487179], [0.256410, 0.487179], msg); assertRangeDomain('xaxis3', rng, [0.512820, 0.743589], [0.512820, 0.743589], msg); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1900,8 +1892,7 @@ describe('Test axes', function() { [['yaxis'], [-0.211, 3.211], true] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1921,8 +1912,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.categoryorder).toBe('trace'); expect(gd._fullLayout.xaxis.categorarray).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should set categoryorder to default even if type is not set to category explicitly', function(done) { @@ -1931,8 +1921,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.categoryorder).toBe('trace'); expect(gd._fullLayout.xaxis.categorarray).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should NOT set categoryorder to default if type is not category', function(done) { @@ -1941,8 +1930,7 @@ describe('Test axes', function() { expect(gd._fullLayout.yaxis.categoryorder).toBe(undefined); expect(gd._fullLayout.xaxis.categorarray).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should set categoryorder to default if type is overridden to be category', function(done) { @@ -1953,8 +1941,7 @@ describe('Test axes', function() { expect(gd._fullLayout.yaxis.categoryorder).toBe('trace'); expect(gd._fullLayout.yaxis.categorarray).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1967,8 +1954,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.categoryorder).toBe('array'); expect(gd._fullLayout.xaxis.categoryarray).toEqual(['b', 'a', 'd', 'e', 'c']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should switch categoryorder on "array" if it is not supplied but categoryarray is supplied', function(done) { @@ -1979,8 +1965,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.categoryorder).toBe('array'); expect(gd._fullLayout.xaxis.categoryarray).toEqual(['b', 'a', 'd', 'e', 'c']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should revert categoryorder to "trace" if "array" is supplied but there is no list', function(done) { @@ -1991,8 +1976,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.categoryorder).toBe('trace'); expect(gd._fullLayout.xaxis.categorarray).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2005,8 +1989,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.categoryorder).toBe('trace'); expect(gd._fullLayout.xaxis.categoryarray).toEqual([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not switch categoryorder on "array" if categoryarray is supplied but empty', function(done) { @@ -2017,8 +2000,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.categoryorder).toBe('trace'); expect(gd._fullLayout.xaxis.categoryarray).toEqual(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2031,8 +2013,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.categoryorder).toBe('trace'); expect(gd._fullLayout.xaxis.categoryarray).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use specified categoryorder if it is supplied even if categoryarray exists', function(done) { @@ -2043,8 +2024,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.categoryorder).toBe('category ascending'); expect(gd._fullLayout.xaxis.categoryarray).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use specified categoryorder if it is supplied even if categoryarray exists', function(done) { @@ -2055,8 +2035,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.categoryorder).toBe('category descending'); expect(gd._fullLayout.xaxis.categoryarray).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2069,8 +2048,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.categoryorder).toBe('trace'); expect(gd._fullLayout.xaxis.categoryarray).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should switch categoryorder to "array" if mode is supplied but invalid and list is supplied', function(done) { @@ -2081,8 +2059,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis.categoryorder).toBe('array'); expect(gd._fullLayout.xaxis.categoryarray).toEqual(['b', 'a', 'd', 'e', 'c']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -2104,8 +2081,7 @@ describe('Test axes', function() { .then(function() { expect(gd._fullLayout.xaxis._rl).toEqual([-0.5, 3.5]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -2143,8 +2119,7 @@ describe('Test axes', function() { expect(yaxis.tickfont).toEqual({ family: '"Open Sans", verdana, arial, sans-serif', size: 12, color: '#444' }); expect(yaxis.tickangle).toBe('auto'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use valid inputs', function(done) { @@ -2170,8 +2145,7 @@ describe('Test axes', function() { expect(yaxis.tickfont).toEqual({ family: 'Garamond', size: 72, color: '#0FF' }); expect(yaxis.tickangle).toBe(-20); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should conditionally coerce based on showticklabels', function(done) { @@ -2187,8 +2161,7 @@ describe('Test axes', function() { var yaxis = gd._fullLayout.yaxis; expect(yaxis.tickangle).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -4146,8 +4119,7 @@ describe('Test axes', function() { t: 'initial', l: 'initial', b: 'initial', r: 'initial' })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not lead to negative plot area heights', function(done) { @@ -4186,8 +4158,7 @@ describe('Test axes', function() { totalHeight: 800 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not lead to negative plot area widths', function(done) { @@ -4226,8 +4197,7 @@ describe('Test axes', function() { totalWidth: 1000 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should handle cases with free+mirror axes', function(done) { @@ -4253,8 +4223,7 @@ describe('Test axes', function() { expect(Object.keys(gd._fullLayout._pushmargin)) .toEqual(['x.automargin', 'y.automargin', 'base']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -4330,8 +4299,7 @@ describe('Test axes', function() { expect(gd._fullLayout.xaxis._gridVals.length).toBe(0, '# of grid lines'); assertZeroLines(['x', 'y']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works with multiple coupled subplots', function(done) { @@ -4365,8 +4333,7 @@ describe('Test axes', function() { // allticks works the same as all assertZeroLines(['x', 'y']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works with multiple overlaid subplots', function(done) { @@ -4406,8 +4373,7 @@ describe('Test axes', function() { .then(function() { assertZeroLines([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -4482,8 +4448,7 @@ describe('Test axes', function() { tickLabels: [106.421, 197.121, 292.821, 388.521, 484.221, 584.921] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should rotate labels to avoid overlaps', function(done) { @@ -4531,8 +4496,7 @@ describe('Test axes', function() { angle: [90, 90] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -4980,8 +4944,7 @@ describe('Test axes', function() { lBreaks: 0 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -5131,8 +5094,7 @@ describe('Test axes', function() { B: [-4554.339622641512, -4584.9056603773615] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should locate rangebreaks & compute l <-> p parameters - y-axis case', function(done) { @@ -5193,8 +5155,7 @@ describe('Test axes', function() { B: [2160, 252.857] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should locate rangebreaks & compute l <-> p parameters - date axis case', function(done) { @@ -5363,8 +5324,7 @@ describe('Test axes', function() { B: [-1972296, -1972404, -1972620] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -5429,8 +5389,7 @@ describe('Test axes', function() { tickVals: ['1970-01-01', '1970-01-01 00:00:00.089', '1970-01-01 00:00:00.1', '1970-01-01 00:00:00.189', '1970-01-01 00:00:00.2'] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); [true, 'reversed'].forEach(function(autorange) { @@ -5552,8 +5511,7 @@ describe('Test axes', function() { ] }, autorange); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -5583,11 +5541,10 @@ describe('Test axes', function() { expect(Lib.warn).toHaveBeenCalledTimes(1); expect(Lib.warn).toHaveBeenCalledWith('scattergl traces do not work on axes with rangebreaks. Setting trace 0 to `visible: false`.'); }) - .catch(failTest) .then(function() { destroyGraphDiv(); done(); - }); + }, done.fail); }); }); @@ -5645,8 +5602,7 @@ describe('Test axes', function() { [' ', '20', '21', '22', '23', '24', '25', ' '] ][i]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -5678,8 +5634,7 @@ describe('Test axes', function() { '2022-02-16' ], [' ', '2020-Q1', '2020-Q2', '2020-Q3', '2020-Q4', '2021-Q1', '2021-Q2', '2021-Q3', '2021-Q4', ' ']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should position quarters - case of dtick set to M6', function(done) { @@ -5707,8 +5662,7 @@ describe('Test axes', function() { '2022-02-15 15:45' ], [' ', '2020-Q1', '2020-Q3', '2021-Q1', '2021-Q3', ' ']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); ['%B', '%b', '%m'].forEach(function(formatter, i) { @@ -5742,8 +5696,7 @@ describe('Test axes', function() { [' ', 'Q1-01', 'Q1-02', 'Q1-03', 'Q2-04', 'Q2-05', 'Q2-06', ' '] ][i]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -5775,8 +5728,7 @@ describe('Test axes', function() { '2020-04-01 12:00' ], ['Jan-W04', 'Feb-W05', 'Feb-W06', 'Feb-W07', 'Feb-W08', 'Mar-W09', 'Mar-W10', 'Mar-W11', 'Mar-W12', 'Mar-W13']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); ['%V', '%W'].forEach(function(formatter, i) { @@ -5811,8 +5763,7 @@ describe('Test axes', function() { ['Jan-W04', 'Feb-W05', 'Feb-W06', 'Feb-W07', 'Feb-W08', 'Mar-W09', 'Mar-W10', 'Mar-W11', 'Mar-W12', 'Mar-W13'] ][i]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -5875,8 +5826,7 @@ describe('Test axes', function() { ['Jan-W01', 'Jan-W02', 'Jan-W03', 'Jan-W04'] ][i]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -5917,8 +5867,7 @@ describe('Test axes', function() { [' ', 'Jan-01/01/2020', 'Jan-01/02/2020', 'Jan-01/03/2020', 'Jan-01/04/2020', 'Jan-01/05/2020', 'Jan-01/06/2020', 'Jan-01/07/2020', ' '] ][i]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -5955,8 +5904,7 @@ describe('Test axes', function() { [' ', 'Wed-00:00:00', 'Wed-03:00:00', 'Wed-06:00:00', 'Wed-09:00:00', 'Wed-12:00:00', 'Wed-15:00:00', 'Wed-18:00:00', 'Wed-21:00:00', 'Thu-00:00:00'] ][i]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -6014,8 +5962,7 @@ describe('Test axes', function() { .then(function() { _assert('', t.positions, t.labels); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -6061,8 +6008,7 @@ describe('Test axes', function() { .then(function() { _assert('', t.positions, t.labels); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -6182,8 +6128,7 @@ describe('Test axes', function() { .then(function() { _assert('', t.positions, t.labels); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -6303,8 +6248,7 @@ describe('Test axes', function() { .then(function() { _assert('', t.positions, t.labels); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -6408,8 +6352,7 @@ describe('Test axes', function() { .then(function() { _assert('', t.positions, t.labels); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -6444,8 +6387,7 @@ describe('Test axes', function() { .then(function() { expect(gd._fullLayout.xaxis.tick0).toBe('2000-01-02'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -6756,8 +6698,7 @@ describe('Test tickformatstops:', function() { expect(d3.selectAll('g.axistext').select('text').html()).toEqual(formatter(new Date(hoverTrace.x))); expect(d3.selectAll('g.hovertext').select('text').html()).toEqual('0'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('doesn\'t fail on bad input', function(done) { @@ -6772,8 +6713,7 @@ describe('Test tickformatstops:', function() { }); promise - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -6820,8 +6760,7 @@ describe('Test template:', function() { expect(xaxis.tickformatstops).not.toBe(undefined, 'tickformatstops'); expect(xaxis.tickformatstops.length).toBe(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -6960,8 +6899,7 @@ describe('more react tests', function() { expect(gd._fullLayout.xaxis._categoriesMap).toEqual({Z: 0, 0: 1, A: 2}); expect(gd._fullLayout.xaxis2._categoriesMap).toEqual({Z: 0, 0: 1, A: 2}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -7018,8 +6956,7 @@ describe('category preservation tests on gd passed to Plotly.react()', function( expect(d3.selectAll('g.axistext').select('text').html()).toEqual('d'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -7056,7 +6993,6 @@ describe('more matching axes tests', function() { } } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/bar_test.js b/test/jasmine/tests/bar_test.js index 51fc90e046a..a72c995723c 100644 --- a/test/jasmine/tests/bar_test.js +++ b/test/jasmine/tests/bar_test.js @@ -11,7 +11,7 @@ var click = require('../assets/click'); var DBLCLICKDELAY = require('@src/plot_api/plot_config').dfltConfig.doubleClickDelay; var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var negateIf = require('../assets/negate_if'); var checkTicks = require('../assets/custom_assertions').checkTicks; var supplyAllDefaults = require('../assets/supply_defaults'); @@ -1180,8 +1180,7 @@ describe('A bar plot', function() { expect(foundTextNodes).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Pushes outside text relative bars inside when not outmost', function(done) { @@ -1216,8 +1215,7 @@ describe('A bar plot', function() { expect(foundTextNodes).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('does not push text inside when base is set', function(done) { @@ -1253,8 +1251,7 @@ describe('A bar plot', function() { expect(foundTextNodes).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show bar texts (outside case)', function(done) { @@ -1286,8 +1283,7 @@ describe('A bar plot', function() { expect(foundTextNodes).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show bar texts (horizontal case)', function(done) { @@ -1317,8 +1313,7 @@ describe('A bar plot', function() { expect(foundTextNodes).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show bar texts (barnorm case)', function(done) { @@ -1351,8 +1346,7 @@ describe('A bar plot', function() { expect(foundTextNodes).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); var insideTextTestsTrace = { @@ -1377,8 +1371,7 @@ describe('A bar plot', function() { var allExpectedColors = trace1Colors.concat(trace2Colors); assertTextFontColors(allExpectedColors)(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should take bar fill opacities into account when calculating contrasting inside text colors', function(done) { @@ -1395,8 +1388,7 @@ describe('A bar plot', function() { Plotly.plot(gd, [trace]) .then(assertTextFontColors([DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use defined textfont.color for inside text instead of the contrasting default', function(done) { @@ -1404,8 +1396,7 @@ describe('A bar plot', function() { Plotly.plot(gd, [data]) .then(assertTextFontColors(Lib.repeat('#09f', 6))) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use matching color from textfont.color array for inside text, contrasting otherwise', function(done) { @@ -1413,8 +1404,7 @@ describe('A bar plot', function() { Plotly.plot(gd, [data]) .then(assertTextFontColors(['#09f', 'green', LIGHT, LIGHT, DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use defined insidetextfont.color for inside text instead of the contrasting default', function(done) { @@ -1422,8 +1412,7 @@ describe('A bar plot', function() { Plotly.plot(gd, [data]) .then(assertTextFontColors(Lib.repeat('#09f', 6))) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use matching color from insidetextfont.color array instead of the contrasting default', function(done) { @@ -1431,8 +1420,7 @@ describe('A bar plot', function() { Plotly.plot(gd, [data]) .then(assertTextFontColors(['yellow', 'green', LIGHT, LIGHT, DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use a contrasting text color by default for outside labels being pushed inside ' + @@ -1449,8 +1437,7 @@ describe('A bar plot', function() { Plotly.plot(gd, [trace1, trace2], layout) .then(assertTextFontColors([LIGHT, DARK])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should style outside labels pushed inside by bars stacked above as inside labels', function(done) { @@ -1469,8 +1456,7 @@ describe('A bar plot', function() { .then(assertTextFontColors(['blue', DARK])) .then(assertTextFontFamilies(['serif', 'Arial'])) .then(assertTextFontSizes([24, 12])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should fall back to textfont array values if insidetextfont array values don\'t ' + @@ -1493,8 +1479,7 @@ describe('A bar plot', function() { .then(assertTextFontColors(['yellow', 'green', 'blue', LIGHT, DARK, LIGHT])) .then(assertTextFontFamilies(['Arial', 'serif', 'Roboto', 'Roboto', 'Roboto', 'Roboto'])) .then(assertTextFontSizes([16, 24, 12, 12, 12, 12])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should retain text styles throughout selecting and deselecting data points', function(done) { @@ -1541,8 +1526,7 @@ describe('A bar plot', function() { .then(function() { assertNonSelectionModeStyle('after selection'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); function assertSelectionModeStyle(label) { var unselColor = ['black', '0.2']; @@ -1722,8 +1706,7 @@ describe('A bar plot', function() { assertTextIsInsidePath(text20, path20); // inside assertTextIsInsidePath(text30, path30); // inside }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should coerce text-related attributes', function(done) { @@ -1806,8 +1789,7 @@ describe('A bar plot', function() { assertTextFont(textNodes[1], expected.outsidetextfont, 1); assertTextFont(textNodes[2], expected.insidetextfont, 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can change orientation and correctly sets axis types', function(done) { @@ -1872,8 +1854,7 @@ describe('A bar plot', function() { checkBarsMatch(['bottom', 'width'], 'final'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to add/remove text node on restyle', function(done) { @@ -1913,8 +1894,7 @@ describe('A bar plot', function() { .then(function() { _assertNumberOfBarTextNodes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to react with new text colors', function(done) { @@ -1946,8 +1926,7 @@ describe('A bar plot', function() { return Plotly.react(gd, gd.data); }) .then(assertTextFontColors(['rgb(255, 0, 0)', 'rgb(255, 0, 0)', 'rgb(255, 0, 0)'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not error out when *textfont* is set in traces w/o *text*', function(done) { @@ -1960,8 +1939,7 @@ describe('A bar plot', function() { .then(function() { expect(getAllBarNodes(gd).length).toBe(13, '# of bars'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show/hide text in clipped and non-clipped layers', function(done) { @@ -2064,8 +2042,7 @@ describe('A bar plot', function() { [true, 3] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function getArea(path) { @@ -2115,8 +2092,7 @@ describe('A bar plot', function() { expect(getArea(d) > 0).toBe(visible, 'item:' + i); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display bar of zero-length as M0,0Z when staticPlot is true', function(done) { @@ -2130,8 +2106,7 @@ describe('A bar plot', function() { var d = nodes[0].getAttribute('d'); expect(d).toBe('M0,0Z'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('show narrow bars', function() { @@ -2161,8 +2136,7 @@ describe('A bar plot', function() { expect(getArea(d) > 0).toBe(true, 'item:' + i); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -2219,8 +2193,7 @@ describe('bar visibility toggling:', function() { .then(function() { _assert('back to both visible', [0.5, 3.5], [-2.222, 2.222], 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update axis range according to visible edits (stack case)', function(done) { @@ -2255,8 +2228,7 @@ describe('bar visibility toggling:', function() { .then(function() { _assert('back to both visible', [0.5, 3.5], [0, 5.263], 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('gets the right legend traceorder if all bars are visible: false', function(done) { @@ -2286,8 +2258,7 @@ describe('bar visibility toggling:', function() { .then(function() { _assert('reversed', [1.922, 3.077], 4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2344,8 +2315,7 @@ describe('bar hover', function() { var mock = Lib.extendDeep({}, require('@mocks/11.json')); Plotly.plot(gd, mock.data, mock.layout) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should return the correct hover point data (case x)', function() { @@ -2370,8 +2340,7 @@ describe('bar hover', function() { var mock = Lib.extendDeep({}, require('@mocks/bar_attrs_group_norm.json')); Plotly.plot(gd, mock.data, mock.layout) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should return the correct hover point data (case y)', function() { @@ -2435,8 +2404,7 @@ describe('bar hover', function() { var out = _hover(gd, -0.25, 0.5, 'closest'); expect(out.text).toEqual('apple', 'hover text'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use hovertemplate if specified', function(done) { @@ -2463,8 +2431,7 @@ describe('bar hover', function() { }); // return Plotly.restyle(gd, 'text', ['APPLE', 'BANANA', 'ORANGE']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should allow both x/y tokens and label/value tokens', function(done) { @@ -2507,8 +2474,7 @@ describe('bar hover', function() { name: 'trace 0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should provide a default label for base in hovertemplate', function(done) { @@ -2553,8 +2519,7 @@ describe('bar hover', function() { name: 'trace 0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2602,8 +2567,7 @@ describe('bar hover', function() { expect(out).toBe(false, hoverSpec); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should return correct hover data (two bars, array width)', function(done) { @@ -2640,8 +2604,7 @@ describe('bar hover', function() { expect(out.style).toEqual([1, 'red', 200, 1]); assertPos(out.pos, [222, 280, 168, 168]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('positions labels correctly w.r.t. narrow bars', function(done) { @@ -2670,8 +2633,7 @@ describe('bar hover', function() { out = _hover(gd, 10, 2, 'closest'); assertPos(out.pos, [145, 155, 15, 15]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2698,8 +2660,7 @@ describe('bar hover', function() { expect(pt0.yLabelVal).toBe(0, 'y label value for data[0]'); expect(pt1.yLabelVal).toBe(1, 'y label value for data[1]'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -2711,8 +2672,7 @@ describe('bar hover', function() { var mock = Lib.extendDeep({}, require('@mocks/bar-with-milliseconds.json')); Plotly.newPlot(gd, mock.data, mock.layout) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display the correct bar length passed in milliseconds from base', function() { @@ -2852,8 +2812,7 @@ describe('bar tweening', function() { var animateOpts = {'data': [{'marker': {'color': ['rgb(255, 0, 0)', 'rgb(0, 255, 0)', 'rgb(0, 0, 255)']}}]}; checkTransition(gd, mock, animateOpts, transitionOpts, tests) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('for vertical bar height and text position', function(done) { @@ -2870,8 +2829,7 @@ describe('bar tweening', function() { var animateOpts = {data: [{y: [5, 24, 12]}]}; checkTransition(gd, mock, animateOpts, transitionOpts, tests) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('for vertical bar width', function(done) { @@ -2888,8 +2846,7 @@ describe('bar tweening', function() { y: [5] }]}, animateOpts, transitionOpts, tests) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('for horizontal bar length and text position', function(done) { @@ -2910,8 +2867,7 @@ describe('bar tweening', function() { var animateOpts = {data: [{x: [15, 15, 15]}]}; checkTransition(gd, mockCopy, animateOpts, transitionOpts, tests) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('for bar line width and color', function(done) { @@ -2930,8 +2886,7 @@ describe('bar tweening', function() { var animateOpts = {'data': [{'marker': {'line': {'width': 20, 'color': ['rgb(255, 0, 0)', 'rgb(0, 255, 0)', 'rgb(0, 0, 255)']}}}]}; checkTransition(gd, mock, animateOpts, transitionOpts, tests) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('for error bars', function(done) { @@ -2949,8 +2904,7 @@ describe('bar tweening', function() { error_y: {value: 20} }]}, animateOpts, transitionOpts, tests) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('for bar positions during object-constancy transitions', function(done) { @@ -2990,8 +2944,7 @@ describe('bar tweening', function() { ]; checkTransition(gd, _mock, nextFrame, transitionOpts, tests) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('blank vertical bars', function(done) { @@ -3020,8 +2973,7 @@ describe('bar tweening', function() { var animateOpts = {data: [{y: [5, null, 2]}]}; checkTransition(gd, mockCopy, animateOpts, transitionOpts, tests) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('blank horizontal bars', function(done) { @@ -3051,8 +3003,7 @@ describe('bar tweening', function() { var animateOpts = {data: [{x: [5, null, 2]}]}; checkTransition(gd, mockCopy, animateOpts, transitionOpts, tests) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('handle BADNUM positions on vertical bars', function(done) { @@ -3091,8 +3042,7 @@ describe('bar tweening', function() { var animateOpts = {data: [{y: y2}]}; checkTransition(gd, mockCopy, animateOpts, transitionOpts, tests) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('handle NaN positions on horizontal bars', function(done) { @@ -3132,8 +3082,7 @@ describe('bar tweening', function() { var animateOpts = {data: [{x: x2}]}; checkTransition(gd, mockCopy, animateOpts, transitionOpts, tests) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -3260,7 +3209,6 @@ describe('bar uniformtext', function() { fontsizes: [12, 12, 12, 12, 12, 12, 12], scales: [0.48, 1, 1, 1, 1, 1, 1], })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/barpolar_test.js b/test/jasmine/tests/barpolar_test.js index 76c97c9e13a..71f97f67485 100644 --- a/test/jasmine/tests/barpolar_test.js +++ b/test/jasmine/tests/barpolar_test.js @@ -4,7 +4,7 @@ var Lib = require('@src/lib'); var supplyAllDefaults = require('../assets/supply_defaults'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + describe('Test barpolar defaults:', function() { var gd; @@ -456,7 +456,7 @@ describe('Test barpolar hover:', function() { }] .forEach(function(specs) { it('should generate correct hover labels ' + specs.desc, function(done) { - run(specs).catch(failTest).then(done); + run(specs).then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/box_test.js b/test/jasmine/tests/box_test.js index e9aab19eeb0..cb12c2d3ad7 100644 --- a/test/jasmine/tests/box_test.js +++ b/test/jasmine/tests/box_test.js @@ -7,7 +7,7 @@ var Box = require('@src/traces/box'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var supplyAllDefaults = require('../assets/supply_defaults'); @@ -1032,7 +1032,7 @@ describe('Test box hover:', function() { axis: 'A' }].forEach(function(specs) { it('should generate correct hover labels ' + specs.desc, function(done) { - run(specs).catch(failTest).then(done); + run(specs).then(done, done.fail); }); }); }); @@ -1063,8 +1063,7 @@ describe('Box edge cases', function() { expect(outliers.length).toBe(1); expect(outliers[0].x).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1114,8 +1113,7 @@ describe('Test box restyle:', function() { .then(function() { _assert('with pts', {boxCnt: 1, ptsCnt: 9}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update axis range accordingly on calc edits', function(done) { @@ -1150,8 +1148,7 @@ describe('Test box restyle:', function() { .then(function() { _assert('auto rng / no boxpoints', [-0.5, 0.5], [-0.555, 10.555]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to change axis range when the number of distinct positions changes', function(done) { @@ -1182,8 +1179,7 @@ describe('Test box restyle:', function() { .then(function() { _assert('only trace1 visible', [-0.5, 0.5], [-0.444, 8.444]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/calcdata_test.js b/test/jasmine/tests/calcdata_test.js index 6573b0028fe..63793c95ce2 100644 --- a/test/jasmine/tests/calcdata_test.js +++ b/test/jasmine/tests/calcdata_test.js @@ -3,7 +3,7 @@ var Plotly = require('@lib/index'); var BADNUM = require('@src/constants/numerical').BADNUM; var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var Lib = require('@src/lib'); describe('calculated data and points', function() { @@ -22,8 +22,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][1]).toEqual(jasmine.objectContaining({ x: BADNUM, y: BADNUM})); expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({ x: BADNUM, y: BADNUM})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should exclude null and undefined points as categories when false', function(done) { @@ -32,8 +31,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][1]).toEqual(jasmine.objectContaining({ x: BADNUM, y: BADNUM})); expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({ x: BADNUM, y: BADNUM})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -50,8 +48,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][3].y).toEqual(13); expect(gd.calcdata[0][4].y).toEqual(14); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output categories in the given order if `trace` order is explicitly specified', function(done) { @@ -70,8 +67,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][3].y).toEqual(13); expect(gd.calcdata[0][4].y).toEqual(14); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -88,8 +84,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({x: 1, y: 13})); expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 3, y: 14})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output categories in descending domain alphanumerical order', function(done) { @@ -104,8 +99,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({x: 3, y: 13})); expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 1, y: 14})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output categories in ascending domain alphanumerical order even if categories are all numbers', function(done) { @@ -120,8 +114,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({x: 1, y: 13})); expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 3, y: 14})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output categories in categoryorder order even if category array is defined', function(done) { @@ -137,8 +130,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({x: 1, y: 13})); expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 3, y: 14})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output categories in ascending domain alphanumerical order, excluding undefined', function(done) { @@ -152,8 +144,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({x: 0, y: 13})); expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 2, y: 14})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should combine duplicate categories', function(done) { @@ -166,8 +157,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][1]).toEqual(jasmine.objectContaining({x: 0, y: 20})); expect(gd._fullLayout.xaxis._categories).toEqual(['1']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should skip over visible-false traces', function(done) { @@ -190,8 +180,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[1][2]).toEqual(jasmine.objectContaining({x: 8, y: 0})); expect(gd._fullLayout.yaxis2._categories).toEqual(['C', 'B', 'A']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -209,8 +198,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({x: 0, y: 13})); expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 2, y: 14})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output categories in explicitly supplied order even if category values are all numbers', function(done) { @@ -226,8 +214,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({x: 0, y: 13})); expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 2, y: 14})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output categories in explicitly supplied order, independent of trace order, pruned', function(done) { @@ -243,8 +230,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({ x: BADNUM, y: BADNUM})); expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 2, y: 14})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output categories in explicitly supplied order even if not all categories are present', function(done) { @@ -260,8 +246,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({x: 0, y: 13})); expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 3, y: 14})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output categories in explicitly supplied order even if some missing categories were at the beginning or end of categoryarray', function(done) { @@ -285,8 +270,7 @@ describe('calculated data and points', function() { expect(domTickTexts).toEqual(['b', 'x', 'a', 'd', 'z', 'e', 'c']); // y, q and k has no data points }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output categories in explicitly supplied order even if some missing categories were at the beginning or end of categoryarray', function(done) { @@ -311,8 +295,7 @@ describe('calculated data and points', function() { expect(domTickTexts).toEqual(['y', 'b', 'x', 'a', 'd', 'z', 'e', 'c']); // q, k has no data; y is null }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output categories in explicitly supplied order even if not all categories are present, and should interact with a null value orthogonally', function(done) { @@ -328,8 +311,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({x: 0, y: 13})); expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 3, y: 14})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output categories in explicitly supplied order first, if not all categories are covered', function(done) { @@ -350,8 +332,7 @@ describe('calculated data and points', function() { // based on the categoryorder. This of course means that the mere presence of categories triggers this // behavior, rather than an explicit 'explicit' categoryorder. }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -381,8 +362,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 9, y: 31})); expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 10, y: 32})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order follows the trace order (even if categoryarray is specified)', function(done) { @@ -414,8 +394,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 9, y: 31})); expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 10, y: 32})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order is category ascending (even if categoryarray is specified)', function(done) { @@ -448,8 +427,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 5, y: 31})); expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 9, y: 32})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order is category descending (even if categoryarray is specified)', function(done) { @@ -482,8 +460,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 5, y: 31})); expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 1, y: 32})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order follows categoryarray', function(done) { @@ -515,8 +492,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 10, y: 31})); expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 3, y: 32})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -547,8 +523,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 1, y: 32})); expect(gd.calcdata[2][3]).toEqual(jasmine.objectContaining({x: 10, y: 33})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order follows the trace order (even if categoryarray is specified)', function(done) { @@ -581,8 +556,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 1, y: 32})); expect(gd.calcdata[2][3]).toEqual(jasmine.objectContaining({x: 10, y: 33})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order is category ascending (even if categoryarray is specified)', function(done) { @@ -616,8 +590,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 0, y: 32})); expect(gd.calcdata[2][3]).toEqual(jasmine.objectContaining({x: 9, y: 33})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order is category descending (even if categoryarray is specified)', function(done) { @@ -651,8 +624,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 10, y: 32})); expect(gd.calcdata[2][3]).toEqual(jasmine.objectContaining({x: 1, y: 33})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order follows categoryarray', function(done) { @@ -685,8 +657,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 1, y: 32})); expect(gd.calcdata[2][3]).toEqual(jasmine.objectContaining({x: 3, y: 33})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -714,8 +685,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 0, y: 31})); expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 1, y: 32})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order follows the trace order (even if categoryarray is specified)', function(done) { @@ -745,8 +715,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 0, y: 31})); expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 1, y: 32})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order is category ascending (even if categoryarray is specified)', function(done) { @@ -777,8 +746,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 1, y: 31})); expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 0, y: 32})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order is category descending (even if categoryarray is specified)', function(done) { @@ -809,8 +777,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 1, y: 31})); expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 2, y: 32})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order follows categoryarray', function(done) { @@ -842,8 +809,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 2, y: 31})); expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 0, y: 32})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('category order follows categoryarray even if data is sparse', function(done) { @@ -875,8 +841,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 9, y: 31})); expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 1, y: 32})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -914,8 +879,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 1, y: 11 + 32})); expect(gd.calcdata[2][3]).toEqual(jasmine.objectContaining({x: 3, y: 33})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('fully overlapping - category order follows categoryarray and stacking produces expected results', function(done) { @@ -948,8 +912,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 2, y: 10 + 21 + 31})); expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 0, y: 11 + 20 + 32})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -965,8 +928,7 @@ describe('calculated data and points', function() { expect(gd._fullLayout.xaxis._categories).toEqual(['a', 'c', 'e', 'g']); expect(gd._fullLayout.xaxis2._categories).toEqual(['h', 'f', 'd', 'b']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should consider number categories and their string representation to be the same', function(done) { @@ -984,8 +946,7 @@ describe('calculated data and points', function() { 'b': 1 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('by value', function() { @@ -1099,8 +1060,7 @@ describe('calculated data and points', function() { expect(gd._fullLayout[trace.type === 'splom' ? 'xaxis' : axName]._categories).toEqual(finalOrder, 'wrong order'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); } ['total ascending', 'total descending'].forEach(function(categoryorder) { @@ -1228,8 +1188,7 @@ describe('calculated data and points', function() { .then(function() { expect(gd._fullLayout.yaxis5._categories).toEqual(order.reverse(), 'wrong order'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1246,8 +1205,7 @@ describe('calculated data and points', function() { expect(gd.calcdata[0][1]).toEqual(jasmine.objectContaining({data: 'b'})); expect(gd.calcdata[0][2]).toEqual(jasmine.objectContaining({data: {foo: 'bar'}})); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/carpet_test.js b/test/jasmine/tests/carpet_test.js index 7ae4e770ab5..4212753899f 100644 --- a/test/jasmine/tests/carpet_test.js +++ b/test/jasmine/tests/carpet_test.js @@ -9,7 +9,7 @@ var smoothFill = require('@src/traces/carpet/smooth_fill_array'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var assertHoverLabelContent = require('../assets/custom_assertions').assertHoverLabelContent; @@ -533,8 +533,7 @@ describe('Test carpet interactions:', function() { expect(countCarpets()).toEqual(0); expect(countContourTraces()).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should add/delete trace properly', function(done) { @@ -564,8 +563,7 @@ describe('Test carpet interactions:', function() { expect(countCarpets()).toEqual(0); expect(countContourTraces()).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should respond to relayout properly', function(done) { @@ -578,8 +576,7 @@ describe('Test carpet interactions:', function() { .then(function() { return Plotly.relayout(gd, 'yaxis.range', [7, 8]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('scattercarpet should be able to coexist with scatter traces', function(done) { @@ -604,8 +601,7 @@ describe('Test carpet interactions:', function() { .then(function() { _assert(3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('preserves order of carpets on the same subplot after hide/show', function(done) { @@ -637,8 +633,7 @@ describe('Test carpet interactions:', function() { .then(function() { expect(getIndices()).toEqual([0, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -695,8 +690,7 @@ describe('scattercarpet array attributes', function() { expect(pt.mlc).toBe(mlc[i]); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -724,8 +718,7 @@ describe('scattercarpet hover labels', function() { [200, 200], fig, [['a: 0.200', 'b: 3.500', 'y: 2.900'], 'a = 0.2'] ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should generate hover label (with hovertext array)', function(done) { @@ -737,8 +730,7 @@ describe('scattercarpet hover labels', function() { [200, 200], fig, [['a: 0.200', 'b: 3.500', 'y: 2.900', 'D'], 'a = 0.2'] ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should generate hover label with \'hoverinfo\' set', function(done) { @@ -749,8 +741,7 @@ describe('scattercarpet hover labels', function() { [200, 200], fig, [['a: 0.200', 'y: 2.900'], null] ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should generate hover label with arrayOk \'hoverinfo\' settings', function(done) { @@ -761,8 +752,7 @@ describe('scattercarpet hover labels', function() { [200, 200], fig, [['b: 3.500', 'y: 2.900'], null] ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should generate hover label with *hovertemplate*', function(done) { @@ -773,8 +763,7 @@ describe('scattercarpet hover labels', function() { [200, 200], fig, [['f(0.2, 3.5) = 2.900'], 'scattercarpet #5'] ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should generate hover label with arrayOk *hovertemplate*', function(done) { @@ -785,8 +774,7 @@ describe('scattercarpet hover labels', function() { [200, 200], fig, [['f(0.2, 3.5) = 3.0'], 'pt #3'] ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -853,7 +841,6 @@ describe('contourcarpet plotting & editing', function() { .then(function() { expect(getIndices()).toEqual([1, 2]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/cartesian_interact_test.js b/test/jasmine/tests/cartesian_interact_test.js index 6ba153b3dea..eefcd8c454f 100644 --- a/test/jasmine/tests/cartesian_interact_test.js +++ b/test/jasmine/tests/cartesian_interact_test.js @@ -9,7 +9,7 @@ var constants = require('@src/plots/cartesian/constants'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var mouseEvent = require('../assets/mouse_event'); -var failTest = require('../assets/fail_test'); + var selectButton = require('../assets/modebar_button'); var drag = require('../assets/drag'); var doubleClick = require('../assets/double_click'); @@ -182,8 +182,7 @@ describe('main plot pan', function() { // X and back; XY and back expect(relayoutCallback).toHaveBeenCalledTimes(6); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should emit plotly_relayouting events during pan interactions', function(done) { @@ -212,8 +211,7 @@ describe('main plot pan', function() { expect(first['xaxis.range[1]'] - last['xaxis.range[1]']).toBeCloseTo(1, 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show/hide `cliponaxis: false` pts according to range', function(done) { @@ -301,8 +299,7 @@ describe('main plot pan', function() { [null, null, null] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -490,8 +487,7 @@ describe('axis zoom/pan and main plot zoom', function() { // reset all from the modebar .then(function() { selectButton(gd._fullLayout._modeBar, 'resetScale2d').click(); }) .then(checkRanges({}, 'final reset')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates with correlated subplots & no constraints - middles, corners, and scrollwheel', function(done) { @@ -519,8 +515,7 @@ describe('axis zoom/pan and main plot zoom', function() { .then(checkRanges({xaxis: [-0.1578, 1.8422], yaxis: [0, 2.2103]}, 'x scroll')) .then(doScroll('xy', 'ns', -20, {dy: -50})) .then(checkRanges({xaxis: [-0.1578, 1.8422], yaxis: [0.1578, 2.1578]}, 'y scroll')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates linked axes when there are constraints', function(done) { @@ -555,8 +550,7 @@ describe('axis zoom/pan and main plot zoom', function() { .then(checkRanges({xaxis: [-0.2103, 2], yaxis: [0, 2.2103], xaxis2: [-0.1052, 2.1052], yaxis2: [-0.1052, 2.1052]}, 'scroll xy')) .then(doScroll('xy', 'ew', -20, {dx: -50})) .then(checkRanges({xaxis: [-0.1578, 1.8422], yaxis: [0.1052, 2.1052]}, 'scroll x')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -580,8 +574,7 @@ describe('axis zoom/pan and main plot zoom', function() { .then(function() { _assert([0.41, 1.23], [1.18, 2]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates axis layout when the constraints require it', function(done) { @@ -613,8 +606,7 @@ describe('axis zoom/pan and main plot zoom', function() { .then(function() { _assert(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should draw correct zoomboxes corners', function(done) { @@ -659,8 +651,7 @@ describe('axis zoom/pan and main plot zoom', function() { .then(function() { return _run('full-y w/ fixed yaxis', [5, 30], {cornerCnt: 0}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should emit plotly_relayouting events when drawing zoom selection', function(done) { @@ -678,8 +669,7 @@ describe('axis zoom/pan and main plot zoom', function() { expect(events.length).toEqual(nsteps); expect(relayoutCallback).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should emit plotly_relayouting events when zooming via mouse wheel', function(done) { @@ -697,8 +687,7 @@ describe('axis zoom/pan and main plot zoom', function() { expect(events.length).toEqual(nsteps); expect(relayoutCallback).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('handles xy, x-only and y-only zoombox updates', function(done) { @@ -716,8 +705,7 @@ describe('axis zoom/pan and main plot zoom', function() { .then(doDblClick('xy', 'nsew')) .then(doDrag('xy', 'nsew', 0, 50)) .then(function() { _assert('after y-only drag', [-0.128, 2.128], [1.287, 1.5]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('handles y-only to xy back to y-only in single zoombox drag motion', function(done) { @@ -782,8 +770,7 @@ describe('axis zoom/pan and main plot zoom', function() { fail('did not emit correct number of plotly_relayout events'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should compute correct multicategory tick label span during drag', function(done) { @@ -835,8 +822,7 @@ describe('axis zoom/pan and main plot zoom', function() { y: [406, 406] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('updates matching axes', function() { @@ -1127,8 +1113,7 @@ describe('axis zoom/pan and main plot zoom', function() { [['xaxis', 'xaxis2', 'xaxis3'], xr0, {autorange: true}], [['yaxis'], yr0, {autorange: true}] ])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1223,8 +1208,7 @@ describe('axis zoom/pan and main plot zoom', function() { .then(drag.end); }) .then(_assert(msg, s.exp)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1362,8 +1346,7 @@ describe('axis zoom/pan and main plot zoom', function() { .then(drag.end); }) .then(_assert(msg, s.exp)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1460,8 +1443,7 @@ describe('axis zoom/pan and main plot zoom', function() { rng0[s.dblclickSubplot], {autorange: true} ]])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1533,8 +1515,7 @@ describe('axis zoom/pan and main plot zoom', function() { [['yaxis'], [1.5, 1.609]], [['xaxis2'], [-0.225, 3.222], {noChange: true}] ])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('panning a matching axes with references to *missing* axes', function(done) { @@ -1586,8 +1567,7 @@ describe('axis zoom/pan and main plot zoom', function() { [['xaxis', 'xaxis2', 'xaxis3', 'xaxis4'], [0.8206, 3.179], {autorange: true}], [['yaxis', 'yaxis2', 'yaxis3', 'yaxis4'], [0.9103, 2.0896], {autorange: true}] ])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('matching and constrained subplots play nice together', function(done) { @@ -1650,8 +1630,7 @@ describe('axis zoom/pan and main plot zoom', function() { expect(gd._fullLayout.xaxis._m).toBe(mx); expect(gd._fullLayout.yaxis._m).toBe(my); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('handles matching & scaleanchor chained together', function(done) { @@ -1710,8 +1689,7 @@ describe('axis zoom/pan and main plot zoom', function() { [['xaxis', 'yaxis'], [-0.732, 2.732], {dragged: true}], [['xaxis2', 'yaxis2'], [-1.232, 2.232], {dragged: true}] ])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1862,9 +1840,10 @@ describe('axis zoom/pan and main plot zoom', function() { zoombox: false, clipTranslate: [0, 0] })) - .catch(failTest) - .then(function() { clearInterval(interval); }) - .then(done); + .then(function() { + clearInterval(interval); + done(); + }, done.fail); }); it('should handle plotly_relayout callback during drag interactions', function(done) { @@ -1997,8 +1976,7 @@ describe('axis zoom/pan and main plot zoom', function() { zoombox: false, clipTranslate: [0, 0] })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should handle react calls in plotly_selecting callback', function(done) { @@ -2090,8 +2068,7 @@ describe('axis zoom/pan and main plot zoom', function() { selectedCnt: 1, selectOutline: false })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2151,8 +2128,7 @@ describe('axis zoom/pan and main plot zoom', function() { .then(_run('dy > MINDRAG', [0, MINDRAG + 2], 'y-zoom')) .then(_run('(dx,dy) < MINDRAG', [MINDRAG - 2, MINDRAG - 2], 'nozoom')) .then(_run('(dx,dy) > MINDRAG', [MINDRAG + 2, MINDRAG + 2], 'xy-zoom')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('with axis rangebreaks', function() { @@ -2218,8 +2194,7 @@ describe('axis zoom/pan and main plot zoom', function() { '1970-01-01 00:00:00.1969' ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should compute correct range updates - y-axis case', function(done) { @@ -2284,8 +2259,7 @@ describe('axis zoom/pan and main plot zoom', function() { '1970-01-01 00:00:00.2089' ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -2337,8 +2311,7 @@ describe('Event data:', function() { expect('marker.colorbar.tickvals' in pt).toBe(false, 'marker.colorbar.tickvals'); expect('marker.colorbar.ticktext' in pt).toBe(false, 'marker.colorbar.ticktext'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should have correct content for *heatmap* traces', function(done) { @@ -2365,8 +2338,7 @@ describe('Event data:', function() { expect('marker.colorbar.tickvals' in pt).toBe(false, 'marker.colorbar.tickvals'); expect('marker.colorbar.ticktext' in pt).toBe(false, 'marker.colorbar.ticktext'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2485,8 +2457,7 @@ describe('Cartesian plots with css transforms', function() { .then(function() {_hoverAndAssertEventOccurred(points[0], xLabels[0]);}) .then(function() {_hoverAndAssertEventOccurred(points[1], xLabels[1]);}) .then(function() {_hoverAndAssertEventOccurred(points[2], xLabels[2]);}) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('drag-zoom behaves correctly after css transform: ' + transform, function(done) { @@ -2529,8 +2500,7 @@ describe('Cartesian plots with css transforms', function() { _assertTransformedZoombox(start, end); }) .then(function() { mouseEvent('mouseup', 0, 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('select behaves correctly after css transform: ' + transform, function(done) { @@ -2562,8 +2532,7 @@ describe('Cartesian plots with css transforms', function() { .then(function() { _assertSelected(t.selected); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/cartesian_test.js b/test/jasmine/tests/cartesian_test.js index 01c4526ac1d..1e042f95bdb 100644 --- a/test/jasmine/tests/cartesian_test.js +++ b/test/jasmine/tests/cartesian_test.js @@ -6,7 +6,7 @@ var Drawing = require('@src/components/drawing'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var assertD3Data = require('../assets/custom_assertions').assertD3Data; describe('restyle', function() { @@ -62,8 +62,7 @@ describe('restyle', function() { }).then(function() { expect(d3.selectAll('g.trace.scatter').size()).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('reuses SVG lines', function(done) { @@ -102,8 +101,7 @@ describe('restyle', function() { // Second line was persisted: expect(firstLine2).toBe(secondLine2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can change scatter mode', function(done) { @@ -148,8 +146,7 @@ describe('restyle', function() { .then(function() { assertScatterModeSizes(3, 9, 9); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can legend-hide the second and only scatter trace', function(done) { @@ -174,8 +171,7 @@ describe('restyle', function() { .then(function() { expect(d3.select('.scatter').size()).toBe(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl can legend-hide the second and only scattergl trace', function(done) { @@ -200,8 +196,7 @@ describe('restyle', function() { .then(function() { expect(!!gd._fullLayout._plots.x2y2._scene).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -252,8 +247,7 @@ describe('relayout', function() { expect(gd._fullLayout.xaxis._initialCategories).toEqual(list); assertCategories(list); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -304,8 +298,7 @@ describe('relayout', function() { .then(function() { assertPointTranslate([-540, 135], [-540, 135]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should autorange correctly with margin pushers', function(done) { @@ -340,8 +333,7 @@ describe('relayout', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(foundXRange, 5); expect(gd.layout.yaxis.range).toBeCloseToArray(foundYRange, 5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -372,8 +364,7 @@ describe('relayout', function() { expect(gd.querySelector('.xlines-above').attributes.d.value).toBe('M0,0'); expect(gd.querySelector('.ylines-above').attributes.d.value).toBe('M0,0'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -417,8 +408,7 @@ describe('subplot creation / deletion:', function() { .then(function() { assertOrphanSubplot(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should remove unused axes when deleting traces', function(done) { @@ -440,8 +430,7 @@ describe('subplot creation / deletion:', function() { expect(gd._fullLayout._subplots.cartesian).toEqual(['xy']); expect(gd._fullLayout._subplots.yaxis).toEqual(['y']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function checkBGLayers(behindCount, x2y2Count, subplots) { @@ -500,8 +489,7 @@ describe('subplot creation / deletion:', function() { .then(function() { checkBGLayers(1, 1, ['xy', 'x2y2']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('puts plot backgrounds behind everything except if they overlap', function(done) { @@ -546,8 +534,7 @@ describe('subplot creation / deletion:', function() { .then(function() { checkBGLayers(1, 1, ['xy', 'x2y2', 'xy3']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('puts not have backgrounds nodes when plot and paper color match', function(done) { @@ -614,8 +601,7 @@ describe('subplot creation / deletion:', function() { // still need a to get correct semi-transparent look checkBGLayers(1, 1, ['xy', 'x2y2', 'xy3']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should clear overlaid subplot trace layers on restyle', function(done) { @@ -643,8 +629,7 @@ describe('subplot creation / deletion:', function() { .then(function() { _assert(0, 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should clear obsolete content out of axis layers when relayout\'ing *layer*', function(done) { @@ -718,8 +703,7 @@ describe('subplot creation / deletion:', function() { [false, 0] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should clear obsolete content out of axis layers when changing overlaying configuation', function(done) { @@ -800,8 +784,7 @@ describe('subplot creation / deletion:', function() { trace1Parent: 'x2y2' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('clear axis ticks, labels and title when relayout an axis to `*visible:false*', function(done) { @@ -842,8 +825,7 @@ describe('subplot creation / deletion:', function() { .then(function() { _assert([5, 4, 1], [6, 6, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('clears secondary labels and divider when updating out of axis type multicategory', function(done) { @@ -900,8 +882,7 @@ describe('subplot creation / deletion:', function() { dividerCnt: 0 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('clears secondary labels and divider when updating out of axis type multicategory (y-axis case)', function(done) { @@ -961,7 +942,6 @@ describe('subplot creation / deletion:', function() { dividerCnt: 0 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/choropleth_test.js b/test/jasmine/tests/choropleth_test.js index 96fa664aca0..65fde82fd0c 100644 --- a/test/jasmine/tests/choropleth_test.js +++ b/test/jasmine/tests/choropleth_test.js @@ -9,7 +9,7 @@ var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var mouseEvent = require('../assets/mouse_event'); -var failTest = require('../assets/fail_test'); + var customAssertions = require('../assets/custom_assertions'); var assertHoverLabelStyle = customAssertions.assertHoverLabelStyle; @@ -205,8 +205,7 @@ describe('Test choropleth hover:', function() { fig, ['RUS\n10', 'trace 1'] ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -221,8 +220,7 @@ describe('Test choropleth hover:', function() { fig, ['tpl 10', 'x'] ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -238,8 +236,7 @@ describe('Test choropleth hover:', function() { fig, ['tExT', null] ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -255,8 +252,7 @@ describe('Test choropleth hover:', function() { fig, ['-text-', null] ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -273,8 +269,7 @@ describe('Test choropleth hover:', function() { fig, ['-text-', null] ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -300,8 +295,7 @@ describe('Test choropleth hover:', function() { fontFamily: 'Roboto' } ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -316,8 +310,7 @@ describe('Test choropleth hover:', function() { fig, ['RUS', 'trace 1'] ) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -338,8 +331,7 @@ describe('Test choropleth hover:', function() { [false, true].forEach(function(hasCssTransform) { it('- base case (truncate z decimals), hasCssTransform: ' + hasCssTransform, function(done) { run(hasCssTransform, pos, base(), exp) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -348,8 +340,7 @@ describe('Test choropleth hover:', function() { var fig = base(); fig.hovertemplate = '%{z}%{location}'; run(hasCssTransform, pos, fig, exp) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -362,8 +353,7 @@ describe('Test choropleth hover:', function() { fig.layout.geo.projection = {scale: 20}; run(hasCssTransform, [300, 200], fig, ['New York', '-75.1 | 42.6']) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -389,8 +379,7 @@ describe('choropleth drawing', function() { // only utopia logs - others are silently ignored expect(loggers.log).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('preserves order after hide/show', function(done) { @@ -420,7 +409,6 @@ describe('choropleth drawing', function() { .then(function() { expect(getIndices()).toEqual([0, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/choroplethmapbox_test.js b/test/jasmine/tests/choroplethmapbox_test.js index 33195943581..28c66c5fbf5 100644 --- a/test/jasmine/tests/choroplethmapbox_test.js +++ b/test/jasmine/tests/choroplethmapbox_test.js @@ -724,8 +724,7 @@ describe('Test choroplethmapbox interactions:', function() { .then(function() { _assert('after adding trace0', { layerCnt: 24 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to restyle *below*', function(done) { @@ -790,7 +789,6 @@ describe('Test choroplethmapbox interactions:', function() { 'place_label_other', 'place_label_city', 'country_label' ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, 5 * jasmine.DEFAULT_TIMEOUT_INTERVAL); }); diff --git a/test/jasmine/tests/click_test.js b/test/jasmine/tests/click_test.js index 9031148b699..60fc4286f80 100644 --- a/test/jasmine/tests/click_test.js +++ b/test/jasmine/tests/click_test.js @@ -6,7 +6,7 @@ var DBLCLICKDELAY = require('@src/plot_api/plot_config').dfltConfig.doubleClickD var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var drag = require('../assets/drag'); var getRectCenter = require('../assets/get_rect_center'); @@ -159,8 +159,7 @@ describe('Test click interactions:', function() { expect(evt.clientX).toEqual(pointPos[0]); expect(evt.clientY).toEqual(pointPos[1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); var modClickOpts = { @@ -390,8 +389,7 @@ describe('Test click interactions:', function() { expect(evt.clientX).toEqual(blankPos[0]); expect(evt.clientY).toEqual(blankPos[1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -415,8 +413,7 @@ describe('Test click interactions:', function() { .then(function() { expect(futureData).toBe(null); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -452,8 +449,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(autoRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray([-0.99100863, 1.10938115]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('on ne dragbox should update the axis ranges', function(done) { @@ -477,8 +473,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-3.01196749, 2.08350047]); expect(gd.layout.yaxis.range).toBeCloseToArray([-0.99100863, 1.10938115]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('on sw dragbox should update the axis ranges', function(done) { @@ -501,8 +496,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-3.00958227, 2.15613055]); expect(gd.layout.yaxis.range).toBeCloseToArray([-0.71100706, 1.38938271]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('on se dragbox should update the axis ranges', function(done) { @@ -526,8 +520,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-3.01196749, 2.08350047]); expect(gd.layout.yaxis.range).toBeCloseToArray([-0.71100706, 1.38938271]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('on ew dragbox should update the xaxis range', function(done) { @@ -550,8 +543,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-3.01196749, 2.15613055]); expect(gd.layout.yaxis.range).toBeCloseToArray(autoRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('on w dragbox should update the xaxis range', function(done) { @@ -574,8 +566,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-2.93933740, 2.15613055]); expect(gd.layout.yaxis.range).toBeCloseToArray(autoRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('on e dragbox should update the xaxis range', function(done) { @@ -597,8 +588,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-3.01196749, 2.0835004]); expect(gd.layout.yaxis.range).toBeCloseToArray(autoRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('on ns dragbox should update the yaxis range', function(done) { @@ -622,8 +612,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(autoRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray(autoRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('on s dragbox should update the yaxis range', function(done) { @@ -647,8 +636,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(autoRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray([-0.7110070646, 1.3893827]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('on n dragbox should update the yaxis range', function(done) { @@ -672,8 +660,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(autoRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray([-0.991008630, 1.10938115]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -717,8 +704,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(autoRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray(autoRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('when set to \'reset+autorange\' (the default) should reset to set range on double click', function(done) { @@ -738,8 +724,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(setRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray(setRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('when set to \'reset+autorange\' (the default) should autosize on 1st double click and reset on 2nd', function(done) { @@ -759,8 +744,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(setRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray(setRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('when set to \'reset+autorange\' (the default) should autosize on 1st double click and zoom when immediately dragged', function(done) { @@ -782,8 +766,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-2.6480169249531356, -1.920115790911955]); expect(gd.layout.yaxis.range).toBeCloseToArray([0.4372261777201992, 1.2306899598686027]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('when set to \'reset+autorange\' (the default) should follow updated auto ranges', function(done) { @@ -819,8 +802,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(newAutoRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray(newAutoRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('when set to \'reset\' should work when \'autorange\' is on', function(done) { @@ -838,8 +820,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(autoRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray(autoRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('when set to \'reset\' should reset to set range on double click', function(done) { @@ -859,8 +840,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(setRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray(setRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('when set to \'reset\' should reset on all double clicks', function(done) { @@ -875,8 +855,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(setRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray(setRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('when set to \'autosize\' should work when \'autorange\' is on', function(done) { @@ -894,8 +873,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(autoRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray(autoRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('when set to \'autosize\' should set to autorange on double click', function(done) { @@ -915,8 +893,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(autoRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray(autoRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('when set to \'autosize\' should reset on all double clicks', function(done) { @@ -931,8 +908,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray(autoRangeX); expect(gd.layout.yaxis.range).toBeCloseToArray(autoRangeY); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not try to autorange fixedrange:true axes when rangeInitial is not set', function(done) { @@ -1022,8 +998,7 @@ describe('Test click interactions:', function() { y2Rng: [-1, 1] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1045,8 +1020,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-2.56671754, -1.644025966]); expect(gd.layout.yaxis.range).toBeCloseToArray([0.159513853, 1.2174655634]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1097,8 +1071,7 @@ describe('Test click interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-7.37937429, -2.21127624]); expect(gd.layout.yaxis.range).toBeCloseToArray([2.182846498, 4.563237844]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); @@ -1113,8 +1086,7 @@ describe('Test click interactions:', function() { expect(plot.attr('transform')).toBe('translate(250,280)scale(1,1)'); }) .then(fns.end) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1154,8 +1126,7 @@ describe('dragbox', function() { }); }) .then(fns.end) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/colorbar_test.js b/test/jasmine/tests/colorbar_test.js index d6895479632..1d43888d171 100644 --- a/test/jasmine/tests/colorbar_test.js +++ b/test/jasmine/tests/colorbar_test.js @@ -7,7 +7,7 @@ var subroutines = require('@src/plot_api/subroutines'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var negateIf = require('../assets/negate_if'); var supplyAllDefaults = require('../assets/supply_defaults'); var assertPlotSize = require('../assets/custom_assertions').assertPlotSize; @@ -92,8 +92,7 @@ describe('Test colorbar:', function() { [9607345622458650.0, 9607345622458652.0, 9607345622458650.0, 9607345622458652.0, 9607345622458650.0, 9607345622458654.0, 9607345622458654.0, 9607345622458638.0] ]; Plotly.newPlot(gd, [{type: 'heatmap', z: z}]) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function assertCB(msg, present, opts) { @@ -192,8 +191,7 @@ describe('Test colorbar:', function() { assertCB('changed size modes', true, {expandedMarginR: true, expandedMarginT: false, top: 150, height: 200}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); // scatter has trace.marker.{showscale, colorbar} @@ -224,8 +222,7 @@ describe('Test colorbar:', function() { .then(function() { assertCB('far right', true, {expandedMarginR: true}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can show and hide colorbars of shared color axes', function(done) { @@ -259,8 +256,7 @@ describe('Test colorbar:', function() { .then(function() { assertCB('far right', true, {expandedMarginR: true}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); // histogram colorbars could not be edited before @@ -293,8 +289,7 @@ describe('Test colorbar:', function() { .then(function() { assertCB('far right', true, {expandedMarginR: true}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('creates multiple fills for contour colorbars', function(done) { @@ -324,8 +319,7 @@ describe('Test colorbar:', function() { .then(function() { assertCB('up high', true, {expandedMarginR: true, expandedMarginT: true, top: 12, multiFill: false}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); // parcoords has trace.marker.{showscale, colorbar} @@ -389,8 +383,7 @@ describe('Test colorbar:', function() { assertParcoordsCB(true, true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function getCBNode() { @@ -413,8 +406,7 @@ describe('Test colorbar:', function() { expect(gd.data[0].colorbar.x).toBeWithin(0.591, 0.01); expect(gd.data[0].colorbar.y).toBeWithin(0.045, 0.01); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@flaky can drag marker-level colorbars in editable mode', function(done) { @@ -433,8 +425,7 @@ describe('Test colorbar:', function() { expect(gd.data[0].marker.colorbar.x).toBeWithin(0.591, 0.01); expect(gd.data[0].marker.colorbar.y).toBeWithin(0.045, 0.01); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@flaky can drag colorbars linked to color axes in editable mode', function(done) { @@ -455,8 +446,7 @@ describe('Test colorbar:', function() { expect(gd._fullLayout.coloraxis.colorbar.x).toBeWithin(0.591, 0.01); expect(gd._fullLayout.coloraxis.colorbar.y).toBeWithin(0.045, 0.01); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can edit colorbar visuals in optimized edit pathway', function(done) { @@ -521,8 +511,7 @@ describe('Test colorbar:', function() { return Plotly.react(gd, gd.data, gd.layout); }) .then(function() { _assert('after layout trace', {outline: [10, 10]}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('creates the same colorbars attributes in newPlot and react', function(done) { @@ -558,8 +547,7 @@ describe('Test colorbar:', function() { actualAttrs = getCBFillAttributes(); expect(actualAttrs).toEqual(expectedAttrs); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/colorscale_test.js b/test/jasmine/tests/colorscale_test.js index b227a65a417..13596c95475 100644 --- a/test/jasmine/tests/colorscale_test.js +++ b/test/jasmine/tests/colorscale_test.js @@ -10,7 +10,7 @@ var Scatter = require('@src/traces/scatter'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var supplyAllDefaults = require('../assets/supply_defaults'); function _supply(arg, layout) { @@ -855,8 +855,7 @@ describe('Test colorscale restyle calls:', function() { colorscaleIn: 'Greens' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to toggle between autocolorscale true/false and set colorscales (scatter marker case)', function(done) { @@ -932,8 +931,7 @@ describe('Test colorscale restyle calls:', function() { colorscaleIn: 'Greens' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to toggle between autocolorscale true/false and set colorscales (scatter marker line case)', function(done) { @@ -1017,8 +1015,7 @@ describe('Test colorscale restyle calls:', function() { colorscaleIn: 'Greens' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to toggle between autocolorscale true/false and set colorscales (coloraxis case)', function(done) { @@ -1097,8 +1094,7 @@ describe('Test colorscale restyle calls:', function() { colorscaleIn: 'Greens' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update coloraxis cmin/cmax on color value changes', function(done) { @@ -1133,8 +1129,7 @@ describe('Test colorscale restyle calls:', function() { .then(_assert('marker.color [-1,2,3]', -1, 3)) .then(function() { return Plotly.react(gd, fig([1, 2, 3])); }) .then(_assert('back again to marker.color [1,2,3]', 1, 3)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work with templates', function(done) { @@ -1172,8 +1167,7 @@ describe('Test colorscale restyle calls:', function() { mcc: ['rgb(68, 1, 84)', 'rgb(33, 145, 140)', 'rgb(253, 231, 37)'] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should work with scatter3d', function(done) { @@ -1201,7 +1195,6 @@ describe('Test colorscale restyle calls:', function() { expect(gd._fullData[0].line.cmin).toBe(2); expect(gd._fullData[0].line.cmax).toBe(4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/command_test.js b/test/jasmine/tests/command_test.js index 31211c62c94..5139a014706 100644 --- a/test/jasmine/tests/command_test.js +++ b/test/jasmine/tests/command_test.js @@ -35,8 +35,7 @@ describe('Plots.executeAPICommand', function() { expect(value).toEqual('resolution'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -56,15 +55,14 @@ describe('Plots.executeAPICommand', function() { expect(value).toEqual('rejection'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); describe('with the skip command', function() { it('resolves immediately', function(done) { Plots.executeAPICommand(gd, 'skip') - .catch(failTest).then(done); + .then(done, done.fail); }); }); }); @@ -546,8 +544,7 @@ describe('component bindings', function() { }).then(function() { expect(count).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('logs a warning if unable to create an observer', function() { @@ -570,8 +567,7 @@ describe('component bindings', function() { Plotly.restyle(gd, 'marker.color', 'blue').then(function() { expect(gd.layout.sliders[0].active).toBe(4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('does not update the component if the value is not present', function(done) { @@ -580,8 +576,7 @@ describe('component bindings', function() { Plotly.restyle(gd, 'marker.color', 'black').then(function() { expect(gd.layout.sliders[0].active).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('udpates bound components when the computed value changes', function(done) { @@ -593,8 +588,7 @@ describe('component bindings', function() { Plotly.restyle(gd, 'line.color', 'blue').then(function() { expect(gd.layout.sliders[0].active).toBe(4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -663,8 +657,7 @@ describe('attaching component bindings', function() { // been removed expect(gd._internalEv._events.plotly_animatingframe).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('attaches and updates bindings for updatemenus', function(done) { @@ -718,7 +711,6 @@ describe('attaching component bindings', function() { // been removed expect(gd._internalEv._events.plotly_animatingframe).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/cone_test.js b/test/jasmine/tests/cone_test.js index 7a2d5233839..ef9b8b30048 100644 --- a/test/jasmine/tests/cone_test.js +++ b/test/jasmine/tests/cone_test.js @@ -4,7 +4,7 @@ var Lib = require('@src/lib'); var supplyAllDefaults = require('../assets/supply_defaults'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var delay = require('../assets/delay'); var mouseEvent = require('../assets/mouse_event'); @@ -172,8 +172,7 @@ describe('Test cone autorange:', function() { var rng = [1.229, 10.771]; _assertAxisRanges('after spacing out the x/y/z coordinates', rng, rng, rng); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -205,8 +204,7 @@ describe('Test cone autorange:', function() { }).then(function() { expect(gd._fullLayout.scene._scene.glplot.objects[0].vectorScale).toBeCloseTo(0.2857, 4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -248,8 +246,7 @@ describe('Test cone interactions', function() { expect(scene).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should not pass zero or infinite `coneSize` to gl-cone3d', function(done) { @@ -283,8 +280,7 @@ describe('Test cone interactions', function() { expect(objs[1].coneScale).toBe(0.5, 'absolute case'); expect(objs[2].coneScale).toBe(0.5, 'absolute + 0-norm case'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should display hover labels', function(done) { @@ -359,8 +355,7 @@ describe('Test cone interactions', function() { nums: 'NORM : 3.00\nat 2,2,2' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should display hover labels (multi-trace case)', function(done) { @@ -401,7 +396,6 @@ describe('Test cone interactions', function() { name: 'blue cone' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/config_test.js b/test/jasmine/tests/config_test.js index 28819423c52..2931ead2435 100644 --- a/test/jasmine/tests/config_test.js +++ b/test/jasmine/tests/config_test.js @@ -96,8 +96,7 @@ describe('config argument', function() { return Plotly.react(gd, data, layout2, config); }) .then(afterResize) - .catch(failTest) - .then(done); + .then(done, done.fail); } it('should fill the frame when autosize: false, fillFrame: true, frameMargins: undefined', function(done) { @@ -178,8 +177,7 @@ describe('config argument', function() { .then(function() { checkLayoutSize(400, 300); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should respect attribute autosizable: false', function(done) { @@ -216,8 +214,7 @@ describe('config argument', function() { expect(gd._fullLayout.height).not.toBe(dfltHeight); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -238,8 +235,7 @@ describe('config argument', function() { expect(link).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display a link when true', function(done) { @@ -253,8 +249,7 @@ describe('config argument', function() { expect(bBox.width).toBeGreaterThan(0); expect(bBox.height).toBeGreaterThan(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -381,64 +376,55 @@ describe('config argument', function() { titleText: false }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should make titles editable', function(done) { initPlot('titleText') .then(checkIfEditable('gtitle', 'Click to enter Plot title')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should make x axes labels editable', function(done) { initPlot('axisTitleText') .then(checkIfEditable('g-xtitle', 'Click to enter X axis title')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should make y axes labels editable', function(done) { initPlot('axisTitleText') .then(checkIfEditable('g-ytitle', 'Click to enter Y axis title')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should make legend labels editable', function(done) { initPlot('legendText') .then(checkIfEditable('legendtext', 'trace 0')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should make annotation labels editable', function(done) { initPlot('annotationText') .then(checkIfEditable('annotation-text-g', 'testing')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should make annotation labels draggable', function(done) { initPlot('annotationTail') .then(checkIfDraggable('annotation-text-g')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should make annotation arrows draggable', function(done) { initPlot('annotationPosition') .then(checkIfDraggable('annotation-arrow-g')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should make legends draggable', function(done) { initPlot('legendPosition') .then(checkIfDraggable('legend')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -469,8 +455,7 @@ describe('config argument', function() { .then(function() { testDraggers(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not have drag rectangles when disabled', function(done) { @@ -478,8 +463,7 @@ describe('config argument', function() { .then(function() { testDraggers(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -509,8 +493,7 @@ describe('config argument', function() { expect(editBox).toBeDefined(); expect(editBox.getAttribute('contenteditable')).toBe('true'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('disallows axis range entry when disabled', function(done) { @@ -526,8 +509,7 @@ describe('config argument', function() { var editBox = document.getElementsByClassName('plugin-editable editable')[0]; expect(editBox).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -554,8 +536,7 @@ describe('config argument', function() { Plotly.Plots.sendDataToCloud(gd); expect(form).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to connect to Chart Studio Cloud when set to https://chart-studio.plotly.com', function(done) { @@ -569,8 +550,7 @@ describe('config argument', function() { expect(form.action).toBe('https://chart-studio.plotly.com/external'); expect(form.method).toBe('post'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can be set to other base urls', function(done) { @@ -582,8 +562,7 @@ describe('config argument', function() { expect(form.action).toContain('/dummy/external'); expect(form.method).toBe('post'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('has lesser priotiy then window env', function(done) { @@ -685,8 +664,7 @@ describe('config argument', function() { fillParent(1, 1); Plotly.plot(gd, data, {}, {responsive: true}) .then(testResponsive) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should still be responsive if the plot is edited', function(done) { @@ -694,8 +672,7 @@ describe('config argument', function() { Plotly.plot(gd, data, {}, {responsive: true}) .then(function() {return Plotly.restyle(gd, 'y[0]', data[0].y[0] + 2);}) .then(testResponsive) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should still be responsive if the plot is purged and replotted', function(done) { @@ -703,8 +680,7 @@ describe('config argument', function() { Plotly.plot(gd, data, {}, {responsive: true}) .then(function() {return Plotly.newPlot(gd, data, {}, {responsive: true});}) .then(testResponsive) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should only have one resize handler when plotted more than once', function(done) { @@ -722,8 +698,7 @@ describe('config argument', function() { expect(cntWindowResize).toBe(1); expect(Plotly.Plots.resize.calls.count()).toBe(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should become responsive if configured as such via Plotly.react', function(done) { @@ -731,8 +706,7 @@ describe('config argument', function() { Plotly.plot(gd, data, {}, {responsive: false}) .then(function() {return Plotly.react(gd, data, {}, {responsive: true});}) .then(testResponsive) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should stop being responsive if configured as such via Plotly.react', function(done) { @@ -748,8 +722,7 @@ describe('config argument', function() { .then(delay(RESIZE_DELAY)) // Check that final figure's size hasn't changed .then(function() {checkLayoutSize(width, height);}) - .catch(failTest) - .then(done); + .then(done, done.fail); }); // Testing fancier CSS layouts @@ -762,8 +735,7 @@ describe('config argument', function() { Plotly.plot(gd, data, {}, { responsive: true }) .then(testResponsive) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should resize vertically in a flexbox when responsive: true', function(done) { @@ -775,8 +747,7 @@ describe('config argument', function() { Plotly.plot(gd, data, {}, { responsive: true }) .then(testResponsive) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should resize in both direction in a grid when responsive: true', function(done) { @@ -789,8 +760,7 @@ describe('config argument', function() { Plotly.plot(gd, data, {}, { responsive: true }) .then(testResponsive) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should provide a fixed non-zero width/height when autosize/responsive: true and container\' size is zero', function(done) { @@ -815,8 +785,7 @@ describe('config argument', function() { expect(gd.clientWidth).toBe(700); expect(gd.clientHeight).toBe(450); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); // The following test is to guarantee we're not breaking the existing (although maybe not ideal) behaviour. @@ -834,8 +803,7 @@ describe('config argument', function() { // The plot should overflow the container! checkLayoutSize(1200, 700); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not resize if gd is hidden', function(done) { @@ -851,8 +819,7 @@ describe('config argument', function() { .then(function() { expect(Plotly.Plots.resize.calls.count()).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -874,8 +841,7 @@ describe('config argument', function() { expect(gd._context._scrollZoom).toEqual({gl3d: 1, geo: 1, mapbox: 1}); expect(gd._context._scrollZoom.cartesian).toBe(undefined, 'no cartesian!'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should fill in blank scrollZoom value', function(done) { @@ -884,8 +850,7 @@ describe('config argument', function() { expect(gd._context._scrollZoom).toEqual({gl3d: 1, geo: 1, mapbox: 1}); expect(gd._context._scrollZoom.cartesian).toBe(undefined, 'no cartesian!'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should honor scrollZoom:true', function(done) { @@ -893,8 +858,7 @@ describe('config argument', function() { expect(gd._context.scrollZoom).toBe(true); expect(gd._context._scrollZoom).toEqual({gl3d: 1, geo: 1, cartesian: 1, mapbox: 1}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should honor scrollZoom:false', function(done) { @@ -902,8 +866,7 @@ describe('config argument', function() { expect(gd._context.scrollZoom).toBe(false); expect(gd._context._scrollZoom).toEqual({}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should honor scrollZoom flaglist', function(done) { @@ -911,8 +874,7 @@ describe('config argument', function() { expect(gd._context.scrollZoom).toBe('mapbox+cartesian'); expect(gd._context._scrollZoom).toEqual({mapbox: 1, cartesian: 1}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -959,8 +921,7 @@ describe('config argument', function() { expect(yrng[0]).toBeGreaterThan(yrng0[0], 'scrolled y-range[0]'); expect(yrng[1]).toBeLessThan(yrng0[1], 'scrolled y-range[1]'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not disable scrollZoom when page is made scrollable by large graph', function(done) { @@ -995,8 +956,7 @@ describe('config argument', function() { expect(yrng[0]).toBeGreaterThan(yrng0[0], 'scrolled y-range[0]'); expect(yrng[1]).toBeLessThan(yrng0[1], 'scrolled y-range[1]'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/contour_test.js b/test/jasmine/tests/contour_test.js index a6bb6a3bc05..4c98713dd19 100644 --- a/test/jasmine/tests/contour_test.js +++ b/test/jasmine/tests/contour_test.js @@ -8,7 +8,7 @@ var Contour = require('@src/traces/contour'); var makeColorMap = require('@src/traces/contour/make_color_map'); var colorScales = require('@src/components/colorscale/scales').scales; -var failTest = require('../assets/fail_test'); + var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var customAssertions = require('../assets/custom_assertions'); @@ -467,8 +467,7 @@ describe('contour plotting and editing', function() { checkTicks('y', ['Jan 102016', 'Jan 24', 'Feb 7', 'Feb 21'], 'date y #2'); expect(gd._fullLayout.yaxis.type).toBe('date'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works and draws labels when explicitly specifying ncontours=1', function(done) { @@ -486,8 +485,7 @@ describe('contour plotting and editing', function() { .then(function() { expect(gd.querySelector('.contourlabels text').textContent).toBe('0.41'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should always draw heatmap coloring layer below contour lines', function(done) { @@ -515,8 +513,7 @@ describe('contour plotting and editing', function() { .then(function() { assertNodeOrder('.hm', '.contourlevel', 'back to heatmap coloring'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can change z values with gaps', function(done) { @@ -557,8 +554,7 @@ describe('contour plotting and editing', function() { expect(gd.calcdata[0][0].z).toEqual([[1, 2], [2, 4], [1, 2.5]]); expect(gd.calcdata[0][0].zmask).toEqual([[1, 1], [0, 1], [1, 0]]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('keeps the correct ordering after hide and show', function(done) { @@ -587,8 +583,7 @@ describe('contour plotting and editing', function() { .then(function() { expect(getIndices()).toEqual([0, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/contourgl_test.js b/test/jasmine/tests/contourgl_test.js index 4979a0029ee..5a7155994b3 100644 --- a/test/jasmine/tests/contourgl_test.js +++ b/test/jasmine/tests/contourgl_test.js @@ -15,7 +15,7 @@ var attributeList = Object.getOwnPropertyNames(schema.traces.heatmapgl.attribute // Test utilities var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var plotData = { 'data': [ @@ -170,8 +170,7 @@ var plotDataElliptical = function(maxJitter) { function makePlot(gd, mock, done) { return Plotly.plot(gd, mock.data, mock.layout) - .then(null, failTest) - .then(done); + .then(done, done.fail); } describe('contourgl plots', function() { @@ -251,8 +250,7 @@ describe('contourgl plots', function() { }).then(function() { expect(scene2d.xaxis.range).toEqual([1, -1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/densitymapbox_test.js b/test/jasmine/tests/densitymapbox_test.js index 3e0ef8576ae..08721a5681d 100644 --- a/test/jasmine/tests/densitymapbox_test.js +++ b/test/jasmine/tests/densitymapbox_test.js @@ -426,8 +426,7 @@ describe('Test densitymapbox interactions:', function() { .then(function() { _assert('after adding trace0', { layerCnt: 22 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to restyle *below*', function(done) { @@ -494,8 +493,7 @@ describe('Test densitymapbox interactions:', function() { 'place_label_other', 'place_label_city', 'country_label' ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, 5 * jasmine.DEFAULT_TIMEOUT_INTERVAL); it('@gl should be able to restyle from and to *scattermapbox*', function(done) { @@ -520,7 +518,6 @@ describe('Test densitymapbox interactions:', function() { .then(function() { _assert('after restyle to scattermapbox', 'scattermapbox'); }) .then(function() { return Plotly.restyle(gd, 'type', 'densitymapbox'); }) .then(function() { _assert('back to densitymapbox', 'densitymapbox'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, 5 * jasmine.DEFAULT_TIMEOUT_INTERVAL); }); diff --git a/test/jasmine/tests/domain_ref_interact_test.js b/test/jasmine/tests/domain_ref_interact_test.js index 6d79887ca2d..7db72882e21 100644 --- a/test/jasmine/tests/domain_ref_interact_test.js +++ b/test/jasmine/tests/domain_ref_interact_test.js @@ -1,5 +1,5 @@ 'use strict'; -var failTest = require('../assets/fail_test'); + var domainRefComponents = require('../assets/domain_ref/components'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); @@ -153,8 +153,7 @@ describe('Shapes referencing domain', function() { testObjectMove(color, x, y, type); }) .then(delay(DELAY_TIME)) - .catch(failTest) - .then(done); + .then(done, done.fail); }; } function testAnnotationMoveLabelItFun(color, x, y) { @@ -163,8 +162,7 @@ describe('Shapes referencing domain', function() { .then(delay(DELAY_TIME)) .then(testAnnotationMoveLabel(color, x, y)) .then(delay(DELAY_TIME)) - .catch(failTest) - .then(done); + .then(done, done.fail); }; } function testAnnotationMoveWholeItFun(color, arrowColor, x, y, corner) { @@ -173,8 +171,7 @@ describe('Shapes referencing domain', function() { .then(delay(DELAY_TIME)) .then(testAnnotationMoveWhole(color, arrowColor, x, y, corner)) .then(delay(DELAY_TIME)) - .catch(failTest) - .then(done); + .then(done, done.fail); }; } it('should move box on linear x axis and log y to the proper position', diff --git a/test/jasmine/tests/domain_ref_test.js b/test/jasmine/tests/domain_ref_test.js index 79ab84b101e..fbc75b649bb 100644 --- a/test/jasmine/tests/domain_ref_test.js +++ b/test/jasmine/tests/domain_ref_test.js @@ -1,5 +1,5 @@ 'use strict'; -var failTest = require('../assets/fail_test'); + var domainRefComponents = require('../assets/domain_ref/components'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); @@ -30,8 +30,7 @@ function makeTests(component, filter) { tests[i](function(v) { expect(v).toBe(true); }, gd) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }; diff --git a/test/jasmine/tests/download_test.js b/test/jasmine/tests/download_test.js index 2c483c9e5f0..59318a92289 100644 --- a/test/jasmine/tests/download_test.js +++ b/test/jasmine/tests/download_test.js @@ -6,7 +6,7 @@ var getImageSize = require('@src/traces/image/helpers').getImageSize; var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var textchartMock = require('@mocks/text_chart_arrays.json'); var LONG_TIMEOUT_INTERVAL = 2 * jasmine.DEFAULT_TIMEOUT_INTERVAL; @@ -43,28 +43,24 @@ describe('Plotly.downloadImage', function() { it('should create link, remove link, accept options', function(done) { downloadTest(gd, 'jpeg') - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('should create link, remove link, accept options', function(done) { downloadTest(gd, 'png') - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('should create link, remove link, accept options', function(done) { downloadTest(gd, 'full-json') - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('should create link, remove link, accept options', function(done) { checkWebp(function(supported) { if(supported) { downloadTest(gd, 'webp') - .catch(failTest) - .then(done); + .then(done, done.fail); } else { done(); } @@ -73,14 +69,12 @@ describe('Plotly.downloadImage', function() { it('should create link, remove link, accept options', function(done) { downloadTest(gd, 'svg') - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('should work when passing graph div id', function(done) { downloadTest('graph', 'svg') - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('should work when passing a figure object', function(done) { @@ -93,8 +87,7 @@ describe('Plotly.downloadImage', function() { expect(gd._snapshotInProgress) .toBe(undefined, 'should not attach _snapshotInProgress to figure objects'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('should produce the right SVG output in IE', function(done) { @@ -142,8 +135,7 @@ describe('Plotly.downloadImage', function() { reader.readAsText(savedBlob); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('should produce right output in Safari', function(done) { @@ -162,8 +154,7 @@ describe('Plotly.downloadImage', function() { expect(args[2][0].slice(0, 8)).toBe(';base64,', 'format:jpeg'); expect(args[3][0].slice(0, 8)).toBe(';base64,', 'format:webp'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should default width & height for downloadImage to match with the live graph', function(done) { @@ -189,8 +180,7 @@ describe('Plotly.downloadImage', function() { expect(size.width).toBe(500, 'div width'); expect(size.height).toBe(300, 'div height'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/draw_newshape_test.js b/test/jasmine/tests/draw_newshape_test.js index 669dadef237..a7ad41620c7 100644 --- a/test/jasmine/tests/draw_newshape_test.js +++ b/test/jasmine/tests/draw_newshape_test.js @@ -5,7 +5,7 @@ var Lib = require('@src/lib'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var selectButton = require('../assets/modebar_button'); var mouseEvent = require('../assets/mouse_event'); var touchEvent = require('../assets/touch_event'); @@ -939,8 +939,7 @@ describe('Draw new shapes to layout', function() { }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1220,8 +1219,7 @@ describe('Activate and edit editable shapes', function() { expect(id).toEqual(undefined, 'deactivate shape by clicking inside'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('circle using ' + device, function(done) { @@ -1277,8 +1275,7 @@ describe('Activate and edit editable shapes', function() { }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('closed-path using ' + device, function(done) { @@ -1322,8 +1319,7 @@ describe('Activate and edit editable shapes', function() { assertPos(obj.path, 'M250,25L225,75L275,75Z'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('bezier curves using ' + device, function(done) { @@ -1367,8 +1363,7 @@ describe('Activate and edit editable shapes', function() { assertPos(obj.path, 'M0,100.00237388724034L0,199.99762611275966L50.00310077519379,199.99762611275966L0,300Q100,300,100,199.9976261127597T150.0031007751938,199.99762611275966C100,300,200,300,200,199.99762611275966S150.0031007751938,199.99762611275966,150.0031007751938,100.00237388724034Z'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('multi-cell path using ' + device, function(done) { @@ -1421,8 +1416,7 @@ describe('Activate and edit editable shapes', function() { expect(gd._fullLayout._activeShapeIndex).toEqual(undefined, 'clear active shape index'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1524,8 +1518,7 @@ describe('Activate and edit editable shapes', function() { expect(el.style['stroke-width']).toBe('3px'); // custom pixel }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should provide invisible border & set pointer-events (depending on fill transparency) for editable shapes i.e. to allow shape activation', function(done) { @@ -1615,8 +1608,7 @@ describe('Activate and edit editable shapes', function() { expect(el.style['stroke-width']).toBe('3px'); // custom pixel }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not provide invisible border & set pointer-events to "stroke" for shapes made editable via config', function(done) { @@ -1655,7 +1647,6 @@ describe('Activate and edit editable shapes', function() { expect(el.style['stroke-width']).toBe('0px'); // no extra pixels }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/drawing_test.js b/test/jasmine/tests/drawing_test.js index 113c8862c0c..ef66916e75a 100644 --- a/test/jasmine/tests/drawing_test.js +++ b/test/jasmine/tests/drawing_test.js @@ -4,7 +4,7 @@ var Drawing = require('@src/components/drawing'); var svgTextUtils = require('@src/lib/svg_text_utils'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + describe('Drawing', function() { 'use strict'; @@ -416,8 +416,7 @@ describe('Drawing', function() { bottom: 4 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works with dummy nodes created in Drawing.tester', function() { @@ -540,8 +539,7 @@ describe('gradients', function() { // full replot and no resulting markers at all -> no gradients checkGradientIds([], [], [], []); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should append window URL to gradient ref if is present', function(done) { @@ -567,10 +565,9 @@ describe('gradients', function() { '")' ].join('')); }) - .catch(failTest) .then(function() { base.remove(); done(); - }); + }, done.fail); }); }); diff --git a/test/jasmine/tests/errorbars_test.js b/test/jasmine/tests/errorbars_test.js index 9ef256b9727..a26bbc7a40b 100644 --- a/test/jasmine/tests/errorbars_test.js +++ b/test/jasmine/tests/errorbars_test.js @@ -3,7 +3,6 @@ var Plotly = require('@lib/index'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); describe('errorbar plotting', function() { @@ -61,8 +60,7 @@ describe('errorbar plotting', function() { .then(function() { check([-0.6667, 2.6667], [-0.2629, 4.9949], 3, 3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows half errorbars and removes individual bars that disappear', function(done) { @@ -97,7 +95,6 @@ describe('errorbar plotting', function() { {xs: 10, xh: 18} ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/finance_test.js b/test/jasmine/tests/finance_test.js index 13d862a5951..9c5ff6617d2 100644 --- a/test/jasmine/tests/finance_test.js +++ b/test/jasmine/tests/finance_test.js @@ -8,7 +8,7 @@ var destroyGraphDiv = require('../assets/destroy_graph_div'); var supplyAllDefaults = require('../assets/supply_defaults'); var hover = require('../assets/hover'); var assertHoverLabelContent = require('../assets/custom_assertions').assertHoverLabelContent; -var failTest = require('../assets/fail_test'); + var mock0 = { open: [33.01, 33.31, 33.50, 32.06, 34.12, 33.05, 33.31, 33.50], @@ -667,8 +667,7 @@ describe('finance charts auto-range', function() { Plotly.plot(gd, [trace]).then(function() { expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.5, 2.5], 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- candlestick case', function(done) { @@ -677,8 +676,7 @@ describe('finance charts auto-range', function() { Plotly.plot(gd, [trace]).then(function() { expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.5, 2.5], 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -742,8 +740,7 @@ describe('finance charts updates:', function() { .then(function() { expect(d3.select('path.box').attr('d')).not.toEqual(path0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to toggle visibility', function(done) { @@ -792,8 +789,7 @@ describe('finance charts updates:', function() { expect(countOHLCTraces()).toEqual(1); expect(countBoxTraces()).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.relayout should work', function(done) { @@ -807,8 +803,7 @@ describe('finance charts updates:', function() { .then(function() { expect(countRangeSliders()).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.extendTraces should work', function(done) { @@ -843,8 +838,7 @@ describe('finance charts updates:', function() { expect(gd.calcdata[0].length).toEqual(10); expect(gd.calcdata[1].length).toEqual(10); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.deleteTraces / addTraces should work', function(done) { @@ -885,8 +879,7 @@ describe('finance charts updates:', function() { expect(countOHLCTraces()).toEqual(1); expect(countBoxTraces()).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.addTraces + Plotly.relayout should update candlestick box position values', function(done) { @@ -930,8 +923,7 @@ describe('finance charts updates:', function() { .then(function() { assertBoxPosFields([-30240000, 30240000]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.plot with data-less trace and adding with Plotly.restyle', function(done) { @@ -970,8 +962,7 @@ describe('finance charts updates:', function() { expect(countBoxTraces()).toEqual(1); expect(countRangeSliders()).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to update ohlc tickwidth', function(done) { @@ -1022,8 +1013,7 @@ describe('finance charts updates:', function() { pathd: 'M0,134.55H0M0,81V193.5M0,85.5H0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work with typed array', function(done) { @@ -1054,8 +1044,7 @@ describe('finance charts updates:', function() { expect(countOHLCTraces()).toBe(1, '# of ohlc traces'); expect(countBoxTraces()).toBe(1, '# of candlestick traces'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1116,8 +1105,7 @@ describe('finance charts *special* handlers:', function() { editText(1, '1'); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1251,7 +1239,7 @@ describe('finance trace hover:', function() { }] .forEach(function(specs) { it('should generate correct hover labels ' + type + ' - ' + specs.desc, function(done) { - run(specs).catch(failTest).then(done); + run(specs).then(done, done.fail); }); }); }); @@ -1313,8 +1301,7 @@ describe('finance trace hover via Fx.hover():', function() { name: '' }, 'after removing 2nd trace'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should ignore empty ' + type + ' item', function(done) { @@ -1352,8 +1339,7 @@ describe('finance trace hover via Fx.hover():', function() { name: 'trace 1' }, 'hover over 3rd items'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/frame_api_test.js b/test/jasmine/tests/frame_api_test.js index 9f69bd97cc8..62bc2e8850e 100644 --- a/test/jasmine/tests/frame_api_test.js +++ b/test/jasmine/tests/frame_api_test.js @@ -3,7 +3,7 @@ var Lib = require('@src/lib'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + describe('Test frame api', function() { 'use strict'; @@ -72,16 +72,14 @@ describe('Test frame api', function() { // Five (`var numericNameWarningCountLimit = 5`) warnings and one warning saying that there won't be more warnings expect(Lib.warn.calls.count()).toEqual(5 + 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('treats an undefined list as a noop', function(done) { Plotly.addFrames(gd, undefined).then(function() { expect(Object.keys(h)).toEqual([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('compresses garbage when adding frames', function(done) { @@ -89,48 +87,42 @@ describe('Test frame api', function() { expect(Object.keys(h)).toEqual(['test']); expect(f).toEqual([{name: 'test'}]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('treats a null list as a noop', function(done) { Plotly.addFrames(gd, null).then(function() { expect(Object.keys(h)).toEqual([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('treats an empty list as a noop', function(done) { Plotly.addFrames(gd, []).then(function() { expect(Object.keys(h)).toEqual([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('names an unnamed frame', function(done) { Plotly.addFrames(gd, [{}]).then(function() { expect(Object.keys(h)).toEqual(['frame 0']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('casts names to strings', function(done) { Plotly.addFrames(gd, [{name: 5}]).then(function() { expect(Object.keys(h)).toEqual(['5']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('creates multiple unnamed frames at the same time', function(done) { Plotly.addFrames(gd, [{}, {}]).then(function() { expect(f).toEqual([{name: 'frame 0'}, {name: 'frame 1'}]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('creates multiple unnamed frames in series', function(done) { @@ -139,16 +131,14 @@ describe('Test frame api', function() { }).then(function() { expect(f).toEqual([{name: 'frame 0'}, {name: 'frame 1'}]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('casts number names to strings on insertion', function(done) { Plotly.addFrames(gd, [{name: 2}]).then(function() { expect(f).toEqual([{name: '2'}]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates frames referenced by number', function(done) { @@ -157,8 +147,7 @@ describe('Test frame api', function() { }).then(function() { expect(f).toEqual([{name: '2', layout: {foo: 'bar'}}]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('avoids name collisions', function(done) { @@ -169,8 +158,7 @@ describe('Test frame api', function() { }).then(function() { expect(f).toEqual([{name: 'frame 0'}, {name: 'frame 2'}, {name: 'frame 1'}, {name: 'foobar'}, {name: 'frame 3'}]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('inserts frames at specific indices', function(done) { @@ -196,8 +184,7 @@ describe('Test frame api', function() { return Plotly.Queue.undo(gd); }) .then(validate) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('inserts frames at specific indices (reversed)', function(done) { @@ -223,8 +210,7 @@ describe('Test frame api', function() { return Plotly.Queue.undo(gd); }) .then(validate) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('implements undo/redo', function(done) { @@ -242,8 +228,7 @@ describe('Test frame api', function() { return Plotly.Queue.redo(gd); }) .then(validate) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('overwrites frames', function(done) { @@ -267,8 +252,7 @@ describe('Test frame api', function() { expect(f).toEqual([{name: 'test1'}, {name: 'test2'}, {name: 'test3'}]); expect(Object.keys(h)).toEqual(['test1', 'test2', 'test3']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -292,8 +276,7 @@ describe('Test frame api', function() { expect(f).toEqual([]); expect(Object.keys(h)).toEqual([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('deletes multiple frames', function(done) { @@ -323,8 +306,7 @@ describe('Test frame api', function() { return Plotly.Queue.redo(gd); }) .then(validate) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('deletes all frames if frameList is falsey', function(done) { @@ -358,8 +340,7 @@ describe('Test frame api', function() { return Plotly.deleteFrames(gd, undefined); }) .then(validateCount(0)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('deleteFrames is a no-op with empty array', function(done) { @@ -381,8 +362,7 @@ describe('Test frame api', function() { return Plotly.deleteFrames(gd, []); }) .then(validateCount(n)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/funnel_test.js b/test/jasmine/tests/funnel_test.js index b69b1d2bb4e..2784ca98c3f 100644 --- a/test/jasmine/tests/funnel_test.js +++ b/test/jasmine/tests/funnel_test.js @@ -9,7 +9,7 @@ var Axes = require('@src/plots/cartesian/axes'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var supplyAllDefaults = require('../assets/supply_defaults'); var color = require('@src/components/color'); var rgb = color.rgb; @@ -662,8 +662,7 @@ describe('A funnel plot', function() { expect(foundTextNodes).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show funnel texts (outside case)', function(done) { @@ -693,8 +692,7 @@ describe('A funnel plot', function() { expect(foundTextNodes).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show texts (horizontal case)', function(done) { @@ -724,8 +722,7 @@ describe('A funnel plot', function() { expect(foundTextNodes).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); var insideTextTestsTrace = { @@ -752,8 +749,7 @@ describe('A funnel plot', function() { Plotly.plot(gd, [trace]) .then(assertTextFontColors([DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use defined textfont.color for inside text instead of the contrasting default', function(done) { @@ -761,8 +757,7 @@ describe('A funnel plot', function() { Plotly.plot(gd, [data]) .then(assertTextFontColors(Lib.repeat('#09f', 6))) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle', function(done) { @@ -956,8 +951,7 @@ describe('A funnel plot', function() { assertTextIsInsidePath(text20, path20); // inside assertTextIsInsidePath(text30, path30); // inside }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to add/remove connector line nodes on restyle', function(done) { @@ -999,8 +993,7 @@ describe('A funnel plot', function() { .then(function() { _assertNumberOfFunnelConnectorNodes(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to add/remove connector region nodes on restyle', function(done) { @@ -1030,8 +1023,7 @@ describe('A funnel plot', function() { .then(function() { _assertNumberOfFunnelConnectorNodes(4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('handle BADNUM positions', function(done) { @@ -1078,8 +1070,7 @@ describe('A funnel plot', function() { .then(function() { return checkTransition(gd, mockCopy, animateOpts, transitionOpts, connectorTests); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to deal with transform that empty out the data coordinate arrays', function(done) { @@ -1108,8 +1099,7 @@ describe('A funnel plot', function() { expect(gd.calcdata[0][0].y).toEqual(NaN); expect(gd.calcdata[0][0].isBlank).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should coerce text-related attributes', function(done) { @@ -1193,8 +1183,7 @@ describe('A funnel plot', function() { assertTextFont(textNodes[1], expected.outsidetextfont, 1); assertTextFont(textNodes[2], expected.insidetextfont, 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to add/remove text node on restyle', function(done) { @@ -1248,8 +1237,7 @@ describe('A funnel plot', function() { .then(function() { _assertNumberOfFunnelTextNodes(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to react with new text colors', function(done) { @@ -1281,8 +1269,7 @@ describe('A funnel plot', function() { return Plotly.react(gd, gd.data); }) .then(assertTextFontColors(['rgb(255, 0, 0)', 'rgb(255, 0, 0)', 'rgb(255, 0, 0)'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); checkTextTemplate([{ @@ -1348,8 +1335,7 @@ describe('funnel hover', function() { var mock = Lib.extendDeep({}, require('@mocks/funnel_11.json')); Plotly.plot(gd, mock.data, mock.layout) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should return the correct hover point data (case x)', function() { @@ -1397,8 +1383,7 @@ describe('funnel hover', function() { var out = _hover(gd, -0.25, 0.25, 'closest'); expect(out.text).toEqual('apple', 'hover text'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should turn off percentages with hoveinfo none or skip', function(done) { @@ -1425,8 +1410,7 @@ describe('funnel hover', function() { .then(function() { expect(d3.selectAll('g.hovertext').size()).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should turn on percentages with hoveinfo all', function(done) { @@ -1457,8 +1441,7 @@ describe('funnel hover', function() { axis: '0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use hovertemplate if specified', function(done) { @@ -1489,8 +1472,7 @@ describe('funnel hover', function() { axis: '0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('display percentage from the initial value', function() { @@ -1524,8 +1506,7 @@ describe('funnel hover', function() { axis: 'E' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1574,8 +1555,7 @@ describe('funnel hover', function() { expect(out).toBe(false, hoverSpec); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('positions labels correctly w.r.t. narrow funnels', function(done) { @@ -1605,8 +1585,7 @@ describe('funnel hover', function() { out = _hover(gd, 10, 2, 'closest'); assertPos(out.pos, [145, 155, 15, 15]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1782,7 +1761,6 @@ describe('funnel uniformtext', function() { fontsizes: [12, 12, 12, 12, 12, 12, 12], scales: [0.44, 1, 1, 1, 1, 1, 1], })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/funnelarea_test.js b/test/jasmine/tests/funnelarea_test.js index 99863d4ac81..7a382689e0b 100644 --- a/test/jasmine/tests/funnelarea_test.js +++ b/test/jasmine/tests/funnelarea_test.js @@ -4,7 +4,7 @@ var Lib = require('@src/lib'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var click = require('../assets/click'); var getClientPosition = require('../assets/get_client_position'); var mouseEvent = require('../assets/mouse_event'); @@ -184,8 +184,7 @@ describe('Funnelarea traces', function() { legendEntries.each(checkPath); expect(legendEntries.size()).toBe(5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can sum values or count labels', function(done) { @@ -211,8 +210,7 @@ describe('Funnelarea traces', function() { } } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function _checkSliceColors(colors) { @@ -260,8 +258,7 @@ describe('Funnelarea traces', function() { return Plotly.newPlot(gd, data2); }) .then(_checkSliceColors(['255,0,0', '0,0,0', '255,0,0', '0,0,0'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can use a separate funnelarea colorway and disable extended colors', function(done) { @@ -279,8 +276,7 @@ describe('Funnelarea traces', function() { return Plotly.relayout(gd, {extendfunnelareacolors: null}); }) .then(_checkSliceColors(['255,255,0', '0,255,0', '0,0,255', '255,255,102', '102,255,102', '102,102,255', '153,153,0'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function _verifyTitle(checkLeft, checkRight, checkTop, checkBottom, checkMiddleX) { @@ -312,8 +308,7 @@ describe('Funnelarea traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(false, false, true, false, true)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows title top center', function(done) { @@ -328,8 +323,7 @@ describe('Funnelarea traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(false, false, true, false, true)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows title top left', function(done) { @@ -344,8 +338,7 @@ describe('Funnelarea traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(true, false, true, false, false)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows title top right', function(done) { @@ -360,8 +353,7 @@ describe('Funnelarea traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(false, true, true, false, false)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('correctly positions large title', function(done) { @@ -376,8 +368,7 @@ describe('Funnelarea traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(false, false, true, false, true)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('support separate stroke width values per slice', function(done) { @@ -409,8 +400,7 @@ describe('Funnelarea traces', function() { expect(this.style.strokeWidth).toBe(expWidths[d[0].i], 'item #' + i); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); [ @@ -435,8 +425,7 @@ describe('Funnelarea traces', function() { .then(_checkFontColors(['red', 'green', 'blue'])) .then(_checkFontFamilies(['Arial', 'Gravitas', 'Roboto'])) .then(_checkFontSizes([12, 20, 16])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -451,8 +440,7 @@ describe('Funnelarea traces', function() { it('should use inside text colors contrasting to explicitly set slice colors by default', function(done) { Plotly.plot(gd, [insideTextTestsTrace]) .then(_checkFontColors([DARK, DARK, LIGHT, LIGHT, DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use inside text colors contrasting to standard slice colors by default', function(done) { @@ -461,39 +449,34 @@ describe('Funnelarea traces', function() { Plotly.plot(gd, [noMarkerTrace]) .then(_checkFontColors([LIGHT, DARK, LIGHT, LIGHT, LIGHT, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use textfont.color for inside text instead of the contrasting default', function(done) { var data = Lib.extendFlat({}, insideTextTestsTrace, {textfont: {color: 'red'}}); Plotly.plot(gd, [data]) .then(_checkFontColors(Lib.repeat('red', 6))) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use matching color from textfont.color array for inside text, contrasting otherwise', function(done) { var data = Lib.extendFlat({}, insideTextTestsTrace, {textfont: {color: ['red', 'blue']}}); Plotly.plot(gd, [data]) .then(_checkFontColors(['red', 'blue', LIGHT, LIGHT, DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not use layout.font.color for inside text, but a contrasting color instead', function(done) { Plotly.plot(gd, [insideTextTestsTrace], {font: {color: 'green'}}) .then(_checkFontColors([DARK, DARK, LIGHT, LIGHT, DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use matching color from insidetextfont.color array instead of the contrasting default', function(done) { var data = Lib.extendFlat({}, insideTextTestsTrace, {textfont: {color: ['orange', 'purple']}}); Plotly.plot(gd, [data]) .then(_checkFontColors(['orange', 'purple', LIGHT, LIGHT, DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); [ @@ -511,8 +494,7 @@ describe('Funnelarea traces', function() { .then(_checkFontColors(['blue', 'yellow', 'orange', 'orange', 'orange', 'orange'])) .then(_checkFontFamilies(['Arial', 'Arial', 'Gravitas', 'Gravitas', 'Gravitas', 'Gravitas'])) .then(_checkFontSizes([24, 34, 12, 12, 12, 12])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -532,8 +514,7 @@ describe('Funnelarea traces', function() { .then(_checkFontColors(['purple', 'blue', LIGHT, LIGHT, DARK, LIGHT])) .then(_checkFontFamilies(['Roboto', 'Arial', 'serif', 'serif', 'serif', 'serif'])) .then(_checkFontSizes([24, 18, 16, 16, 16, 16])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); [ @@ -551,8 +532,7 @@ describe('Funnelarea traces', function() { .then(_checkFontColors(['blue', 'yellow', LIGHT, LIGHT, DARK, LIGHT])) .then(_checkFontFamilies(['Arial', 'Arial', 'serif', 'serif', 'serif', 'serif'])) .then(_checkFontSizes([24, 34, 16, 16, 16, 16])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -576,8 +556,7 @@ describe('Funnelarea traces', function() { _assertTitle('base', 'yo', 'rgb(0, 0, 255)'); _verifyTitle(true, false, true, false, false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle title', function(done) { @@ -604,8 +583,7 @@ describe('Funnelarea traces', function() { _assertTitle('base', 'oy', 'rgb(255, 0, 0)'); _verifyTitle(false, true, true, false, false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle title despite using the deprecated attributes', function(done) { @@ -630,8 +608,7 @@ describe('Funnelarea traces', function() { _assertTitle('base', 'oy', 'rgb(255, 0, 0)'); _verifyTitle(false, true, true, false, false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to react with new text colors', function(done) { @@ -658,8 +635,7 @@ describe('Funnelarea traces', function() { return Plotly.react(gd, gd.data); }) .then(_checkFontColors(['rgb(0, 0, 255)', 'rgb(0, 0, 255)', 'rgb(0, 0, 255)'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to toggle visibility', function(done) { @@ -678,8 +654,7 @@ describe('Funnelarea traces', function() { .then(_assert('both visible:false', 0)) .then(function() { return Plotly.restyle(gd, 'visible', true); }) .then(_assert('back to visible:true', 4)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); checkTextTemplate([{ @@ -946,8 +921,7 @@ describe('funnelarea hovering', function() { 'garbage hoverinfo' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show the correct separators for values', function(done) { @@ -960,8 +934,7 @@ describe('funnelarea hovering', function() { .then(function() { assertLabel('0\n12|345|678@91\n99@9%'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show falsy zero text', function(done) { @@ -982,8 +955,7 @@ describe('funnelarea hovering', function() { .then(function() { assertLabel('D\n0\n4\n14.3%'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use hovertemplate if specified', function(done) { @@ -1049,8 +1021,7 @@ describe('funnelarea hovering', function() { 'hovertemplate arrayOK' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should honor *hoverlabel.namelength*', function(done) { @@ -1067,8 +1038,7 @@ describe('funnelarea hovering', function() { .then(function() { assertHoverLabelContent({nums: '0\n5\n33.3%', name: 'lo'}, 'base'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1169,8 +1139,7 @@ describe('Test event data of interactions on a funnelarea plot:', function() { expect(futureData.points[0].i).toBeUndefined(); expect(futureData.points[0].pointNumbers).toEqual([0, 5]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1252,8 +1221,7 @@ describe('Test event data of interactions on a funnelarea plot:', function() { mouseEvent('mouseover', pointPos[0], pointPos[1]); expect(futureData).toBe(null); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1323,8 +1291,7 @@ describe('funnelarea relayout', function() { var slices = d3.selectAll(SLICES_SELECTOR); slices.each(checkRelayoutColor); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1405,8 +1372,7 @@ describe('Test funnelarea interactions edge cases:', function() { hoverLabel: 1 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1480,8 +1446,7 @@ describe('Test funnelarea calculated areas', function() { Plotly.plot(gd, data) .then(_checkCalculatedAreaRatios([0.4, 0.3, 0.2, 0.1])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1580,8 +1545,7 @@ describe('Test funnelarea calculated areas with scalegroup', function() { Plotly.plot(gd, data) .then(_checkCalculatedAreaRatios([0.4, 0.3, 0.2, 0.1])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1773,8 +1737,7 @@ describe('Test funnelarea calculated areas with scalegroup on various domain rat Plotly.plot(gd, data) .then(_checkCalculatedAreaRatios([0.4, 0.3, 0.2, 0.1])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1903,7 +1866,6 @@ describe('funnelarea uniformtext', function() { fontsizes: [12, 12, 12, 12, 12, 12, 12, 12], scales: [1, 1, 1, 1, 1, 1, 1, 0.69], })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/fx_test.js b/test/jasmine/tests/fx_test.js index c7b3d4d09d1..63e468ca176 100644 --- a/test/jasmine/tests/fx_test.js +++ b/test/jasmine/tests/fx_test.js @@ -4,7 +4,7 @@ var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var supplyAllDefaults = require('../assets/supply_defaults'); -var failTest = require('../assets/fail_test'); + describe('Fx defaults', function() { 'use strict'; @@ -269,6 +269,6 @@ describe('relayout', function() { return Plotly.relayout(gd, 'xaxis.fixedrange', false); }).then(function() { assertMainDrag('ew-resize', true); - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); diff --git a/test/jasmine/tests/geo_test.js b/test/jasmine/tests/geo_test.js index 2a0fdcc8dcb..6d2a670df0b 100644 --- a/test/jasmine/tests/geo_test.js +++ b/test/jasmine/tests/geo_test.js @@ -10,7 +10,7 @@ var topojsonUtils = require('@src/lib/topojson_utils'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var negateIf = require('../assets/negate_if'); var getClientPosition = require('../assets/get_client_position'); var mouseEvent = require('../assets/mouse_event'); @@ -1065,8 +1065,7 @@ describe('Test geo interactions', function() { expect(countTraces('scattergeo')).toBe(1); expect(countTraces('choropleth')).toBe(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should toggle choropleth elements', function(done) { @@ -1082,8 +1081,7 @@ describe('Test geo interactions', function() { expect(countTraces('scattergeo')).toBe(1); expect(countTraces('choropleth')).toBe(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1114,8 +1112,7 @@ describe('Test geo interactions', function() { expect(countGeos()).toBe(0); expect(countColorBars()).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1308,8 +1305,7 @@ describe('Test geo interactions', function() { expect(countChoroplethPaths()).toBe(N_LOCATIONS_AT_START - 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to update line/marker/text nodes and choropleth paths', function(done) { @@ -1335,8 +1331,7 @@ describe('Test geo interactions', function() { expect(countChoroplethPaths()).toBe(locationsQueue.length); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1351,8 +1346,7 @@ describe('Test geo interactions', function() { mouseEvent('mousemove', 350, 250); expect(d3.selectAll('g.hovertext').size()).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should clear hover label when cursor slips off subplot', function(done) { @@ -1392,8 +1386,7 @@ describe('Test geo interactions', function() { }, 100); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not confuse positions on either side of the globe', function(done) { @@ -1421,8 +1414,7 @@ describe('Test geo interactions', function() { check([px, 163], 0); check([px, 360], 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should plot to scope defaults when user setting lead to NaN map bounds', function(done) { @@ -1482,8 +1474,7 @@ describe('Test geo interactions', function() { 'Invalid geo settings, relayout\'ing to default view.' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should get hover right for choropleths involving landmasses that cross antimeridian', function(done) { @@ -1533,8 +1524,7 @@ describe('Test geo interactions', function() { .then(function() { check([-150, -89], 1, 'spot in Antarctica that requires *stitching*'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should reset viewInitial when updating *scope*', function(done) { @@ -1617,8 +1607,7 @@ describe('Test geo interactions', function() { 'projection.rotation.lon': 0 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it([ @@ -1705,8 +1694,7 @@ describe('Test geo interactions', function() { expect(gd._fullLayout.geo.lonaxis.showgrid).toBe(false); expect(gd._fullLayout.geo.lataxis.showgrid).toBe(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('should not make request for topojson when not needed', function() { @@ -1733,8 +1721,7 @@ describe('Test geo interactions', function() { .then(_assert(0)) .then(function() { return Plotly.relayout(gd, 'geo.showcoastlines', true); }) .then(_assert(1)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- no base layers + choropleth', function(done) { @@ -1746,8 +1733,7 @@ describe('Test geo interactions', function() { geo: {showcoastlines: false} }) .then(_assert(1)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- no base layers + location scattergeo', function(done) { @@ -1758,8 +1744,7 @@ describe('Test geo interactions', function() { geo: {showcoastlines: false} }) .then(_assert(1)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- geo.visible:false', function(done) { @@ -1773,8 +1758,7 @@ describe('Test geo interactions', function() { .then(_assert(0)) .then(function() { return Plotly.relayout(gd, 'geo.visible', true); }) .then(_assert(1)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -2059,8 +2043,7 @@ describe('Test geo base layers', function() { ['bg', 'coastlines', 'frame', 'backplot', 'frontplot'] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to relayout axis grid *tick0* / *dtick*', function(done) { @@ -2116,8 +2099,7 @@ describe('Test geo base layers', function() { latCnt: 5, lat0: [80, 308.5] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2273,8 +2255,7 @@ describe('Test geo zoom/pan/drag interactions:', function() { [90, 0], [350, 260], [0, 0], 101.9 ], 'dblclick'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- fitbounds case', function(done) { @@ -2328,8 +2309,7 @@ describe('Test geo zoom/pan/drag interactions:', function() { [-180, -0], [350, 260], [0, 0], 114.59 ], 'dblclick'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2422,8 +2402,7 @@ describe('Test geo zoom/pan/drag interactions:', function() { [75, -45], 160 ], 'dblclick'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- fitbounds case', function(done) { @@ -2477,8 +2456,7 @@ describe('Test geo zoom/pan/drag interactions:', function() { [0.252, -19.8], 160 ], 'dblclick'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2565,8 +2543,7 @@ describe('Test geo zoom/pan/drag interactions:', function() { [247, 260], [0, 57.5], 292.2 ], 'dblclick'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- fitbounds case', function(done) { @@ -2620,8 +2597,7 @@ describe('Test geo zoom/pan/drag interactions:', function() { [247, 260], [5.7998, 49.29], 504.8559 ], 'dblclick'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2701,8 +2677,7 @@ describe('Test geo zoom/pan/drag interactions:', function() { [416, 309], 738.5 ], 'dblclick'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should guard against undefined projection.invert result in some projections', function(done) { @@ -2721,8 +2696,7 @@ describe('Test geo zoom/pan/drag interactions:', function() { // nor emit events expect(eventData).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should respect scrollZoom config option', function(done) { @@ -2769,8 +2743,7 @@ describe('Test geo zoom/pan/drag interactions:', function() { ['geo.projection.rotation.lon', 'geo.center.lon', 'geo.center.lat', 'geo.projection.scale'] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('plotly_relayouting', function() { @@ -2808,8 +2781,7 @@ describe('Test geo zoom/pan/drag interactions:', function() { expect(Object.keys(events[0])).toContain(key); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/gl2d_click_test.js b/test/jasmine/tests/gl2d_click_test.js index f0514c10a4d..edae5bbc56a 100644 --- a/test/jasmine/tests/gl2d_click_test.js +++ b/test/jasmine/tests/gl2d_click_test.js @@ -4,7 +4,7 @@ var Lib = require('@src/lib'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test.js'); + var customAssertions = require('../assets/custom_assertions'); var assertHoverLabelStyle = customAssertions.assertHoverLabelStyle; @@ -218,8 +218,7 @@ describe('Test hover and click interactions', function() { Plotly.plot(gd, _mock) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should output correct event data for scattergl in *select* dragmode', function(done) { @@ -257,8 +256,7 @@ describe('Test hover and click interactions', function() { Plotly.plot(gd, _mock) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should output correct event data for scattergl in *lasso* dragmode', function(done) { @@ -296,8 +294,7 @@ describe('Test hover and click interactions', function() { Plotly.plot(gd, _mock) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should output correct event data for scattergl with hoverinfo: \'none\'', function(done) { @@ -316,8 +313,7 @@ describe('Test hover and click interactions', function() { Plotly.plot(gd, _mock) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should show correct label for scattergl when hovertext is set', function(done) { @@ -343,8 +339,7 @@ describe('Test hover and click interactions', function() { Plotly.plot(gd, _mock) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should not error when scattergl trace has missing points', function(done) { @@ -373,8 +368,7 @@ describe('Test hover and click interactions', function() { var interval = setInterval(function() { hover(xp--, yp--); }, 10); return delay(100)().then(function() { clearInterval(interval); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should show last point data for overlapped scattergl points with hovermode set to closest', function(done) { @@ -414,8 +408,7 @@ describe('Test hover and click interactions', function() { } }) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should output correct event data for pointcloud', function(done) { @@ -442,8 +435,7 @@ describe('Test hover and click interactions', function() { Plotly.plot(gd, _mock) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl scatter3d should propagate marker colors to hover labels', function(done) { @@ -467,8 +459,7 @@ describe('Test hover and click interactions', function() { Plotly.newPlot(gd, _mock) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should output correct event data for heatmapgl', function(done) { @@ -500,8 +491,7 @@ describe('Test hover and click interactions', function() { Plotly.plot(gd, _mock) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should output correct event data for heatmapgl (asymmetric case) ', function(done) { @@ -533,8 +523,7 @@ describe('Test hover and click interactions', function() { Plotly.plot(gd, _mock) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should output correct event data for scattergl after visibility restyle', function(done) { @@ -575,8 +564,7 @@ describe('Test hover and click interactions', function() { return Plotly.restyle(gd, 'visible', false, [1]); }) .then(run2) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should output correct event data for scattergl-fancy', function(done) { @@ -623,8 +611,7 @@ describe('Test hover and click interactions', function() { return Plotly.restyle(gd, 'visible', false, [1]); }) .then(run2) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should output correct event data contourgl', function(done) { @@ -651,8 +638,7 @@ describe('Test hover and click interactions', function() { Plotly.plot(gd, _mock) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -689,7 +675,6 @@ describe('hover with (x|y)period positioning', function() { nums: '(Jan 2006, Jun 1, 1970)' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/gl2d_plot_interact_test.js b/test/jasmine/tests/gl2d_plot_interact_test.js index a11749f096e..eaeacc30be5 100644 --- a/test/jasmine/tests/gl2d_plot_interact_test.js +++ b/test/jasmine/tests/gl2d_plot_interact_test.js @@ -7,7 +7,7 @@ var Drawing = require('@src/components/drawing'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var touchEvent = require('../assets/touch_event'); var drag = require('../assets/drag'); var selectButton = require('../assets/modebar_button'); @@ -42,8 +42,7 @@ describe('Test removal of gl contexts', function() { expect(!!gd._fullLayout._plots.xy._scene).toBe(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Plotly.newPlot should remove gl context from the graph div of a gl2d plot', function(done) { @@ -85,8 +84,7 @@ describe('Test removal of gl contexts', function() { firstCanvas !== secondCanvas && firstGlContext.isContextLost() ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -123,8 +121,7 @@ describe('Test gl plot side effects', function() { var rangeSlider = document.getElementsByClassName('range-slider')[0]; expect(rangeSlider).not.toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to replot from a blank graph', function(done) { @@ -165,8 +162,7 @@ describe('Test gl plot side effects', function() { return Plotly.purge(gd); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to switch trace type', function(done) { @@ -190,8 +186,7 @@ describe('Test gl plot side effects', function() { .then(function() { expect(d3.selectAll('canvas').size()).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to resize canvas properly', function(done) { @@ -209,8 +204,7 @@ describe('Test gl plot side effects', function() { .then(function() { expect(gd.querySelector('.gl-canvas-context').width).toBe(300); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should fire *plotly_webglcontextlost* when on webgl context lost', function(done) { @@ -256,8 +250,7 @@ describe('Test gl plot side effects', function() { // isn't used for scattergl traces expect(eventData).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should not clear context when dimensions are not integers', function(done) { @@ -307,8 +300,7 @@ describe('Test gl plot side effects', function() { expect(Plots.cleanPlot).toHaveBeenCalledTimes(2); expect(Lib.log).toHaveBeenCalledTimes(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to toggle from svg to gl', function(done) { @@ -331,8 +323,7 @@ describe('Test gl plot side effects', function() { expect(countCanvases()).toBe(0); expect(d3.selectAll('.scatterlayer > .trace').size()).toBe(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should create two WebGL contexts per graph', function(done) { @@ -345,8 +336,7 @@ describe('Test gl plot side effects', function() { }); expect(cnt).toBe(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should clear canvases on *replot* edits', function(done) { @@ -379,8 +369,7 @@ describe('Test gl plot side effects', function() { expect(gd._fullLayout._glcanvas.data()[0].regl.clear).toHaveBeenCalledTimes(1); expect(gd._fullLayout._glcanvas.data()[1].regl.clear).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -508,8 +497,7 @@ describe('Test gl2d plot interactions:', function() { 'yaxis.range[1]': jasmine.any(Number) })); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl supports 1D and 2D Zoom', function(done) { @@ -561,8 +549,7 @@ describe('Test gl2d plot interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([6, 8], 3); expect(gd.layout.yaxis.range).toBeCloseToArray([5, 7], 3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl supports axis constraints with zoom', function(done) { @@ -628,8 +615,7 @@ describe('Test gl2d plot interactions:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-8.2, 24.2], 1); expect(gd.layout.yaxis.range).toBeCloseToArray([-0.12, 16.1], 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl data-referenced annotations should update on drag', function(done) { @@ -671,8 +657,7 @@ describe('Test gl2d plot interactions:', function() { .then(function() { assertAnnotation([327, 331]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should not scroll document while panning', function(done) { @@ -725,7 +710,6 @@ describe('Test gl2d plot interactions:', function() { .then(function() { expect(relayoutCallback).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/gl3d_hover_click_test.js b/test/jasmine/tests/gl3d_hover_click_test.js index 2747ff630ec..593f30ce76d 100644 --- a/test/jasmine/tests/gl3d_hover_click_test.js +++ b/test/jasmine/tests/gl3d_hover_click_test.js @@ -4,7 +4,7 @@ var Lib = require('@src/lib'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var delay = require('../assets/delay'); @@ -97,8 +97,7 @@ describe('Test gl3d trace click/hover:', function() { } ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should honor *hoverlabel.namelength*', function(done) { @@ -121,8 +120,7 @@ describe('Test gl3d trace click/hover:', function() { } ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should display correct hover labels and emit correct event data (scatter3d case)', function(done) { @@ -294,8 +292,7 @@ describe('Test gl3d trace click/hover:', function() { .then(function() { assertHoverText(null, null, null, 'THIS Y -- a'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should display correct hover labels and emit correct event data (surface case with connectgaps enabled)', function(done) { @@ -327,8 +324,7 @@ describe('Test gl3d trace click/hover:', function() { fontColor: 'rgb(255, 255, 255)' }, 'initial'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should display correct hover labels and emit correct event data (surface case)', function(done) { @@ -447,8 +443,7 @@ describe('Test gl3d trace click/hover:', function() { .then(function() { assertHoverText(null, null, null, '!!! 43 !!!'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should emit correct event data on click (scatter3d case)', function(done) { @@ -473,8 +468,7 @@ describe('Test gl3d trace click/hover:', function() { .then(function() { assertEventData(140.72, -96.97, -96.97, 0, 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should display correct hover labels (mesh3d case)', function(done) { @@ -546,8 +540,7 @@ describe('Test gl3d trace click/hover:', function() { .then(function() { assertHoverText(null, null, null, '3-4-5'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@noCI @gl should display correct face colors', function(done) { @@ -599,8 +592,7 @@ describe('Test gl3d trace click/hover:', function() { 'face color' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@noCI @gl should display correct face intensities (uniform grid)', function(done) { @@ -630,8 +622,7 @@ describe('Test gl3d trace click/hover:', function() { 'trace 0' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@noCI @gl should display correct face intensities (non-uniform grid)', function(done) { @@ -661,8 +652,7 @@ describe('Test gl3d trace click/hover:', function() { 'trace 0' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@noCI @gl should display correct face intensities *alpha-hull* case', function(done) { @@ -705,8 +695,7 @@ describe('Test gl3d trace click/hover:', function() { 'trace 0' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@noCI @gl should display correct face intensities *delaunay* case', function(done) { @@ -749,8 +738,7 @@ describe('Test gl3d trace click/hover:', function() { 'trace 0' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function scroll(target, amt) { @@ -834,8 +822,7 @@ describe('Test gl3d trace click/hover:', function() { 'vertex color' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should pick correct points after orthographic scroll zoom - scatter3d case', function(done) { @@ -904,8 +891,7 @@ describe('Test gl3d trace click/hover:', function() { 'marker color' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should pick latest & closest points on hover if two points overlap', function(done) { @@ -929,8 +915,7 @@ describe('Test gl3d trace click/hover:', function() { .then(function() { assertHoverText('x: 1', 'y: 1', 'z: 1', 'third above', 'trace 1'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('propagate colors to hover labels', function() { @@ -1106,8 +1091,7 @@ describe('Test gl3d trace click/hover:', function() { fontFamily: 'Arial' }, 'undefined'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl scatter3d ' + t + ' colorscale', function(done) { @@ -1278,8 +1262,7 @@ describe('Test gl3d trace click/hover:', function() { fontFamily: 'Arial' }, '6th point'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/gl3d_plot_interact_test.js b/test/jasmine/tests/gl3d_plot_interact_test.js index 2adb6ccfbb9..fdd24a620d8 100644 --- a/test/jasmine/tests/gl3d_plot_interact_test.js +++ b/test/jasmine/tests/gl3d_plot_interact_test.js @@ -7,7 +7,7 @@ var Drawing = require('@src/components/drawing'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var drag = require('../assets/drag'); var selectButton = require('../assets/modebar_button'); @@ -135,8 +135,7 @@ describe('Test gl3d before/after plot', function() { expect(cameraFinal.eye[2]).not.toBeCloseTo(1.2, 2, 'cameraFinal.eye[2]'); expect(cameraFinal.mouseListener.enabled === true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -177,8 +176,7 @@ describe('Test gl3d plots', function() { .then(function() { expect(gd._fullLayout.scene.dragmode === 'orbit').toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should set the camera dragmode to turntable if the camera.up.z vector is set to be upwards', function(done) { @@ -205,8 +203,7 @@ describe('Test gl3d plots', function() { .then(function() { expect(gd._fullLayout.scene.dragmode === 'turntable').toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should set the camera dragmode to turntable if the camera.up is not set', function(done) { @@ -228,8 +225,7 @@ describe('Test gl3d plots', function() { .then(function() { expect(gd._fullLayout.scene.dragmode === 'turntable').toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should set the camera dragmode to turntable if any of camera.up.[x|y|z] is missing', function(done) { @@ -256,8 +252,7 @@ describe('Test gl3d plots', function() { .then(function() { expect(gd._fullLayout.scene.dragmode === 'turntable').toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should not set the camera dragmode to turntable if camera.up.z is zero.', function(done) { @@ -284,8 +279,7 @@ describe('Test gl3d plots', function() { .then(function() { expect(gd._fullLayout.scene.dragmode === 'turntable').not.toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should set the camera projection type to perspective if the camera.projection.type is not set', function(done) { @@ -308,8 +302,7 @@ describe('Test gl3d plots', function() { expect(gd._fullLayout.scene.camera.projection.type === 'perspective').toBe(true); expect(gd._fullLayout.scene._scene.camera._ortho === false).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should set the camera projection type to orthographic if the camera.projection.type is set to orthographic', function(done) { @@ -335,8 +328,7 @@ describe('Test gl3d plots', function() { expect(gd._fullLayout.scene.camera.projection.type === 'orthographic').toBe(true); expect(gd._fullLayout.scene._scene.camera._ortho === true).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should enable orthographic & perspective projections using relayout', function(done) { @@ -386,8 +378,7 @@ describe('Test gl3d plots', function() { expect(gd._fullLayout.scene.camera.projection.type === 'perspective').toBe(true); expect(gd._fullLayout.scene._scene.camera._ortho === false).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should not set _length to NaN and dtick should be defined.', function(done) { @@ -416,8 +407,7 @@ describe('Test gl3d plots', function() { expect(isNaN(zaxis._length)).toBe(false); expect(zaxis.dtick === undefined).toBe(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -584,8 +574,7 @@ describe('Test gl3d modebar handlers - perspective case', function() { buttonDefault.click(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl button resetCameraDefault3d should reset to initial aspectmode & aspectratios', function(done) { @@ -614,8 +603,7 @@ describe('Test gl3d modebar handlers - perspective case', function() { buttonDefault.click(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl button resetCameraLastSave3d should reset to initial aspectmode & aspectratios', function(done) { @@ -641,8 +629,7 @@ describe('Test gl3d modebar handlers - perspective case', function() { buttonDefault.click(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl button resetCameraLastSave3d should reset camera to default', function(done) { @@ -715,8 +702,7 @@ describe('Test gl3d modebar handlers - perspective case', function() { assertCameraEye(gd._fullLayout.scene, 0.1, 0.1, 4); assertCameraEye(gd._fullLayout.scene2, 2.5, 2.5, 5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -802,8 +788,7 @@ describe('Test gl3d modebar handlers - orthographic case', function() { buttonDefault.click(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl button resetCameraDefault3d should reset to initial aspectmode & aspectratios', function(done) { @@ -832,8 +817,7 @@ describe('Test gl3d modebar handlers - orthographic case', function() { buttonDefault.click(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl button resetCameraLastSave3d should reset to initial aspectmode & aspectratios', function(done) { @@ -862,8 +846,7 @@ describe('Test gl3d modebar handlers - orthographic case', function() { buttonDefault.click(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl button resetCameraLastSave3d should reset camera to default', function(done) { @@ -936,8 +919,7 @@ describe('Test gl3d modebar handlers - orthographic case', function() { assertCameraEye(gd._fullLayout.scene, 0.1, 0.1, 4); assertCameraEye(gd._fullLayout.scene2, 2.5, 2.5, 5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1001,8 +983,7 @@ describe('Test gl3d drag and wheel interactions', function() { .then(function() { expect(relayoutCallback).toHaveBeenCalledTimes(3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should update the scene camera - perspective case', function(done) { @@ -1115,8 +1096,7 @@ describe('Test gl3d drag and wheel interactions', function() { .then(function() { _assertAndReset(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should update the scene camera - orthographic case', function(done) { @@ -1227,8 +1207,7 @@ describe('Test gl3d drag and wheel interactions', function() { .then(function() { _assertAndReset(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should update the scene aspectmode & aspectratio when zooming with scroll wheel i.e. orthographic case', function(done) { @@ -1313,8 +1292,7 @@ describe('Test gl3d drag and wheel interactions', function() { expect(gd._fullLayout.scene2._scene.glplot.getAspectratio().y).toBeCloseTo(2); expect(gd._fullLayout.scene2._scene.glplot.getAspectratio().z).toBeCloseTo(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should fire plotly_relayouting events when dragged - perspective case', function(done) { @@ -1365,8 +1343,7 @@ describe('Test gl3d drag and wheel interactions', function() { expect(key).not.toBe('scene.aspectmode'); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should fire plotly_relayouting events when dragged - orthographic case', function(done) { @@ -1416,8 +1393,7 @@ describe('Test gl3d drag and wheel interactions', function() { expect(key).not.toBe('scene.aspectmode'); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); @@ -1466,8 +1442,7 @@ describe('Test gl3d drag and wheel interactions', function() { expect(Object.keys(events[0])).toContain(key); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should preserve aspectratio values when orthographic scroll zoom i.e. after restyle', function(done) { @@ -1561,8 +1536,7 @@ describe('Test gl3d drag and wheel interactions', function() { expect(aspectratio.y).toBeCloseTo(0.725, 3, 'aspectratio.y'); expect(aspectratio.z).toBeCloseTo(1.269, 3, 'aspectratio.z'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1609,8 +1583,7 @@ describe('Test gl3d relayout calls', function() { .then(function() { assertMargins(0, 0, 0, 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should skip root-level axis objects', function(done) { @@ -1627,8 +1600,7 @@ describe('Test gl3d relayout calls', function() { zaxis: {} }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should maintain projection type when resetCamera buttons clicked after switching projection type from perspective to orthographic', function(done) { @@ -1667,8 +1639,7 @@ describe('Test gl3d relayout calls', function() { selectButton(gd._fullLayout._modeBar, 'resetCameraDefault3d').click(); expect(gd._fullLayout.scene._scene.camera._ortho).toEqual(true, 'orthographic'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should maintain projection type when resetCamera buttons clicked after switching projection type from orthographic to perspective', function(done) { @@ -1710,8 +1681,7 @@ describe('Test gl3d relayout calls', function() { selectButton(gd._fullLayout._modeBar, 'resetCameraDefault3d').click(); expect(gd._fullLayout.scene._scene.camera._ortho).toEqual(false, 'perspective'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1802,8 +1772,7 @@ describe('Test gl3d annotations', function() { .then(function() { assertAnnotationsXY([[262, 199], [257, 135], [325, 233]], 'base 0'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be removed when beyond the scene axis ranges', function(done) { @@ -1835,8 +1804,7 @@ describe('Test gl3d annotations', function() { .then(function() { assertAnnotationText(['0', '1', '2', '3', '4', '5', '6'], 'back to base after zaxis range relayout'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to add/remove and hide/unhide themselves via relayout', function(done) { @@ -1885,8 +1853,7 @@ describe('Test gl3d annotations', function() { .then(function() { assertAnnotationText(['new!'], 'after add new (2)'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should work across multiple scenes', function(done) { @@ -1938,8 +1905,7 @@ describe('Test gl3d annotations', function() { assertAnnotationCntPerScene('scene', 1); assertAnnotationCntPerScene('scene2', 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should contribute to scene axis autorange', function(done) { @@ -1972,8 +1938,7 @@ describe('Test gl3d annotations', function() { .then(function() { assertSceneAxisRanges([0.9375, 3.0625], [0.9375, 3.0625], [0.7187, 10.2813]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should allow text and tail position edits under `editable: true`', function(done) { @@ -2038,8 +2003,7 @@ describe('Test gl3d annotations', function() { 'scene.annotations[0].ay': -80 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should display hover labels and trigger *plotly_clickannotation* event', function(done) { @@ -2088,8 +2052,7 @@ describe('Test gl3d annotations', function() { dispatch('click'); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2115,8 +2078,7 @@ describe('Test removal of gl contexts', function() { Plots.cleanPlot([], {}, gd._fullData, gd._fullLayout); expect(gd._fullLayout.scene._scene.glplot).toBe(null); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Plotly.newPlot should remove gl context from the graph div of a gl3d plot', function(done) { @@ -2160,8 +2122,7 @@ describe('Test removal of gl contexts', function() { firstCanvas !== secondCanvas && firstGlContext.isContextLost() ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should fire *plotly_webglcontextlost* when on webgl context lost', function(done) { @@ -2181,8 +2142,7 @@ describe('Test removal of gl contexts', function() { expect((eventData || {}).event).toBeDefined(); expect((eventData || {}).layer).toBe('scene'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2239,13 +2199,11 @@ describe('Test gl3d drag events', function() { it('@gl should respond to drag interactions with mock of unset camera', function(done) { testEvents(makePlot(gd, require('@mocks/gl3d_scatter3d-connectgaps.json'))) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should respond to drag interactions with mock of partially set camera', function(done) { testEvents(makePlot(gd, require('@mocks/gl3d_errorbars_zx.json'))) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/gl3dlayout_test.js b/test/jasmine/tests/gl3dlayout_test.js index a4a56bd29a0..59960549fa3 100644 --- a/test/jasmine/tests/gl3dlayout_test.js +++ b/test/jasmine/tests/gl3dlayout_test.js @@ -6,7 +6,7 @@ var Color = require('@src/components/color'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + describe('Test gl3d axes defaults', function() { 'use strict'; @@ -563,7 +563,6 @@ describe('Gl3d layout edge cases', function() { expect(aspect.y).toBeCloseTo(0.6437); expect(aspect.z).toBeCloseTo(0.9655); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/heatmap_test.js b/test/jasmine/tests/heatmap_test.js index 722f737fa1a..7087c30bff0 100644 --- a/test/jasmine/tests/heatmap_test.js +++ b/test/jasmine/tests/heatmap_test.js @@ -10,7 +10,7 @@ var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var supplyAllDefaults = require('../assets/supply_defaults'); -var failTest = require('../assets/fail_test'); + describe('heatmap supplyDefaults', function() { 'use strict'; @@ -688,8 +688,7 @@ describe('heatmap plot', function() { }).then(function() { assertImageCnt(5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('keeps the correct ordering after hide and show', function(done) { @@ -718,8 +717,7 @@ describe('heatmap plot', function() { .then(function() { expect(getIndices()).toEqual([0, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle', function(done) { @@ -753,8 +751,7 @@ describe('heatmap plot', function() { expect(imageURLs[1]).toEqual(imageURLs[3]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('draws canvas with correct margins', function(done) { @@ -799,8 +796,7 @@ describe('heatmap plot', function() { expect(args[3]).toBe(argumentsWithoutPadding[i][3] - yGap, i); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can change z values with connected gaps', function(done) { @@ -827,8 +823,7 @@ describe('heatmap plot', function() { .then(function() { expect(gd.calcdata[0][0].z).toEqual([[1, 2], [2, 4], [1, 2]]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -972,8 +967,7 @@ describe('heatmap hover', function() { Plotly.restyle(gd, {zsmooth: 'none'}, [0]) .then(checkData) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/histogram2d_test.js b/test/jasmine/tests/histogram2d_test.js index a03523ee710..aa60af897ac 100644 --- a/test/jasmine/tests/histogram2d_test.js +++ b/test/jasmine/tests/histogram2d_test.js @@ -7,7 +7,7 @@ var calc = require('@src/traces/histogram2d/calc'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var mouseEvent = require('../assets/mouse_event'); -var failTest = require('../assets/fail_test'); + var supplyAllDefaults = require('../assets/supply_defaults'); var customAssertions = require('../assets/custom_assertions'); @@ -248,8 +248,7 @@ describe('Test histogram2d', function() { .then(function() { return Plotly.relayout(gd, 'xaxis.range', [0, 2]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function _assert(xBinsFull, yBinsFull, xBins, yBins) { @@ -323,8 +322,7 @@ describe('Test histogram2d', function() { {start: -0.5, end: 59.5, size: 20}, undefined, undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('respects explicit autobin: false as a one-time autobin', function(done) { @@ -347,8 +345,7 @@ describe('Test histogram2d', function() { .then(function() { _assert(binSpec, binSpec, binSpec, binSpec); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -433,8 +430,7 @@ describe('Test histogram2d hover:', function() { name: '' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('hover info', function() { @@ -456,8 +452,7 @@ describe('Test histogram2d hover:', function() { nums: 'x: 3 - 5\ny: 4 - 6\nz: 3' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows the data range when bins have multiple values (case 2)', function(done) { @@ -474,8 +469,7 @@ describe('Test histogram2d hover:', function() { _hover(250, 250); assertHoverLabelContent({nums: ['x: b', 'y: 4 - 5', 'z: 0'].join('\n')}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows the exact data when bins have single values', function(done) { @@ -496,8 +490,7 @@ describe('Test histogram2d hover:', function() { nums: 'x: 3.3\ny: 4.2\nz: 3' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows the data range when bins have no value in it', function(done) { @@ -544,8 +537,7 @@ describe('Test histogram2d hover:', function() { _check('off left/bottom of pt', 50, 325, ['x: 5 - 9', 'y: 2', 'z: 0']); _check('off right/bottom of pt', 300, 325, ['x: 50 - 54', 'y: 2', 'z: 0']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/histogram_test.js b/test/jasmine/tests/histogram_test.js index 88b600ed583..41f9e38fd5b 100644 --- a/test/jasmine/tests/histogram_test.js +++ b/test/jasmine/tests/histogram_test.js @@ -13,7 +13,7 @@ var getBinSpanLabelRound = require('@src/traces/histogram/bin_label_vals'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var supplyAllDefaults = require('../assets/supply_defaults'); -var failTest = require('../assets/fail_test'); + var checkEventData = require('../assets/check_event_data'); var constants = require('@src/traces/histogram/constants'); @@ -875,8 +875,7 @@ describe('Test histogram', function() { expect(cd0[i].ph1).toBe(cd1[i].ph1); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('autobins all data as one', function() { @@ -1169,8 +1168,7 @@ describe('Test histogram', function() { expect(gd._fullData[0].xbins).toEqual({start: 9, end: 51, size: 2}); expect(gd._fullData[0].nbinsx).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('respects explicit autobin: false as a one-time autobin', function(done) { @@ -1190,8 +1188,7 @@ describe('Test histogram', function() { .then(function() { expect(gd._fullData[0].xbins).toEqual({start: 1, end: 6, size: 1}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('allows changing axis type with new x data', function(done) { @@ -1209,8 +1206,7 @@ describe('Test histogram', function() { expect(gd._fullLayout.xaxis.type).toBe('date'); expect(gd._fullLayout.xaxis.range).toEqual(['2016-12-31 12:00', '2017-01-03 12:00']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can resize a plot with several histograms', function(done) { @@ -1242,8 +1238,7 @@ describe('Test histogram', function() { expect(trace._xautoBinFinished).toBeUndefined(i); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('gives the right bar width for single-value histograms', function(done) { @@ -1255,8 +1250,7 @@ describe('Test histogram', function() { .then(function() { expect(gd._fullLayout.xaxis.range).toBeCloseToArray([2, 4], 3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can recalc after the first trace is hidden', function(done) { @@ -1292,8 +1286,7 @@ describe('Test histogram', function() { .then(function() { assertTraceCount(3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('autobins all histograms (on the same subplot) together except `visible: false`', function(done) { @@ -1340,8 +1333,7 @@ describe('Test histogram', function() { // legendonly traces still flip us back to gapped expect(gd._fullLayout.bargap).toBe(0.2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index 48f98c7059f..62a28e9834a 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -14,7 +14,7 @@ var mouseEvent = require('../assets/mouse_event'); var click = require('../assets/click'); var delay = require('../assets/delay'); var doubleClick = require('../assets/double_click'); -var failTest = require('../assets/fail_test'); + var touchEvent = require('../assets/touch_event'); var negateIf = require('../assets/negate_if'); @@ -69,8 +69,7 @@ describe('Fx.hover:', function() { expect(gd._hoverdata).toBe(undefined, 'did not generate hoverdata'); expect(Lib.warn).toHaveBeenCalledWith('Unrecognized subplot: x2y2'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -553,8 +552,7 @@ describe('hover info', function() { nums: 'PV learning ...' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -614,8 +612,7 @@ describe('hover info', function() { axis: '1' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('puts the right trace on the right', function(done) { @@ -653,8 +650,7 @@ describe('hover info', function() { axis: '1' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -705,8 +701,7 @@ describe('hover info', function() { name: 'two' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display correct label content with specified format - heatmap', function(done) { @@ -741,8 +736,7 @@ describe('hover info', function() { name: 'one' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('provides exponents correctly for z data', function(done) { @@ -780,8 +774,7 @@ describe('hover info', function() { }); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display correct label content with specified format - contour', function(done) { @@ -893,8 +886,7 @@ describe('hover info', function() { name: '' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should get the right content and color for contour constraints', function(done) { @@ -963,8 +955,7 @@ describe('hover info', function() { assertHoverLabelStyle(d3.select(this), styles[i]); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display correct label content with specified format - histogram2dcontour', function(done) { @@ -1023,8 +1014,7 @@ describe('hover info', function() { name: ['', ''] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display correct label - x/y/z heatmap|contour', function(done) { @@ -1068,8 +1058,7 @@ describe('hover info', function() { name: 'contour: 2' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1090,8 +1079,7 @@ describe('hover info', function() { axis: '2' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1154,8 +1142,7 @@ describe('hover info', function() { expect(pt.xaxis).toBe(gd._fullLayout.xaxis); expect(pt.yaxis).toBe(gd._fullLayout.yaxis); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows the exact data when bins have single values', function(done) { @@ -1187,8 +1174,7 @@ describe('hover info', function() { axis: '3.3' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('will show a category range if you ask nicely', function(done) { @@ -1215,8 +1201,7 @@ describe('hover info', function() { axis: 'soup - nuts' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1286,8 +1271,7 @@ describe('hover info', function() { nums: 'Jan 2, 2011\nopen: 2\nhigh: 4\nlow: 1\nclose: 3 â–²' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows correct labels in split mode', function(done) { @@ -1340,8 +1324,7 @@ describe('hover info', function() { axis: 'Jan 3, 2011' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows text iff text is in hoverinfo', function(done) { @@ -1371,8 +1354,7 @@ describe('hover info', function() { axis: 'Jan 2, 2011' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1402,8 +1384,7 @@ describe('hover info', function() { axis: '2' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display the correct format when ticklabels false', function(done) { @@ -1417,8 +1398,7 @@ describe('hover info', function() { axis: '2' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1487,8 +1467,7 @@ describe('hover info', function() { .then(function() { expect(hoverHandler).not.toHaveBeenCalled(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should emit events only if the event looks user-driven', function(done) { @@ -1514,8 +1493,7 @@ describe('hover info', function() { .then(function() { expect(hoverHandler).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1551,8 +1529,7 @@ describe('hover info', function() { expect(labelCount()).toBe(7); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1631,8 +1608,7 @@ describe('hover info', function() { assertLabelsInsideBoxes(nodes); assertSecondaryRightToPrimaryBox(nodes); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('centered-aligned, should stack nicely upon each other', function(done) { @@ -1680,8 +1656,7 @@ describe('hover info', function() { expect(calcLineOverlap(boxLABB.top, boxLABB.bottom, boxSFBB.top, boxSFBB.bottom)) .toBeWithin(0, 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should stack multi-line trace-name labels nicely', function(done) { @@ -1724,8 +1699,7 @@ describe('hover info', function() { expect(calcLineOverlap(secondaryBB.top, secondaryBB.bottom, secondaryBB2.top, secondaryBB2.bottom)) .toBeWithin(2, 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should avoid overlaps on *too close* pts are filtered out', function(done) { @@ -1758,8 +1732,7 @@ describe('hover info', function() { expect(calcLineOverlap(boxA.top, boxA.bottom, boxC.top, boxC.bottom)) .toBeWithin(0, 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1808,8 +1781,7 @@ describe('hover info', function() { .then(_assert('left-edge hover (side:top)', {txt: 'Jan 1, 2019', lx: 37})) .then(_hoverRight) .then(_assert('right-edge hover (side:top)', {txt: 'Jan 1, 2020', lx: 362})) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('hovermode:y common label should shift and clip text start into graph div', function(done) { @@ -1874,8 +1846,7 @@ describe('hover info', function() { ltx: 38, tspanX: [-11, 38] })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1911,8 +1882,7 @@ describe('hover info', function() { axis: '0.388' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should format labels according to a template string and locale', function(done) { @@ -1950,8 +1920,7 @@ describe('hover info', function() { axis: '0,388' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should format secondary label with extra tag', function(done) { @@ -1973,8 +1942,7 @@ describe('hover info', function() { axis: '0.388' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should support pseudo-html', function(done) { @@ -1996,8 +1964,7 @@ describe('hover info', function() { axis: '0.388' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should support array', function(done) { @@ -2023,8 +1990,7 @@ describe('hover info', function() { axis: '0.388' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should contain the axis names', function(done) { @@ -2047,8 +2013,7 @@ describe('hover info', function() { axis: '0.388' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work with layout.meta references', function(done) { @@ -2066,8 +2031,7 @@ describe('hover info', function() { axis: '0.388' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work with trace meta references', function(done) { @@ -2086,8 +2050,7 @@ describe('hover info', function() { axis: '0.388' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2113,8 +2076,7 @@ describe('hover info', function() { axis: '2' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should fallback to regular hover content when hoveron does not support hovertemplate', function(done) { @@ -2145,8 +2107,7 @@ describe('hover info', function() { name: 'trace 1' }, 'hovering on a pt'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should honor *hoverlabel.align', function(done) { @@ -2193,8 +2154,7 @@ describe('hover info', function() { .then(function() { _assert('arrayOk align:right left pt', {textAnchor: 'end', posX: 84.73}); }) .then(function() { _hoverNatural(gd, 395, 395); }) .then(function() { _assert('arrayOk align:left right pt', {textAnchor: 'start', posX: -84.73}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should honor *hoverlabel.align (centered label case)', function(done) { @@ -2232,8 +2192,7 @@ describe('hover info', function() { }) .then(function() { _hoverNatural(gd, 200, 200); }) .then(function() { _assert('align:right', {textAnchor: 'end', posX: 57}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2395,8 +2354,7 @@ describe('hover on many lines+bars', function() { expect(d3.select(gd).selectAll('g.hovertext').size()).toBe(2); expect(d3.select(gd).selectAll('g.axistext').size()).toBe(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2417,8 +2375,7 @@ describe('hover info on overlaid subplots', function() { axis: '1' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2483,8 +2440,7 @@ describe('hover after resizing', function() { .then(function() { return check(pos1, [null, null, null], 'back to initial, not showing blank spot'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2517,8 +2473,7 @@ describe('hover on fill', function() { assertLabelsCorrect([242, 292], [233, 210], 'trace 1'); assertLabelsCorrect([147, 252], [158.925, 248.1], 'trace 0'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should always show one label in the right place (symmetric fill edge case)', function(done) { @@ -2546,8 +2501,7 @@ describe('hover on fill', function() { // gives same results w/o closing point assertLabelsCorrect([200, 200], [73.75, 250], 'trace 0'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work for scatterternary too', function(done) { @@ -2583,8 +2537,7 @@ describe('hover on fill', function() { // then make sure we can still select a *different* item afterward assertLabelsCorrect([237, 218], [266.75, 265], 'trace 1'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should act like closest mode on ternary when cartesian is in compare mode', function(done) { @@ -2609,8 +2562,7 @@ describe('hover on fill', function() { // hover on the cartesian trace in the corner assertLabelsCorrect([363, 122], [367, 122], 'trace 38'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2661,8 +2613,7 @@ describe('Hover on multicategory axes', function() { assertHoverLabelContent({ nums: 'Sample: b\nYear: 2018' }); expect(eventData.x).toEqual(['2018', 'b']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work on heatmap traces', function(done) { @@ -2695,8 +2646,7 @@ describe('Hover on multicategory axes', function() { }); expect(eventData.x).toEqual(['2017', 'q3']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2844,8 +2794,7 @@ describe('hover on traces with (x|y)period positioning', function() { }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows hover info for box, ohlc, candlestick traces', function(done) { @@ -2916,8 +2865,7 @@ describe('hover on traces with (x|y)period positioning', function() { }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows hover info and hovertemplate for bar and scatter traces using (start | middle | end) alignments and different periods', function(done) { @@ -3137,8 +3085,7 @@ describe('hover on traces with (x|y)period positioning', function() { }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -3228,8 +3175,7 @@ describe('Hover on axes with rangebreaks', function() { y: 8 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work when rangebreaks are present on x-axis (reversed range)', function(done) { @@ -3297,8 +3243,7 @@ describe('Hover on axes with rangebreaks', function() { y: 0 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work when rangebreaks are present on y-axis using hovermode x (case of bar and autorange reversed)', function(done) { @@ -3376,8 +3321,7 @@ describe('Hover on axes with rangebreaks', function() { x: 8 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work when rangebreaks are present on y-axis', function(done) { @@ -3444,8 +3388,7 @@ describe('Hover on axes with rangebreaks', function() { y: '1970-01-01' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work when rangebreaks are present on y-axis (reversed range)', function(done) { @@ -3513,8 +3456,7 @@ describe('Hover on axes with rangebreaks', function() { y: '1970-01-01 00:00:00.2' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -3588,8 +3530,7 @@ describe('hover updates', function() { // Assert label restored: assertLabelsCorrect(null, [103, 100], 'trace 10.5', 'animation/update 3'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not trigger infinite loop of plotly_unhover events', function(done) { @@ -3688,8 +3629,7 @@ describe('hover updates', function() { assertLabelsCorrect(offPt2, null, null, 'after react() resolves [off-pt]'); expect(Fx.hover).toHaveBeenCalledTimes(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -3892,8 +3832,7 @@ describe('Test hover label custom styling:', function() { text: [13, 'Arial', 'rgb(255, 255, 255)'] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work for x/y cartesian traces (multi-trace case)', function(done) { @@ -3958,8 +3897,7 @@ describe('Test hover label custom styling:', function() { color: ['rgb(68, 68, 68)', 'rgb(68, 68, 68)'] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work for 2d z cartesian traces', function(done) { @@ -4014,8 +3952,7 @@ describe('Test hover label custom styling:', function() { text: [11, 'Gravitas', 'rgb(255, 0, 0)'] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -4079,8 +4016,7 @@ describe('hover distance', function() { name: 'trace 0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('correctly responds to setting the hoverdistance to -1 by increasing ' + @@ -4103,8 +4039,7 @@ describe('hover distance', function() { name: 'trace 0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -4152,8 +4087,7 @@ describe('hover distance', function() { expect(gd._hoverdata).toEqual(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('responds to hoverdistance change from 10 to 30 (part 2)', function(done) { @@ -4176,8 +4110,7 @@ describe('hover distance', function() { name: 'trace 0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('responds to hoverdistance change from default to 0 (part 1)', function() { @@ -4208,8 +4141,7 @@ describe('hover distance', function() { expect(gd._hoverdata).toEqual(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('responds to setting the hoverdistance to -1 by increasing ' + @@ -4241,8 +4173,7 @@ describe('hover distance', function() { name: 'trace 0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -4268,8 +4199,7 @@ describe('hover distance', function() { expect(gd._hoverdata.length).toEqual(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('selects all points at the same position on a log axis', function(done) { @@ -4285,8 +4215,7 @@ describe('hover distance', function() { expect(gd._hoverdata.length).toEqual(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('selects all points at the same position on a category axis', function(done) { @@ -4302,8 +4231,7 @@ describe('hover distance', function() { expect(gd._hoverdata.length).toEqual(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('selects all points at the same position on a date axis', function(done) { @@ -4319,8 +4247,7 @@ describe('hover distance', function() { expect(gd._hoverdata.length).toEqual(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -4352,8 +4279,7 @@ describe('hover label rotation:', function() { }], { hovermode: 'y' }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should rotate labels under *hovermode:y*', function() { @@ -4378,8 +4304,7 @@ describe('hover label rotation:', function() { isRotated: false }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -4402,8 +4327,7 @@ describe('hover label rotation:', function() { }], { hovermode: 'y' }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should rotate labels under *hovermode:y*', function() { @@ -4428,8 +4352,7 @@ describe('hover label rotation:', function() { isRotated: false }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -4448,8 +4371,7 @@ describe('hovermode defaults to', function() { .then(function() { expect(gd._fullLayout.hovermode).toBe('closest'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('\'x\' for horizontal cartesian plots if clickmode lacks \'select\'', function(done) { @@ -4457,8 +4379,7 @@ describe('hovermode defaults to', function() { .then(function() { expect(gd._fullLayout.hovermode).toBe('y'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('\'y\' for vertical cartesian plots if clickmode lacks \'select\'', function(done) { @@ -4466,8 +4387,7 @@ describe('hovermode defaults to', function() { .then(function() { expect(gd._fullLayout.hovermode).toBe('x'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('\'closest\' for a non-cartesian plot', function(done) { @@ -4478,8 +4398,7 @@ describe('hovermode defaults to', function() { .then(function() { expect(gd._fullLayout.hovermode).toBe('closest'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -4509,8 +4428,7 @@ describe('hover labels z-position', function() { compareMask = modebar[0].compareDocumentPosition(hoverlayer[0]); expect(compareMask).toBe(Node.DOCUMENT_POSITION_FOLLOWING, '.hoverlayer appears after the .modebar'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -4546,8 +4464,7 @@ describe('touch devices', function() { expect(clickHandler).toHaveBeenCalled(); expect(hoverHandler).not.toHaveBeenCalled(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -4576,8 +4493,7 @@ describe('dragmode: false', function() { .then(function() { expect(hoverHandler).toHaveBeenCalled(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -4673,8 +4589,7 @@ describe('hovermode: (x|y)unified', function() { expect(ax.spikesnap).toBe('hovered data'); expect(gd._fullLayout.yaxis.showspike).toBeFalse; }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('set smart defaults for spikeline in y unified', function(done) { @@ -4690,8 +4605,7 @@ describe('hovermode: (x|y)unified', function() { expect(ax.spikesnap).toBe('hovered data'); expect(gd._fullLayout.yaxis.showspike).toBeFalse; }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('x unified should work for x/y cartesian traces', function(done) { @@ -4702,8 +4616,7 @@ describe('hovermode: (x|y)unified', function() { assertLabel({title: '3', items: ['trace 0 : 4', 'trace 1 : 8']}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('y unified should work for x/y cartesian traces', function(done) { @@ -4715,8 +4628,7 @@ describe('hovermode: (x|y)unified', function() { assertLabel({title: '6', items: ['trace 0 : 2', 'trace 1 : 5']}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('unified hover modes should work for x/y cartesian traces via template', function(done) { @@ -4743,8 +4655,7 @@ describe('hovermode: (x|y)unified', function() { assertLabel({title: '6', items: ['trace 0 : 2', 'trace 1 : 5']}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('x unified should work for x/y cartesian traces with legendgroup', function(done) { @@ -4764,8 +4675,7 @@ describe('hovermode: (x|y)unified', function() { 'trace 4 : 1' ]}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shares filtering logic with compare mode x', function(done) { @@ -4786,8 +4696,7 @@ describe('hovermode: (x|y)unified', function() { 'Market incom... : 0.4420997' ]}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should have the same traceorder as the legend', function(done) { @@ -4807,8 +4716,7 @@ describe('hovermode: (x|y)unified', function() { assertLabel({title: '3', items: expectation.reverse()}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should order items based on trace index as in the legend', function(done) { @@ -4826,8 +4734,7 @@ describe('hovermode: (x|y)unified', function() { 'Attic (Ardui... : (Apr 13, 2014, 15:26:34, 98.49)' ]}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work for finance traces', function(done) { @@ -4843,8 +4750,7 @@ describe('hovermode: (x|y)unified', function() { 'candlestick : open: 22high: 27low: 19close: 23 â–²' ]}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work for "legend_horizontal_autowrap"', function(done) { @@ -4858,8 +4764,7 @@ describe('hovermode: (x|y)unified', function() { assertElementCount('g.hoverlayer g.legend', 1); assertElementCount('g.hoverlayer g.traces', 20); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should style scatter symbols accordingly', function(done) { @@ -4877,8 +4782,7 @@ describe('hovermode: (x|y)unified', function() { assertLabel({title: '2', items: ['3']}); assertSymbol([['rgb(253, 231, 37)', '0px', '']]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should style bar symbols accordingly', function(done) { @@ -4896,8 +4800,7 @@ describe('hovermode: (x|y)unified', function() { assertLabel({title: '20', items: ['20']}); assertSymbol([['rgb(168, 140, 33)', '4px', 'rgb(111, 193, 115)']]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should style funnel symbols accordingly', function(done) { @@ -4913,8 +4816,7 @@ describe('hovermode: (x|y)unified', function() { ['rgb(255, 255, 0)', '5px', 'rgb(0, 0, 127)'] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should style waterfall symbols correctly', function(done) { @@ -4938,8 +4840,7 @@ describe('hovermode: (x|y)unified', function() { ['rgb(255, 65, 54)', '5px', 'rgb(238, 130, 238)'] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('label should have bgcolor/bordercolor from hoverlabel or legend or paper_bgcolor', function(done) { @@ -5017,8 +4918,7 @@ describe('hovermode: (x|y)unified', function() { assertRectColor(bgcolor[3], bgcolor[3]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use hoverlabel.font or legend.font or layout.font', function(done) { @@ -5086,8 +4986,7 @@ describe('hovermode: (x|y)unified', function() { assertFont('Mono', '30px', 'rgb(255, 0, 0)'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work with hovertemplate', function(done) { @@ -5113,8 +5012,7 @@ describe('hovermode: (x|y)unified', function() { '8.00' ]}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('on relayout, it deletes existing hover', function(done) { @@ -5135,7 +5033,6 @@ describe('hovermode: (x|y)unified', function() { assertElementCount('g.hovertext', 0); assertElementCount('g.legend', 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/hover_spikeline_test.js b/test/jasmine/tests/hover_spikeline_test.js index d33108d1e8e..427fcea24b7 100644 --- a/test/jasmine/tests/hover_spikeline_test.js +++ b/test/jasmine/tests/hover_spikeline_test.js @@ -4,7 +4,7 @@ var Plotly = require('@lib/index'); var Fx = require('@src/components/fx'); var Lib = require('@src/lib'); -var failTest = require('../assets/fail_test'); + var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); @@ -87,8 +87,7 @@ describe('spikeline hover', function() { [] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works the same for scattergl', function(done) { @@ -109,8 +108,7 @@ describe('spikeline hover', function() { [] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('draws lines and markers on enabled axes w/o tick labels', function(done) { @@ -132,8 +130,7 @@ describe('spikeline hover', function() { [] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('draws lines and markers on enabled axes in the x hovermode', function(done) { @@ -152,8 +149,7 @@ describe('spikeline hover', function() { [] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('draws lines up to x-axis position', function(done) { @@ -179,8 +175,7 @@ describe('spikeline hover', function() { // from "y" of xy subplot top, down to "y" xy2 subplot bottom _assert([[189, 100, 189, 320]], []); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('draws lines up to y-axis position - anchor free case', function(done) { @@ -208,8 +203,7 @@ describe('spikeline hover', function() { // from "y" of pt, down to "y" of x axis (which is further down) _assert([[95.75, 100, 95.75, 210]], []); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('draws lines up to y-axis position', function(done) { @@ -237,8 +231,7 @@ describe('spikeline hover', function() { // from "x" at xy2 subplot left, to "x" at xy subplot right _assert([[80, 114.75, 320, 114.75]], []); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('draws lines up to y-axis position - anchor free case', function(done) { @@ -266,8 +259,7 @@ describe('spikeline hover', function() { // from "x" of y axis (which is further left) to "x" of pt _assert([[200, 114.75, 320, 114.75]], []); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('draws lines and markers on enabled axes in the spikesnap "cursor" mode', function(done) { @@ -294,8 +286,7 @@ describe('spikeline hover', function() { [] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('does not show spikes if no points are hovered in the spikesnap "hovered data" mode', function(done) { @@ -321,8 +312,7 @@ describe('spikeline hover', function() { _hover({xval: 1.5}); _assert([], []); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('doesn\'t switch between toaxis and across spikemodes on switching the hovermodes', function(done) { @@ -356,8 +346,7 @@ describe('spikeline hover', function() { [] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('increase the range of search for points to draw the spikelines on spikedistance change', function(done) { @@ -391,8 +380,7 @@ describe('spikeline hover', function() { [] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('correctly responds to setting the spikedistance to -1 by increasing ' + @@ -427,8 +415,7 @@ describe('spikeline hover', function() { [] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('correctly select the closest bar even when setting spikedistance to -1', function(done) { @@ -450,8 +437,7 @@ describe('spikeline hover', function() { expect(lines.size()).toBe(4); expect(lines[0][1].getAttribute('stroke')).toBe('#1f77b4'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('correctly responds to setting the spikedistance to 0 by disabling ' + @@ -486,8 +472,7 @@ describe('spikeline hover', function() { [] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function spikeLayout() { @@ -531,8 +516,7 @@ describe('spikeline hover', function() { .then(_assertBarSpikes) .then(function() { _setHovermode('closest'); }) .then(_assertBarSpikes) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('positions spikes at the data value on grouped boxes', function(done) { @@ -556,8 +540,7 @@ describe('spikeline hover', function() { [[200, 500], [100, 400]] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('positions spikes correctly on grouped violins', function(done) { @@ -585,8 +568,7 @@ describe('spikeline hover', function() { [[200, 500], [100, 400]] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('positions spikes correctly on heatmaps', function(done) { @@ -601,8 +583,7 @@ describe('spikeline hover', function() { [[200, 500], [100, 400]] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('positions spikes correctly on contour maps', function(done) { @@ -620,8 +601,7 @@ describe('spikeline hover', function() { [[200, 500], [100, 400]] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('does not show spikes on scatter fills', function(done) { @@ -640,8 +620,7 @@ describe('spikeline hover', function() { [[200, 500], [100, 400]] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('correctly draws lines up to the last point', function(done) { @@ -664,8 +643,7 @@ describe('spikeline hover', function() { expect(lines[0][1].getAttribute('stroke')).toBe('red'); expect(lines[0][3].getAttribute('stroke')).toBe('red'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('works across all cartesian traces', function() { @@ -773,8 +751,7 @@ describe('spikeline hover', function() { var lines = d3.selectAll('line.spikeline'); expect(lines.size()).toBe(4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/image_test.js b/test/jasmine/tests/image_test.js index 59c6cea43b4..64a68a1777b 100644 --- a/test/jasmine/tests/image_test.js +++ b/test/jasmine/tests/image_test.js @@ -7,7 +7,7 @@ var Image = require('@src/traces/image'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var customAssertions = require('../assets/custom_assertions'); var assertHoverLabelContent = customAssertions.assertHoverLabelContent; @@ -273,8 +273,7 @@ describe('image plot', function() { }).then(function() { assertImageCnt(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function getImageURL() { @@ -323,8 +322,7 @@ describe('image plot', function() { expect(imageURLs[1]).toEqual(imageURLs[3], 'image should restyle step 1'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -354,8 +352,7 @@ describe('image plot', function() { expect(x[2]).toEqual(x[0]); expect(y[2]).toEqual(y[0]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should handle restyling x0/y0 to category', function(done) { @@ -376,8 +373,7 @@ describe('image plot', function() { expect(x[1]).toEqual(x[0], 'image element should have same x position'); expect(y[1]).toEqual(y[0], 'image element should have same y position'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('keeps the correct ordering after hide and show', function(done) { @@ -406,8 +402,7 @@ describe('image plot', function() { .then(function() { expect(getIndices()).toEqual([0, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('renders pixelated image when source is defined', function(done) { @@ -417,8 +412,7 @@ describe('image plot', function() { .then(function(gd) { expect(gd.calcdata[0][0].trace._fastImage).toBeTruthy(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); [ @@ -436,8 +430,7 @@ describe('image plot', function() { .then(function(gd) { expect(gd.calcdata[0][0].trace._fastImage).toBe(false, 'when ' + attr[0] + ' is ' + attr[1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -517,8 +510,7 @@ describe('image hover:', function() { name: '' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display RGB channel values', function(done) { @@ -532,8 +524,7 @@ describe('image hover:', function() { name: '' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display RGBA channel values', function(done) { @@ -546,8 +537,7 @@ describe('image hover:', function() { name: '' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display HSL channel values', function(done) { @@ -561,8 +551,7 @@ describe('image hover:', function() { name: '' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display HSLA channel values', function(done) { @@ -576,8 +565,7 @@ describe('image hover:', function() { name: '' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); [ @@ -603,8 +591,7 @@ describe('image hover:', function() { name: '' }, 'variable `' + test[0] + '` should be available!'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -625,8 +612,7 @@ describe('image hover:', function() { name: '' }, 'variable text should be available!'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -663,8 +649,7 @@ describe('image hover:', function() { name: '' }, 'variable `' + test[0] + '` should be available!'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -696,8 +681,7 @@ describe('image hover:', function() { name: '' }, 'positions should be correct!'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/indicator_test.js b/test/jasmine/tests/indicator_test.js index 8b05fa8014d..d6779c7d0d8 100644 --- a/test/jasmine/tests/indicator_test.js +++ b/test/jasmine/tests/indicator_test.js @@ -6,7 +6,7 @@ var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var delay = require('../assets/delay'); -var failTest = require('../assets/fail_test'); + var supplyAllDefaults = require('../assets/supply_defaults'); // var calc = require('@src/traces/indicator/calc').calc; var customAssertions = require('../assets/custom_assertions.js'); @@ -176,8 +176,7 @@ describe('Indicator plot', function() { .then(function() { checkNumbersScale(1, 'should scale up'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('scale down but never back up if domain size is constant', function(done) { @@ -197,8 +196,7 @@ describe('Indicator plot', function() { .then(function() { checkNumbersScale(0.8, 'should not scale up'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); ['number', 'delta'].forEach(function(numberType) { @@ -222,8 +220,7 @@ describe('Indicator plot', function() { .then(function() { checkNumbersScale(1, 'should not rescale'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -251,8 +248,7 @@ describe('Indicator plot', function() { .then(function() { assertContent('$220'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('supports suffix', function(done) { @@ -265,8 +261,7 @@ describe('Indicator plot', function() { .then(function() { assertContent('220 potatoes'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('supports prefix', function(done) { @@ -279,8 +274,7 @@ describe('Indicator plot', function() { .then(function() { assertContent('Speed: 220'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -308,8 +302,7 @@ describe('Indicator plot', function() { .then(function() { assertContent(gd._fullData[0].delta.increasing.symbol + '0.100'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -331,8 +324,7 @@ describe('Indicator plot', function() { .then(function() { customAssertions.assertMultiNodeOrder(['g.bg-arc', 'g.value-arc', 'g.threshold-arc', 'g.gauge-outline']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -354,8 +346,7 @@ describe('Indicator plot', function() { .then(function() { customAssertions.assertMultiNodeOrder(['g.bg-bullet', 'g.value-bullet', 'g.threshold-bullet', 'g.gauge-outline']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -385,8 +376,7 @@ describe('Indicator plot', function() { expect(titleBBox.bottom).toBeCloseTo(numbersBBox.top - cn.titlePadding, 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('position it above angular axes', function(done) { @@ -406,8 +396,7 @@ describe('Indicator plot', function() { var axBBox = ax.getBoundingClientRect(); expect(titleBBox.bottom).toBeCloseTo(axBBox.top - cn.titlePadding, 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('position it left of bullet', function(done) { @@ -427,8 +416,7 @@ describe('Indicator plot', function() { var axBBox = ax.getBoundingClientRect(); expect(titleBBox.right < axBBox.left).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -483,8 +471,7 @@ describe('Indicator plot', function() { .then(function() { assert([1, 1, 0, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should draw blank path when value is NaN', function(done) { @@ -516,8 +503,7 @@ describe('Indicator plot', function() { .then(function() { expect(getBulletRect()).toBe('0', 'width-less bullet of value:null'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -550,8 +536,7 @@ describe('Indicator animations', function() { .then(function() { expect(Plots.transitionFromReact).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -632,7 +617,6 @@ describe('Indicator attributes', function() { // expect(gd._fullData[0].gauge.steps[0].range).toEqual([0, 250], 'wrong gauge.steps[0].range'); // expect(gd._fullData[0].gauge.steps[0].color).toEqual('rgba(255, 255, 0, 0.5)'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/isosurface_test.js b/test/jasmine/tests/isosurface_test.js index 2421ca8460d..2cadb756ac1 100644 --- a/test/jasmine/tests/isosurface_test.js +++ b/test/jasmine/tests/isosurface_test.js @@ -4,7 +4,7 @@ var Lib = require('@src/lib'); var supplyAllDefaults = require('../assets/supply_defaults'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var delay = require('../assets/delay'); var mouseEvent = require('../assets/mouse_event'); @@ -226,8 +226,7 @@ describe('Test isosurface', function() { .then(function() { assertPositions(0, 'to be OK positions'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl isosurface should create no iso-surface and set `gl-positions: []` for traces when all the data is outside isomin and isomax', function(done) { @@ -247,8 +246,7 @@ describe('Test isosurface', function() { .then(function() { assertPositions(0, 'to be OK positions'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -302,8 +300,7 @@ describe('Test isosurface', function() { return Plotly.purge(gd); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -412,8 +409,7 @@ describe('Test isosurface', function() { .then(function() { return Plotly.restyle(gd, 'hovertemplate', '%{value}
(%{x},%{y},%{z})!!'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -509,8 +505,7 @@ describe('Test isosurface grid', function() { cellsLength: 104 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -558,7 +553,6 @@ describe('Test isosurface grid', function() { }).then(function() { expect(Lib.warn).toHaveBeenCalledWith('Encountered arbitrary coordinates! Unable to input data grid.'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/layout_images_test.js b/test/jasmine/tests/layout_images_test.js index 4f2de029009..7d8aa3e8a51 100644 --- a/test/jasmine/tests/layout_images_test.js +++ b/test/jasmine/tests/layout_images_test.js @@ -6,7 +6,7 @@ var Lib = require('@src/lib'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var jsLogo = 'https://images.plot.ly/language-icons/api-home/js-logo.png'; @@ -135,8 +135,7 @@ describe('Layout images', function() { .then(function() { checkLayers(0, 0, 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should fall back on imageLowerLayer for below missing subplots', function(done) { @@ -163,8 +162,7 @@ describe('Layout images', function() { .then(function() { checkLayers(0, 2, 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('with anchors and sizing', function() { @@ -184,8 +182,7 @@ describe('Layout images', function() { .then(function() { expect(Plotly.d3.select('image').attr('preserveAspectRatio')).toBe('xMidYMid'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work for left top', function(done) { @@ -197,8 +194,7 @@ describe('Layout images', function() { .then(function() { testAspectRatio('xMinYMin'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work for right bottom', function(done) { @@ -210,8 +206,7 @@ describe('Layout images', function() { .then(function() { testAspectRatio('xMaxYMax'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work for stretch sizing', function(done) { @@ -224,8 +219,7 @@ describe('Layout images', function() { .then(function() { testAspectRatio('none'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work for fill sizing', function(done) { @@ -238,8 +232,7 @@ describe('Layout images', function() { .then(function() { testAspectRatio('xMinYMin slice'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -284,8 +277,7 @@ describe('Layout images', function() { mouseEvent('mouseup', 300, 250); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should move when referencing axes', function(done) { @@ -318,8 +310,7 @@ describe('Layout images', function() { mouseEvent('mouseup', 300, 250); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -366,8 +357,7 @@ describe('Layout images', function() { expect(newCanvasElement).toBeDefined(); expect(newCanvasElement.toDataURL).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update the image if changed', function(done) { @@ -380,8 +370,7 @@ describe('Layout images', function() { var newUrl = newImg.attr('xlink:href'); expect(url).not.toBe(newUrl); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update the image position if changed', function(done) { @@ -399,8 +388,7 @@ describe('Layout images', function() { var newImg = Plotly.d3.select('image'); expect([+newImg.attr('x'), +newImg.attr('y')]).toEqual([80, 100]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should remove the image tag if an invalid source', function(done) { @@ -412,8 +400,7 @@ describe('Layout images', function() { var newSelection = Plotly.d3.select('image'); expect(newSelection.size()).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -491,8 +478,7 @@ describe('Layout images', function() { assertImages(0); expect(gd.layout.images).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -586,8 +572,7 @@ describe('images log/linear axis changes', function() { .then(function() { expect(gd.layout.images[0].y).toBe(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('keeps the same data value if the axis type is changed without position', function(done) { @@ -626,7 +611,6 @@ describe('images log/linear axis changes', function() { expect(gd.layout.images[0].y).toBe(2); expect(gd.layout.images[0].sizey).toBe(2.5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/legend_scroll_test.js b/test/jasmine/tests/legend_scroll_test.js index 19b1ddbaeac..c5c711547bf 100644 --- a/test/jasmine/tests/legend_scroll_test.js +++ b/test/jasmine/tests/legend_scroll_test.js @@ -7,7 +7,7 @@ var DBLCLICKDELAY = require('@src/plot_api/plot_config').dfltConfig.doubleClickD var d3 = require('@plotly/d3'); var createGraph = require('../assets/create_graph_div'); var destroyGraph = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var getBBox = require('../assets/get_bbox'); var mouseEvent = require('../assets/mouse_event'); var touchEvent = require('../assets/touch_event'); @@ -250,8 +250,7 @@ describe('The legend', function() { expect(hasScrollBar()).toBe(true); expect(getScroll(gd)).not.toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates scrollBar size/existence on deleteTraces', function(done) { @@ -285,8 +284,7 @@ describe('The legend', function() { expect(hasScrollBar()).toBe(false); expect(getScroll(gd)).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should keep the scrollbar position after a toggle event', function(done) { @@ -387,8 +385,7 @@ describe('The legend', function() { expect(countLegendGroups(gd)).toBe(0); expect(countLegendClipPaths(gd)).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should resize when relayout\'ed with new height', function(done) { @@ -406,8 +403,7 @@ describe('The legend', function() { expect(+legendHeight).toBe(getPlotHeight(gd)); expect(+legendHeight).toBeLessThan(+origLegendHeight); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -441,8 +437,7 @@ describe('The legend', function() { expect(countLegendGroups(gd)).toBe(0); expect(countLegendClipPaths(gd)).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should resize when traces added', function(done) { @@ -453,8 +448,7 @@ describe('The legend', function() { expect(+legendHeight).toBeCloseTo(+origLegendHeight + 19, 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/legend_test.js b/test/jasmine/tests/legend_test.js index ad82a2d7eb0..2e401b563bc 100644 --- a/test/jasmine/tests/legend_test.js +++ b/test/jasmine/tests/legend_test.js @@ -665,8 +665,7 @@ describe('legend relayout update', function() { expect(d3.selectAll('g.legend').size()).toBe(1); assertPlotSize({width: 400}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update border styling', function(done) { @@ -702,8 +701,7 @@ describe('legend relayout update', function() { }).then(function() { assertLegendStyle('rgb(0, 0, 255)', 'rgb(255, 0, 0)', 10); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('should update legend valign', function() { @@ -730,8 +728,7 @@ describe('legend relayout update', function() { bottom = markerOffsetY(); expect(bottom).toBeGreaterThan(middle); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -750,8 +747,7 @@ describe('legend relayout update', function() { .then(function() { expect(gd._fullLayout._size.b).toBe(113); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -779,8 +775,7 @@ describe('legend relayout update', function() { .then(_assert('base', [5, 4.4], [512, 29])) .then(function() { return Plotly.relayout(gd, 'legend.x', 0.8); }) .then(_assert('after relayout almost to right edge', [188, 4.4], [512, 29])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should fit in graph viewport when changing legend.title.side', function(done) { @@ -815,8 +810,7 @@ describe('legend relayout update', function() { .then(_assert('after relayout to *left*', [607.54, 60], [180, 67])) .then(function() { return Plotly.relayout(gd, 'legend.title.side', 'top'); }) .then(_assert('after relayout to *top*', [667.72, 60], [120, 83])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to clear legend title using react', function(done) { @@ -851,8 +845,7 @@ describe('legend relayout update', function() { .then(function() { expect(d3.selectAll('.legendtitletext')[0].length).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -875,8 +868,7 @@ describe('legend orientation change:', function() { }).then(function() { expect(gd._fullLayout.legend.bgcolor).toBe(initialLegendBGColor); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -927,8 +919,7 @@ describe('legend restyle update', function() { expect(countLegendItems()).toEqual(1); assertTraceToggleRect(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1184,8 +1175,7 @@ describe('legend interaction', function() { .then(function() { assertVisible(gd, [true, true, true, true]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1286,7 +1276,7 @@ describe('legend interaction', function() { {target: 2, value: {name: 'hoo'}} ]); assertLabels(['boo~~~', '1 (trace 1)', 'hoo ', ' ', '4 (trace 1)']); - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); @@ -1326,8 +1316,7 @@ describe('legend interaction', function() { Plotly.newPlot(gd, data, layout, config) .then(toggleTrace) .then(assertToggled(false)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1400,8 +1389,7 @@ describe('legend interaction', function() { .then(assertVisible(['legendonly', 'legendonly', true])) .then(clickAt(s.clickPos[2])) .then(assertVisible(['legendonly', 'legendonly', 'legendonly'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1453,7 +1441,7 @@ describe('legend interaction', function() { .then(assertVisible([false, 'legendonly', true])) .then(click(0)) .then(assertVisible([false, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); it('clicking once toggles true -> legendonly', function(done) { @@ -1461,7 +1449,7 @@ describe('legend interaction', function() { .then(assertVisible([false, 'legendonly', true])) .then(click(1)) .then(assertVisible([false, 'legendonly', 'legendonly'])) - .catch(failTest).then(done); + .then(done, done.fail); }); it('double-clicking isolates a visible trace ', function(done) { @@ -1470,14 +1458,14 @@ describe('legend interaction', function() { .then(assertVisible([false, true, true])) .then(click(0, 2)) .then(assertVisible([false, true, 'legendonly'])) - .catch(failTest).then(done); + .then(done, done.fail); }); it('double-clicking an isolated trace shows all non-hidden traces', function(done) { Promise.resolve() .then(click(0, 2)) .then(assertVisible([false, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); }); @@ -1507,7 +1495,7 @@ describe('legend interaction', function() { .then(assertVisible([false, 'legendonly', true, 'legendonly'])) .then(click(1)) .then(assertVisible([false, true, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); it('isolates legendgroups as a whole', function(done) { @@ -1516,7 +1504,7 @@ describe('legend interaction', function() { .then(assertVisible([false, true, 'legendonly', true])) .then(click(1, 2)) .then(assertVisible([false, true, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); }); @@ -1549,7 +1537,7 @@ describe('legend interaction', function() { it('computes the initial visibility correctly', function(done) { Promise.resolve() .then(assertVisible([false, true, true, true, true, true, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); it('toggles the visibility of a non-groupby trace in the presence of groupby traces', function(done) { @@ -1558,7 +1546,7 @@ describe('legend interaction', function() { .then(assertVisible([false, true, 'legendonly', true, true, true, true, true])) .then(click(1)) .then(assertVisible([false, true, true, true, true, true, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); it('toggles the visibility of the first group in a groupby trace', function(done) { @@ -1567,7 +1555,7 @@ describe('legend interaction', function() { .then(assertVisible([false, 'legendonly', true, true, true, true, true, true])) .then(click(0)) .then(assertVisible([false, true, true, true, true, true, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); it('toggles the visibility of the third group in a groupby trace', function(done) { @@ -1576,7 +1564,7 @@ describe('legend interaction', function() { .then(assertVisible([false, true, true, true, 'legendonly', true, true, true])) .then(click(3)) .then(assertVisible([false, true, true, true, true, true, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); it('double-clicking isolates a non-groupby trace', function(done) { @@ -1585,7 +1573,7 @@ describe('legend interaction', function() { .then(assertVisible([false, true, 'legendonly', 'legendonly', 'legendonly', 'legendonly', 'legendonly', 'legendonly'])) .then(click(0, 2)) .then(assertVisible([false, true, true, true, true, true, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); it('double-clicking isolates a groupby trace', function(done) { @@ -1594,7 +1582,7 @@ describe('legend interaction', function() { .then(assertVisible([false, 'legendonly', true, 'legendonly', 'legendonly', 'legendonly', 'legendonly', 'legendonly'])) .then(click(1, 2)) .then(assertVisible([false, true, true, true, true, true, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); }); @@ -1614,7 +1602,7 @@ describe('legend interaction', function() { .then(assertVisible([true, 'legendonly', true])) .then(click(0, 2)) .then(assertVisible([true, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); it('isolate trace in legend, ignore trace that is not in legend (2)', function(done) { @@ -1623,7 +1611,7 @@ describe('legend interaction', function() { .then(assertVisible(['legendonly', true, true])) .then(click(1, 2)) .then(assertVisible([true, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); it('isolate trace in legend AND trace in associated legendgroup', function(done) { @@ -1632,7 +1620,7 @@ describe('legend interaction', function() { .then(assertVisible([true, 'legendonly', true])) .then(click(0, 2)) .then(assertVisible([true, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); it('isolate trace in legend, hide trace not in legend that has set legendgroup', function(done) { @@ -1641,7 +1629,7 @@ describe('legend interaction', function() { .then(assertVisible(['legendonly', true, 'legendonly'])) .then(click(1, 2)) .then(assertVisible([true, true, true])) - .catch(failTest).then(done); + .then(done, done.fail); }); }); @@ -1819,8 +1807,7 @@ describe('legend interaction', function() { expandedIndex: 0 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should have correct keys (groupby case)', function(done) { @@ -1848,8 +1835,7 @@ describe('legend interaction', function() { expandedIndex: 2 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should have correct keys (pie case)', function(done) { @@ -1872,8 +1858,7 @@ describe('legend interaction', function() { label: 'A' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1917,8 +1902,7 @@ describe('legend interaction', function() { { y: [3, 5, 0] } ]) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }, 2 * jasmine.DEFAULT_TIMEOUT_INTERVAL); it('- pie case', function(done) { @@ -1938,8 +1922,7 @@ describe('legend interaction', function() { values: [1, 2, 3] }]) .then(run) - .catch(failTest) - .then(done); + .then(done, done.fail); }, 2 * jasmine.DEFAULT_TIMEOUT_INTERVAL); }); }); @@ -1965,8 +1948,7 @@ describe('legend DOM', function() { expect(lastEl.getAttribute('class')).toBe('legendtoggle'); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2033,7 +2015,6 @@ describe('legend with custom doubleClickDelay', function() { .then(delay(tShort + 10)) .then(click(0)).then(delay(1.1 * tShort)).then(click(0)) .then(_assert('[short] after click + (1.1*t) delay + click', 2, 0)) - .catch(failTest) - .then(done); + .then(done, done.fail); }, 3 * jasmine.DEFAULT_TIMEOUT_INTERVAL); }); diff --git a/test/jasmine/tests/lib_test.js b/test/jasmine/tests/lib_test.js index cc8620dbcb6..9b91ef31189 100644 --- a/test/jasmine/tests/lib_test.js +++ b/test/jasmine/tests/lib_test.js @@ -8,7 +8,7 @@ var Plotly = require('@lib'); var Plots = require('@src/plots/plots'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + describe('Test lib.js:', function() { 'use strict'; @@ -2753,8 +2753,7 @@ describe('Queue', function() { expect(gd.undoQueue.index).toEqual(0); expect(gd.undoQueue.queue).toEqual([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should fill in undoQueue up to value found in *queueLength* config', function(done) { @@ -2824,7 +2823,6 @@ describe('Queue', function() { expect(gd.undoQueue.queue[1].redo.args[0][1]) .toEqual({ 'transforms[0]': null }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/localize_test.js b/test/jasmine/tests/localize_test.js index e6f1c564ef4..9591dbb8f4a 100644 --- a/test/jasmine/tests/localize_test.js +++ b/test/jasmine/tests/localize_test.js @@ -8,7 +8,7 @@ var utcFormat = require('d3-time-format').utcFormat; var Plotly = require('@lib'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + describe('localization', function() { 'use strict'; @@ -59,8 +59,7 @@ describe('localization', function() { expect(firstXLabel()).toBe('Jan 2001'); expect(firstYLabel()).toBe('0.5'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function getLabels(axLetter) { @@ -102,8 +101,7 @@ describe('localization', function() { 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('contains correct periods, dateTime, date, and time fields in the default locale', function(done) { @@ -145,8 +143,7 @@ describe('localization', function() { '01/01/2000~23:00:00', '01/02/2000~00:00:00', '01/02/2000~01:00:00' ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('uses the region first, then language (registered case)', function(done) { @@ -195,8 +192,7 @@ describe('localization', function() { expect(firstXLabel()).toBe('!1 2001'); expect(firstYLabel()).toBe('0~5'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('gives higher precedence to region than context vs registered', function(done) { @@ -241,8 +237,7 @@ describe('localization', function() { // full names were not overridden, so fall back on english expect(gd._fullLayout.xaxis._dateFormat('%a %b %A %B')(d0)).toBe('t !1 Thursday January'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('does not generate an automatic base locale in context', function(done) { @@ -255,8 +250,7 @@ describe('localization', function() { expect(firstXLabel()).toBe('Jan 2001'); expect(firstYLabel()).toBe('0.5'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('allows registering dictionary and format separately without overwriting the other', function() { @@ -317,8 +311,7 @@ describe('localization', function() { .then(function() { expect(firstYLabel()).toBe('0D500'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('uses extraFormat to localize the autoFormatted x-axis date tick', function(done) { @@ -367,8 +360,7 @@ describe('localization', function() { // test format.dayMonthYear expect(firstXLabel()).toBe('00:001 Jan 2001'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates ticks and modebar tooltips on Plotly.react', function(done) { @@ -401,7 +393,6 @@ describe('localization', function() { expect(firstXLabel()).toBe('Jan 2001'); expect(getZoomTip()).toBe('Zoom'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/mapbox_test.js b/test/jasmine/tests/mapbox_test.js index d2467b85ab7..d68d73d521f 100644 --- a/test/jasmine/tests/mapbox_test.js +++ b/test/jasmine/tests/mapbox_test.js @@ -11,7 +11,7 @@ var destroyGraphDiv = require('../assets/destroy_graph_div'); var mouseEvent = require('../assets/mouse_event'); var click = require('../assets/click'); var delay = require('../assets/delay'); -var failTest = require('../assets/fail_test'); + var supplyAllDefaults = require('../assets/supply_defaults'); var customAssertions = require('../assets/custom_assertions'); @@ -539,8 +539,7 @@ describe('mapbox plots', function() { .then(function() { expect(countVisibleTraces(gd, modes)).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should be able to delete and add traces', function(done) { @@ -580,8 +579,7 @@ describe('mapbox plots', function() { .then(function() { expect(gd._fullLayout.mapbox === undefined).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should not update center while dragging', function(done) { @@ -608,7 +606,7 @@ describe('mapbox plots', function() { // Second relayout on mapbox.center does not result in a setCenter // call since map drag is underway expect(map.setCenter).toHaveBeenCalledTimes(1); - }).catch(failTest).then(done); + }).then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should not update zoom while scroll wheeling', function(done) { @@ -628,7 +626,7 @@ describe('mapbox plots', function() { // call since a scroll wheel zoom is underway expect(map.setZoom).toHaveBeenCalledTimes(1); }); - }).catch(failTest).then(done); + }).then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should be able to restyle', function(done) { @@ -687,8 +685,7 @@ describe('mapbox plots', function() { [1, 0, 0, 1] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should be able to relayout', function(done) { @@ -749,8 +746,7 @@ describe('mapbox plots', function() { assertLayout([0, 0], 6, [80, 100, 454, 135]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should be able to relayout the map style', function(done) { @@ -775,8 +771,7 @@ describe('mapbox plots', function() { .then(function() { assertLayout('Mapbox Dark'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should be able to add, update and remove layers', function(done) { @@ -934,8 +929,7 @@ describe('mapbox plots', function() { expect(getLayerLength(gd)).toEqual(1); expect(countVisibleLayers(gd)).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should be able to update layer image', function(done) { @@ -1007,8 +1001,7 @@ describe('mapbox plots', function() { expect(indexUpper).toBeGreaterThan(0); expect(indexUpper).toBe(indexLower + 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should be able to react to layer changes', function(done) { @@ -1062,8 +1055,7 @@ describe('mapbox plots', function() { .then(function() { _assert('rgba(255,0,0,1)'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should not wedge graph after reacting to invalid layer', function(done) { @@ -1096,8 +1088,7 @@ describe('mapbox plots', function() { expect(mapInfo.layoutLayers.length).toBe(1, 'one layer'); expect(mapInfo.layoutSources.length).toBe(1, 'one layer source'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should not attempt to remove non-existing layer sources', function(done) { @@ -1118,8 +1109,7 @@ describe('mapbox plots', function() { }); }) .then(_assert('no layers', 0)) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should validate layout layer input', function(done) { @@ -1136,8 +1126,7 @@ describe('mapbox plots', function() { expect(mapInfo.layoutLayers.length).toBe(0, 'no on-map layer'); expect(mapInfo.layoutSources.length).toBe(0, 'no map source'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should be able to update the access token', function(done) { @@ -1153,8 +1142,7 @@ describe('mapbox plots', function() { expect(gd._fullLayout.mapbox.accesstoken).toEqual(MAPBOX_ACCESS_TOKEN); expect(gd._promises.length).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should be able to update traces', function(done) { @@ -1191,8 +1179,7 @@ describe('mapbox plots', function() { .then(function() { assertDataPts([5, 5]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should display to hover labels on mouse over', function(done) { @@ -1229,8 +1216,7 @@ describe('mapbox plots', function() { name: 'trace 0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should respond to hover interactions by', function(done) { @@ -1277,8 +1263,7 @@ describe('mapbox plots', function() { expect(hoverCnt).toEqual(1); expect(unhoverCnt).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should not attempt to rehover over exiting subplots', function(done) { @@ -1309,8 +1294,7 @@ describe('mapbox plots', function() { expect(Fx.hover.calls.argsFor(0)[2]).toBe('xy'); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should respond drag / scroll / double-click interactions', function(done) { @@ -1395,8 +1379,7 @@ describe('mapbox plots', function() { expect(doubleClickCnt).toBe(1, 'double click cnt'); expect(getMapInfo(gd).zoom).toBeGreaterThan(1.234); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should respond to click interactions by', function(done) { @@ -1422,8 +1405,7 @@ describe('mapbox plots', function() { expect(ptData.curveNumber).toEqual(0, 'returning the correct curve number'); expect(ptData.pointNumber).toEqual(0, 'returning the correct point number'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should respect scrollZoom config option', function(done) { @@ -1477,8 +1459,7 @@ describe('mapbox plots', function() { var zoomNew = getMapInfo(gd).zoom; expect(zoomNew).toBe(zoom0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); describe('attributions', function() { @@ -1489,8 +1470,7 @@ describe('mapbox plots', function() { expect(s.size()).toBe(1); expect(s.text()).toEqual('© OpenStreetMap'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be displayed for style from Mapbox', function(done) { @@ -1500,8 +1480,7 @@ describe('mapbox plots', function() { expect(s.size()).toBe(1); expect(s.text()).toEqual('© Mapbox © OpenStreetMap Improve this map'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function mockLayoutCustomStyle() { @@ -1541,8 +1520,7 @@ describe('mapbox plots', function() { expect(s.size()).toBe(1); expect(s.text()).toEqual(''); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be displayed for custom style with attribution', function(done) { @@ -1555,8 +1533,7 @@ describe('mapbox plots', function() { expect(s.size()).toBe(1); expect(s.text()).toEqual(attr); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be displayed for attributions defined in layers\' sourceattribution', function(done) { @@ -1576,8 +1553,7 @@ describe('mapbox plots', function() { expect(s.html().indexOf('')).toBe(-1); expect(s.html().indexOf('<img src=x onerror="alert(XSS);">')).not.toBe(-1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1746,8 +1722,7 @@ describe('mapbox react', function() { .then(function() { assertTile(secondLink); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); }); @@ -1870,8 +1845,7 @@ describe('test mapbox trace/layout *below* interactions', function() { layout: 24 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, 8 * jasmine.DEFAULT_TIMEOUT_INTERVAL); it('@gl should be able to update *below* - scattermapbox + choroplethmapbox + densitymapbox case', function(done) { @@ -1936,8 +1910,7 @@ describe('test mapbox trace/layout *below* interactions', function() { choropleth: [5, 6] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, 8 * jasmine.DEFAULT_TIMEOUT_INTERVAL); it('@gl should be warn when *below* value does not correspond to a layer on the map', function(done) { @@ -2010,8 +1983,7 @@ describe('test mapbox trace/layout *below* interactions', function() { .then(function() { expect(Lib.warn).toHaveBeenCalledTimes(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, 8 * jasmine.DEFAULT_TIMEOUT_INTERVAL); }); @@ -2052,8 +2024,7 @@ describe('Test mapbox GeoJSON fetching:', function() { expect(Lib.isPlainObject(window.PlotlyGeoAssets[url])).toBe(true, 'is a GeoJSON object'); expect(Lib.isPlainObject(window.PlotlyGeoAssets[url2])).toBe(true, 'is a GeoJSON object'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should fetch GeoJSON using URLs found in the traces', function(done) { @@ -2078,8 +2049,7 @@ describe('Test mapbox GeoJSON fetching:', function() { expect(actual).toEqual(new Error('GeoJSON at URL "invalidUrl" does not exist.')); expect(window.PlotlyGeoAssets.invalidUrl).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); }); @@ -2116,8 +2086,7 @@ describe('mapbox toImage', function() { .then(function(imgData) { expect(imgData.length).toBeGreaterThan(MINIMUM_LENGTH); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should generate image data with config credentials', function(done) { @@ -2134,8 +2103,7 @@ describe('mapbox toImage', function() { .then(function(imgData) { expect(imgData.length).toBeGreaterThan(MINIMUM_LENGTH); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); it('@gl should generate image data with layout credentials', function(done) { @@ -2154,8 +2122,7 @@ describe('mapbox toImage', function() { .then(function(imgData) { expect(imgData.length).toBeGreaterThan(MINIMUM_LENGTH); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); }); diff --git a/test/jasmine/tests/mesh3d_test.js b/test/jasmine/tests/mesh3d_test.js index 49ed39443b0..831e4cb15d1 100644 --- a/test/jasmine/tests/mesh3d_test.js +++ b/test/jasmine/tests/mesh3d_test.js @@ -3,7 +3,7 @@ var Lib = require('@src/lib'); var supplyDefaults = require('@src/traces/mesh3d').supplyDefaults; var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + describe('Test mesh3d', function() { 'use strict'; @@ -268,8 +268,7 @@ describe('Test mesh3d', function() { return Plotly.purge(gd); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -317,8 +316,7 @@ describe('Test mesh3d', function() { .then(function() { assertCells(4, 'to be OK cells'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be visible when the indices could be rounded to be in vertex range', function(done) { @@ -340,8 +338,7 @@ describe('Test mesh3d', function() { .then(function() { assertCells(4, 'to be OK cells'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be visible when the indices are equal or greater than the number of vertices', function(done) { @@ -363,8 +360,7 @@ describe('Test mesh3d', function() { .then(function() { assertCells(0, 'to be OK cells'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be visible when the indices are negative', function(done) { @@ -386,8 +382,7 @@ describe('Test mesh3d', function() { .then(function() { assertCells(0, 'to be OK cells'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be visible when the indices have different sizes', function(done) { @@ -409,8 +404,7 @@ describe('Test mesh3d', function() { .then(function() { assertCells(0, 'to be OK cells'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be visible when the indices are provided and OK', function(done) { @@ -432,8 +426,7 @@ describe('Test mesh3d', function() { .then(function() { assertCells(4, 'to be OK cells'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be visible when values are passed in string format', function(done) { @@ -454,8 +447,7 @@ describe('Test mesh3d', function() { .then(function() { assertCells(4, 'to be OK cells'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be visible when the index arrays are empty', function(done) { @@ -477,8 +469,7 @@ describe('Test mesh3d', function() { .then(function() { assertCells(0, 'to be OK cells'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be visible when the index arrays are not provided', function(done) { @@ -497,8 +488,7 @@ describe('Test mesh3d', function() { .then(function() { assertCells(3, 'to be OK cells'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be visible when the vertex arrays are empty', function(done) { @@ -517,8 +507,7 @@ describe('Test mesh3d', function() { .then(function() { assertCells(0, 'to be OK cells'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be invisible when the vertex arrays missing', function(done) { @@ -528,8 +517,7 @@ describe('Test mesh3d', function() { .then(function() { assertVisibility(false, 'to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be invisible when the vertex arrays are not arrays - number case', function(done) { @@ -545,8 +533,7 @@ describe('Test mesh3d', function() { .then(function() { assertVisibility(false, 'to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be invisible when the vertex arrays are not arrays - boolean case', function(done) { @@ -562,8 +549,7 @@ describe('Test mesh3d', function() { .then(function() { assertVisibility(false, 'to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be invisible when the vertex arrays are not arrays - object case', function(done) { @@ -579,8 +565,7 @@ describe('Test mesh3d', function() { .then(function() { assertVisibility(false, 'to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be invisible when the vertex arrays are not arrays - string case', function(done) { @@ -596,8 +581,7 @@ describe('Test mesh3d', function() { .then(function() { assertVisibility(false, 'to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be invisible when the index arrays are not arrays - string case', function(done) { @@ -613,8 +597,7 @@ describe('Test mesh3d', function() { .then(function() { assertVisibility(false, 'to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be invisible when the index arrays are not arrays - object case', function(done) { @@ -630,8 +613,7 @@ describe('Test mesh3d', function() { .then(function() { assertVisibility(false, 'to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be invisible when the index arrays are not arrays - boolean case', function(done) { @@ -647,8 +629,7 @@ describe('Test mesh3d', function() { .then(function() { assertVisibility(false, 'to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mesh3d should be invisible when the index arrays are not arrays - number case', function(done) { @@ -664,8 +645,7 @@ describe('Test mesh3d', function() { .then(function() { assertVisibility(false, 'to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/modebar_test.js b/test/jasmine/tests/modebar_test.js index f5db01e588b..6eb991c1e6e 100644 --- a/test/jasmine/tests/modebar_test.js +++ b/test/jasmine/tests/modebar_test.js @@ -1048,8 +1048,7 @@ describe('ModeBar', function() { expect(Registry.call) .toHaveBeenCalledWith('downloadImage', gd, {format: 'png'}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should accept overriding defaults', function(done) { @@ -1065,8 +1064,7 @@ describe('ModeBar', function() { expect(Registry.call) .toHaveBeenCalledWith('downloadImage', gd, {format: 'svg', filename: 'x'}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should accept overriding defaults with null values', function(done) { @@ -1078,8 +1076,7 @@ describe('ModeBar', function() { expect(Registry.call) .toHaveBeenCalledWith('downloadImage', gd, {format: 'png', width: null, height: null}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1395,8 +1392,7 @@ describe('ModeBar', function() { _assert(10, 10, 8); button.isActive(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1423,8 +1419,7 @@ describe('ModeBar', function() { _run('cartesian bundle'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1445,8 +1440,7 @@ describe('ModeBar', function() { selectButton(gd._fullLayout._modeBar, 'resetViews').click(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1496,8 +1490,7 @@ describe('ModeBar', function() { style = document.querySelector(styleSelector); expect(style).toBeNull(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('changes icon colors', function(done) { @@ -1510,8 +1503,7 @@ describe('ModeBar', function() { .then(function() { checkButtonColor(button, colors[1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('changes active icon colors', function(done) { @@ -1525,8 +1517,7 @@ describe('ModeBar', function() { .then(function() { checkButtonColor(button, colors[1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('changes background color (displayModeBar: hover)', function(done) { @@ -1542,8 +1533,7 @@ describe('ModeBar', function() { expect(style.backgroundColor).toBe('rgba(0, 0, 0, 0)'); expect(getStyleRule().rules[3].style.backgroundColor).toBe(colors[1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('changes background color (displayModeBar: true)', function(done) { @@ -1559,8 +1549,7 @@ describe('ModeBar', function() { expect(style.backgroundColor).toBe(colors[1]); expect(getStyleRule().rules[3].style.backgroundColor).toBe(colors[1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('changes orientation', function(done) { @@ -1578,8 +1567,7 @@ describe('ModeBar', function() { size = modeBarEl.getBoundingClientRect(); expect(size.width > size.height).toBeTruthy(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/page_test.js b/test/jasmine/tests/page_test.js index 216ed383222..046b00189e1 100644 --- a/test/jasmine/tests/page_test.js +++ b/test/jasmine/tests/page_test.js @@ -4,7 +4,6 @@ var Lib = require('@src/lib'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); describe('page rendering', function() { @@ -82,7 +81,6 @@ describe('page rendering', function() { expect(bBox.height).toBe(0); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/parcats_test.js b/test/jasmine/tests/parcats_test.js index 898c957c3b6..9a5152c95b0 100644 --- a/test/jasmine/tests/parcats_test.js +++ b/test/jasmine/tests/parcats_test.js @@ -182,8 +182,7 @@ describe('Basic parcats trace', function() { expect(trace.type).toEqual('parcats'); expect(trace.dimensions.length).toEqual(3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should compute initial model properly', function(done) { @@ -261,8 +260,7 @@ describe('Basic parcats trace', function() { count: 9, valueInds: [0, 1, 2, 3, 4, 5, 6, 7, 8]}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should compute initial data properly', function(done) { @@ -271,8 +269,7 @@ describe('Basic parcats trace', function() { // Check that trace data matches input expect(gd.data[0]).toEqual(mock.data[0]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should compute initial fullData properly', function(done) { @@ -284,8 +281,7 @@ describe('Basic parcats trace', function() { expect(fullTrace.bundlecolors).toBe(true); expect(fullTrace.dimensions[1].visible).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should compute initial model views properly', function(done) { @@ -294,8 +290,7 @@ describe('Basic parcats trace', function() { checkParcatsModelView(gd); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should compute initial svg properly', function(done) { @@ -303,8 +298,7 @@ describe('Basic parcats trace', function() { .then(function() { checkParcatsSvg(gd); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -389,8 +383,7 @@ describe('Dimension reordered parcats trace', function() { categoryInd: 0, displayInd: 0}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should recover from bad display order specification', function(done) { @@ -454,8 +447,7 @@ describe('Dimension reordered parcats trace', function() { categoryInd: 0, displayInd: 0}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should compute initial model views properly', function(done) { @@ -464,8 +456,7 @@ describe('Dimension reordered parcats trace', function() { checkParcatsModelView(gd); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should compute initial svg properly', function(done) { @@ -473,8 +464,7 @@ describe('Dimension reordered parcats trace', function() { .then(function() { checkParcatsSvg(gd); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -622,8 +612,7 @@ describe('Drag to reordered dimensions', function() { [0]]); restyleCallback.calls.reset(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should support dragging dimension label to reorder dimensions in perpendicular arrangement', function(done) { @@ -697,8 +686,7 @@ describe('Drag to reordered dimensions', function() { restyleCallback.calls.reset(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should NOT support dragging dimension label to reorder dimensions in fixed arrangement', function(done) { @@ -758,8 +746,7 @@ describe('Drag to reordered dimensions', function() { expect(restyleCallback).toHaveBeenCalledTimes(0); restyleCallback.calls.reset(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -978,8 +965,7 @@ describe('Drag to reordered categories', function() { restyleCallback.calls.reset(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should support dragging category to reorder categories only in perpendicular arrangement', function(done) { @@ -1061,8 +1047,7 @@ describe('Drag to reordered categories', function() { restyleCallback.calls.reset(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should NOT support dragging category to reorder categories or dimensions in fixed arrangement', function(done) { @@ -1130,8 +1115,7 @@ describe('Drag to reordered categories', function() { expect(restyleCallback).toHaveBeenCalledTimes(0); restyleCallback.calls.reset(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1192,8 +1176,7 @@ describe('Click events', function() { var constraints = clickData.constraints; expect(constraints).toEqual({1: 'C'}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should NOT fire on category click if hoverinfo is skip', function(done) { @@ -1223,8 +1206,7 @@ describe('Click events', function() { // Check that click callback was called expect(clickData).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should fire on path click', function(done) { @@ -1267,8 +1249,7 @@ describe('Click events', function() { var constraints = clickData.constraints; expect(constraints).toEqual({0: 1, 1: 'C', 2: 11}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should NOT fire on path click if hoverinfo is skip', function(done) { @@ -1298,8 +1279,7 @@ describe('Click events', function() { // Check that click callback was called expect(clickData).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1357,8 +1337,7 @@ describe('Click events with hoveron color', function() { var constraints = clickData.constraints; expect(constraints).toEqual({1: 'C', color: 1}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); @@ -1401,8 +1380,7 @@ describe('Click events with hoveron color', function() { var constraints = clickData.constraints; expect(constraints).toEqual({0: 1, 1: 'C', 2: 11, color: 1}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1488,8 +1466,7 @@ describe('Hover events', function() { {curveNumber: 0, pointNumber: 5}, {curveNumber: 0, pointNumber: 8}]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('hover and unhover should fire on path', function(done) { @@ -1555,8 +1532,7 @@ describe('Hover events', function() { {curveNumber: 0, pointNumber: 5}, {curveNumber: 0, pointNumber: 8}]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1638,8 +1614,7 @@ describe('Hover events with hoveron color', function() { expect(pts).toEqual([ {curveNumber: 0, pointNumber: 5}]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('hover and unhover should fire on path hoveron color', function(done) { @@ -1703,8 +1678,7 @@ describe('Hover events with hoveron color', function() { expect(pts).toEqual([ {curveNumber: 0, pointNumber: 5}]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/parcoords_test.js b/test/jasmine/tests/parcoords_test.js index ff3afecb1b9..32c883b47b1 100644 --- a/test/jasmine/tests/parcoords_test.js +++ b/test/jasmine/tests/parcoords_test.js @@ -9,7 +9,7 @@ var PC = require('@src/traces/parcoords/constants'); var createGraphDiv = require('../assets/create_graph_div'); var delay = require('../assets/delay'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var click = require('../assets/click'); var supplyAllDefaults = require('../assets/supply_defaults'); @@ -384,8 +384,7 @@ describe('parcoords edge cases', function() { expect(gd.data[0].dimensions[1].range).toEqual([0, 700000]); expect(gd.data[0].dimensions[1].constraintrange).not.toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Do something sensible if there is no panel i.e. dimension count is less than 2', function(done) { @@ -400,8 +399,7 @@ describe('parcoords edge cases', function() { expect(gd.data[0].dimensions[0].constraintrange).toBeDefined(); expect(gd.data[0].dimensions[0].constraintrange).toEqual([200, 700]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Does not error with zero dimensions', function(done) { @@ -412,8 +410,7 @@ describe('parcoords edge cases', function() { expect(gd.data[0].dimensions.length).toEqual(0); expect(document.querySelectorAll('.axis').length).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Does not error with dimensions including only 0', function(done) { @@ -431,8 +428,7 @@ describe('parcoords edge cases', function() { expect(gd.data[0].dimensions.length).toEqual(1); expect(document.querySelectorAll('.axis').length).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Works with duplicate dimension labels', function(done) { @@ -446,8 +442,7 @@ describe('parcoords edge cases', function() { expect(gd.data[0].dimensions.length).toEqual(2); expect(document.querySelectorAll('.axis').length).toEqual(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Works with a single line; also, use a longer color array than the number of lines', function(done) { @@ -473,8 +468,7 @@ describe('parcoords edge cases', function() { expect(document.querySelectorAll('.axis').length).toEqual(2); expect(gd.data[0].dimensions[0].values.length).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Does not raise an error with zero lines and no specified range', function(done) { @@ -495,8 +489,7 @@ describe('parcoords edge cases', function() { expect(document.querySelectorAll('.axis').length).toEqual(0); expect(gd.data[0].dimensions[0].values.length).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Works with non-finite `values` elements', function(done) { @@ -521,8 +514,7 @@ describe('parcoords edge cases', function() { expect(document.querySelectorAll('.axis').length).toEqual(2); expect(gd.data[0].dimensions[0].values.length).toEqual(values[0].length); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Works with 60 dimensions', function(done) { @@ -551,8 +543,7 @@ describe('parcoords edge cases', function() { expect(gd.data[0].dimensions.length).toEqual(60); expect(document.querySelectorAll('.axis').length).toEqual(60); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Truncates 60+ dimensions to 60', function(done) { @@ -579,8 +570,7 @@ describe('parcoords edge cases', function() { expect(gd.data[0].dimensions.length).toEqual(60); expect(document.querySelectorAll('.axis').length).toEqual(60); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Truncates dimension values to the shortest array, retaining only 3 lines', function(done) { @@ -608,8 +598,7 @@ describe('parcoords edge cases', function() { expect(gd.data[0].dimensions.length).toEqual(60); expect(document.querySelectorAll('.axis').length).toEqual(60); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Skip dimensions which are not plain objects or whose `values` is not an array', function(done) { @@ -641,8 +630,7 @@ describe('parcoords edge cases', function() { expect(gd.data[0].dimensions.length).toEqual(5); // it's still five, but ... expect(document.querySelectorAll('.axis').length).toEqual(3); // only 3 axes shown }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -664,8 +652,7 @@ describe('parcoords Lifecycle methods', function() { expect(gd.data.length).toEqual(0); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Plotly.deleteTraces with two traces removes the deleted plot', function(done) { @@ -696,8 +683,7 @@ describe('parcoords Lifecycle methods', function() { expect(document.querySelectorAll('.y-axis').length).toEqual(0); expect(gd.data.length).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function _assertVisibleData(visible, msg) { @@ -732,8 +718,7 @@ describe('parcoords Lifecycle methods', function() { .then(_assertVisibleData(true, 'initial')) .then(restyleDimension('values', 1, [[]])) .then(_assertVisibleData(false, 'no panels')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl displays focused and context data after relayout', function(done) { @@ -745,8 +730,7 @@ describe('parcoords Lifecycle methods', function() { return Plotly.relayout(gd, 'paper_bgcolor', '#eef'); }) .then(_assertVisibleData(true, 'after relayout')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('Having two datasets', function() { @@ -772,8 +756,7 @@ describe('parcoords Lifecycle methods', function() { expect(document.querySelectorAll('.gl-container').length).toEqual(1); expect(gd.data.length).toEqual(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Plotly.addTraces should add a new parcoords row', function(done) { @@ -796,8 +779,7 @@ describe('parcoords Lifecycle methods', function() { expect(document.querySelectorAll('.gl-container').length).toEqual(1); expect(gd.data.length).toEqual(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Plotly.restyle should update the existing parcoords row', function(done) { @@ -840,8 +822,7 @@ describe('parcoords Lifecycle methods', function() { expect(document.querySelectorAll('.gl-container').length).toEqual(1); expect(gd.data.length).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -871,8 +852,7 @@ describe('parcoords Lifecycle methods', function() { expect(rgb[0]).not.toBe(0, 'all red'); expect(rgb[2]).toBe(0, 'no blue'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl line.color `Plotly.restyle` should not change context layer', function(done) { @@ -907,8 +887,7 @@ describe('parcoords Lifecycle methods', function() { expect(newRGB).toBe(oldRGB, 'no change to context'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -939,8 +918,7 @@ describe('parcoords basic use', function() { }); expect(cnt).toBe(3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl `Plotly.plot` should have proper fields on `gd.data` on initial rendering', function(done) { @@ -960,8 +938,7 @@ describe('parcoords basic use', function() { expect(gd.data[0].dimensions[1].range).toEqual([0, 700000]); expect(gd.data[0].dimensions[1].constraintrange).not.toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Calling `Plotly.plot` again should add the new parcoords', function(done) { @@ -991,8 +968,7 @@ describe('parcoords basic use', function() { expect(document.querySelectorAll('.axis').length).toEqual(20); // one dimension is `visible: false` }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Calling `Plotly.restyle` with a string path to colorscale should amend the preexisting parcoords', function(done) { @@ -1011,8 +987,7 @@ describe('parcoords basic use', function() { expect(gd.data[0].dimensions[1].constraintrange).not.toBeDefined(); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Calling `Plotly.restyle` for a dimension should amend the preexisting dimension', function(done) { @@ -1036,8 +1011,7 @@ describe('parcoords basic use', function() { .then(restyleDimension('constraintrange', [[0, 1]])) .then(restyleDimension('values', [[0, 0.1, 0.4, 1, 2, 0, 0.1, 0.4, 1, 2]])) .then(restyleDimension('visible', false)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Calling `Plotly.restyle` with an object should amend the preexisting parcoords', function(done) { @@ -1060,8 +1034,7 @@ describe('parcoords basic use', function() { expect(gd.data[0].dimensions[0].constraintrange).toEqual([100000, 150000]); expect(gd.data[0].dimensions[1].constraintrange).not.toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Should emit a \'plotly_restyle\' event', function(done) { @@ -1086,8 +1059,7 @@ describe('parcoords basic use', function() { .then(function() { expect(tester.get()).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Should emit a \'plotly_hover\' event', function(done) { @@ -1117,8 +1089,7 @@ describe('parcoords basic use', function() { expect(hoverCalls).toBe(1); expect(unhoverCalls).toBe(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Calling `Plotly.relayout` with string should amend the preexisting parcoords', function(done) { @@ -1139,8 +1110,7 @@ describe('parcoords basic use', function() { expect(gd.data[0].dimensions[0].constraintrange).toEqual([100000, 150000]); expect(gd.data[0].dimensions[1].constraintrange).not.toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Calling `Plotly.relayout`with object should amend the preexisting parcoords', function(done) { @@ -1161,8 +1131,7 @@ describe('parcoords basic use', function() { expect(gd.data[0].dimensions[0].constraintrange).toEqual([100000, 150000]); expect(gd.data[0].dimensions[1].constraintrange).not.toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl Calling `Plotly.animate` with patches targeting `dimensions` attributes should do the right thing', function(done) { @@ -1200,8 +1169,7 @@ describe('parcoords basic use', function() { values: [1, 4] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should fire *plotly_webglcontextlost* when on webgl context lost', function(done) { @@ -1236,8 +1204,7 @@ describe('parcoords basic use', function() { trigger('pick'); _assert('pickLayer', 3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1331,8 +1298,7 @@ describe('parcoords react more attributes', function() { expect(nHighlight[1]).toBe(2); expect(nHighlight[0]).toBe(4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should change axis visibility', function(done) { @@ -1357,8 +1323,7 @@ describe('parcoords react more attributes', function() { expect(allLabels.size()).toBe(3); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1512,8 +1477,7 @@ describe('parcoords constraint interactions - without defined axis ranges', func checkDashCount(getDashArray(0), 2); expect(gd.data[0].dimensions[0].constraintrange).toBeCloseTo2DArray([[0.75, 1.25], [3.75, 4]]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl updates continuous constraints with no snap', function(done) { @@ -1564,8 +1528,7 @@ describe('parcoords constraint interactions - without defined axis ranges', func expect(getDashArray(1)).toBeCloseToArray(newDashArray); expect(gd.data[0].dimensions[1].constraintrange).toBeCloseToArray([-2.913369429404415, 9]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl will only select one region when multiselect is disabled', function(done) { @@ -1604,8 +1567,7 @@ describe('parcoords constraint interactions - without defined axis ranges', func checkDashCount(finalDashArray, 2); expect(gd.data[0].dimensions[0].constraintrange).toBeCloseTo2DArray([[0.75, 1.25], [2.75, 4]]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should keep single point dimension selected', function(done) { @@ -1648,8 +1610,7 @@ describe('parcoords constraint interactions - without defined axis ranges', func expect(rgb[0]).toBe(0, 'no red'); expect(rgb[2]).not.toBe(0, 'all blue'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1735,8 +1696,7 @@ describe('parcoords constraint interactions - with defined axis ranges', functio .then(function() { expect(gd.data[0].dimensions[1].constraintrange).toBeCloseToArray([3.75, 6.25]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1801,7 +1761,6 @@ describe('parcoords constraint click interactions - with pre-defined constraint .then(function() { expect(gd._fullData[0].dimensions[1].constraintrange).toEqual(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/pie_test.js b/test/jasmine/tests/pie_test.js index 98d730f570c..60ab7ce3320 100644 --- a/test/jasmine/tests/pie_test.js +++ b/test/jasmine/tests/pie_test.js @@ -4,7 +4,7 @@ var Lib = require('@src/lib'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var click = require('../assets/click'); var getClientPosition = require('../assets/get_client_position'); var mouseEvent = require('../assets/mouse_event'); @@ -206,8 +206,7 @@ describe('Pie traces', function() { legendEntries.each(checkPath); expect(legendEntries.size()).toBe(5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can sum values or count labels', function(done) { @@ -233,8 +232,7 @@ describe('Pie traces', function() { } } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function _checkSliceColors(colors) { @@ -282,8 +280,7 @@ describe('Pie traces', function() { return Plotly.newPlot(gd, data2); }) .then(_checkSliceColors(['0,0,0', '255,0,0', '255,0,0', '0,0,0'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can use a separate pie colorway and disable extended colors', function(done) { @@ -301,8 +298,7 @@ describe('Pie traces', function() { return Plotly.relayout(gd, {extendpiecolors: null}); }) .then(_checkSliceColors(['255,255,0', '0,255,0', '0,0,255', '255,255,102', '102,255,102', '102,102,255', '153,153,0'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows multiline title in hole', function(done) { @@ -321,8 +317,7 @@ describe('Pie traces', function() { expect(Math.abs(titlePos[0] - pieCenterPos[0])).toBeLessThan(4); expect(Math.abs(titlePos[1] - pieCenterPos[1])).toBeLessThan(4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function _verifyPointInCircle(x, y, circleCenter, radius) { @@ -359,8 +354,7 @@ describe('Pie traces', function() { expect(_verifyPointInCircle(titleBox.right, titleBox.bottom, pieCenterPos, radius)) .toBeLessThan(3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function _verifyTitle(checkLeft, checkRight, checkTop, checkBottom, checkMiddleX) { @@ -394,8 +388,7 @@ describe('Pie traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(false, false, true, false, true)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows title top center if titleposition is undefined and no hole', function(done) { @@ -409,8 +402,7 @@ describe('Pie traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(false, false, true, false, true)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows title top center', function(done) { @@ -425,8 +417,7 @@ describe('Pie traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(false, false, true, false, true)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows title top left', function(done) { @@ -441,8 +432,7 @@ describe('Pie traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(true, false, true, false, false)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows title top right', function(done) { @@ -457,8 +447,7 @@ describe('Pie traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(false, true, true, false, false)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows title bottom left', function(done) { @@ -473,8 +462,7 @@ describe('Pie traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(true, false, false, true, false)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows title bottom center', function(done) { @@ -489,8 +477,7 @@ describe('Pie traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(false, false, false, true, true)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows title bottom right', function(done) { @@ -505,8 +492,7 @@ describe('Pie traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(false, true, false, true, false)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle title position', function(done) { @@ -529,8 +515,7 @@ describe('Pie traces', function() { .then(_verifyTitle(false, false, false, true, true)) .then(function() { return Plotly.restyle(gd, 'titleposition', 'bottom right'); }) .then(_verifyTitle(false, true, false, true, false)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('does not intersect pulled slices', function(done) { @@ -556,8 +541,7 @@ describe('Pie traces', function() { }); expect(titleBox.bottom).toBeLessThan(minSliceTop); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('correctly positions large title', function(done) { @@ -572,8 +556,7 @@ describe('Pie traces', function() { textinfo: 'none' }], {height: 300, width: 300}) .then(_verifyTitle(false, false, true, false, true)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('support separate stroke width values per slice', function(done) { @@ -606,8 +589,7 @@ describe('Pie traces', function() { expect(this.style.strokeWidth).toBe(expWidths[d[0].i], 'item #' + i); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); [ @@ -634,8 +616,7 @@ describe('Pie traces', function() { .then(_checkFontColors(['red', 'green', 'blue'])) .then(_checkFontFamilies(['Arial', 'Gravitas', 'Roboto'])) .then(_checkFontSizes([12, 20, 16])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -650,8 +631,7 @@ describe('Pie traces', function() { it('should use inside text colors contrasting to explicitly set slice colors by default', function(done) { Plotly.plot(gd, [insideTextTestsTrace]) .then(_checkFontColors([DARK, DARK, LIGHT, LIGHT, DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use inside text colors contrasting to standard slice colors by default', function(done) { @@ -660,39 +640,34 @@ describe('Pie traces', function() { Plotly.plot(gd, [noMarkerTrace]) .then(_checkFontColors([LIGHT, DARK, LIGHT, LIGHT, LIGHT, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use textfont.color for inside text instead of the contrasting default', function(done) { var data = Lib.extendFlat({}, insideTextTestsTrace, {textfont: {color: 'red'}}); Plotly.plot(gd, [data]) .then(_checkFontColors(Lib.repeat('red', 6))) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use matching color from textfont.color array for inside text, contrasting otherwise', function(done) { var data = Lib.extendFlat({}, insideTextTestsTrace, {textfont: {color: ['red', 'blue']}}); Plotly.plot(gd, [data]) .then(_checkFontColors(['red', 'blue', LIGHT, LIGHT, DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not use layout.font.color for inside text, but a contrasting color instead', function(done) { Plotly.plot(gd, [insideTextTestsTrace], {font: {color: 'green'}}) .then(_checkFontColors([DARK, DARK, LIGHT, LIGHT, DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use matching color from insidetextfont.color array instead of the contrasting default', function(done) { var data = Lib.extendFlat({}, insideTextTestsTrace, {textfont: {color: ['orange', 'purple']}}); Plotly.plot(gd, [data]) .then(_checkFontColors(['orange', 'purple', LIGHT, LIGHT, DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); [ @@ -711,8 +686,7 @@ describe('Pie traces', function() { .then(_checkFontColors(['blue', 'yellow', 'orange', 'orange', 'orange', 'orange'])) .then(_checkFontFamilies(['Arial', 'Arial', 'Gravitas', 'Gravitas', 'Gravitas', 'Gravitas'])) .then(_checkFontSizes([24, 34, 12, 12, 12, 12])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -732,8 +706,7 @@ describe('Pie traces', function() { .then(_checkFontColors(['purple', 'blue', LIGHT, LIGHT, DARK, LIGHT])) .then(_checkFontFamilies(['Roboto', 'Arial', 'serif', 'serif', 'serif', 'serif'])) .then(_checkFontSizes([24, 18, 16, 16, 16, 16])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should fall back to textfont array values and layout.font scalar' + @@ -753,8 +726,7 @@ describe('Pie traces', function() { .then(_checkFontColors(['purple', 'blue', 'orange', 'orange', 'orange', 'orange'])) .then(_checkFontFamilies(['Roboto', 'Arial', 'serif', 'serif', 'serif', 'serif'])) .then(_checkFontSizes([24, 18, 16, 16, 16, 16])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); [ @@ -772,8 +744,7 @@ describe('Pie traces', function() { .then(_checkFontColors(['blue', 'yellow', LIGHT, LIGHT, DARK, LIGHT])) .then(_checkFontFamilies(['Arial', 'Arial', 'serif', 'serif', 'serif', 'serif'])) .then(_checkFontSizes([24, 34, 16, 16, 16, 16])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -792,8 +763,7 @@ describe('Pie traces', function() { .then(_checkFontColors(['blue', 'yellow', 'orange', 'orange', 'orange', 'orange'])) .then(_checkFontFamilies(['Arial', 'Arial', 'serif', 'serif', 'serif', 'serif'])) .then(_checkFontSizes([24, 34, 16, 16, 16, 16])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -817,8 +787,7 @@ describe('Pie traces', function() { _assertTitle('base', 'yo', 'rgb(0, 0, 255)'); _verifyTitle(true, false, true, false, false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('still support the deprecated `title` structure (backwards-compatibility)', function(done) { @@ -833,8 +802,7 @@ describe('Pie traces', function() { _assertTitle('base', 'yo', 'rgb(0, 0, 255)'); _verifyTitle(true, false, true, false, false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle title', function(done) { @@ -861,8 +829,7 @@ describe('Pie traces', function() { _assertTitle('base', 'oy', 'rgb(255, 0, 0)'); _verifyTitle(false, true, false, true, false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle title despite using the deprecated attributes', function(done) { @@ -887,8 +854,7 @@ describe('Pie traces', function() { _assertTitle('base', 'oy', 'rgb(255, 0, 0)'); _verifyTitle(false, true, false, true, false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to react with new text colors', function(done) { @@ -920,8 +886,7 @@ describe('Pie traces', function() { return Plotly.react(gd, gd.data); }) .then(_checkFontColors(['rgb(255, 0, 0)', 'rgb(255, 0, 0)', 'rgb(255, 0, 0)'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to toggle visibility', function(done) { @@ -940,8 +905,7 @@ describe('Pie traces', function() { .then(_assert('both visible:false', 0)) .then(function() { return Plotly.restyle(gd, 'visible', true); }) .then(_assert('back to visible:true', 4)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should grow and shrink margins under *automargin:true*', function(done) { @@ -1014,8 +978,7 @@ describe('Pie traces', function() { t: 'shrunk', l: 'shrunk', b: 'shrunk', r: 'shrunk' })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1296,8 +1259,7 @@ describe('pie hovering', function() { 'garbage hoverinfo' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show the correct separators for values', function(done) { @@ -1310,8 +1272,7 @@ describe('pie hovering', function() { .then(function() { assertLabel('0\n12|345|678@91\n99@9%'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show falsy zero text', function(done) { @@ -1332,8 +1293,7 @@ describe('pie hovering', function() { .then(function() { assertLabel('D\n0\n4\n14.3%'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use hovertemplate if specified', function(done) { @@ -1399,8 +1359,7 @@ describe('pie hovering', function() { 'hovertemplate arrayOK' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should honor *hoverlabel.namelength*', function(done) { @@ -1417,8 +1376,7 @@ describe('pie hovering', function() { .then(function() { assertHoverLabelContent({nums: '4\n5\n33.3%', name: 'lo'}, 'base'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should honor *hoverlabel.align*', function(done) { @@ -1472,8 +1430,7 @@ describe('pie hovering', function() { .then(function() { _assert('arrayOk align:right left sector', {textAnchor: 'end', posX: 37.45}); }) .then(_hoverRight) .then(function() { _assert('arrayOk align:left right sector', {textAnchor: 'start', posX: -37.45}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1522,8 +1479,7 @@ describe('pie hovering', function() { expect(bbox.left).toBeWithin(30, 10, 'bbox left bound'); expect(bbox.right).toBeWithin(220, 10, 'bbox right bound'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1624,8 +1580,7 @@ describe('Test event data of interactions on a pie plot:', function() { expect(futureData.points[0].i).toBeUndefined(); expect(futureData.points[0].pointNumbers).toEqual([4, 9]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1707,8 +1662,7 @@ describe('Test event data of interactions on a pie plot:', function() { mouseEvent('mouseover', pointPos[0], pointPos[1]); expect(futureData).toBe(null); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1778,8 +1732,7 @@ describe('pie relayout', function() { var slices = d3.selectAll(SLICES_SELECTOR); slices.each(checkRelayoutColor); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1860,8 +1813,7 @@ describe('Test pie interactions edge cases:', function() { hoverLabel: 1 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1956,8 +1908,7 @@ describe('pie inside text orientation', function() { .then(assertTextRotations('back to "auto"', { rotations: [-84, 0, -30, 0] })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2084,8 +2035,7 @@ describe('pie uniformtext', function() { fontsizes: [12, 12, 12, 12, 12, 12, 12, 12], scales: [1, 1, 1, 1, 1, 1, 1, 0.52], })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2157,8 +2107,7 @@ describe('pie value format', function() { expect(text).toBe(exp[i]); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should handle rounding big & small percents', function(done) { @@ -2198,7 +2147,6 @@ describe('pie value format', function() { expect(text).toBe(exp[i]); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/plot_api_react_test.js b/test/jasmine/tests/plot_api_react_test.js index 5eec393530e..dfdfa486235 100644 --- a/test/jasmine/tests/plot_api_react_test.js +++ b/test/jasmine/tests/plot_api_react_test.js @@ -114,8 +114,7 @@ describe('@noCIdep Plotly.react', function() { .then(function() { expect(d3.selectAll('.point').size()).toBe(3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should notice new data by ===, without layout.datarevision', function(done) { @@ -143,8 +142,7 @@ describe('@noCIdep Plotly.react', function() { expect(d3.selectAll('.point').size()).toBe(5); countCalls({plot: 1}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should notice new layout.datarevision', function(done) { @@ -174,8 +172,7 @@ describe('@noCIdep Plotly.react', function() { countCalls({plot: 1}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('picks up partial redraws', function(done) { @@ -240,8 +237,7 @@ describe('@noCIdep Plotly.react', function() { .then(function() { countCalls({doColorBars: 1, plot: 1}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('picks up special dtick geo case', function(done) { @@ -271,8 +267,7 @@ describe('@noCIdep Plotly.react', function() { countCalls({plot: 1}); expect(countLines()).toBe(6); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('picks up minimal sequence for cartesian axis range updates', function(done) { @@ -290,8 +285,7 @@ describe('@noCIdep Plotly.react', function() { expect(Axes.draw).toHaveBeenCalledWith(gd, 'redraw'); expect(subroutines.layoutStyles).not.toHaveBeenCalled(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('redraws annotations one at a time', function(done) { @@ -350,8 +344,7 @@ describe('@noCIdep Plotly.react', function() { countCalls({plot: 1}); expect(layout.yaxis.range[1]).toBeCloseTo(ymax, 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('redraws images all at once', function(done) { @@ -405,8 +398,7 @@ describe('@noCIdep Plotly.react', function() { expect(n.attributes.y.value).not.toBe(y); expect(n.attributes.height.value).not.toBe(height); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can change config, and always redraws', function(done) { @@ -440,8 +432,7 @@ describe('@noCIdep Plotly.react', function() { expect(d3.selectAll('.gtitle').size()).toBe(0); countCalls({plot: 1}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can put polar plots into staticPlot mode', function(done) { @@ -466,8 +457,7 @@ describe('@noCIdep Plotly.react', function() { .then(function() { expect(d3.select(gd).selectAll('.drag').size()).toBe(4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can change from scatter to category scatterpolar and back', function(done) { @@ -511,8 +501,7 @@ describe('@noCIdep Plotly.react', function() { .then(function() { countTraces(1, 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can change data in candlesticks multiple times', function(done) { @@ -558,8 +547,7 @@ describe('@noCIdep Plotly.react', function() { .then(function() { assertCalc(2, 4, -1, 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function aggregatedPie(i) { @@ -684,8 +672,7 @@ describe('@noCIdep Plotly.react', function() { .then(reactTo(aggregatedPie(1))) .then(checkCalcData(aggPie1CD)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can change scatter aggregations', function(done) { @@ -697,8 +684,7 @@ describe('@noCIdep Plotly.react', function() { .then(reactTo(aggregatedScatter(1))) .then(checkCalcData(aggScatter1CD)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl can change parcoords aggregations', function(done) { @@ -714,8 +700,7 @@ describe('@noCIdep Plotly.react', function() { .then(reactTo(aggregatedParcoords(0))) .then(checkValues(aggParcoords0Vals)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl can change type with aggregations', function(done) { @@ -742,8 +727,7 @@ describe('@noCIdep Plotly.react', function() { .then(reactTo(aggregatedParcoords(0))) .then(checkValues(aggParcoords0Vals)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can change frames without redrawing', function(done) { @@ -767,8 +751,7 @@ describe('@noCIdep Plotly.react', function() { expect(frameData.length).toBe(1); expect(frameData[0].name).toBe('frame2'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); // make sure we've included every trace type in this suite @@ -865,8 +848,7 @@ describe('@noCIdep Plotly.react', function() { expect(fullJson()).toEqual(initialJson); countCalls({}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); } mockLists.svg.forEach(function(mockSpec) { @@ -932,8 +914,7 @@ describe('resizing with Plotly.relayout and Plotly.react', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-0.53448, 1.53448], 3); expect(gd.layout.yaxis.range).toBeCloseToArray([0.46552, 2.53448], 3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -979,8 +960,7 @@ describe('clear bglayer react', function() { expect(gd._fullLayout.plot_bgcolor).toBe('green'); expect(hasBgRect()).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('clear plot background when react from gl2d to gl3d & back', function(done) { @@ -1007,8 +987,7 @@ describe('clear bglayer react', function() { expect(gd._fullLayout.plot_bgcolor).toBe('green'); expect(hasBgRect()).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('create plot background when react from gl3d to gl2d & back', function(done) { @@ -1035,8 +1014,7 @@ describe('clear bglayer react', function() { expect(gd._fullLayout.plot_bgcolor).toBe(undefined); expect(hasBgRect()).toBe(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('create plot background when react from gl3d to cartesian & back', function(done) { @@ -1063,8 +1041,7 @@ describe('clear bglayer react', function() { expect(gd._fullLayout.plot_bgcolor).toBe(undefined); expect(hasBgRect()).toBe(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('change plot background when react from cartesian to gl2d & back', function(done) { @@ -1091,8 +1068,7 @@ describe('clear bglayer react', function() { expect(gd._fullLayout.plot_bgcolor).toBe('yellow'); expect(hasBgRect()).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('change plot background when react from gl2d to cartesian & back', function(done) { @@ -1119,8 +1095,7 @@ describe('clear bglayer react', function() { expect(gd._fullLayout.plot_bgcolor).toBe('yellow'); expect(hasBgRect()).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1242,8 +1217,7 @@ describe('Plotly.react and uirevision attributes', function() { .then(checkHasEdits) .then(_react(fig(false))) .then(checkNoEdits) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('moves trace visibility with uid', function(done) { @@ -1262,8 +1236,7 @@ describe('Plotly.react and uirevision attributes', function() { })) // now the first trace is hidden, because it has uid b now! .then(checkState([{visible: 'legendonly'}, {visible: [undefined, true]}])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('should handle case where traces are removed', function() { @@ -1289,8 +1262,7 @@ describe('Plotly.react and uirevision attributes', function() { .then(mockLegendClick) .then(_react([{y: [1, 2, 1]}])) .then(_assert('after react', [true])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- case no uirevision with uid', function(done) { @@ -1299,8 +1271,7 @@ describe('Plotly.react and uirevision attributes', function() { .then(mockLegendClick) .then(_react([{y: [1, 2, 1], uid: 'a'}])) .then(_assert('after react', [true])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- case with uirevision no uid', function(done) { @@ -1309,8 +1280,7 @@ describe('Plotly.react and uirevision attributes', function() { .then(mockLegendClick) .then(_react({data: [{y: [1, 2, 1]}], layout: {uirevision: true}})) .then(_assert('after react', ['legendonly'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- case with uirevision with uid', function(done) { @@ -1319,8 +1289,7 @@ describe('Plotly.react and uirevision attributes', function() { .then(mockLegendClick) .then(_react({data: [{y: [1, 2, 1], uid: 'a'}], layout: {uirevision: true}})) .then(_assert('after react', ['legendonly'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1375,8 +1344,7 @@ describe('Plotly.react and uirevision attributes', function() { .then(checkAutoRange(false, false, true, true)) .then(_react(fig('b', undefined, undefined, false, ''))) .then(checkAutoRange(true, true, true, true)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('respects reverting an explicit cartesian axis range to auto', function(done) { @@ -1413,8 +1381,7 @@ describe('Plotly.react and uirevision attributes', function() { .then(checkRanges([2, 4], [5, 7])) .then(_react(fig(undefined, undefined))) .then(checkRanges([0, 2], [3, 5])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('respects reverting an explicit polar axis range to auto', function(done) { @@ -1446,8 +1413,7 @@ describe('Plotly.react and uirevision attributes', function() { .then(checkRange([2, 4])) .then(_react(fig(undefined))) .then(checkRange([0, 1.05263])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function _run(figFn, editFn, checkInitial, checkEdited) { @@ -1550,7 +1516,7 @@ describe('Plotly.react and uirevision attributes', function() { var checkAllVisible = checkVisible([true, true, true], true); var checkSomeHidden = checkVisible([false, true, false], false); - _run(fig, hideSome, checkAllVisible, checkSomeHidden).catch(failTest).then(done); + _run(fig, hideSome, checkAllVisible, checkSomeHidden).then(done, done.fail); }); it('@gl preserves modebar interactions using modebar.uirevision', function(done) { @@ -1601,7 +1567,7 @@ describe('Plotly.react and uirevision attributes', function() { var checkOriginalModes = checkState([], attrs(true)); var checkEditedModes = checkState([], attrs()); - _run(fig, editModes, checkOriginalModes, checkEditedModes).catch(failTest).then(done); + _run(fig, editModes, checkOriginalModes, checkEditedModes).then(done, done.fail); }); it('preserves geo viewport changes using geo.uirevision', function(done) { @@ -1633,7 +1599,7 @@ describe('Plotly.react and uirevision attributes', function() { var checkOriginalView = checkState([], attrs(true)); var checkEditedView = checkState([], attrs()); - _run(fig, editView, checkOriginalView, checkEditedView).catch(failTest).then(done); + _run(fig, editView, checkOriginalView, checkEditedView).then(done, done.fail); }); it('preserves geo viewport changes using geo.uirevision (fitbounds case)', function(done) { @@ -1666,7 +1632,7 @@ describe('Plotly.react and uirevision attributes', function() { var checkOriginalView = checkState([], attrs(true)); var checkEditedView = checkState([], attrs()); - _run(fig, editView, checkOriginalView, checkEditedView).catch(failTest).then(done); + _run(fig, editView, checkOriginalView, checkEditedView).then(done, done.fail); }); it('@gl preserves 3d camera changes using scene.uirevision', function(done) { @@ -1706,7 +1672,7 @@ describe('Plotly.react and uirevision attributes', function() { var checkOriginalCamera = _checkCamera(true); var checkEditedCamera = _checkCamera(false); - _run(fig, editCamera, checkOriginalCamera, checkEditedCamera).catch(failTest).then(done); + _run(fig, editCamera, checkOriginalCamera, checkEditedCamera).then(done, done.fail); }); it('preserves selectedpoints using selectionrevision', function(done) { @@ -1739,7 +1705,7 @@ describe('Plotly.react and uirevision attributes', function() { {selectedpoints: [[2]]} ]); - _run(fig, editSelection, checkNoSelection, checkSelection).catch(failTest).then(done); + _run(fig, editSelection, checkNoSelection, checkSelection).then(done, done.fail); }); it('preserves selectedpoints using selectedrevision (groupby case)', function(done) { @@ -1779,7 +1745,7 @@ describe('Plotly.react and uirevision attributes', function() { // point 4 is last, in group 3 var checkSelection = checkState([{selectedpoints: [[5, 7, 8, 4]]}]); - _run(fig, editSelection, checkNoSelection, checkSelection).catch(failTest).then(done); + _run(fig, editSelection, checkNoSelection, checkSelection).then(done, done.fail); }); it('preserves polar view changes using polar.uirevision', function(done) { @@ -1827,8 +1793,7 @@ describe('Plotly.react and uirevision attributes', function() { .then(function() { return _run(fig2, editPolar, checkInitial, checkEdited); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('preserves ternary view changes using ternary.uirevision', function(done) { @@ -2118,8 +2083,7 @@ describe('Plotly.react and uirevision attributes', function() { .then(function() { assertLevel('after reacting with new data, but with same uirevision', 'Seth'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('preserves treemap level changes', function(done) { @@ -2154,8 +2118,7 @@ describe('Plotly.react and uirevision attributes', function() { .then(function() { assertLevel('after reacting with new data, but with same uirevision', 'Seth'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2242,8 +2205,7 @@ describe('Test Plotly.react + interactions under uirevision:', function() { .then(function() { _assertGUI('before'); }) .then(_react) .then(function() { _assertGUI('after'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('geo subplots should preserve viewport changes after panning', function(done) { @@ -2295,8 +2257,7 @@ describe('Test Plotly.react + interactions under uirevision:', function() { .then(function() { _assertGUI('before'); }) .then(_react) .then(function() { _assertGUI('after'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl mapbox subplots should preserve viewport changes after panning', function(done) { @@ -2369,7 +2330,6 @@ describe('Test Plotly.react + interactions under uirevision:', function() { .then(function() { _assertGUI('before'); }) .then(_react) .then(function() { _assertGUI('after'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/plot_api_test.js b/test/jasmine/tests/plot_api_test.js index 29669c95d1b..7ae1168449d 100644 --- a/test/jasmine/tests/plot_api_test.js +++ b/test/jasmine/tests/plot_api_test.js @@ -16,7 +16,7 @@ var editTypes = require('@src/plot_api/edit_types'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var negateIf = require('../assets/negate_if'); var checkTicks = require('../assets/custom_assertions').checkTicks; var supplyAllDefaults = require('../assets/supply_defaults'); @@ -50,8 +50,7 @@ describe('Test plot api', function() { expect(gd.data.length).toEqual(1); expect(gd._context.editable).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('accepts gd and an object as args', function(done) { @@ -67,8 +66,7 @@ describe('Test plot api', function() { expect(gd._transitionData._frames.length).toEqual(1); expect(gd._context.editable).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('allows adding more frames to the initial set', function(done) { @@ -94,8 +92,7 @@ describe('Test plot api', function() { expect(gd._transitionData._frames[1].name).toEqual('frame2'); expect(gd._transitionData._frames[2].name).toEqual('frame3'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should emit afterplot event after plotting is done', function(done) { @@ -110,8 +107,7 @@ describe('Test plot api', function() { promise.then(function() { expect(afterPlot).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -149,8 +145,7 @@ describe('Test plot api', function() { expect(clipWidth).toBe(240); expect(clipHeight).toBe(220); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('sets null values to their default', function(done) { @@ -167,8 +162,7 @@ describe('Test plot api', function() { .then(function() { expect(gd._fullLayout.width).toBe(defaultWidth); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('ignores undefined values', function(done) { @@ -185,8 +179,7 @@ describe('Test plot api', function() { .then(function() { expect(gd._fullLayout.width).toBe(defaultWidth - 25); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can set items in array objects', function(done) { @@ -201,8 +194,7 @@ describe('Test plot api', function() { .then(function() { expect(gd.layout.rando).toEqual([1, 45, 3]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('errors if child and parent are edited together', function(done) { @@ -237,8 +229,7 @@ describe('Test plot api', function() { }).toThrow(); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can set empty text nodes', function(done) { @@ -260,8 +251,7 @@ describe('Test plot api', function() { var newHeight = scatter.getBoundingClientRect().height; expect(newHeight).toEqual(oldHeight); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should skip empty axis objects', function(done) { @@ -275,8 +265,7 @@ describe('Test plot api', function() { .then(function() { return Plotly.relayout(gd, { zaxis: {} }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('annotations, shapes and images linked to category axes should update properly on zoom/pan', function(done) { @@ -348,8 +337,7 @@ describe('Test plot api', function() { expect(getShapePos()).toBeCloseToArray([350, 369]); expect(getImagePos()).toBeCloseToArray([170, 272.52]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('clears autorange when you modify a range or part of a range', function(done) { @@ -387,8 +375,7 @@ describe('Test plot api', function() { expect(gd.layout.yaxis.autorange).toBe(false); expect(gd.layout.yaxis.range[1]).toBe(3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('sets aspectmode to manual when you provide any aspectratio', function(done) { @@ -406,8 +393,7 @@ describe('Test plot api', function() { .then(function() { expect(gd.layout.scene.aspectmode).toBe('auto'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('sets tickmode to linear when you edit tick0 or dtick', function(done) { @@ -431,8 +417,7 @@ describe('Test plot api', function() { expect(gd.layout.xaxis.tick0).toBeUndefined(); expect(gd.layout.yaxis.dtick).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates non-auto ranges for linear/log changes', function(done) { @@ -453,8 +438,7 @@ describe('Test plot api', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([1, 10], 5); expect(gd.layout.yaxis.range).toBeCloseToArray([0, 1], 5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('respects reversed autorange when switching linear to log', function(done) { @@ -479,8 +463,7 @@ describe('Test plot api', function() { // make sure it's a real loggy range expect(xRange[0]).toBeLessThan(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('autoranges automatically when switching to/from any other axis type than linear <-> log', function(done) { @@ -504,8 +487,7 @@ describe('Test plot api', function() { expect(gd._fullLayout.xaxis.type).toBe('linear'); expect(gd.layout.xaxis.range).toEqual([0.6, 1.7]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates autosize/width/height correctly', function(done) { @@ -541,8 +523,7 @@ describe('Test plot api', function() { .then(assertSizeAndThen(700, 500, false, 'explicit height and width', {autosize: true})) .then(assertSizeAndThen(543, 432, true, 'final back to autosize')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('passes update data back to plotly_relayout unmodified ' + @@ -568,8 +549,7 @@ describe('Test plot api', function() { 'polar.radialaxis.title': 'Radial' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -663,8 +643,7 @@ describe('Test plot api', function() { .then(function() { expectReplot('select 2'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should trigger replot (but not recalc) when changing attributes that affect axis length/range', function() { @@ -774,8 +753,7 @@ describe('Test plot api', function() { .then(function() { expect(gd.calcdata).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -812,8 +790,7 @@ describe('Test plot api', function() { // "docalc" deletes gd.calcdata - make sure this didn't happen expect(gd.calcdata).toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('calls Bar.arraysToCalcdata and Plots.style on bar styling', function(done) { @@ -830,8 +807,7 @@ describe('Test plot api', function() { expect(plotApi.plot).not.toHaveBeenCalled(); expect(gd.calcdata).toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should do full replot when arrayOk attributes are updated', function(done) { @@ -870,8 +846,7 @@ describe('Test plot api', function() { expect(gd.calcdata).toBeUndefined(); expect(plotApi.plot).toHaveBeenCalled(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should do full replot when arrayOk base attributes are updated', function(done) { @@ -910,8 +885,7 @@ describe('Test plot api', function() { expect(gd.calcdata).toBeUndefined(); expect(plotApi.plot).toHaveBeenCalled(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should do full replot when attribute container are updated', function(done) { @@ -933,8 +907,7 @@ describe('Test plot api', function() { expect(gd.calcdata).toBeUndefined(); expect(plotApi.plot).toHaveBeenCalled(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('calls plot on xgap and ygap styling', function(done) { @@ -953,8 +926,7 @@ describe('Test plot api', function() { .then(function() { expect(plotApi.plot.calls.count()).toEqual(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); [ @@ -988,8 +960,7 @@ describe('Test plot api', function() { expect(gd.calcdata).toBeUndefined(); expect(plotApi.plot).toHaveBeenCalled(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1028,8 +999,7 @@ describe('Test plot api', function() { plotApi.plot.calls.reset(); return Plotly.restyle(gd, 'zmin', 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1052,8 +1022,7 @@ describe('Test plot api', function() { .then(function() { expect(gd._fullData[0].marker.color).toBe('blue'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('ignores invalid trace indices', function(done) { @@ -1066,8 +1035,7 @@ describe('Test plot api', function() { // Call restyle on an invalid trace indice Plotly.restyle(gd, {'type': 'scatter', 'marker.color': 'red'}, [1]) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('restores null values to defaults', function(done) { @@ -1090,8 +1058,7 @@ describe('Test plot api', function() { .then(function() { expect(gd._fullData[0].marker.color).toBe(colorDflt); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can target specific traces by leaving properties undefined', function(done) { @@ -1119,8 +1086,7 @@ describe('Test plot api', function() { expect(gd._fullData[0].marker.color).toBe(colorDflt[0]); expect(gd._fullData[1].marker.color).toBe(colorDflt[1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1157,8 +1123,7 @@ describe('Test plot api', function() { expect(gd._fullData[0].zmax).toBe(10); expect(gd.data[0].contours).toEqual({start: 3, end: 9, size: 1}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('errors if child and parent are edited together', function(done) { @@ -1193,8 +1158,7 @@ describe('Test plot api', function() { }).toThrow(); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('turns off zauto when you edit zmin or zmax', function(done) { @@ -1230,8 +1194,7 @@ describe('Test plot api', function() { .then(function() { check(false, 'undo'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('turns off cauto (autocolorscale) when you edit cmin or cmax (colorscale)', function(done) { @@ -1283,8 +1246,7 @@ describe('Test plot api', function() { .then(function() { check(false, false, 'undo'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('turns on cauto when cmid is edited', function(done) { @@ -1354,8 +1316,7 @@ describe('Test plot api', function() { cmin: -1, cmax: 4 })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('turns off autobin when you edit bin specs', function(done) { @@ -1404,8 +1365,7 @@ describe('Test plot api', function() { .then(function() { check(false, 'undo'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('turns off autocontour when you edit contour specs', function(done) { @@ -1441,8 +1401,7 @@ describe('Test plot api', function() { .then(function() { check(false, 'undo'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function checkScaling(xyType, xyTypeIn, iIn, iOut) { @@ -1466,8 +1425,7 @@ describe('Test plot api', function() { .then(function() { checkScaling('scaled', 'scaled', 0, 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('sets heatmap xtype/ytype even when data/fullData indices mismatch', function(done) { @@ -1492,8 +1450,7 @@ describe('Test plot api', function() { .then(function() { checkScaling('scaled', 'scaled', 1, 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('sets colorbar.tickmode to linear when editing colorbar.tick0/dtick', function(done) { @@ -1531,8 +1488,7 @@ describe('Test plot api', function() { .then(function() { check(false, 'undo'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates colorbars when editing bar charts', function(done) { @@ -1552,8 +1508,7 @@ describe('Test plot api', function() { .then(function() { expect(d3.select('.cbaxis').size()).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates colorbars when editing gl3d plots', function(done) { @@ -1571,8 +1526,7 @@ describe('Test plot api', function() { .then(function() { expect(d3.select('.cbaxis').size()).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates box position and axis type when it falls back to name', function(done) { @@ -1595,8 +1549,7 @@ describe('Test plot api', function() { checkTicks('x', ['12', '12.5'], 'switched to numeric'); expect(gd._fullLayout.xaxis.type).toBe('linear'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('updates scene axis types automatically', function(done) { @@ -1609,8 +1562,7 @@ describe('Test plot api', function() { .then(function() { expect(gd._fullLayout.scene.zaxis.type).toBe('category'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can drop Cartesian while constraints are active', function(done) { @@ -1624,8 +1576,7 @@ describe('Test plot api', function() { expect(gd._fullLayout._axisConstraintGroups).toBeUndefined(); expect(gd._fullLayout.scene !== undefined).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2329,8 +2280,7 @@ describe('Test plot api', function() { expect(Object.keys(gd)).toEqual(initialKeys); expect(gd.innerHTML).toEqual(intialHTML); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2368,8 +2318,7 @@ describe('Test plot api', function() { .then(function() { expect(d3.selectAll('g.trace.scatter').size()).toEqual(3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2734,8 +2683,7 @@ describe('Test plot api', function() { expect(fullLayout.height).toBe(height); expect(+svg.getAttribute('height')).toBe(height); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should only have one modebar-container', function(done) { @@ -2764,8 +2712,7 @@ describe('Test plot api', function() { }); }) .then(_assert('after update()')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2799,8 +2746,7 @@ describe('Test plot api', function() { expect(subroutines.doTraceStyle).toHaveBeenCalledTimes(1); expect(calcdata).toBe(gd.calcdata); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('clear calcdata on data updates', function(done) { @@ -2809,8 +2755,7 @@ describe('Test plot api', function() { expect(layout).toBe(gd.layout); expect(calcdata).not.toBe(gd.calcdata); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('clear calcdata on data + axis updates w/o extending current gd.data', function(done) { @@ -2829,8 +2774,7 @@ describe('Test plot api', function() { expect(gd.data.length).toEqual(1); expect(subroutines.layoutReplot).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('call doLegend on legend updates', function(done) { @@ -2838,8 +2782,7 @@ describe('Test plot api', function() { expect(subroutines.doLegend).toHaveBeenCalledTimes(1); expect(calcdata).toBe(gd.calcdata); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('call array manager when adding update menu', function(done) { @@ -2859,8 +2802,7 @@ describe('Test plot api', function() { expect(subroutines.layoutReplot).toHaveBeenCalledTimes(0); expect(calcdata).toBe(gd.calcdata); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('call doModeBar when updating \'dragmode\'', function(done) { @@ -2868,8 +2810,7 @@ describe('Test plot api', function() { expect(subroutines.doModeBar).toHaveBeenCalledTimes(1); expect(calcdata).toBe(gd.calcdata); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('ignores invalid trace indices', function() { diff --git a/test/jasmine/tests/plot_interact_test.js b/test/jasmine/tests/plot_interact_test.js index 0ce89a264f8..26079c05cf0 100644 --- a/test/jasmine/tests/plot_interact_test.js +++ b/test/jasmine/tests/plot_interact_test.js @@ -5,7 +5,7 @@ var Lib = require('@src/lib'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + // This suite is more of a test of the structure of interaction elements on // various plot types. Tests of actual mouse interactions on cartesian plots @@ -116,8 +116,7 @@ describe('Test plot structure', function() { expect(countClipPaths()).toEqual(4); expect(countDraggers()).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should restore layout axes when they get deleted', function(done) { @@ -159,8 +158,7 @@ describe('Test plot structure', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([-4.79980, 74.48580], 4); expect(gd.layout.yaxis.range).toBeCloseToArray([-1.2662, 17.67023], 4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -384,8 +382,7 @@ describe('Test plot structure', function() { 'g-y2title': 0 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -442,8 +439,7 @@ describe('Test plot structure', function() { expect(countPieTraces()).toEqual(0); expect(countSubplots()).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to be restyled to a bar chart and back', function(done) { @@ -462,8 +458,7 @@ describe('Test plot structure', function() { expect(countBarTraces()).toEqual(0); expect(countSubplots()).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -553,8 +548,7 @@ describe('plot svg clip paths', function() { expect(cp.substring(cp.length - 2)).toEqual('\')'); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should set clip path url to ids appended to window url', function(done) { @@ -579,7 +573,6 @@ describe('plot svg clip paths', function() { base.remove(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/plot_promise_test.js b/test/jasmine/tests/plot_promise_test.js index 53856770ba3..b032f4e6ac8 100644 --- a/test/jasmine/tests/plot_promise_test.js +++ b/test/jasmine/tests/plot_promise_test.js @@ -2,7 +2,7 @@ var Plotly = require('@lib/index'); var Events = require('@src/lib/events'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + describe('Plotly.___ methods', function() { 'use strict'; @@ -443,8 +443,7 @@ describe('Plotly.___ methods', function() { expect(typeof gd).toBe('object'); expect(gd.layout).toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should return a rejected promise if gd is hidden', function(done) { @@ -455,8 +454,7 @@ describe('Plotly.___ methods', function() { expect(err).toBeDefined(); expect(err.message).toBe('Resize must be passed a displayed plot div element.'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should return a rejected promise if gd is detached from the DOM', function(done) { @@ -467,8 +465,7 @@ describe('Plotly.___ methods', function() { expect(err).toBeDefined(); expect(err.message).toBe('Resize must be passed a displayed plot div element.'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should return a resolved promise if plot has been purged and there is nothing to resize', function(done) { @@ -478,8 +475,7 @@ describe('Plotly.___ methods', function() { destroyGraphDiv(); resizePromise - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should return a resolved promise if plot has been hidden and gd is hidden', function(done) { @@ -488,8 +484,7 @@ describe('Plotly.___ methods', function() { initialDiv.style.display = 'none'; resizePromise - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('errors before even generating a promise if gd is not defined', function() { diff --git a/test/jasmine/tests/plots_test.js b/test/jasmine/tests/plots_test.js index 8c9e313b836..ac05b8c89a3 100644 --- a/test/jasmine/tests/plots_test.js +++ b/test/jasmine/tests/plots_test.js @@ -7,7 +7,7 @@ var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var supplyAllDefaults = require('../assets/supply_defaults'); -var failTest = require('../assets/fail_test'); + describe('Test Plots', function() { 'use strict'; @@ -390,8 +390,7 @@ describe('Test Plots', function() { expect(gd.id).toBeTruthy(); Plotly.Plots.resize(gd.id) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -414,8 +413,7 @@ describe('Test Plots', function() { .then(function() { _assert({l: 74, r: 74, t: 82, b: 66}); }) .then(function() { return Plotly.Plots.resize(gd); }) .then(function() { _assert({l: 74, r: 74, t: 82, b: 66}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -439,8 +437,7 @@ describe('Test Plots', function() { expect(v[0]).toEqual(v[1]); expect(v[1]).toEqual(v[2]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -613,8 +610,7 @@ describe('Test Plots', function() { name: 'garbage' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should convert typed arrays to regular arrays', function(done) { @@ -643,8 +639,7 @@ describe('Test Plots', function() { expect(obj.data[0].marker.size).toEqual([20, 30, 10]); expect(obj.data[0].marker.color).toEqual([10, 30, 20]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -788,8 +783,7 @@ describe('Test Plots', function() { destroyGraphDiv(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should handle cases when module plot is not set (ternary case)', function(done) { @@ -808,8 +802,7 @@ describe('Test Plots', function() { destroyGraphDiv(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -857,8 +850,7 @@ describe('Test Plots', function() { // some special Plots.style logic. expect(Drawing.pointStyle).toHaveBeenCalledTimes(3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -923,8 +915,7 @@ describe('Test Plots', function() { .then(function() { assertSubplots({cartesian: ['xy']}, 'totally blank'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('uses the first x & y axes it finds in making a blank cartesian subplot', function(done) { @@ -932,8 +923,7 @@ describe('Test Plots', function() { .then(function() { assertSubplots({cartesian: ['x3y4']}, 'blank with axis objects'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows expected cartesian subplots from visible traces and components', function(done) { @@ -950,8 +940,7 @@ describe('Test Plots', function() { .then(function() { assertSubplots({cartesian: ['xy', 'x2y2', 'x3y3', 'x5y5']}, 'visible components'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('shows expected cartesian subplots from invisible traces and components', function(done) { @@ -968,8 +957,7 @@ describe('Test Plots', function() { .then(function() { assertSubplots({cartesian: ['xy', 'x2y2', 'x3y3', 'x5y5']}, 'invisible components'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('ignores unused axis and subplot objects', function(done) { @@ -987,8 +975,7 @@ describe('Test Plots', function() { .then(function() { assertSubplots({pie: 1}, 'just pie'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1055,8 +1042,7 @@ describe('Test Plots', function() { plotCallCnt: 0 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1122,8 +1108,7 @@ describe('grids', function() { })); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('defaults to a coupled layout', function(done) { @@ -1166,8 +1151,7 @@ describe('grids', function() { }); _assertMissing(['xaxis', 'yaxis', 'xaxis4', 'yaxis4']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('has a bigger default gap with independent layout', function(done) { @@ -1214,8 +1198,7 @@ describe('grids', function() { }); _assertMissing(['xaxis', 'yaxis']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can set x and y gaps and change domain', function(done) { @@ -1262,8 +1245,7 @@ describe('grids', function() { yaxis2: [0, 0.35 / 1.7] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('responds to xside and yside', function(done) { @@ -1309,8 +1291,7 @@ describe('grids', function() { checkAxis('xaxis2', 'free', 'bottom', 0); checkAxis('yaxis2', 'free', 'left', 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('places other subplots in the grid by default', function(done) { @@ -1341,7 +1322,6 @@ describe('grids', function() { checkDomain(gd._fullData[0], 1, 0, [0.6, 1], [0.6, 1]); checkDomain(gd._fullLayout.geo, 0, 1, [0, 0.4], [0, 0.4]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/pointcloud_test.js b/test/jasmine/tests/pointcloud_test.js index ec4a723fe5f..ce4bb18a1b6 100644 --- a/test/jasmine/tests/pointcloud_test.js +++ b/test/jasmine/tests/pointcloud_test.js @@ -7,7 +7,7 @@ var d3 = require('@plotly/d3'); // Test utilities var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var delay = require('../assets/delay'); var mouseEvent = require('../assets/mouse_event'); var readPixel = require('../assets/read_pixel'); @@ -159,8 +159,7 @@ describe('pointcloud traces', function() { it('@gl renders without raising an error', function(done) { Plotly.plot(gd, Lib.extendDeep({}, plotData)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should update properly', function(done) { @@ -188,8 +187,7 @@ describe('pointcloud traces', function() { expect(scene2d.xaxis.range).toBeCloseToArray([-0.548, 9.548], 2); expect(scene2d.yaxis.range).toBeCloseToArray([-1.415, 10.415], 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should not change other traces colors', function(done) { @@ -206,8 +204,7 @@ describe('pointcloud traces', function() { expect(RGBA[2] === 0).toBe(true, 'no blue'); expect(RGBA[3] === 255).toBe(true, 'no transparent'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should respond to drag', function(done) { @@ -253,7 +250,6 @@ describe('pointcloud traces', function() { .then(function() { _assertRange('after pan drag', [0.2743, 10.3719], [-3.537, 8.292]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/polar_test.js b/test/jasmine/tests/polar_test.js index c15e02a4b4c..4cfe31d150e 100644 --- a/test/jasmine/tests/polar_test.js +++ b/test/jasmine/tests/polar_test.js @@ -6,7 +6,7 @@ var constants = require('@src/plots/polar/constants'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var negateIf = require('../assets/negate_if'); var mouseEvent = require('../assets/mouse_event'); var click = require('../assets/click'); @@ -56,8 +56,7 @@ describe('Test legacy polar plots logs:', function() { expect(Lib.log).toHaveBeenCalledTimes(1); expect(Lib.log).toHaveBeenCalledWith('Legacy polar charts are deprecated!'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -320,8 +319,7 @@ describe('Test relayout on polar subplots:', function() { .then(function() { _assert(dflt); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to relayout axis types', function(done) { @@ -350,8 +348,7 @@ describe('Test relayout on polar subplots:', function() { expect(gd._fullLayout.polar.radialaxis.range) .toBeCloseToArray([0, 11.225]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be propagate angular settings down to tick labels', function(done) { @@ -376,8 +373,7 @@ describe('Test relayout on polar subplots:', function() { // if they're the same, the tick label position did not update expect(pos1).not.toBeCloseTo2DArray(pos0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to relayout angular ticks layout', function(done) { @@ -412,8 +408,7 @@ describe('Test relayout on polar subplots:', function() { .then(function() { check(8, 'M-1.5,0h-5'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to toggle axis features', function(done) { @@ -492,8 +487,7 @@ describe('Test relayout on polar subplots:', function() { ['outside', ''], [8, 0], '.angular-axis > path.angularaxistick', assertCnt )) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle radial axis title', function(done) { @@ -548,8 +542,7 @@ describe('Test relayout on polar subplots:', function() { .then(function() { assertTitle('yo2', false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should clean up its framework, clip paths and info layers when getting deleted', function(done) { @@ -582,8 +575,7 @@ describe('Test relayout on polar subplots:', function() { .then(function() { _assert({subplot: 1, clip: 1, rtitle: 1}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update axis ranges when extending traces', function(done) { @@ -641,8 +633,7 @@ describe('Test relayout on polar subplots:', function() { sampleXY: [-25, 43] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to relayout *gridshape*', function(done) { @@ -680,8 +671,7 @@ describe('Test relayout on polar subplots:', function() { .then(function() { _assert('relayout -> circular', {letter: 'A', cnt: 2}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not attempt to draw radial axis when *polar.hole* is set to 1', function(done) { @@ -709,8 +699,7 @@ describe('Test relayout on polar subplots:', function() { .then(function() { _assert('hole=1', false); }) .then(function() { return Plotly.relayout(gd, 'polar.hole', 0.2); }) .then(function() { _assert('hole=0.2', true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -904,8 +893,7 @@ describe('Test polar interactions:', function() { plotly_relayout: 1 }, 'after right click'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should respond to drag interactions on plot area', function(done) { @@ -1013,8 +1001,7 @@ describe('Test polar interactions:', function() { .then(function() { _assertDrag([1.15, 7.70], 'with polar.hole>0, from quadrant #1 move top-right'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should response to drag interactions on radial drag area', function(done) { @@ -1097,8 +1084,7 @@ describe('Test polar interactions:', function() { .then(function() { expect(eventCnts.plotly_relayout).toBe(8, 'total # of relayout events'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should response to drag interactions on inner radial drag area', function(done) { @@ -1136,8 +1122,7 @@ describe('Test polar interactions:', function() { .then(function() { _assert([-3.55, 11.36], 'move outward'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should response to drag interactions on angular drag area', function(done) { @@ -1201,8 +1186,7 @@ describe('Test polar interactions:', function() { .then(function() { expect(eventCnts.plotly_relayout).toBe(4, 'total # of relayout events'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('should update scene during drag interactions on radial and angular drag area', function() { @@ -1294,8 +1278,7 @@ describe('Test polar interactions:', function() { .then(_assert) .then(function() { return _dragAngular(); }) .then(_assert) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1341,8 +1324,7 @@ describe('Test polar interactions:', function() { expect(Object.keys(events[len - 1])).toContain(key); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should emit events on inner radial drag area', function(done) { @@ -1374,8 +1356,7 @@ describe('Test polar interactions:', function() { expect(Object.keys(events[0])).toContain(key); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should emit events on angular drag area', function(done) { @@ -1408,8 +1389,7 @@ describe('Test polar interactions:', function() { expect(Object.keys(events[0])).toContain(key); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1469,8 +1449,7 @@ describe('Test polar *gridshape linear* interactions', function() { .then(function() { return _drag(dragPos1, [-100, -50]); }) .then(function() { _assert('rotate left', 90); }) .then(function() { expect(evtCnt).toBe(3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should rotate all non-symmetrical layers on angular drag', function(done) { @@ -1548,8 +1527,7 @@ describe('Test polar *gridshape linear* interactions', function() { expect(evtData['polar.radialaxis.angle']) .toBeCloseTo(82.8, 1, 'polar.radialaxis.angle event data'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should place zoombox handles at correct place on main drag', function(done) { @@ -1642,8 +1620,7 @@ describe('Test polar *gridshape linear* interactions', function() { ] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1761,8 +1738,7 @@ describe('Polar plots with css transforms', function() { .then(function() { expect(Object.keys(hoverEvents).length).toBe(t.hovered); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('drag-zoom behaves correctly after css transform: ' + transform, function(done) { @@ -1777,8 +1753,7 @@ describe('Polar plots with css transforms', function() { var points = _getVisiblePointsData(); expect(points.map(function(e) { return e.i; })).toEqual(t.zoomed); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('select behaves correctly after css transform: ' + transform, function(done) { @@ -1801,8 +1776,7 @@ describe('Polar plots with css transforms', function() { .then(function() { _assertSelected(t.selected); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/range_selector_test.js b/test/jasmine/tests/range_selector_test.js index d135b2ce710..490fe6ebe29 100644 --- a/test/jasmine/tests/range_selector_test.js +++ b/test/jasmine/tests/range_selector_test.js @@ -7,7 +7,7 @@ var Lib = require('@src/lib'); var Color = require('@src/components/color'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var getRectCenter = require('../assets/get_rect_center'); var mouseEvent = require('../assets/mouse_event'); var setConvert = require('@src/plots/cartesian/set_convert'); @@ -508,8 +508,7 @@ describe('range selector interactions:', function() { assertNodeCount('.rangeselector', 1); assertNodeCount('.button', allButtons); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to be removed by `relayout`', function(done) { @@ -518,8 +517,7 @@ describe('range selector interactions:', function() { assertNodeCount('.rangeselector', 0); assertNodeCount('.button', 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to remove button(s) on `relayout`', function(done) { @@ -535,8 +533,7 @@ describe('range selector interactions:', function() { }).then(function() { assertNodeCount('.button', len - 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to change its style on `relayout`', function(done) { @@ -552,8 +549,7 @@ describe('range selector interactions:', function() { }).then(function() { checkButtonColor('rgb(255, 0, 0)', 'rgb(0, 0, 255)'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update range and active button when clicked', function() { @@ -614,8 +610,7 @@ describe('range selector interactions:', function() { // 'all' should be after an autoscale checkActiveButton(buttons.size() - 1, 'back to all'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -660,7 +655,6 @@ describe('range selector automargin', function() { .then(function() { assertPlotSize({widthLessThan: 400, heightLessThan: 300}, 'reshow'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/range_slider_test.js b/test/jasmine/tests/range_slider_test.js index 76051046faa..f05c223f52c 100644 --- a/test/jasmine/tests/range_slider_test.js +++ b/test/jasmine/tests/range_slider_test.js @@ -12,7 +12,7 @@ var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var mouseEvent = require('../assets/mouse_event'); var supplyAllDefaults = require('../assets/supply_defaults'); -var failTest = require('../assets/fail_test'); + var assertPlotSize = require('../assets/custom_assertions').assertPlotSize; var TOL = 6; @@ -61,8 +61,7 @@ describe('Visible rangesliders', function() { plotMock().then(function() { expect(getRangeSlider()).toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should have the correct style and size and be able to update these', function(done) { @@ -96,8 +95,7 @@ describe('Visible rangesliders', function() { expect(bg.getAttribute('stroke')).toBe('#404040'); expect(+bg.getAttribute('stroke-width')).toBe(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should react to resizing the minimum handle', function(done) { @@ -118,8 +116,7 @@ describe('Visible rangesliders', function() { expect(maskMin.getAttribute('width')).toEqual(String(diff)); expect(handleMin.getAttribute('transform')).toBe('translate(' + (diff - 2.5) + ',0.5)'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should react to resizing the maximum handle', function(done) { @@ -145,8 +142,7 @@ describe('Visible rangesliders', function() { testTranslate1D(handleMax, dataMaxStart + diff); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should react to moving the slidebox left to right', function(done) { @@ -171,8 +167,7 @@ describe('Visible rangesliders', function() { expect(+maskMin.getAttribute('width')).toBeCloseTo(String(diff)); testTranslate1D(handleMin, dataMinStart + diff - 3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should react to moving the slidebox right to left', function(done) { @@ -197,8 +192,7 @@ describe('Visible rangesliders', function() { expect(+maskMax.getAttribute('width')).toBeCloseTo(-diff); testTranslate1D(handleMax, dataMaxStart + diff); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not react to any interactions when staticPlot is set', function(done) { @@ -231,8 +225,7 @@ describe('Visible rangesliders', function() { .then(function() { expect(gd.layout.xaxis.range).toBeCloseToArray([0, 49]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update correctly when moving slider on an axis with rangebreaks', function(done) { @@ -285,8 +278,7 @@ describe('Visible rangesliders', function() { '1970-01-01 00:00:00.2' ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should resize the main plot when rangeslider has moved', function(done) { @@ -315,8 +307,7 @@ describe('Visible rangesliders', function() { rangeDiff3 = gd._fullLayout.xaxis.range[1] - gd._fullLayout.xaxis.range[0]; expect(rangeDiff3).toBeLessThan(rangeDiff2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should relayout with relayout "array syntax"', function(done) { @@ -334,8 +325,7 @@ describe('Visible rangesliders', function() { testTranslate1D(handleMin, 123.32); testTranslate1D(handleMax, 252.65); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should relayout with relayout "element syntax"', function(done) { @@ -353,8 +343,7 @@ describe('Visible rangesliders', function() { testTranslate1D(handleMin, 123.32); testTranslate1D(handleMax, 617); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should relayout with style options', function(done) { @@ -401,8 +390,7 @@ describe('Visible rangesliders', function() { expect(bg.getAttribute('stroke')).toBe('blue'); expect(bg.getAttribute('stroke-width')).toBe('3'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should relayout on size / domain udpate', function(done) { @@ -436,8 +424,7 @@ describe('Visible rangesliders', function() { expect(+maskMin.getAttribute('width')).toBeWithin(9.22, TOL); expect(+maskMax.getAttribute('width')).toBeWithin(71.95, TOL); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should automargin correctly with a top or bottom x axis', function(done) { @@ -481,8 +468,7 @@ describe('Visible rangesliders', function() { .then(function() { assertBottom(210); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -509,8 +495,7 @@ describe('Rangeslider visibility property', function() { expect(rangeSlider).not.toBeDefined(); assertPlotSize({height: 400}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should add the slider if rangeslider is set to anything', function(done) { @@ -523,8 +508,7 @@ describe('Rangeslider visibility property', function() { expect(rangeSlider).toBeDefined(); assertPlotSize({heightLessThan: 400}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should add the slider if visible changed to `true`', function(done) { @@ -538,8 +522,7 @@ describe('Rangeslider visibility property', function() { expect(countRangeSliderClipPaths()).toEqual(1); assertPlotSize({heightLessThan: 400}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should remove the slider if changed to `false` or `undefined`', function(done) { @@ -560,8 +543,7 @@ describe('Rangeslider visibility property', function() { expect(countRangeSliderClipPaths()).toEqual(0); assertPlotSize({height: 400}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should clear traces in range plot when needed', function(done) { @@ -643,8 +625,7 @@ describe('Rangeslider visibility property', function() { expect(count('g.heatmaplayer > g.hm')).toEqual(0); expect(count('g.contourlayer > g.contour')).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -928,8 +909,7 @@ describe('rangesliders in general', function() { expect(rangeSlider).toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should plot when only y data is provided', function(done) { @@ -939,8 +919,7 @@ describe('rangesliders in general', function() { expect(rangeSlider).toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should expand its range in accordance with new data arrays', function(done) { @@ -972,8 +951,7 @@ describe('rangesliders in general', function() { .then(function() { assertRange([-0.31, 5.31], [-0.31, 5.31]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not expand its range when range slider range is set', function(done) { @@ -1026,8 +1004,7 @@ describe('rangesliders in general', function() { .then(function() { assertRange([-0.26, 4.26], [-2, 12]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should configure yaxis opts on relayout', function(done) { @@ -1053,8 +1030,7 @@ describe('rangesliders in general', function() { .then(function() { expect(gd.layout.xaxis.rangeslider.yaxis).toEqual(jasmine.objectContaining({ rangemode: 'match' })); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update rangeslider x/y ranges when data changes even if main axes are not autoranged', function(done) { @@ -1081,8 +1057,7 @@ describe('rangesliders in general', function() { expect(gd._fullLayout.xaxis.rangeslider.range).toBeCloseToArray([-1, 5], 3); expect(gd._fullLayout.xaxis.rangeslider.yaxis.range).toBeCloseToArray([-1, 11], 3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to turn on rangeslider x/y autorange if initially specified', function(done) { @@ -1115,8 +1090,7 @@ describe('rangesliders in general', function() { expect(gd._fullLayout.xaxis.rangeslider.range).toBeCloseToArray([-0.5, 2.5], 3); expect(gd._fullLayout.xaxis.rangeslider.yaxis.range).toBeCloseToArray([0.5, 3.5], 3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to turn on rangeslider x/y autorange implicitly by deleting x range', function(done) { @@ -1142,8 +1116,7 @@ describe('rangesliders in general', function() { .then(function() { expect(gd._fullLayout.xaxis.rangeslider.range).toBeCloseToArray([-0.5, 2.5], 3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should give correct rangeslider range on reversed axes', function(done) { @@ -1212,8 +1185,7 @@ describe('rangesliders in general', function() { rangesliderRng: [0, 3] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/sankey_test.js b/test/jasmine/tests/sankey_test.js index bacd53f85b5..010e0d92db6 100644 --- a/test/jasmine/tests/sankey_test.js +++ b/test/jasmine/tests/sankey_test.js @@ -379,8 +379,7 @@ describe('sankey tests', function() { expect(gd.data.length).toEqual(0); expect(d3.selectAll('.sankey').size()).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.deleteTraces removes draggers', function(done) { @@ -393,8 +392,7 @@ describe('sankey tests', function() { .then(function() { expect(document.getElementsByClassName('bgsankey').length).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.plot does not show Sankey if \'visible\' is false', function(done) { @@ -415,8 +413,7 @@ describe('sankey tests', function() { expect(gd.data.length).toEqual(1); expect(d3.selectAll('.sankey').size()).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('\'node\' remains visible even if \'value\' is very low', function(done) { @@ -437,8 +434,7 @@ describe('sankey tests', function() { return Math.min(prevMin, d3.select(rect).attr('height')); }, Infinity)).toEqual(0.5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('switch from normal to circular Sankey on react', function(done) { @@ -453,8 +449,7 @@ describe('sankey tests', function() { .then(function() { expect(gd.calcdata[0][0].circular).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('switch from circular to normal Sankey on react', function(done) { @@ -478,8 +473,7 @@ describe('sankey tests', function() { .then(function() { expect(gd.calcdata[0][0].circular).toBe(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can create groups, restyle groups and properly update DOM', function(done) { @@ -517,8 +511,7 @@ describe('sankey tests', function() { var L = sankeyNodes.filter(function(d) { return d.partOfGroup;}).size(); expect(L).toBe(newGroup.flat().length, 'does not have the right number of ghost nodes'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('switches from normal to circular Sankey on grouping', function(done) { @@ -539,8 +532,7 @@ describe('sankey tests', function() { .then(function() { expect(gd.calcdata[0][0].circular).toBe(false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('prevents nodes from overlapping in snap arrangement', function(done) { @@ -566,8 +558,7 @@ describe('sankey tests', function() { // Nodes do not overlap in snap expect(checkElementOverlap(3, 6)).not.toBeTruthy('nodes overlap'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('resets each subplot to its initial view (ie. x, y groups) via modebar button', function(done) { @@ -612,8 +603,7 @@ describe('sankey tests', function() { expect(gd._fullData[0].node.groups).toEqual([]); expect(gd._fullData[1].node.groups).toEqual([[2, 3]]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('works as a subplot in the presence of other trace types', function(done) { @@ -624,8 +614,7 @@ describe('sankey tests', function() { }; Plotly.plot(gd, mockCopy) - .catch(failTest) - .then(done); + .then(done, done.fail); }); ['0', '1'].forEach(function(finalUIRevision) { @@ -665,8 +654,7 @@ describe('sankey tests', function() { ); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -779,8 +767,7 @@ describe('sankey tests', function() { ['rgb(255, 255, 0)', 'rgb(255, 0, 255)', 18, 'Roboto', 'rgb(0, 128, 0)'] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should position hover labels correctly', function(done) { @@ -815,8 +802,7 @@ describe('sankey tests', function() { expect(pos.x).toBeCloseTo(279, -1.5, 'it should have correct x position'); expect(pos.y).toBeCloseTo(500, -1.5, 'it should have correct y position'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show the correct hover labels when hovertemplate is specified', function(done) { @@ -866,8 +852,7 @@ describe('sankey tests', function() { ['rgb(0, 0, 96)', 'rgb(255, 255, 255)', 13, 'Arial', 'rgb(255, 255, 255)'] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show the correct hover labels with the style provided in template', function(done) { @@ -919,8 +904,7 @@ describe('sankey tests', function() { ['rgb(255, 255, 0)', 'rgb(255, 0, 255)', 18, 'Roboto', 'rgb(0, 128, 0)'] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show the correct hover labels even if there is no link.label supplied', function(done) { @@ -937,8 +921,7 @@ describe('sankey tests', function() { ['rgb(0, 0, 96)', 'rgb(255, 255, 255)', 13, 'Arial', 'rgb(255, 255, 255)'] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show the multiple hover labels in a flow in hovermode `x`', function(done) { @@ -978,8 +961,7 @@ describe('sankey tests', function() { var domRect = g.node().getBoundingClientRect(); expect((domRect.bottom + domRect.top) / 2).toBeCloseTo(203, 0, 'it should center the hoverlabel associated with hovered link'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not show any labels if hovermode is false', function(done) { @@ -997,8 +979,7 @@ describe('sankey tests', function() { _hover(link[0], link[1]); assertNoLabel(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); ['skip', 'none'].forEach(function(hoverinfoFlag) { @@ -1013,8 +994,7 @@ describe('sankey tests', function() { _hover(node[0], node[1]); assertNoLabel(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1030,8 +1010,7 @@ describe('sankey tests', function() { _hover(link[0], link[1]); assertNoLabel(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1051,8 +1030,7 @@ describe('sankey tests', function() { _hover(link[0], link[1]); assertNoLabel(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1067,8 +1045,7 @@ describe('sankey tests', function() { _hover(link[0], link[1]); assertNoLabel(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should honor *hoverlabel.namelength*', function(done) { @@ -1093,8 +1070,7 @@ describe('sankey tests', function() { name: '447' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1170,8 +1146,7 @@ describe('sankey tests', function() { value: 46.477 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should output correct hover/unhover event data', function(done) { @@ -1224,8 +1199,7 @@ describe('sankey tests', function() { value: 46.477 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function assertNoHoverEvents(type) { @@ -1249,8 +1223,7 @@ describe('sankey tests', function() { .then(function() { return Plotly.relayout(gd, 'hovermode', false); }) .then(assertNoHoverEvents('node')) .then(assertNoHoverEvents('link')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not output hover/unhover event data when trace hoverinfo is skip', function(done) { @@ -1260,8 +1233,7 @@ describe('sankey tests', function() { .then(function() { return Plotly.restyle(gd, 'hoverinfo', 'skip'); }) .then(assertNoHoverEvents('link')) .then(assertNoHoverEvents('node')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not output hover/unhover event data when link.hoverinfo is skip', function(done) { @@ -1270,8 +1242,7 @@ describe('sankey tests', function() { Plotly.plot(gd, fig) .then(function() { return Plotly.restyle(gd, 'link.hoverinfo', 'skip'); }) .then(assertNoHoverEvents('link')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@noCI should not output hover/unhover event data when node.hoverinfo is skip', function(done) { @@ -1280,8 +1251,7 @@ describe('sankey tests', function() { Plotly.plot(gd, fig) .then(function() { return Plotly.restyle(gd, 'node.hoverinfo', 'skip'); }) .then(assertNoHoverEvents('node')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1335,8 +1305,7 @@ describe('sankey tests', function() { Plotly.newPlot(gd, mockCopy) .then(testDragNode(move)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not change the position of a node if the mouse does not move', function(done) { @@ -1345,8 +1314,7 @@ describe('sankey tests', function() { Plotly.newPlot(gd, mockCopy) .then(testDragNode(move)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should persist the position of every nodes after drag in attributes nodes.(x|y)', function(done) { @@ -1393,8 +1361,7 @@ describe('sankey tests', function() { } return true; }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1467,8 +1434,7 @@ describe('sankey tests', function() { expect(newPosition.x).toBeCloseTo(pos[0], 2, 'x position ' + msg); expect(newPosition.y).toBeCloseTo(pos[1], 2, 'y position ' + msg); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/scatter3d_test.js b/test/jasmine/tests/scatter3d_test.js index 0d2a999e335..4177640e0fa 100644 --- a/test/jasmine/tests/scatter3d_test.js +++ b/test/jasmine/tests/scatter3d_test.js @@ -7,7 +7,7 @@ var Scatter3D = require('@src/traces/scatter3d'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var delay = require('../assets/delay'); function countCanvases() { @@ -158,8 +158,7 @@ describe('Test scatter3d interactions:', function() { expect(gd._fullLayout._has('gl3d')).toBe(true); expect(gd._fullLayout.scene._scene).toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to delete the last trace', function(done) { @@ -175,8 +174,7 @@ describe('Test scatter3d interactions:', function() { expect(gd._fullLayout._has('gl3d')).toBe(false); expect(gd._fullLayout.scene === undefined).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to toggle visibility', function(done) { @@ -240,8 +238,7 @@ describe('Test scatter3d interactions:', function() { .then(function() { assertObjects(order0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should avoid passing blank texts to webgl', function(done) { @@ -259,8 +256,7 @@ describe('Test scatter3d interactions:', function() { .then(function() { assertIsFilled('not to be empty text'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should avoid passing empty lines to webgl', function(done) { @@ -287,8 +283,7 @@ describe('Test scatter3d interactions:', function() { // see https://github.com/plotly/plotly.js/issues/1976 expect(obj.vao.draw).toHaveBeenCalledTimes(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should only accept texts for textposition otherwise textposition is set to middle center before passing to webgl', function(done) { @@ -312,7 +307,6 @@ describe('Test scatter3d interactions:', function() { expect(AllTextpositions[i]).toBe('middle center', 'is not middle center'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/scatter_test.js b/test/jasmine/tests/scatter_test.js index b1c3be873fc..8d663a021fd 100644 --- a/test/jasmine/tests/scatter_test.js +++ b/test/jasmine/tests/scatter_test.js @@ -10,7 +10,7 @@ var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var customAssertions = require('../assets/custom_assertions'); var negateIf = require('../assets/negate_if'); -var failTest = require('../assets/fail_test'); + var transitions = require('../assets/transitions'); var assertClip = customAssertions.assertClip; @@ -683,7 +683,7 @@ describe('end-to-end scatter tests', function() { points.each(function() { expect(d3.select(this).classed('plotly-customdata')).toBe(false); }); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('adds "textpoint" class to scatter text points', function(done) { @@ -694,7 +694,7 @@ describe('end-to-end scatter tests', function() { text: ['a', 'b', 'c'] }]).then(function() { expect(Plotly.d3.selectAll('.textpoint').size()).toBe(3); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('should remove all point and text nodes on blank data', function(done) { @@ -747,8 +747,7 @@ describe('end-to-end scatter tests', function() { assertNodeCnt(3, 3); assertText(['A', 'B', 'C']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should keep layering correct as mode & fill change', function(done) { @@ -836,7 +835,7 @@ describe('end-to-end scatter tests', function() { p = p.then(setMode(i)).then(testOrdering(i)); } - p.catch(failTest).then(done); + p.then(done, done.fail); }); function _assertNodes(ptStyle, txContent) { @@ -893,8 +892,7 @@ describe('end-to-end scatter tests', function() { ['apple', 'banana', 'clementine'] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should reorder point and text nodes even when linked to ids (add/remove case)', function(done) { @@ -937,8 +935,7 @@ describe('end-to-end scatter tests', function() { ['apple', 'banana', 'clementine'] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should smoothly add/remove nodes tags with *ids* during animations', function(done) { @@ -973,8 +970,7 @@ describe('end-to-end scatter tests', function() { ['apple', 'banana', 'dragon fruit'] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('animates fillcolor', function(done) { @@ -995,7 +991,7 @@ describe('end-to-end scatter tests', function() { ); }).then(function() { expect(fill()).toEqual('rgb(0, 0, 255)'); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('clears fills tonext when either trace is emptied out', function(done) { @@ -1038,8 +1034,7 @@ describe('end-to-end scatter tests', function() { .then(function() { checkFill(false, 'null out both traces'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('correctly autoranges fill tonext traces across multiple subplots', function(done) { @@ -1055,8 +1050,7 @@ describe('end-to-end scatter tests', function() { // even though the fill was correctly drawn down to zero expect(gd._fullLayout.yaxis2.range[0]).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('correctly autoranges fill tonext traces with only one point', function(done) { @@ -1064,8 +1058,7 @@ describe('end-to-end scatter tests', function() { .then(function() { expect(gd._fullLayout.yaxis.range[0]).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work with typed arrays', function(done) { @@ -1124,8 +1117,7 @@ describe('end-to-end scatter tests', function() { expect(getColor(legendPts.node())).toBe('rgb(0, 255, 0)', 'legend pt color'); expect(getMarkerSize(legendPts.node())).toBe(16, 'legend pt size'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function assertAxisRanges(msg, xrng, yrng) { @@ -1169,8 +1161,7 @@ describe('end-to-end scatter tests', function() { .then(function() { assertAxisRanges('auto rng / base marker.size', [-0.13, 2.13], [0.93, 2.07]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update axis range according to visible edits', function(done) { @@ -1197,8 +1188,7 @@ describe('end-to-end scatter tests', function() { .then(function() { assertAxisRanges('back to both visible', [0.676, 6.323], [-2.29, 2.29]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to start from visible:false', function(done) { @@ -1222,8 +1212,7 @@ describe('end-to-end scatter tests', function() { .then(function() { _assert('back to visible:false', 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not error out when segment-less marker-less fill traces', function(done) { @@ -1236,8 +1225,7 @@ describe('end-to-end scatter tests', function() { expect(d3.selectAll('.js-fill').size()).toBe(1, 'js-fill is there'); expect(d3.select('.js-fill').attr('d')).toBe('M0,0Z', 'js-fill has an empty path'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1361,8 +1349,7 @@ describe('stacked area', function() { y3: [0, 4.32], y4: [0, 1.08], y5: [0, 105.26], y6: [0, 5.26] }, 'middle trace *implicit* visible: false'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can add/delete stack groups', function(done) { @@ -1394,8 +1381,7 @@ describe('stacked area', function() { .then(function() { _assert([0, 3.205], 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('does not stack on date axes', function(done) { @@ -1409,8 +1395,7 @@ describe('stacked area', function() { // adding milliseconds since 1970 .toEqual(['2015', '2017']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('does not stack on category axes', function(done) { @@ -1423,8 +1408,7 @@ describe('stacked area', function() { // and autorange to ~[-0.2, 3.2] expect(gd.layout.yaxis.range).toBeCloseToArray([-0.1, 2.1], 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1491,8 +1475,7 @@ describe('scatter hoverPoints', function() { expect(pts[1].text).toEqual('banana', 'hover text'); expect(pts[2].text).toEqual('orange', 'hover text'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1620,8 +1603,7 @@ describe('Test Scatter.style', function() { 'selected pt 1 w/ set unselected.marker.opacity' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should style selected point marker color correctly', function(done) { @@ -1707,8 +1689,7 @@ describe('Test Scatter.style', function() { 'selected pts 0-2 w/ set selected.marker.color' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should style selected point marker size correctly', function(done) { @@ -1751,8 +1732,7 @@ describe('Test Scatter.style', function() { 'selected pt 0 w/ set unselected.marker.size' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should style selected point textfont correctly', function(done) { @@ -1834,8 +1814,7 @@ describe('Test Scatter.style', function() { 'selected pts 0-2 w/ set selected.textfont.color' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1980,8 +1959,7 @@ describe('Test scatter *clipnaxis*:', function() { [true, 1] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/scattergeo_test.js b/test/jasmine/tests/scattergeo_test.js index 3f673be7fd4..0575cd4c5bd 100644 --- a/test/jasmine/tests/scattergeo_test.js +++ b/test/jasmine/tests/scattergeo_test.js @@ -14,7 +14,7 @@ var customAssertions = require('../assets/custom_assertions'); var assertHoverLabelStyle = customAssertions.assertHoverLabelStyle; var assertHoverLabelContent = customAssertions.assertHoverLabelContent; var checkTextTemplate = require('../assets/check_texttemplate'); -var failTest = require('../assets/fail_test'); + var supplyAllDefaults = require('../assets/supply_defaults'); describe('Test scattergeo defaults', function() { @@ -348,16 +348,14 @@ describe('Test scattergeo hover', function() { Plotly.restyle(gd, 'hoverinfo', 'lon+lat+text+name').then(function() { check([381, 221], ['(10°, 10°)\nA', 'trace 0']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use the hovertemplate', function(done) { Plotly.restyle(gd, 'hovertemplate', 'tpl %{lat}x').then(function() { check([381, 221], ['tpl 10', 'x']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not hide hover label when hovertemplate', function(done) { @@ -367,32 +365,28 @@ describe('Test scattergeo hover', function() { }).then(function() { check([381, 221], ['tpl 10', 'x']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should generate hover label info (\'text\' single value case)', function(done) { Plotly.restyle(gd, 'text', 'text').then(function() { check([381, 221], ['(10°, 10°)\ntext', null]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should generate hover label info (\'hovertext\' single value case)', function(done) { Plotly.restyle(gd, 'hovertext', 'hovertext').then(function() { check([381, 221], ['(10°, 10°)\nhovertext', null]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should generate hover label info (\'hovertext\' array case)', function(done) { Plotly.restyle(gd, 'hovertext', ['Apple', 'Banana', 'Orange']).then(function() { check([381, 221], ['(10°, 10°)\nApple', null]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should generate hover label with custom styling', function(done) { @@ -409,16 +403,14 @@ describe('Test scattergeo hover', function() { fontFamily: 'Arial' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should generate hover label with arrayOk \'hoverinfo\' settings', function(done) { Plotly.restyle(gd, 'hoverinfo', [['lon', null, 'lat+name']]).then(function() { check([381, 221], ['lon: 10°', null]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('should preserve lon/lat formatting hovetemplate equivalence', function() { @@ -431,8 +423,7 @@ describe('Test scattergeo hover', function() { lat: [[10.00087683]] }) .then(function() { check(pos, exp); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- hovertemplate case (same lon/lat truncation)', function(done) { @@ -442,8 +433,7 @@ describe('Test scattergeo hover', function() { hovertemplate: '(%{lon}°, %{lat}°)
%{text}' }) .then(function() { check(pos, exp); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -459,8 +449,7 @@ describe('Test scattergeo hover', function() { .then(function() { check([275, 255], ['New York', 'LOOK']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -484,8 +473,7 @@ describe('scattergeo drawing', function() { // only utopia logs - others are silently ignored expect(loggers.log).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('preserves order after hide/show', function(done) { @@ -510,8 +498,7 @@ describe('scattergeo drawing', function() { .then(function() { expect(getIndices()).toEqual([0, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/scattergl_select_test.js b/test/jasmine/tests/scattergl_select_test.js index 6cb3e29b0a3..73ca8967dfc 100644 --- a/test/jasmine/tests/scattergl_select_test.js +++ b/test/jasmine/tests/scattergl_select_test.js @@ -4,7 +4,7 @@ var Lib = require('@src/lib'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test.js'); + var doubleClick = require('../assets/double_click'); var delay = require('../assets/delay'); @@ -104,8 +104,7 @@ describe('Test gl2d lasso/select:', function() { ] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should work under fast mode with *lasso* dragmode', function(done) { @@ -128,8 +127,7 @@ describe('Test gl2d lasso/select:', function() { ] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should work under fancy mode with *select* dragmode', function(done) { @@ -148,8 +146,7 @@ describe('Test gl2d lasso/select:', function() { points: [{x: 0.004, y: 12.5}] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should work under fancy mode with *lasso* dragmode', function(done) { @@ -167,8 +164,7 @@ describe('Test gl2d lasso/select:', function() { points: [{ x: 0.099, y: 2.75 }] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should work on trace with enabled transforms', function(done) { @@ -190,8 +186,7 @@ describe('Test gl2d lasso/select:', function() { ] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should work on gl text charts', function(done) { @@ -273,8 +268,7 @@ describe('Test gl2d lasso/select:', function() { ] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should work on gl text charts with array textfont.color', function(done) { @@ -353,8 +347,7 @@ describe('Test gl2d lasso/select:', function() { ] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -424,8 +417,7 @@ describe('Test displayed selections:', function() { expect(readContext()).toBe(0, 'update+select context'); expect(readFocus()).toBeGreaterThan(1e4, 'update+select focus'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should display selection of big number of regular points', function(done) { @@ -455,8 +447,7 @@ describe('Test displayed selections:', function() { expect(readPixel(gd.querySelector('.gl-canvas-context'), 158, 100)[3]).not.toBe(0); expect(readPixel(gd.querySelector('.gl-canvas-focus'), 168, 100)[3]).not.toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should display selection of big number of miscellaneous points', function(done) { @@ -500,8 +491,7 @@ describe('Test displayed selections:', function() { expect(readPixel(gd.querySelector('.gl-canvas-context'), 158, 100)[3]).not.toBe(0); expect(readPixel(gd.querySelector('.gl-canvas-focus'), 168, 100)[3]).not.toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -678,8 +668,7 @@ describe('Test selections during funky scenarios', function() { ] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should behave correctly when doubleclick before selecting anything', function(done) { @@ -714,8 +703,7 @@ describe('Test selections during funky scenarios', function() { ] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should behave correctly during select -> doubleclick -> dragmode:mode -> dragmode:select', function(done) { @@ -766,8 +754,7 @@ describe('Test selections during funky scenarios', function() { ] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -846,8 +833,7 @@ describe('Test selections during funky scenarios', function() { ['select2d', [[[], []]]] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should work on overlaid subplots', function(done) { @@ -888,7 +874,6 @@ describe('Test selections during funky scenarios', function() { expect(scene.scatter2d.draw).toHaveBeenCalledTimes(1); expect(scene2.scatter2d.draw).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/scattergl_test.js b/test/jasmine/tests/scattergl_test.js index d409d89e753..71a84c6f5c9 100644 --- a/test/jasmine/tests/scattergl_test.js +++ b/test/jasmine/tests/scattergl_test.js @@ -36,7 +36,7 @@ describe('end-to-end scattergl tests', function() { var subplot = fullLayout._plots.xy; var scene = subplot._scene; expect(scene.glText.length).toEqual(1); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('@gl should update a plot with text labels', function(done) { @@ -104,7 +104,7 @@ describe('end-to-end scattergl tests', function() { var subplot = fullLayout._plots.xy; var scene = subplot._scene; expect(scene.glText.length).toEqual(2); - }).catch(failTest).then(done); + }).then(done, done.fail); }); ['text', 'texttemplate'].forEach(function(attr) { @@ -167,8 +167,7 @@ describe('end-to-end scattergl tests', function() { assertDrawCall('back up', 1); expect(readPixel(gd.querySelector('.gl-canvas-context'), 108, 100)[0]).not.toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to toggle trace with different modes', function(done) { @@ -214,8 +213,7 @@ describe('end-to-end scattergl tests', function() { expect(scene.glText[0].render).toHaveBeenCalledTimes(1); expect(scene.scatter2d.draw).toHaveBeenCalledTimes(3, 'both traces have markers'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should change plot type with incomplete data', function(done) { @@ -230,8 +228,7 @@ describe('end-to-end scattergl tests', function() { return Plotly.restyle(gd, {y: [[1]]}, 0); }).not.toThrow(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should restyle opacity', function(done) { @@ -254,8 +251,7 @@ describe('end-to-end scattergl tests', function() { .then(function() { expect(ScatterGl.calc).toHaveBeenCalledTimes(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should update selected points', function(done) { @@ -341,8 +337,7 @@ describe('end-to-end scattergl tests', function() { expect(scene.selectBatch).toEqual([[], []], msg); expect(scene.unselectBatch).toEqual([[], []], msg); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should remove fill2d', function(done) { @@ -358,8 +353,7 @@ describe('end-to-end scattergl tests', function() { .then(function() { expect(readPixel(gd.querySelector('.gl-canvas-context'), 100, 80)[0]).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to draw more than 4096 colors', function(done) { @@ -403,8 +397,7 @@ describe('end-to-end scattergl tests', function() { // and 105545275 after. expect(total).toBeGreaterThan(4e6); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should work with typed array', function(done) { @@ -434,8 +427,7 @@ describe('end-to-end scattergl tests', function() { expect(opts.positions) .toBeCloseToArray([1, 1, 2, 2, 3, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should handle transform traces properly (calcTransform case)', function(done) { @@ -466,8 +458,7 @@ describe('end-to-end scattergl tests', function() { var scene = gd.calcdata[0][0].t._scene; expect(scene.selectBatch[0]).toEqual([0]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should handle transform traces properly (default transform case)', function(done) { @@ -500,8 +491,7 @@ describe('end-to-end scattergl tests', function() { var scene = gd.calcdata[0][0].t._scene; expect(scene.selectBatch).toEqual([[], [0]]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should not cause infinite loops when coordinate arrays start/end with NaN', function(done) { @@ -573,8 +563,7 @@ describe('end-to-end scattergl tests', function() { [undefined, 0, undefined, 0] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should reset the sanp to length after react and not to TOO_MANY_POINTS constant', function(done) { @@ -618,7 +607,7 @@ describe('end-to-end scattergl tests', function() { }) .then(function() { expect(getSnap()).toEqual(TOO_MANY_POINTS + 1); - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); @@ -668,8 +657,7 @@ describe('Test scattergl autorange:', function() { expect(gd._fullLayout.xaxis.range).toBeCloseToArray(glRangeX, 'x range'); expect(gd._fullLayout.yaxis.range).toBeCloseToArray(glRangeY, 'y range'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -718,8 +706,7 @@ describe('Test scattergl autorange:', function() { expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.079, 1.079], 2, 'x range'); expect(gd._fullLayout.yaxis.range).toBeCloseToArray([-0.105, 1.105], 2, 'y range'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl - case array marker.size', function(done) { @@ -734,8 +721,7 @@ describe('Test scattergl autorange:', function() { expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.119, 1.119], 2, 'x range'); expect(gd._fullLayout.yaxis.range).toBeCloseToArray([-0.199, 1.199], 2, 'y range'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl - case mode:lines', function(done) { @@ -748,8 +734,7 @@ describe('Test scattergl autorange:', function() { expect(gd._fullLayout.xaxis.range).toBeCloseToArray([0, N - 1], 2, 'x range'); expect(gd._fullLayout.yaxis.range).toBeCloseToArray([-0.0555, 1.0555], 2, 'y range'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/scattermapbox_test.js b/test/jasmine/tests/scattermapbox_test.js index 39018139d7e..4635ae64f8b 100644 --- a/test/jasmine/tests/scattermapbox_test.js +++ b/test/jasmine/tests/scattermapbox_test.js @@ -8,7 +8,7 @@ var convert = require('@src/traces/scattermapbox/convert'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var supplyAllDefaults = require('../assets/supply_defaults'); var assertHoverLabelContent = require('../assets/custom_assertions').assertHoverLabelContent; @@ -762,8 +762,7 @@ describe('scattermapbox hover', function() { out = hoverPoints(getPointData(gd), xval, yval)[0]; expect(out.extraText).toEqual('(10°, 10°)
A'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should generate hover label info (positive winding case)', function() { @@ -803,8 +802,7 @@ describe('scattermapbox hover', function() { expect(out.extraText).toEqual('lon: 10°'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should generate hover label info (hoverinfo: \'lat\' case)', function(done) { @@ -816,8 +814,7 @@ describe('scattermapbox hover', function() { expect(out.extraText).toEqual('lat: 10°'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should generate hover label info (hoverinfo: \'text\' + \'text\' array case)', function(done) { @@ -829,8 +826,7 @@ describe('scattermapbox hover', function() { expect(out.extraText).toEqual('A'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should generate hover label info (hoverinfo: \'text\' + \'hovertext\' array case)', function(done) { @@ -842,8 +838,7 @@ describe('scattermapbox hover', function() { expect(out.extraText).toEqual('Apple'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should generate hover label (\'marker.color\' array case)', function(done) { @@ -852,8 +847,7 @@ describe('scattermapbox hover', function() { expect(out.color).toEqual('red'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should generate hover label (\'marker.color\' w/ colorscale case)', function(done) { @@ -862,8 +856,7 @@ describe('scattermapbox hover', function() { expect(out.color).toEqual('rgb(245, 195, 157)'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should generate hover label (\'hoverinfo\' array case)', function(done) { @@ -887,8 +880,7 @@ describe('scattermapbox hover', function() { .then(function() { check('(10°, 10°)
Apple'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should pass along hovertemplate', function(done) { @@ -900,8 +892,7 @@ describe('scattermapbox hover', function() { expect(out.hovertemplate).toEqual('tpl'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should always display hoverlabel when hovertemplate is defined', function(done) { @@ -912,8 +903,7 @@ describe('scattermapbox hover', function() { .then(function() { checkHoverLabel([190, 215], ['tpl2', '']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1082,8 +1072,7 @@ describe('Test plotly events on a scattermapbox plot:', function() { expect(pt.lon).toEqual(10, 'points[0].lon'); expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1213,8 +1202,7 @@ describe('Test plotly events on a scattermapbox plot when css transform is prese expect(pt.lon).toEqual(10, 'points[0].lon'); expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/scatterpolar_test.js b/test/jasmine/tests/scatterpolar_test.js index c0802a50e29..e4105bd7be0 100644 --- a/test/jasmine/tests/scatterpolar_test.js +++ b/test/jasmine/tests/scatterpolar_test.js @@ -4,7 +4,7 @@ var ScatterPolar = require('@src/traces/scatterpolar'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var customAssertions = require('../assets/custom_assertions'); @@ -195,7 +195,7 @@ describe('Test scatterpolar hover:', function() { }] .forEach(function(specs) { it('should generate correct hover labels ' + specs.desc, function(done) { - run(specs).catch(failTest).then(done); + run(specs).then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/scatterpolargl_test.js b/test/jasmine/tests/scatterpolargl_test.js index 87670d57b05..18d45923371 100644 --- a/test/jasmine/tests/scatterpolargl_test.js +++ b/test/jasmine/tests/scatterpolargl_test.js @@ -5,7 +5,7 @@ var ScatterPolarGl = require('@src/traces/scatterpolargl'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var readPixel = require('../assets/read_pixel'); @@ -110,7 +110,7 @@ describe('Test scatterpolargl hover:', function() { }] .forEach(function(specs) { it('@gl should generate correct hover labels ' + specs.desc, function(done) { - run(specs).catch(failTest).then(done); + run(specs).then(done, done.fail); }); }); }); @@ -176,8 +176,7 @@ describe('Test scatterpolargl interactions:', function() { expect(totalPixels()).not.toBe(0); expect(d3.selectAll('.scatterlayer > .trace').size()).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to toggle from svg to gl (on graph with scattergl subplot)', function(done) { @@ -257,8 +256,7 @@ describe('Test scatterpolargl interactions:', function() { expect(scenePolar.destroy).toHaveBeenCalledTimes(1); expect(gd._fullLayout.polar._subplot._scene).toBe(null); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -301,8 +299,7 @@ describe('Test scatterpolargl autorange:', function() { expect(gd._fullLayout.polar.radialaxis.range) .toBeCloseToArray(svgRange, 'gl radial range'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -342,8 +339,7 @@ describe('Test scatterpolargl autorange:', function() { .toBeCloseToArray([0, 1.0799], 2, 'radial range'); expect(cnt).toBe(1, '# of plot call'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl - case array marker.size', function(done) { @@ -358,8 +354,7 @@ describe('Test scatterpolargl autorange:', function() { .toBeCloseToArray([0, 1.0465], 2, 'radial range'); expect(cnt).toBe(1, '# of plot call'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl - case mode:lines', function(done) { @@ -373,8 +368,7 @@ describe('Test scatterpolargl autorange:', function() { .toBeCloseToArray([0, 0.9999], 2, 'radial range'); expect(cnt).toBe(1, '# of plot call'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/scatterternary_test.js b/test/jasmine/tests/scatterternary_test.js index 89153c75f08..1022154c956 100644 --- a/test/jasmine/tests/scatterternary_test.js +++ b/test/jasmine/tests/scatterternary_test.js @@ -5,7 +5,7 @@ var ScatterTernary = require('@src/traces/scatterternary'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var customAssertions = require('../assets/custom_assertions'); var supplyAllDefaults = require('../assets/supply_defaults'); @@ -408,8 +408,7 @@ describe('scatterternary hover', function() { expect(scatterPointData[0].yLabelVal).toBeUndefined(); expect(scatterPointData[0].text).toEqual('orange'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should pass along hovertemplate on hover', function(done) { @@ -427,8 +426,7 @@ describe('scatterternary hover', function() { expect(scatterPointData[0].bLabel).toBe('0.1111111'); expect(scatterPointData[0].cLabel).toBe('0.5555556'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should always display hoverlabel when hovertemplate is defined', function(done) { @@ -446,8 +444,7 @@ describe('scatterternary hover', function() { .then(function() { check([380, 210], ['0.5, 0.25, 0.25']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -551,8 +548,7 @@ describe('Test scatterternary *cliponaxis*', function() { [true, 1] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/select_test.js b/test/jasmine/tests/select_test.js index e5f484cfa48..f3a479c0024 100644 --- a/test/jasmine/tests/select_test.js +++ b/test/jasmine/tests/select_test.js @@ -8,7 +8,7 @@ var DBLCLICKDELAY = require('@src/plot_api/plot_config').dfltConfig.doubleClickD var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var touchEvent = require('../assets/touch_event'); @@ -245,8 +245,7 @@ describe('Click-to-select', function() { plotMock14() .then(function() { return _immediateClickPt(mock14Pts[7]); }) .then(function() { assertSelectedPoints(7); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('clears entire selection when the last selected data point', function() { @@ -272,8 +271,7 @@ describe('Click-to-select', function() { .then(function() { assertSelectedPoints(35); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -295,8 +293,7 @@ describe('Click-to-select', function() { .then(function() { assertSelectedPoints(35); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('supports adding to an existing selection', function(done) { @@ -307,8 +304,7 @@ describe('Click-to-select', function() { return _clickPt(mock14Pts[35], { shiftKey: true }); }) .then(function() { assertSelectedPoints([7, 35]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('supports subtracting from an existing selection', function(done) { @@ -323,8 +319,7 @@ describe('Click-to-select', function() { return _clickPt(mock14Pts[7], { shiftKey: true }); }) .then(function() { assertSelectedPoints(35); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can be used interchangeably with lasso/box select', function(done) { @@ -376,8 +371,7 @@ describe('Click-to-select', function() { .then(function() { assertSelectionCleared(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl works in a multi-trace plot', function(done) { @@ -420,8 +414,7 @@ describe('Click-to-select', function() { .then(function() { assertSelectedPoints([[1], [2], [3]]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('is supported in pan/zoom mode', function(done) { @@ -455,8 +448,7 @@ describe('Click-to-select', function() { // persist after zoombox assertSelectedPoints(7); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('retains selected points when switching between pan and zoom mode', function(done) { @@ -483,8 +475,7 @@ describe('Click-to-select', function() { .then(function() { assertSelectedPoints(35); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl is supported by scattergl in pan/zoom mode', function(done) { @@ -509,8 +500,7 @@ describe('Click-to-select', function() { .then(function() { assertSelectedPoints(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('deals correctly with histogram\'s binning in the persistent selection case', function(done) { @@ -544,8 +534,7 @@ describe('Click-to-select', function() { .then(function() { assertSelectionCleared(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); function clickFirstBinImmediately() { return _immediateClickPt({ x: 141, y: 358 }); } function clickFirstBin() { return _click(141, 358); } @@ -577,8 +566,7 @@ describe('Click-to-select', function() { .then(function() { assertSelectionCleared(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); function clickPtImmediately() { return _immediateClickPt({ x: 610, y: 342 }); } function clickPt() { return _clickPt({ x: 610, y: 342 }); } @@ -598,8 +586,7 @@ describe('Click-to-select', function() { .then(function() { assertSelectionCleared(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -616,8 +603,7 @@ describe('Click-to-select', function() { .then(function() { assertSelectionCleared(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -701,8 +687,7 @@ describe('Click-to-select', function() { .then(function() { assertSelectedPoints(testCase.expectedPts); }) - .catch(failTest) - .then(doneFn); + .then(doneFn, doneFn.fail); } }); @@ -741,8 +726,7 @@ describe('Click-to-select', function() { }); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('triggers \'plotly_selected\' before \'plotly_click\'', function() { @@ -787,8 +771,7 @@ describe('Click-to-select', function() { return click(testCase.x, testCase.y); }) - .catch(failTest) - .then(doneFn); + .then(doneFn, doneFn.fail); } }); @@ -909,8 +892,7 @@ describe('Test select box and lasso in general:', function() { .then(function() { expect(doubleClickData).toBe(null, 'with the correct deselect data'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should handle add/sub selection', function(done) { @@ -1001,8 +983,7 @@ describe('Test select box and lasso in general:', function() { .then(function() { expect(doubleClickData).toBe(null, 'with the correct deselect data'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1055,8 +1036,7 @@ describe('Test select box and lasso in general:', function() { .then(function() { expect(doubleClickData).toBe(null, 'with the correct deselect data'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should set selected points in graph data', function(done) { @@ -1074,8 +1054,7 @@ describe('Test select box and lasso in general:', function() { .then(function() { expect(gd.data[0].selectedpoints).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should set selected points in full data', function(done) { @@ -1093,8 +1072,7 @@ describe('Test select box and lasso in general:', function() { .then(function() { expect(gd._fullData[0].selectedpoints).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should trigger selecting/selected/deselect events for touches', function(done) { @@ -1127,8 +1105,7 @@ describe('Test select box and lasso in general:', function() { .then(function() { expect(doubleClickData).toBe(null, 'with the correct deselect data'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1207,8 +1184,7 @@ describe('Test select box and lasso in general:', function() { .then(function() { checkPointCount(0, '(multiple invisible traces lasso)'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should skip over BADNUM items', function(done) { @@ -1246,8 +1222,7 @@ describe('Test select box and lasso in general:', function() { expect(selectedData.points[0].x).toBe(0); expect(selectedData.points[0].y).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('scroll zoom should clear selection regions', function(done) { @@ -1279,8 +1254,7 @@ describe('Test select box and lasso in general:', function() { // make sure it works the 2nd time aroung assertSelectionNodes(0, 0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('should return correct range data on dragmode *select*', function() { @@ -1319,8 +1293,7 @@ describe('Test select box and lasso in general:', function() { .then(function() { expect(selectedData.range.x).toBeCloseToArray(s.rng, 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1361,8 +1334,7 @@ describe('Test select box and lasso in general:', function() { .then(function() { expect(selectedData.lassoPoints.x).toBeCloseToArray(s.pts, 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1385,8 +1357,7 @@ describe('Test select box and lasso in general:', function() { .then(function() { assertSelectionNodes(0, 0, 'after axrange relayout'); }) .then(_drag) .then(function() { assertSelectionNodes(0, 2, 'after drag 2'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should select the right data with the corresponding select direction', function(done) { @@ -1445,8 +1416,7 @@ describe('Test select box and lasso in general:', function() { .then(function() { assertSelectedPointNumbers([4]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should cleanly clear and restart selections on double click when add/subtract mode on', function(done) { @@ -1474,8 +1444,7 @@ describe('Test select box and lasso in general:', function() { .then(function() { _assertSelectedPoints([67, 68, 69, 70, 71, 72, 73, 74]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); function _assertSelectedPoints(selPts) { if(selPts) { @@ -1591,8 +1560,7 @@ describe('Test select box and lasso in general:', function() { selpts: [40, 41, 42, 43, 44, 45, 46, 47, 48] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should remember selection polygons from previous select/lasso mode', function(done) { @@ -1727,8 +1695,7 @@ describe('Test select box and lasso in general:', function() { outline: [[150, 150], [150, 170], [170, 170], [170, 150]] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1936,8 +1903,7 @@ describe('Test select box and lasso per trace:', function() { LASSOEVENTS, 'scatterternary lasso after relayout' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1977,8 +1943,7 @@ describe('Test select box and lasso per trace:', function() { null, LASSOEVENTS, 'scattercarpet lasso' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2039,8 +2004,7 @@ describe('Test select box and lasso per trace:', function() { [[370, 120], [500, 200]], null, null, NOEVENTS, 'scattermapbox pan' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); }); @@ -2092,8 +2056,7 @@ describe('Test select box and lasso per trace:', function() { null, LASSOEVENTS, 'choroplethmapbox lasso' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); }); @@ -2195,8 +2158,7 @@ describe('Test select box and lasso per trace:', function() { [[370, 120], [500, 200]], null, null, NOEVENTS, 'scattergeo pan' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); }); @@ -2238,8 +2200,7 @@ describe('Test select box and lasso per trace:', function() { LASSOEVENTS, 'scatterpolar lasso' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2299,8 +2260,7 @@ describe('Test select box and lasso per trace:', function() { LASSOEVENTS, 'barpolar lasso' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2366,8 +2326,7 @@ describe('Test select box and lasso per trace:', function() { [[370, 120], [500, 200]], null, [200, 180], NOEVENTS, 'choropleth pan' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); }); @@ -2428,8 +2387,7 @@ describe('Test select box and lasso per trace:', function() { null, BOXEVENTS, 'waterfall select' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2492,8 +2450,7 @@ describe('Test select box and lasso per trace:', function() { null, BOXEVENTS, 'funnel select' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2584,8 +2541,7 @@ describe('Test select box and lasso per trace:', function() { null, BOXEVENTS, 'bar select (after xaxis.range relayout)' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2648,8 +2604,7 @@ describe('Test select box and lasso per trace:', function() { null, BOXEVENTS, 'date/category select' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2701,8 +2656,7 @@ describe('Test select box and lasso per trace:', function() { null, BOXEVENTS, 'histogram select' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2770,8 +2724,7 @@ describe('Test select box and lasso per trace:', function() { null, BOXEVENTS, 'box select' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2823,8 +2776,7 @@ describe('Test select box and lasso per trace:', function() { null, BOXEVENTS, 'box select' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2890,8 +2842,7 @@ describe('Test select box and lasso per trace:', function() { null, BOXEVENTS, 'violin select' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2970,8 +2921,7 @@ describe('Test select box and lasso per trace:', function() { null, BOXEVENTS, type + ' select' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -3018,8 +2968,7 @@ describe('Test select box and lasso per trace:', function() { BOXEVENTS, 'transformed trace select (all points selected)' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -3072,8 +3021,7 @@ describe('Test select box and lasso per trace:', function() { .then(function() { assertFillOpacity([1, 1, 1, 1, 1, 1], 'final'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -3112,8 +3060,7 @@ describe('Test select box and lasso per trace:', function() { .then(function() { expect(gd._fullData[0].node.groups).toEqual([[4, 3, 2]], 'failed to group #4 + existing group of #2 and #3'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -3134,8 +3081,7 @@ describe('Test select box and lasso per trace:', function() { .then(function() { expect(gd._fullData[0].node.groups).toEqual([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -3192,8 +3138,7 @@ describe('Test that selections persist:', function() { style: [0.2, 1, 0.2] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should persist for box', function(done) { @@ -3238,8 +3183,7 @@ describe('Test that selections persist:', function() { style: [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 1, 1, 1], }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should persist for histogram', function(done) { @@ -3279,8 +3223,7 @@ describe('Test that selections persist:', function() { style: [0.2, 1, 0.2, 0.2, 0.2], }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -3342,8 +3285,7 @@ describe('Test that selection styles propagate to range-slider plot:', function( .then(function() { _assert('after double-click reset', [1, 1, 1, 1, 1, 1, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- svg finance case', function(done) { @@ -3374,8 +3316,7 @@ describe('Test that selection styles propagate to range-slider plot:', function( .then(function() { _assert('after double-click reset', [1, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/shapes_test.js b/test/jasmine/tests/shapes_test.js index 7c80fbe07be..5d7d0dd998a 100644 --- a/test/jasmine/tests/shapes_test.js +++ b/test/jasmine/tests/shapes_test.js @@ -10,7 +10,7 @@ var Axes = require('@src/plots/cartesian/axes'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var drag = require('../assets/drag'); var customAssertions = require('../assets/custom_assertions'); @@ -246,8 +246,7 @@ describe('Test shapes:', function() { expect(countShapePathsInLowerLayer()) .toEqual(countShapesInLowerLayer(gd)); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -268,8 +267,7 @@ describe('Test shapes:', function() { expect(countShapePathsInUpperLayer()) .toEqual(countShapesInUpperLayer(gd)); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -292,8 +290,7 @@ describe('Test shapes:', function() { expect(countShapePathsInSubplots()) .toEqual(countShapesInSubplots(gd)); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -340,8 +337,7 @@ describe('Test shapes:', function() { expect(getLastShape(gd)).toEqual(shape); expect(countShapes(gd)).toEqual(index + 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to remove a shape', function(done) { @@ -373,8 +369,7 @@ describe('Test shapes:', function() { expect(countShapePathsInUpperLayer()).toEqual(pathCount - 2); expect(countShapes(gd)).toEqual(index - 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to remove all shapes', function(done) { @@ -401,8 +396,7 @@ describe('Test shapes:', function() { expect(countShapePathsInSubplots()).toEqual(0); expect(gd.layout.shapes).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can replace the shapes array', function(done) { @@ -419,8 +413,7 @@ describe('Test shapes:', function() { expect(gd.layout.shapes.length).toBe(2); expect(Lib.warn).not.toHaveBeenCalled(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to update a shape layer', function(done) { @@ -465,8 +458,7 @@ describe('Test shapes:', function() { expect(getLastShape(gd)).toEqual(shape); expect(countShapes(gd)).toEqual(index + 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -530,8 +522,7 @@ describe('shapes axis reference changes', function() { .then(function() { expect(getShape(0).attr('clip-path') || '').toMatch(/xy2\'\)$/); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -569,8 +560,7 @@ describe('shapes edge cases', function() { expect(countShapePathsInUpperLayer()).toBe(0); expect(countShapePathsInSubplots()).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -625,8 +615,7 @@ describe('shapes autosize', function() { .then(function() { assertRanges('stretched shapes[0]', [0, 3], [0, 2]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should propagate axis autorange changes when axis ranges are set', function(done) { @@ -658,8 +647,7 @@ describe('shapes autosize', function() { .then(function() { assertRanges('auto rng / small shape', [-0.18, 3], [0.86, 3]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -728,8 +716,7 @@ describe('Test shapes: a plot with shapes and an overlaid axis', function() { it('should not throw an exception', function(done) { Plotly.plot(gd, data, layout) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -872,8 +859,7 @@ describe('A fixed size path shape', function() { .then(function() { assertShapeSize(getFirstShapeNode(), 30, 20); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('is draggable', function(done) { @@ -882,8 +868,7 @@ describe('A fixed size path shape', function() { drag({node: getFirstShapeNode(), dpos: [50, 50]}).then(function() { assertShapeSize(getFirstShapeNode(), 30, 20); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -905,8 +890,7 @@ describe('A fixed size path shape', function() { expect(bbox.width).toBeLessThan(widthBeforeDrag); assertShapeFullyVisible(shapeNodeAfterDrag); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -928,8 +912,7 @@ describe('A fixed size path shape', function() { expect(bbox.height).toBeLessThan(heightBeforeDrag); assertShapeFullyVisible(shapeNodeAfterDrag); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1048,8 +1031,7 @@ describe('A fixed size shape', function() { var reRenderedShapeNode = getFirstShapeNode(); assertShapeSize(reRenderedShapeNode, 25, 25); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('is draggable', function(done) { @@ -1058,8 +1040,7 @@ describe('A fixed size shape', function() { drag({node: getFirstShapeNode(), dpos: [50, 50]}).then(function() { assertShapeSize(getFirstShapeNode(), 25, 25); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1082,8 +1063,7 @@ describe('A fixed size shape', function() { expect(bbox.width).toBeLessThan(widthBeforeDrag); assertShapeFullyVisible(shapeNodeAfterDrag); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1106,8 +1086,7 @@ describe('A fixed size shape', function() { expect(bbox.height).toBeLessThan(heightBeforeDrag); assertShapeFullyVisible(shapeNodeAfterDrag); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1149,8 +1128,7 @@ describe('A fixed size shape', function() { expect(bBoxAfterDrag.width).toBe(bBoxBeforeDrag.width + resizeFactor * Math.abs(dx)); assertShapeFullyVisible(shapeNodeAfterDrag); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1179,8 +1157,7 @@ describe('A fixed size shape', function() { expect(bBoxAfterDrag.left).toBe(bBoxBeforeDrag.left + 10); expect(bBoxAfterDrag.top).toBe(bBoxBeforeDrag.top - 10); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1202,8 +1179,7 @@ describe('A fixed size shape', function() { expect(bBoxAfterDrag.bottom).toBe(bBoxBeforeDrag.bottom, 'bottom'); expect(bBoxAfterDrag.left).toBe(bBoxBeforeDrag.left + 25, 'left'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1225,8 +1201,7 @@ describe('A fixed size shape', function() { expect(bBoxAfterDrag.bottom).toBe(bBoxBeforeDrag.bottom - 10, 'bottom'); expect(bBoxAfterDrag.left).toBe(bBoxBeforeDrag.left, 'left'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/sliders_test.js b/test/jasmine/tests/sliders_test.js index 858d787b314..cd4ecff15e9 100644 --- a/test/jasmine/tests/sliders_test.js +++ b/test/jasmine/tests/sliders_test.js @@ -6,7 +6,7 @@ var Plotly = require('@lib'); var Lib = require('@src/lib'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var delay = require('../assets/delay'); var assertPlotSize = require('../assets/custom_assertions').assertPlotSize; @@ -305,7 +305,7 @@ describe('ugly internal manipulation of steps', function() { // The selected option no longer exists, so confirm it's // been fixed during the process of updating/drawing it: expect(gd._fullLayout.sliders[0].active).toEqual(0); - }).catch(failTest).then(done); + }).then(done, done.fail); }); }); @@ -357,8 +357,7 @@ describe('sliders interactions', function() { .then(function() { checkPositions('back to original'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should draw only visible sliders', function(done) { @@ -413,8 +412,7 @@ describe('sliders interactions', function() { expect(gd._fullLayout._pushmargin['slider-0']).toBeDefined(); expect(gd._fullLayout._pushmargin['slider-1']).toBeDefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('only draws visible steps', function(done) { @@ -465,8 +463,7 @@ describe('sliders interactions', function() { .then(function() { assertSlider(10, 5, 0, 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should respond to mouse clicks', function(done) { @@ -506,8 +503,7 @@ describe('sliders interactions', function() { expect(mouseupFill).toEqual(originalFill); expect(mockCopy.layout.sliders[0].active).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should issue events on interaction', function(done) { @@ -570,8 +566,7 @@ describe('sliders interactions', function() { // Now an end: assertEventCounts(1, 2, 2, 1, 'mouseup'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function assertNodeCount(query, cnt) { diff --git a/test/jasmine/tests/snapshot_test.js b/test/jasmine/tests/snapshot_test.js index de1bb67a091..603fa501df7 100644 --- a/test/jasmine/tests/snapshot_test.js +++ b/test/jasmine/tests/snapshot_test.js @@ -4,7 +4,7 @@ var Lib = require('@src/lib'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var subplotMock = require('../../image/mocks/multiple_subplots.json'); var annotationMock = require('../../image/mocks/annotations.json'); @@ -209,7 +209,7 @@ describe('Plotly.Snapshot', function() { var svgElements = svgDOM.getElementsByTagName('svg'); expect(svgElements.length).toBe(1); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('should not return any nested svg tags of annotations', function(done) { @@ -220,7 +220,7 @@ describe('Plotly.Snapshot', function() { var svgElements = svgDOM.getElementsByTagName('svg'); expect(svgElements.length).toBe(1); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('should force *visibility: visible* for text elements with *visibility: inherit*', function(done) { @@ -245,8 +245,7 @@ describe('Plotly.Snapshot', function() { expect(textElements[i].style.display).toEqual(''); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('should handle quoted style properties', function() { @@ -302,8 +301,7 @@ describe('Plotly.Snapshot', function() { expect(legendPointElements.length).toEqual(1); checkURL(legendPointElements[0].style.fill); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- legend with contour items case', function(done) { @@ -323,8 +321,7 @@ describe('Plotly.Snapshot', function() { var lineItems = svgDOM.getElementsByClassName('legendlines'); checkURL(lineItems[1].firstChild.style.stroke, 'stroke gradient'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- colorbar case', function(done) { @@ -341,8 +338,7 @@ describe('Plotly.Snapshot', function() { checkURL(fillItems[i].style.fill, 'fill gradient ' + i); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('- legend3dandfriends case', function(done) { @@ -359,8 +355,7 @@ describe('Plotly.Snapshot', function() { checkURL(fillItems[i].style.fill, 'fill gradient ' + i); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -380,8 +375,7 @@ describe('Plotly.Snapshot', function() { expect(el.getAttribute('height')).toBe('1000', 'height'); expect(el.getAttribute('viewBox')).toBe('0 0 300 400', 'viewbox'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/splom_test.js b/test/jasmine/tests/splom_test.js index 40d9699bd50..51e6de384ea 100644 --- a/test/jasmine/tests/splom_test.js +++ b/test/jasmine/tests/splom_test.js @@ -681,8 +681,7 @@ describe('Test splom interactions:', function() { expect(gd._fullLayout._splomGrid).toBeUndefined(); expect(gd._fullLayout._splomScenes).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl when hasOnlyLargeSploms, should create correct regl-line2d data for grid', function(done) { @@ -735,8 +734,7 @@ describe('Test splom interactions:', function() { // and another for all 'zeroline' lines _assert([8968, 1876]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should update properly in-and-out of hasOnlyLargeSploms regime', function(done) { @@ -846,8 +844,7 @@ describe('Test splom interactions:', function() { bgCnt: 0 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should correctly move axis layers when relayouting *grid.(x|y)side*', function(done) { @@ -888,8 +885,7 @@ describe('Test splom interactions:', function() { y: 79, y2: 230, y3: 382 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should work with typed arrays', function(done) { @@ -903,8 +899,7 @@ describe('Test splom interactions:', function() { values: new Int32Array([2, 5, 6]) }] }]) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should toggle trace correctly', function(done) { @@ -940,8 +935,7 @@ describe('Test splom interactions:', function() { .then(function() { _assert('all back', [1, 1, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@noCI @gl should clear graph and replot when canvas and WebGL context dimensions do not match', function(done) { @@ -1000,8 +994,7 @@ describe('Test splom interactions:', function() { expect(Lib.log) .toHaveBeenCalledWith('WebGL context buffer and canvas dimensions do not match due to browser/WebGL bug. Clearing graph and plotting again.'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should update axis arrangement on show(upper|lower)half + diagonal.visible restyles', function(done) { @@ -1079,8 +1072,7 @@ describe('Test splom interactions:', function() { fullYaxes: ['linear', 'category', 'category', null] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should not fail when editing graph with visible:false traces', function(done) { @@ -1123,8 +1115,7 @@ describe('Test splom interactions:', function() { [1, 0.498, 0.0549, 0.4] ], 'marker colors'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1204,8 +1195,7 @@ describe('Test splom update switchboard:', function() { expect(gd.layout.xaxis.range).toBeCloseToArray([0, 1], 1, 'xrng ' + msg); expect(gd._fullLayout.xaxis.range).toBeCloseToArray([0, 1], 1, 'xrng ' + msg); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should trigger minimal sequence for marker style updates', function(done) { @@ -1349,8 +1339,7 @@ describe('Test splom update switchboard:', function() { expect(scene.matrixOptions.marker).not.toBeNull(msg); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1569,8 +1558,7 @@ describe('Test splom drag:', function() { [0.3, 7.6] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1692,8 +1680,7 @@ describe('Test splom select:', function() { selectionOutlineCnt: 2 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should redraw splom traces before scattergl trace (if any)', function(done) { @@ -1733,8 +1720,7 @@ describe('Test splom select:', function() { expect(splomCnt).toBe(1, 'splom redraw before scattergl'); expect(scatterGlCnt).toBe(2, 'scattergl redraw after splom'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should behave correctly during select->dblclick->pan scenarios', function(done) { @@ -1835,8 +1821,7 @@ describe('Test splom select:', function() { unselectBatch: [] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to select and then clear using API', function(done) { @@ -1876,7 +1861,6 @@ describe('Test splom select:', function() { selectBatch: [], unselectBatch: [] })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/streamtube_test.js b/test/jasmine/tests/streamtube_test.js index 380a37acd05..3673128f3d4 100644 --- a/test/jasmine/tests/streamtube_test.js +++ b/test/jasmine/tests/streamtube_test.js @@ -4,7 +4,7 @@ var Lib = require('@src/lib'); var supplyAllDefaults = require('../assets/supply_defaults'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var delay = require('../assets/delay'); var mouseEvent = require('../assets/mouse_event'); @@ -100,8 +100,7 @@ describe('Test streamtube autorange', function() { [-5.32, 5.51], [-6.32, 3.85], [-3.54, 3.91] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -161,8 +160,7 @@ describe('Test streamtube starting positions defaults:', function() { cellsLength: 2096 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should cut xz at min-y and take all x/y/z pts on that plane except those on the edges', function(done) { @@ -172,8 +170,7 @@ describe('Test streamtube starting positions defaults:', function() { cellsLength: 512 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should take middle pt if mesh vector has length 2', function(done) { @@ -183,8 +180,7 @@ describe('Test streamtube starting positions defaults:', function() { cellsLength: 432 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should take pt if mesh vector has length 1', function(done) { @@ -194,8 +190,7 @@ describe('Test streamtube starting positions defaults:', function() { cellsLength: 240 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -242,8 +237,7 @@ describe('Test streamtube interactions', function() { cellsLength: 512 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); [ // list of directions @@ -333,8 +327,7 @@ describe('Test streamtube interactions', function() { cellsLength: 2112 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -388,8 +381,7 @@ describe('Test streamtube interactions', function() { }).then(function() { expect(Lib.warn).toHaveBeenCalledWith('Encountered arbitrary coordinates! Unable to input data grid.'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should add/clear gl objects correctly', function(done) { @@ -421,8 +413,7 @@ describe('Test streamtube interactions', function() { .then(function() { _assert('after deleteTraces #2', {glObjCnt: 0}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should be able to restyle to a cone trace and back', function(done) { @@ -454,8 +445,7 @@ describe('Test streamtube interactions', function() { objTypes: ['cone', 'streamtube'] }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -534,8 +524,7 @@ describe('Test streamtube hover', function() { .then(function() { assertHoverLabelContent({nums: 'SCALAR HOVERTEXT !!'}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should display hover labels (multi-trace case)', function(done) { @@ -578,8 +567,7 @@ describe('Test streamtube hover', function() { name: 'TUBE' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl should emit correct event data', function(done) { @@ -631,7 +619,6 @@ describe('Test streamtube hover', function() { fail('did not trigger plotly_hover'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/sunburst_test.js b/test/jasmine/tests/sunburst_test.js index c2558caceb8..7665b47a91d 100644 --- a/test/jasmine/tests/sunburst_test.js +++ b/test/jasmine/tests/sunburst_test.js @@ -10,7 +10,7 @@ var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var mouseEvent = require('../assets/mouse_event'); var delay = require('../assets/delay'); -var failTest = require('../assets/fail_test'); + var customAssertions = require('../assets/custom_assertions'); var assertHoverLabelStyle = customAssertions.assertHoverLabelStyle; @@ -691,7 +691,7 @@ describe('Test sunburst hover:', function() { }] .forEach(function(spec) { it('should generate correct hover labels and event data - ' + spec.desc, function(done) { - run(spec).catch(failTest).then(done); + run(spec).then(done, done.fail); }); }); }); @@ -760,8 +760,7 @@ describe('Test sunburst hover lifecycle:', function() { fail('did not trigger correct # of plotly_unhover events'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -828,8 +827,7 @@ describe('Test sunburst clicks:', function() { fail('incorrect plotly_animating triggering'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should trigger plotly_click event when clicking on root node', function(done) { @@ -857,8 +855,7 @@ describe('Test sunburst clicks:', function() { fail('incorrect plotly_animating triggering'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should trigger plotly_click event when clicking on leaf node', function(done) { @@ -886,8 +883,7 @@ describe('Test sunburst clicks:', function() { fail('incorrect plotly_animating triggering'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not trigger animation when graph is transitioning', function(done) { @@ -946,8 +942,7 @@ describe('Test sunburst clicks:', function() { fail('incorrect plotly_animating triggering - ' + msg); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to override default click behavior using plotly_sunburstclick handler ()', function(done) { @@ -972,8 +967,7 @@ describe('Test sunburst clicks:', function() { fail('incorrect plotly_animating triggering'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1004,8 +998,7 @@ describe('Test sunburst restyle:', function() { .then(_assert('both visible:false', 0)) .then(_restyle({'visible': true})) .then(_assert('back to visible:true', 2)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle *maxdepth* and *level* w/o recomputing the hierarchy', function(done) { @@ -1035,8 +1028,7 @@ describe('Test sunburst restyle:', function() { .then(_assert('with non-root level', 13)) .then(_restyle({maxdepth: null, level: null})) .then(_assert('back to first view', 96)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle *leaf.opacity*', function(done) { @@ -1079,8 +1071,7 @@ describe('Test sunburst restyle:', function() { .then(_assert('raise leaf.opacity', ['', '1', '', '1'])) .then(_restyle({'leaf.opacity': null})) .then(_assert('back to dflt', ['', '0.7', '', '0.7'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle *textinfo* with various *insidetextorientation*', function(done) { @@ -1158,8 +1149,7 @@ describe('Test sunburst restyle:', function() { .then(_assert('no textinfo', ['', '', '', ''])) .then(_restyle({textinfo: null})) .then(_assert('back to dflt', ['Root\nnode0', 'B\nnode2', 'A\nnode1', 'b\nnode3'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1252,8 +1242,7 @@ describe('Test sunburst tweening:', function() { _assert('move B text to new position', 'transform', 'B', [313.45, 275.54]); _assert('move b text to new position', 'transform', 'b', [274.42, 314.57]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should tween sector enter/update (case: click on entry, no maxdepth)', function(done) { @@ -1287,8 +1276,7 @@ describe('Test sunburst tweening:', function() { _assert('move B text to new position', 'transform', 'B', [316.85, 272.14]); _assert('move b text to new position', 'transform', 'b', [274.42, 314.57]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should tween sector enter/update/exit (case: click on entry, maxdepth=2)', function(done) { @@ -1321,8 +1309,7 @@ describe('Test sunburst tweening:', function() { _assert('move B text to new position', 'transform', 'B', [303.01, 285.98]); _assert('enter b text to new position', 'transform', 'b', [248.75, 239]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should tween sector enter/update/exit (case: click on entry, maxdepth=2, level=B)', function(done) { @@ -1355,8 +1342,7 @@ describe('Test sunburst tweening:', function() { 'L383.75,235A33.75,33.750,1,1350,201.25Z' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); /* @@ -1384,8 +1370,7 @@ describe('Test sunburst tweening:', function() { // '' // ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); */ @@ -1410,8 +1395,7 @@ describe('Test sunburst tweening:', function() { _assert('move Y text to new position', 'transform', 'Y', [395.12660928295867, 124.11350635624726]); _assert('move Z text to new position', 'transform', 'Z', [354.1550374068844, 115.63596810986363]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update text position during transition using *horizontal* insidetextorientation', function(done) { @@ -1435,8 +1419,7 @@ describe('Test sunburst tweening:', function() { _assert('move Y text to new position', 'transform', 'Y', [395.12660928295867, 124.11350635624726]); _assert('move Z text to new position', 'transform', 'Z', [354.1550374068844, 115.63596810986363]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update text position during transition using *tangential* insidetextorientation', function(done) { @@ -1460,8 +1443,7 @@ describe('Test sunburst tweening:', function() { _assert('move Y text to new position', 'transform', 'Y', [393.6173101979463, 123.958130483835]); _assert('move Z text to new position', 'transform', 'Z', [359.52567880729003, 116.05583257124167]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update text position during transition using *radial* insidetextorientation', function(done) { @@ -1485,8 +1467,7 @@ describe('Test sunburst tweening:', function() { _assert('move Y text to new position', 'transform', 'Y', [398.67767996405655, 121.9940236084775]); _assert('move Z text to new position', 'transform', 'Z', [354.00770212095256, 116.19286557341015]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update text position during transition using *radial* insidetextorientation with level', function(done) { @@ -1509,8 +1490,7 @@ describe('Test sunburst tweening:', function() { _assert('move Y text to new position', 'transform', 'Y', [247.47466543373307, 255.288278237516]); _assert('move Z text to new position', 'transform', 'Z', [300.75324430542196, 332.0135787956955]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update text position during transition using *tangential* insidetextorientation with level', function(done) { @@ -1533,8 +1513,7 @@ describe('Test sunburst tweening:', function() { _assert('move Y text to new position', 'transform', 'Y', [249.73412124927503, 271.78420776316403]); _assert('move Z text to new position', 'transform', 'Z', [305.39156336654094, 331.3597434293286]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update text position during transition using *horizontal* insidetextorientation with level', function(done) { @@ -1557,8 +1536,7 @@ describe('Test sunburst tweening:', function() { _assert('move Y text to new position', 'transform', 'Y', [244.44862109889465, 255.71893345117468]); _assert('move Z text to new position', 'transform', 'Z', [301.6438278403359, 334.2263222726318]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1624,8 +1602,7 @@ describe('Test sunburst interactions edge cases', function() { hoverLabel: 1 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show falsy zero text', function(done) { @@ -1647,8 +1624,7 @@ describe('Test sunburst interactions edge cases', function() { .then(function() { assertHoverLabelContent({ nums: 'D\n4\n0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should transition sunburst traces only', function(done) { @@ -1682,8 +1658,7 @@ describe('Test sunburst interactions edge cases', function() { sunburstTraceCnt: 1 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to transition sunburst traces via `Plotly.react`', function(done) { @@ -1701,8 +1676,7 @@ describe('Test sunburst interactions edge cases', function() { .then(function() { expect(Plots.transitionFromReact).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1985,8 +1959,7 @@ describe('sunburst inside text orientation', function() { .then(assertTextRotations('back to "auto"', { rotations: [-0.6, 0, 48, 0] })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -2111,8 +2084,7 @@ describe('sunburst uniformtext', function() { fontsizes: [12, 12, 12, 12, 12, 12, 12, 12, 12, 12], scales: [1, 1, 1, 1, 1, 1, 1, 1, 1, 0.52], })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should uniform text scales after transition', function(done) { @@ -2175,7 +2147,6 @@ describe('sunburst uniformtext', function() { fontsizes: [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], scales: [1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1], })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/surface_test.js b/test/jasmine/tests/surface_test.js index 97a205e402e..9060b0f7b93 100644 --- a/test/jasmine/tests/surface_test.js +++ b/test/jasmine/tests/surface_test.js @@ -1,7 +1,7 @@ var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var supplyDefaults = require('@src/traces/surface').supplyDefaults; -var failTest = require('../assets/fail_test'); + var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); @@ -204,8 +204,7 @@ describe('Test surface', function() { .then(function() { assertVisibility(false, 'not to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl surface should be invisible when the x array is defined but is empty', function(done) { @@ -218,8 +217,7 @@ describe('Test surface', function() { .then(function() { assertVisibility(false, 'not to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl surface should be invisible when the y array is defined but is empty', function(done) { @@ -232,8 +230,7 @@ describe('Test surface', function() { .then(function() { assertVisibility(false, 'not to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl surface should be invisible when the x array is defined and has at least one item', function(done) { @@ -246,8 +243,7 @@ describe('Test surface', function() { .then(function() { assertVisibility(true, 'to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl surface should be invisible when the y array is defined and has at least one item', function(done) { @@ -260,8 +256,7 @@ describe('Test surface', function() { .then(function() { assertVisibility(true, 'to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl surface should be visible when the x and y are not provided; but z array is provided', function(done) { @@ -272,8 +267,7 @@ describe('Test surface', function() { .then(function() { assertVisibility(true, 'to be visible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl surface should be invisible when the x and y are provided; but z array is not provided', function(done) { @@ -285,8 +279,7 @@ describe('Test surface', function() { .then(function() { assertVisibility(false, 'to be invisible'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/table_test.js b/test/jasmine/tests/table_test.js index c8c338bd4d2..180afdcaba0 100644 --- a/test/jasmine/tests/table_test.js +++ b/test/jasmine/tests/table_test.js @@ -7,7 +7,7 @@ var cn = require('@src/traces/table/constants').cn; var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var supplyAllDefaults = require('../assets/supply_defaults'); var mouseEvent = require('../assets/mouse_event'); @@ -153,8 +153,7 @@ describe('table', function() { expect(gd.data[0].cells.values.length).toEqual(2); expect(document.querySelectorAll('.' + cn.yColumn).length).toEqual(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Works with one column', function(done) { @@ -166,8 +165,7 @@ describe('table', function() { expect(gd.data[0].cells.values.length).toEqual(1); expect(document.querySelectorAll('.' + cn.yColumn).length).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Does not error with zero columns', function(done) { @@ -180,8 +178,7 @@ describe('table', function() { expect(gd.data[0].cells.values.length).toEqual(0); expect(document.querySelectorAll('.' + cn.yColumn).length).toEqual(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Does not raise an error with zero lines', function(done) { @@ -198,8 +195,7 @@ describe('table', function() { expect(gd.data[0].cells.values.length).toEqual(2); expect(document.querySelectorAll('.' + cn.yColumn).length).toEqual(2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should remove scroll glyph and capture zone when *staticPlot:true*', function(done) { @@ -227,8 +223,7 @@ describe('table', function() { glyph: 0 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -248,8 +243,7 @@ describe('table', function() { expect(document.querySelectorAll('.' + cn.yColumn).length).toEqual(7); expect(document.querySelectorAll('.' + cn.columnCell).length).toEqual(7 * 2); // both column rows to render }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('`Plotly.plot` should render all columns even if no header contents were supplied yet', function(done) { @@ -265,8 +259,7 @@ describe('table', function() { expect(document.querySelectorAll('#header .' + cn.columnCell).length).toEqual(7); expect(document.querySelector('#header .' + cn.columnCell + ' text').textContent).toEqual(''); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('`Plotly.plot` should render all the column headers even if not all header values were supplied', function(done) { @@ -281,8 +274,7 @@ describe('table', function() { expect(document.querySelectorAll('#header .' + cn.columnCell).length).toEqual(7); expect(document.querySelector('#header .' + cn.columnCell + ' text').textContent).toEqual('A'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -317,8 +309,7 @@ describe('table', function() { expect(gd.data.length).toEqual(2); expect(document.querySelectorAll('.' + cn.yColumn).length).toEqual(7 * 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Calling `Plotly.restyle` with a string path should amend the preexisting table', function(done) { @@ -333,8 +324,7 @@ describe('table', function() { expect(gd.data[0].header.line.color).toEqual(['dimgray', 'grey']); // no change relative to original mock value expect(gd.data[0].cells.line.color).toEqual(['grey']); // no change relative to original mock value }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Calling `Plotly.restyle` for a `header.values` change should amend the preexisting one', function(done) { @@ -353,8 +343,7 @@ describe('table', function() { restyleValues('cells', 0, [['new cell content 1', 'new cell content 2']])() .then(restyleValues('cells', 2, [[0, 0.1]])) .then(restyleValues('header', 1, [['Species top', 'Species bottom']])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Calling `Plotly.relayout` with string should amend the preexisting table', function(done) { @@ -364,8 +353,7 @@ describe('table', function() { expect(gd.data.length).toEqual(1); expect(gd.layout.width).toEqual(500); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Calling `Plotly.relayout` with object should amend the preexisting table', function(done) { @@ -375,8 +363,7 @@ describe('table', function() { expect(gd.data.length).toEqual(1); expect(gd.layout.width).toEqual(500); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -512,8 +499,7 @@ describe('table', function() { scroll(bigCenter, -40); assertBubbledEvents(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/template_test.js b/test/jasmine/tests/template_test.js index 66008699a0f..e1975316c4c 100644 --- a/test/jasmine/tests/template_test.js +++ b/test/jasmine/tests/template_test.js @@ -199,11 +199,10 @@ describe('makeTemplate', function() { } }); }) - .catch(failTest) .then(function() { document.body.removeChild(gd); - }) - .then(done); + done(); + }, done.fail); }); }); @@ -255,8 +254,7 @@ describe('template interactions', function() { // item count and order are unchanged now, item just moves. schoolDragger = checkAnnotations(6, 5, 4, 0.5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('makes a new shape or edits the existing one as necessary', function(done) { @@ -292,8 +290,7 @@ describe('template interactions', function() { // item count and order are unchanged now, item just resizes. rectDragger = checkShapes(2, 0.4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -397,7 +394,7 @@ describe('validateTemplate', function() { path: 'layout.annotations[4]', templateitemname: 'nope', msg: 'There are no templates for item layout.annotations[4] with name nope' - }]).catch(failTest).then(done); + }]).then(done, done.fail); }); it('catches missing template.data', function(done) { @@ -410,7 +407,7 @@ describe('validateTemplate', function() { }], // check only the first error - we don't care about the specifics // uncovered after we already know there's no template.data - 1).catch(failTest).then(done); + 1).then(done, done.fail); }); it('catches missing template.layout', function(done) { @@ -420,6 +417,6 @@ describe('validateTemplate', function() { checkValidate(noLayoutMock, [{ code: 'layout', msg: 'The template has no key layout.' - }], 1).catch(failTest).then(done); + }], 1).then(done, done.fail); }); }); diff --git a/test/jasmine/tests/ternary_test.js b/test/jasmine/tests/ternary_test.js index abb45214ee5..6f3b041895d 100644 --- a/test/jasmine/tests/ternary_test.js +++ b/test/jasmine/tests/ternary_test.js @@ -7,7 +7,7 @@ var supplyLayoutDefaults = require('@src/plots/ternary/layout_defaults'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var click = require('../assets/click'); var doubleClick = require('../assets/double_click'); @@ -56,8 +56,7 @@ describe('ternary plots', function() { }).then(function() { expect(countTraces('scatter')).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to delete and add traces', function(done) { @@ -98,8 +97,7 @@ describe('ternary plots', function() { expect(countTraces('scatter')).toEqual(1); checkTitles(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle', function(done) { @@ -116,8 +114,7 @@ describe('ternary plots', function() { 'translate(248.76,117.69)' ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display to hover labels', function(done) { @@ -172,8 +169,7 @@ describe('ternary plots', function() { fontFamily: 'Gravitas' }, 'after hoverlabel styling restyle call'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should respond to hover interactions by', function() { @@ -245,8 +241,7 @@ describe('ternary plots', function() { .then(function() { assertRange(gd, [0.4435, 0.2462, 0.1523]); }) .then(function() { return doubleClick(pointPos[0], pointPos[1]); }) .then(function() { assertRange(gd, [0, 0, 0]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -272,8 +267,7 @@ describe('ternary plots', function() { .then(function() { assertRange(gd, range); }) .then(function() { return doubleClick(390, 220); }) .then(function() { assertRange(gd, range); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -345,8 +339,7 @@ describe('ternary plots', function() { .then(function() { _assert(dflt); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to relayout axis tickfont attributes', function(done) { @@ -378,8 +371,7 @@ describe('ternary plots', function() { .then(function() { _assert('Roboto', 'rgb(255, 0, 0)', 20); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to relayout axis title attributes', function(done) { @@ -427,8 +419,7 @@ describe('ternary plots', function() { _assert('b', 'white chocolate', 'sans-serif', rgb('blue'), 10); _assert('c', 'candy', 'serif', rgb('pink'), 30); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to hide/show ticks and tick labels', function(done) { @@ -481,8 +472,7 @@ describe('ternary plots', function() { '.caxis > path.ytick', 'ternary.caxis.ticks', ['outside', ''], [4, 0] )) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should render a-axis and c-axis with negative offsets', function(done) { @@ -509,8 +499,7 @@ describe('ternary plots', function() { expect(subplot.aaxis._offset < 0).toBe(true); expect(subplot.caxis._offset < 0).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); describe('plotly_relayouting', function() { @@ -536,8 +525,7 @@ describe('ternary plots', function() { expect(events.length).toEqual(path.length - 1); expect(relayoutCallback).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -609,8 +597,7 @@ describe('ternary plots when css transform is present', function() { .then(function() { assertRange(gd, [0.4486, 0.2480, 0.1453]); }) .then(function() { return doubleClick(pointPos[0], pointPos[1]); }) .then(function() { assertRange(gd, [0, 0, 0]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should display to hover labels', function(done) { @@ -665,8 +652,7 @@ describe('ternary plots when css transform is present', function() { fontFamily: 'Gravitas' }, 'after hoverlabel styling restyle call'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should respond to hover interactions by', function() { diff --git a/test/jasmine/tests/titles_test.js b/test/jasmine/tests/titles_test.js index 1d889f756c7..6d5c65d5428 100644 --- a/test/jasmine/tests/titles_test.js +++ b/test/jasmine/tests/titles_test.js @@ -9,7 +9,7 @@ var rgb = require('@src/components/color').rgb; var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var mouseEvent = require('../assets/mouse_event'); -var failTest = require('../assets/fail_test'); + describe('Plot title', function() { 'use strict'; @@ -48,8 +48,7 @@ describe('Plot title', function() { .then(function() { expectDefaultCenteredPosition(gd); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can still be defined as `layout.title` to ensure backwards-compatibility', function(done) { @@ -58,8 +57,7 @@ describe('Plot title', function() { expectTitle('Plotly line chart'); expectDefaultCenteredPosition(gd); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can be updated via `relayout`', function(done) { @@ -69,8 +67,7 @@ describe('Plot title', function() { return Plotly.relayout(gd, {title: {text: 'Some other title'}}); }) .then(expectTitleFn('Some other title')) - .catch(failTest) - .then(done); + .then(done, done.fail); }); // Horizontal alignment @@ -93,8 +90,7 @@ describe('Plot title', function() { .then(function() { expectLeftEdgeAlignedTo(testCase.selector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can be placed at the right edge of the ' + testCase.selector.desc, function(done) { @@ -106,8 +102,7 @@ describe('Plot title', function() { .then(function() { expectRightEdgeAlignedTo(testCase.selector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can be placed at the center of the ' + testCase.selector.desc, function(done) { @@ -119,8 +114,7 @@ describe('Plot title', function() { .then(function() { expectCenteredWithin(testCase.selector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -144,8 +138,7 @@ describe('Plot title', function() { .then(function() { expectCapLineAlignsWithTopEdgeOf(testCase.selector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can be placed at the bottom edge of the ' + testCase.selector.desc, function(done) { @@ -157,8 +150,7 @@ describe('Plot title', function() { .then(function() { expectBaselineAlignsWithBottomEdgeOf(testCase.selector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can be placed in the vertical center of the ' + testCase.selector.desc, function(done) { @@ -170,8 +162,7 @@ describe('Plot title', function() { .then(function() { expectCenteredVerticallyWithin(testCase.selector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -192,8 +183,7 @@ describe('Plot title', function() { .then(function() { expectBaselineInMiddleOfTopMargin(gd); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); // xanchor 'auto' test @@ -223,8 +213,7 @@ describe('Plot title', function() { var textAnchor = titleSel().attr('text-anchor'); expect(textAnchor).toBe(testCase.expAlignment, testDesc); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); } @@ -256,8 +245,7 @@ describe('Plot title', function() { .then(function() { testCase.expFn(elemSelector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); } @@ -270,8 +258,7 @@ describe('Plot title', function() { .then(function() { expectDefaultCenteredPosition(gd); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); // Horizontal padding @@ -287,8 +274,7 @@ describe('Plot title', function() { expect(titleSel().attr('text-anchor')).toBe('start'); expect(titleX() - 10).toBe(leftOf(refSelector)); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -304,8 +290,7 @@ describe('Plot title', function() { expect(titleSel().attr('text-anchor')).toBe('end'); expect(titleX() + 10).toBe(rightOf(refSelector)); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -333,8 +318,7 @@ describe('Plot title', function() { .then(function() { expectCenteredWithin(refSelector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -354,8 +338,7 @@ describe('Plot title', function() { .then(function() { expectCenteredWithin(paperElemSelector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -371,8 +354,7 @@ describe('Plot title', function() { .then(function() { expectRightEdgeAlignedTo(paperElemSelector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('mutes right padding when xanchor is left', function(done) { @@ -387,8 +369,7 @@ describe('Plot title', function() { .then(function() { expectLeftEdgeAlignedTo(paperElemSelector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); // Vertical padding @@ -404,8 +385,7 @@ describe('Plot title', function() { var capLineY = calcTextCapLineY(titleSel()); expect(capLineY).toBe(topOf(refSelector) + 10); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -421,8 +401,7 @@ describe('Plot title', function() { var baselineY = calcTextBaselineY(titleSel()); expect(baselineY).toBe(bottomOf(refSelector) - 10); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -450,8 +429,7 @@ describe('Plot title', function() { .then(function() { expectCenteredVerticallyWithin(refSelector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -471,8 +449,7 @@ describe('Plot title', function() { .then(function() { expectCenteredVerticallyWithin(paperElemSelector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -488,8 +465,7 @@ describe('Plot title', function() { .then(function() { expectBaselineAlignsWithBottomEdgeOf(paperElemSelector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('mutes bottom padding when yanchor is top', function(done) { @@ -504,8 +480,7 @@ describe('Plot title', function() { .then(function() { expectCapLineAlignsWithTopEdgeOf(paperElemSelector); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function extendLayout(titleAttrs) { @@ -676,8 +651,7 @@ describe('Titles can be updated', function() { .then(function() { expectChangedTitles(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('via `Plotly.update` ' + testCase.desc, function(done) { @@ -685,8 +659,7 @@ describe('Titles can be updated', function() { .then(function() { expectChangedTitles(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -759,8 +732,7 @@ describe('Titles and labels', function() { expect(xTitleSel().text()).toBe('x-new'); expect(d3.select('.xtick').text()).toBe('b'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -814,8 +786,7 @@ describe('Titles support setting custom font properties', function() { expectXAxisTitleFont('#333', 'sans-serif', 20); expectYAxisTitleFont('#666', 'Arial', 16); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('through using the deprecated `titlefont` properties (backwards-compatibility)', function(done) { @@ -856,8 +827,7 @@ describe('Titles support setting custom font properties', function() { expectXAxisTitleFont('#333', 'sans-serif', 20); expectYAxisTitleFont('#666', 'Arial', 16); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -984,8 +954,7 @@ describe('Title fonts can be updated', function() { .then(function() { expectChangedTitleFonts(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('via `Plotly.update` ' + testCase.desc, function(done) { @@ -993,8 +962,7 @@ describe('Title fonts can be updated', function() { .then(function() { expectChangedTitleFonts(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1063,8 +1031,7 @@ describe('Titles for multiple axes', function() { expect(yTitleSel(2).text()).toBe('Y-Axis 2'); expect(yTitleSel(2).node().style.fill).toBe(rgb('blue')); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can be updated using deprecated `title` and `titlefont` syntax (backwards-compatibility)', function(done) { @@ -1094,8 +1061,7 @@ describe('Titles for multiple axes', function() { expect(y2Style.fontFamily).toBe('monospace'); expect(y2Style.fontSize).toBe('5px'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1288,8 +1254,7 @@ describe('Editable titles', function() { checkTitle('g', 'Click to enter Plot title', 0.2, 0.2) ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('has hover effects for blank titles', function(done) { @@ -1305,8 +1270,7 @@ describe('Editable titles', function() { checkTitle('g', 'Click to enter Plot title', 0, 1) ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('has no hover effects for titles that used to be blank', function(done) { @@ -1331,7 +1295,6 @@ describe('Editable titles', function() { checkTitle('g', 'TTT', 1, 1) ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/toimage_test.js b/test/jasmine/tests/toimage_test.js index fc684e3a7e1..603c8e9e83e 100644 --- a/test/jasmine/tests/toimage_test.js +++ b/test/jasmine/tests/toimage_test.js @@ -4,7 +4,7 @@ var Lib = require('@src/lib'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var subplotMock = require('@mocks/multiple_subplots.json'); var pieAutoMargin = require('@mocks/pie_automargin'); @@ -57,7 +57,7 @@ describe('Plotly.toImage', function() { expect(isPromise(returnValue)).toBe(true); - returnValue.catch(failTest).then(done); + returnValue.then(done, done.fail); }); it('should throw error with unsupported file type', function(done) { @@ -68,8 +68,7 @@ describe('Plotly.toImage', function() { expect(function() { Plotly.toImage(gd, {format: 'x'}); }) .toThrow(new Error('Export format is not png, jpeg, webp, svg or full-json.')); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should throw error with height and/or width < 1', function(done) { @@ -84,8 +83,7 @@ describe('Plotly.toImage', function() { expect(function() { Plotly.toImage(gd, {width: 0.5}); }) .toThrow(new Error('Height and width should be pixel values.')); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should create img with proper height and width', function(done) { @@ -112,8 +110,7 @@ describe('Plotly.toImage', function() { expect(img.height).toBe(400); expect(img.width).toBe(400); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use width/height of graph div when width/height are set to *null*', function(done) { @@ -130,8 +127,7 @@ describe('Plotly.toImage', function() { }) .then(function() { return Plotly.toImage(gd, {width: null, height: null}); }) .then(function(url) { return assertSize(url, 832, 502); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should create proper file type', function(done) { @@ -158,8 +154,7 @@ describe('Plotly.toImage', function() { .then(function(url) { expect(url.split('webp')[0]).toBe('data:image/'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should strip *data:image* prefix when *imageDataOnly* is turned on', function(done) { @@ -186,8 +181,7 @@ describe('Plotly.toImage', function() { expect(d.indexOf('data:image/')).toBe(-1); expect(d.length).toBeWithin(15831, 1e3, 'webp image length'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); FORMATS.forEach(function(f) { @@ -199,8 +193,7 @@ describe('Plotly.toImage', function() { .then(function(url) { return assertSize(url, 1400, 900); }) .then(function() { return Plotly.toImage(gd, {format: f, scale: 0.5}); }) .then(function(url) { return assertSize(url, 350, 225); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -213,8 +206,7 @@ describe('Plotly.toImage', function() { expect(img.width).toBe(700); expect(img.height).toBe(450); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should accept graph div id as input', function(done) { @@ -227,8 +219,7 @@ describe('Plotly.toImage', function() { expect(img.width).toBe(700); expect(img.height).toBe(450); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should work on pages with ', function(done) { @@ -258,11 +249,10 @@ describe('Plotly.toImage', function() { expect(middle.indexOf('http://')).toBe(-1, 'no URL in subplot clipPath!'); expect(middle.indexOf('https://')).toBe(-1, 'no URL in subplot clipPath!'); }) - .catch(failTest) .then(function() { base.remove(); done(); - }); + }, done.fail); }); describe('with format `full-json`', function() { @@ -285,8 +275,7 @@ describe('Plotly.toImage', function() { expect(fig.data[0].mode).toBe('lines+markers', 'contain default mode'); expect(fig.version).toBe(Plotly.version, 'contains Plotly version'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('export an object with data/layout/config', function(done) { @@ -299,8 +288,7 @@ describe('Plotly.toImage', function() { expect(fig.data[0].mode).toBe('lines+markers', 'contain default mode'); expect(fig.version).toBe(Plotly.version, 'contains Plotly version'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('export computed margins', function(done) { @@ -315,8 +303,7 @@ describe('Plotly.toImage', function() { expect(computed.margin.r).toBeDefined('no right'); expect(computed.margin.b).toBeDefined('no bottom'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('record and export computed margins with "Too many auto-margin redraws"', function(done) { @@ -347,8 +334,7 @@ describe('Plotly.toImage', function() { expect(computed.margin.b).toBeGreaterThan(80); expect(computed.margin.r).toBeGreaterThan(80); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/transform_aggregate_test.js b/test/jasmine/tests/transform_aggregate_test.js index a5a8c9cfe98..bc09cf338ed 100644 --- a/test/jasmine/tests/transform_aggregate_test.js +++ b/test/jasmine/tests/transform_aggregate_test.js @@ -2,7 +2,7 @@ var Plotly = require('@lib/index'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + describe('aggregate', function() { var gd; @@ -68,8 +68,7 @@ describe('aggregate', function() { var inverseMapping = transform._indexToPoints; expect(inverseMapping).toEqual({0: [0, 2, 3, 4], 1: [1]}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('handles all funcs except sum for date data', function(done) { @@ -109,8 +108,7 @@ describe('aggregate', function() { expect(traceOut.customdata).toEqual(['2001-05', 'b']); expect(traceOut.marker.line.width).toEqual([4, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('handles all funcs except sum and avg for category data', function(done) { @@ -148,8 +146,7 @@ describe('aggregate', function() { expect(traceOut.hovertext).toEqual(['c', 'b']); expect(traceOut.marker.line.width).toEqual([4, 1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('allows date and category sums, and category avg, with weird output', function(done) { @@ -185,8 +182,7 @@ describe('aggregate', function() { var inverseMapping = transform._indexToPoints; expect(inverseMapping).toEqual({0: [0, 1], 1: [2, 3]}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can aggregate on an existing data array', function(done) { @@ -214,8 +210,7 @@ describe('aggregate', function() { var inverseMapping = transform._indexToPoints; expect(inverseMapping).toEqual({0: [0, 1, 4], 1: [2, 3]}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can handle case where aggregation array is missing', function(done) { @@ -239,8 +234,7 @@ describe('aggregate', function() { var inverseMapping = transform._indexToPoints; expect(inverseMapping).toEqual({0: [0, 1, 4], 1: [2, 3]}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('handles median, mode, rms, stddev, change & range for numeric data', function(done) { @@ -284,8 +278,7 @@ describe('aggregate', function() { expect(traceOut.marker.line.width).toBeCloseToArray([0.5, 0], 5); expect(traceOut.marker.color).toBeCloseToArray([Math.sqrt(1 / 3), 0], 5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('handles ragged data - extra groups are ignored', function(done) { @@ -307,8 +300,7 @@ describe('aggregate', function() { expect(traceOut.x).toEqual([2, 1]); expect(traceOut.y).toBeCloseToArray([3.5, 2], 5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('handles ragged data - groups is the shortest, others are ignored', function(done) { @@ -330,8 +322,7 @@ describe('aggregate', function() { expect(traceOut.x).toEqual([2, 1]); expect(traceOut.y).toBeCloseToArray([3.5, 2], 5); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('links fullData aggregations to userData via _index', function(done) { @@ -369,8 +360,7 @@ describe('aggregate', function() { expect(enabledAggregations[2].target).toEqual('marker.color'); expect(enabledAggregations[2]._index).toEqual(-1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('does not error out on bad *group* value', function(done) { @@ -387,8 +377,7 @@ describe('aggregate', function() { expect(tOut.groups).toBe('x', 'the *groups* default'); expect(tOut.enabled).toBe(false, 'should not be *enabled*'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('use numeric sort function for median', function(done) { @@ -414,7 +403,6 @@ describe('aggregate', function() { var traceOut = gd._fullData[0]; expect(traceOut.y[0]).toBe(10); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/transform_filter_test.js b/test/jasmine/tests/transform_filter_test.js index a5006e2672c..957fbaa3847 100644 --- a/test/jasmine/tests/transform_filter_test.js +++ b/test/jasmine/tests/transform_filter_test.js @@ -8,7 +8,7 @@ var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var customAssertions = require('../assets/custom_assertions'); var supplyAllDefaults = require('../assets/supply_defaults'); -var failTest = require('../assets/fail_test'); + var assertDims = customAssertions.assertDims; var assertStyle = customAssertions.assertStyle; @@ -1105,8 +1105,7 @@ describe('filter transforms interactions', function() { var uid = gd._fullData[0]._fullInput.uid; expect(gd._fullData[0].uid).toEqual(uid + '0'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.restyle should work', function(done) { @@ -1152,8 +1151,7 @@ describe('filter transforms interactions', function() { expect(gd._fullLayout.xaxis.range).toBeCloseToArray([2, 4]); expect(gd._fullLayout.yaxis.range).toBeCloseToArray([0, 2]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.extendTraces should work', function(done) { @@ -1177,8 +1175,7 @@ describe('filter transforms interactions', function() { assertDims([5]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.deleteTraces should work', function(done) { @@ -1197,8 +1194,7 @@ describe('filter transforms interactions', function() { }).then(function() { assertDims([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('toggling trace visibility should work', function(done) { @@ -1221,8 +1217,7 @@ describe('filter transforms interactions', function() { }).then(function() { assertDims([3, 4]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('zooming in/out should not change filtered data', function(done) { @@ -1248,8 +1243,7 @@ describe('filter transforms interactions', function() { expect(gd.calcdata[0].map(getTx)).toEqual(['e', 'f', 'g']); expect(gd.calcdata[1].map(getTx)).toEqual(['D', 'E', 'F', 'G']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update axis categories', function(done) { @@ -1292,8 +1286,7 @@ describe('filter transforms interactions', function() { expect(gd._fullLayout.xaxis._categories).toEqual(['i']); expect(gd._fullLayout.yaxis._categories).toEqual([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should clear indexToPoints on removal', function(done) { @@ -1315,8 +1308,7 @@ describe('filter transforms interactions', function() { .then(function() { expect(gd._fullData[0]._indexToPoints).toBeUndefined(); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1352,7 +1344,7 @@ describe('filter resulting in empty coordinate arrays', function() { it(d[0], function(done) { gd = createGraphDiv(); var fig = filter2empty(d[1]); - Plotly.newPlot(gd, fig).catch(failTest).then(done); + Plotly.newPlot(gd, fig).then(done, done.fail); }); }); }); @@ -1364,7 +1356,7 @@ describe('filter resulting in empty coordinate arrays', function() { it('@gl ' + d[0], function(done) { gd = createGraphDiv(); var fig = filter2empty(d[1]); - Plotly.newPlot(gd, fig).catch(failTest).then(done); + Plotly.newPlot(gd, fig).then(done, done.fail); }); }); }); @@ -1380,7 +1372,7 @@ describe('filter resulting in empty coordinate arrays', function() { it('@gl' + d[0], function(done) { gd = createGraphDiv(); var fig = filter2empty(d[1]); - Plotly.newPlot(gd, fig).catch(failTest).then(done); + Plotly.newPlot(gd, fig).then(done, done.fail); }); }); }); diff --git a/test/jasmine/tests/transform_groupby_test.js b/test/jasmine/tests/transform_groupby_test.js index 0c28798bf18..47c67f36b6f 100644 --- a/test/jasmine/tests/transform_groupby_test.js +++ b/test/jasmine/tests/transform_groupby_test.js @@ -5,7 +5,7 @@ var Lib = require('@src/lib'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var customAssertions = require('../assets/custom_assertions'); -var failTest = require('../assets/fail_test'); + var assertDims = customAssertions.assertDims; var assertStyle = customAssertions.assertStyle; @@ -89,8 +89,7 @@ describe('groupby', function() { assertDims([4, 3]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Accepts deprecated object notation for styles', function(done) { @@ -139,8 +138,7 @@ describe('groupby', function() { expect(gd._fullData[0].marker.opacity).toEqual(1); expect(gd._fullData[1].marker.opacity).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); // The final test for restyle updates using deprecated syntax // is omitted since old style syntax is *only* sanitized on @@ -193,8 +191,7 @@ describe('groupby', function() { [0.4, 0.4] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.react should work', function(done) { @@ -257,8 +254,7 @@ describe('groupby', function() { [1, 1] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.extendTraces should work', function(done) { @@ -285,8 +281,7 @@ describe('groupby', function() { assertDims([5, 5]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.deleteTraces should work', function(done) { @@ -305,8 +300,7 @@ describe('groupby', function() { }).then(function() { assertDims([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('toggling trace visibility should work', function(done) { @@ -329,8 +323,7 @@ describe('groupby', function() { }).then(function() { assertDims([4, 3, 4, 3]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.plot should group points properly using typed array', function(done) { @@ -345,8 +338,7 @@ describe('groupby', function() { expect(gd._fullData[1].x).toEqual([11, 2, 3]); expect(gd._fullData[1].y).toEqual([2, 2, 0]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -458,8 +450,7 @@ describe('groupby', function() { assertDims([4, 3]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.plot should plot the transform traces', function(done) { @@ -475,8 +466,7 @@ describe('groupby', function() { expect(gd._fullData.length).toEqual(1); assertDims([7]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.plot should plot the transform traces', function(done) { @@ -495,8 +485,7 @@ describe('groupby', function() { assertDims([7]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.plot should plot the transform traces', function(done) { @@ -516,8 +505,7 @@ describe('groupby', function() { assertDims([7]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.plot should plot the transform traces', function(done) { @@ -537,8 +525,7 @@ describe('groupby', function() { assertDims([7]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -575,8 +562,7 @@ describe('groupby', function() { assertDims([4, 3]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }; } @@ -708,8 +694,7 @@ describe('groupby', function() { expect(gd._fullData[0].marker.line.color).toEqual(['orange', 'red', 'cyan', 'pink']); expect(gd._fullData[1].marker.line.color).toEqual('yellow'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('passes with no explicit styling for the individual group', test(mockData4)); @@ -744,8 +729,7 @@ describe('groupby', function() { assertDims([7]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }; } diff --git a/test/jasmine/tests/transform_multi_test.js b/test/jasmine/tests/transform_multi_test.js index a867ee29ee1..ff7eef10a2f 100644 --- a/test/jasmine/tests/transform_multi_test.js +++ b/test/jasmine/tests/transform_multi_test.js @@ -6,7 +6,7 @@ var Lib = require('@src/lib'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var customAssertions = require('../assets/custom_assertions'); var supplyAllDefaults = require('../assets/supply_defaults'); @@ -357,11 +357,10 @@ describe('user-defined transforms:', function() { .then(function() { expect(getLineWidth()).toBe(4); }) - .catch(failTest) .then(function() { delete Plots.transformsRegistry.linemaker; - }) - .then(done); + done(); + }, done.fail); }); }); @@ -462,8 +461,7 @@ describe('multiple transforms:', function() { expect(gd._fullData[0].transforms[1]._indexToPoints).toEqual({0: [1, 3], 1: [4]}); expect(gd._fullData[0].transforms[2]._indexToPoints).toEqual({0: [4]}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); @@ -483,8 +481,7 @@ describe('multiple transforms:', function() { assertDims([2, 2]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.plot should plot the transform traces (reverse case)', function(done) { @@ -505,8 +502,7 @@ describe('multiple transforms:', function() { assertDims([2, 2]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.restyle should work', function(done) { @@ -557,8 +553,7 @@ describe('multiple transforms:', function() { [0.4, 0.4] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.extendTraces should work', function(done) { @@ -583,8 +578,7 @@ describe('multiple transforms:', function() { assertDims([3, 3]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.deleteTraces should work', function(done) { @@ -601,8 +595,7 @@ describe('multiple transforms:', function() { }).then(function() { assertDims([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('toggling trace visibility should work', function(done) { @@ -623,8 +616,7 @@ describe('multiple transforms:', function() { }).then(function() { assertDims([2, 2, 2, 2]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('executes filter and aggregate in the order given', function(done) { @@ -660,8 +652,7 @@ describe('multiple transforms:', function() { expect(trace2Out.x).toEqual([4, -5]); expect(trace2Out.y).toEqual([5, 4]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('always executes groupby before aggregate', function(done) { @@ -710,8 +701,7 @@ describe('multiple transforms:', function() { expect(t2g2.x).toEqual(t1g2.x); expect(t2g2.y).toEqual(t1g2.y); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -731,8 +721,7 @@ describe('invalid transforms', function() { }]).then(function() { expect(gd._fullData[0].transforms.length).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -794,8 +783,7 @@ describe('multiple traces with transforms:', function() { assertDims([2, 3, 3]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.restyle should work', function(done) { @@ -849,8 +837,7 @@ describe('multiple traces with transforms:', function() { [0.4, 0.6, 0.6] ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.extendTraces should work', function(done) { @@ -876,8 +863,7 @@ describe('multiple traces with transforms:', function() { }).then(function() { assertDims([5, 4, 4]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('Plotly.deleteTraces should work', function(done) { @@ -896,8 +882,7 @@ describe('multiple traces with transforms:', function() { }).then(function() { assertDims([]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('toggling trace visibility should work', function(done) { @@ -924,8 +909,7 @@ describe('multiple traces with transforms:', function() { }).then(function() { assertDims([3, 3]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -991,8 +975,7 @@ describe('restyle applied on transforms:', function() { expect(gd.data[0].transforms).toBeUndefined(msg); expect(gd._fullData[0].y).toEqual([2, 1, 2], msg); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/transform_sort_test.js b/test/jasmine/tests/transform_sort_test.js index df5c76f29a8..48671783bec 100644 --- a/test/jasmine/tests/transform_sort_test.js +++ b/test/jasmine/tests/transform_sort_test.js @@ -5,7 +5,7 @@ var Lib = require('@src/lib'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var supplyAllDefaults = require('../assets/supply_defaults'); @@ -298,8 +298,7 @@ describe('Test sort transform interactions:', function() { .then(function() { _assertFirst('M10,0A10,10 0 1'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('does not preserve event data `pointNumber` value', function(done) { @@ -390,8 +389,7 @@ describe('Test sort transform interactions:', function() { .then(function(eventData) { assertPt(eventData, 1, 1, 5, 'G'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should honor *categoryarray* when set', function(done) { @@ -427,7 +425,6 @@ describe('Test sort transform interactions:', function() { .then(function() { expect(gd._fullLayout.xaxis._categories).toEqual(['A', 'B', 'C']); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/transition_test.js b/test/jasmine/tests/transition_test.js index 17278ccc839..f33ed7e0487 100644 --- a/test/jasmine/tests/transition_test.js +++ b/test/jasmine/tests/transition_test.js @@ -8,7 +8,7 @@ var Drawing = require('@src/components/drawing'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var delay = require('../assets/delay'); var mock = require('@mocks/animation'); @@ -39,7 +39,7 @@ function runTests(transitionDuration) { .then(delay(20)) .then(function() { expect(Date.now() - t1).toBeGreaterThan(transitionDuration); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('emits plotly_transitioning on transition start', function(done) { @@ -52,7 +52,7 @@ function runTests(transitionDuration) { .then(delay(20)) .then(function() { expect(beginTransitionCnt).toBe(1); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('emits plotly_transitioned on transition end', function(done) { @@ -65,7 +65,7 @@ function runTests(transitionDuration) { .then(delay(20)) .then(function() { expect(trEndCnt).toEqual(1); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('transitions an annotation', function(done) { @@ -93,7 +93,7 @@ function runTests(transitionDuration) { // Ensure both coordinates have moved, i.e. that the annotation has transitioned: expect(p1[0]).not.toEqual(p2[0]); expect(p1[1]).not.toEqual(p2[1]); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('transitions an image', function(done) { @@ -128,7 +128,7 @@ function runTests(transitionDuration) { // Test that the image element identity has not: expect(e1).toBe(e2); - }).catch(failTest).then(done); + }).then(done, done.fail); }); it('transitions a shape', function(done) { @@ -185,7 +185,7 @@ function runTests(transitionDuration) { expect(d3).toEqual(d2); expect(s3).not.toEqual(s2); - }).catch(failTest).then(done); + }).then(done, done.fail); }); @@ -221,7 +221,7 @@ function runTests(transitionDuration) { target: 'x', value: 10 })]); - }).catch(failTest).then(done); + }).then(done, done.fail); }); // This doesn't really test anything that the above tests don't cover, but it combines @@ -255,7 +255,7 @@ function runTests(transitionDuration) { expect(endCnt).toEqual(3); }) .then(checkNoneRunning) - .catch(failTest).then(done); + .then(done, done.fail); }); }); } @@ -452,8 +452,7 @@ describe('Plotly.react transitions:', function() { [Plots, 'transitionFromReact', 1] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should go through transition pathway only when there are animatable changes', function(done) { @@ -514,8 +513,7 @@ describe('Plotly.react transitions:', function() { [Plots, 'transitionFromReact', 1] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should no try to transition a trace which is not *animatable:true* yet', function(done) { @@ -555,8 +553,7 @@ describe('Plotly.react transitions:', function() { [Plots, 'transitionFromReact', 0] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not try to transition when the *config* has changed', function(done) { @@ -591,8 +588,7 @@ describe('Plotly.react transitions:', function() { [Plots, 'transitionFromReact', 1] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should only *redraw* at end of transition when necessary', function(done) { @@ -637,8 +633,7 @@ describe('Plotly.react transitions:', function() { [Registry, 'call', ['redraw', gd]] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@flaky should only transition the layout when both traces and layout have animatable changes by default', function(done) { @@ -729,8 +724,7 @@ describe('Plotly.react transitions:', function() { [gd._fullLayout._basePlotModules[0], 'plot', [gd]] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should transition data coordinates with and without *datarevision*', function(done) { @@ -797,8 +791,7 @@ describe('Plotly.react transitions:', function() { [Plots, 'transitionFromReact', 1] ]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@flaky should transition layout when one or more axis auto-ranged value changed', function(done) { @@ -848,8 +841,7 @@ describe('Plotly.react transitions:', function() { ]); assertAxAutorange('axes are still autorange:false', false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not transition layout when axis auto-ranged value do not changed', function(done) { @@ -919,8 +911,7 @@ describe('Plotly.react transitions:', function() { ]); assertAxAutorange('y-axis is now autorange:false', false); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should emit transition events', function(done) { @@ -946,8 +937,7 @@ describe('Plotly.react transitions:', function() { expect(store[k]).toHaveBeenCalledTimes(1); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should preserve trace object-constancy (out-of-order case)', function(done) { @@ -1030,8 +1020,7 @@ describe('Plotly.react transitions:', function() { ]); _assertTraceNodes(msg, traceNodes, [[360, 90], [120, 210]]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should preserve trace object-constancy (# of traces mismatch case)', function(done) { @@ -1118,8 +1107,7 @@ describe('Plotly.react transitions:', function() { var traceNodesNew = gd.querySelectorAll('.scatterlayer > .trace'); _assertTraceNodes(msg, [traceNodes[0], traceNodesNew[1]], [[360, 90], [120, 210]]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not leak axis update from subplot to subplot', function(done) { @@ -1187,8 +1175,7 @@ describe('Plotly.react transitions:', function() { xaxis: [-10, 10], xaxis2: [-20, 20], xaxis3: [-30, 30], yaxis: [-10, 10], yaxis2: [-20, 20], yaxis3: [-30, 30] })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update ranges of date and category axes', function(done) { @@ -1231,7 +1218,6 @@ describe('Plotly.react transitions:', function() { expect(gd._fullLayout.xaxis.range).toEqual(['2018-06-01', '2019-06-01']); expect(gd._fullLayout.xaxis2.range).toEqual([0.5, 1.5]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/treemap_test.js b/test/jasmine/tests/treemap_test.js index 08bec0a82a7..15aa7739ceb 100644 --- a/test/jasmine/tests/treemap_test.js +++ b/test/jasmine/tests/treemap_test.js @@ -10,7 +10,7 @@ var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var mouseEvent = require('../assets/mouse_event'); var delay = require('../assets/delay'); -var failTest = require('../assets/fail_test'); + var customAssertions = require('../assets/custom_assertions'); var assertHoverLabelStyle = customAssertions.assertHoverLabelStyle; @@ -582,8 +582,7 @@ describe('Test treemap plot:', function() { var element = gd3.select('.treemap trace').node(); expect(element).toBe(null); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -781,7 +780,7 @@ describe('Test treemap hover:', function() { }] .forEach(function(spec) { it('should generate correct hover labels and event data - ' + spec.desc, function(done) { - run(spec).catch(failTest).then(done); + run(spec).then(done, done.fail); }); }); }); @@ -923,7 +922,7 @@ describe('Test treemap hover with and without levels', function() { }] .forEach(function(spec) { it('should generate correct hover labels and event data - ' + spec.desc + ' with level:' + spec.level, function(done) { - run(spec).catch(failTest).then(done); + run(spec).then(done, done.fail); }); }); }); @@ -992,8 +991,7 @@ describe('Test treemap hover lifecycle:', function() { fail('did not trigger correct # of plotly_unhover events'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1060,8 +1058,7 @@ describe('Test treemap clicks:', function() { fail('incorrect plotly_animating triggering'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should trigger plotly_click event when clicking on leaf node', function(done) { @@ -1083,8 +1080,7 @@ describe('Test treemap clicks:', function() { expect(trackers.click[0].points[0].label).toBe('Noam'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not trigger animation when graph is transitioning', function(done) { @@ -1144,8 +1140,7 @@ describe('Test treemap clicks:', function() { fail('incorrect plotly_animating triggering - ' + msg); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to override default click behavior using plotly_treemapclick handler ()', function(done) { @@ -1170,8 +1165,7 @@ describe('Test treemap clicks:', function() { fail('incorrect plotly_animating triggering'); } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1202,8 +1196,7 @@ describe('Test treemap restyle:', function() { .then(_assert('both visible:false', 0)) .then(_restyle({'visible': true})) .then(_assert('back to visible:true', 2)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle *maxdepth* and *level* w/o recomputing the hierarchy', function(done) { @@ -1233,8 +1226,7 @@ describe('Test treemap restyle:', function() { .then(_assert('with non-root level', 67)) .then(_restyle({maxdepth: null, level: null})) .then(_assert('back to first view', 97)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle *textinfo*', function(done) { @@ -1292,8 +1284,7 @@ describe('Test treemap restyle:', function() { .then(_assert('show everything', ['Root', 'B', 'A\n1\nnode1', 'b\n3\nnode3'])) .then(_restyle({textinfo: null})) .then(_assert('back to dflt', ['Root', 'B', 'A\nnode1', 'b\nnode3'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1384,8 +1375,7 @@ describe('Test treemap tweening:', function() { _assert('move B text to new position', 'transform', 'B', [222.75, 126], 3); _assert('move b text to new position', 'transform', 'b', [225.75, 150], 3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should tween sector enter/update (case: click on entry, no maxdepth)', function(done) { @@ -1416,8 +1406,7 @@ describe('Test treemap tweening:', function() { _assert('move B text to new position', 'transform', 'B', [222.75, 126], 3); _assert('move b text to new position', 'transform', 'b', [225.75, 150], 3); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should tween sector enter/update/exit (case: click on entry, maxdepth=2)', function(done) { @@ -1448,8 +1437,7 @@ describe('Test treemap tweening:', function() { _assert('move B text to new position', 'transform', 'B', [221.25, 126], 3); _assert('enter b text to new position', 'transform', 'b', [287.625, 192]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should tween sector enter/update/exit (case: click on entry, maxdepth=2, level=B)', function(done) { @@ -1479,8 +1467,7 @@ describe('Test treemap tweening:', function() { 'M215.75,112L617,112L617,367L215.75,367Z' ); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1546,8 +1533,7 @@ describe('Test treemap interactions edge cases', function() { hoverLabel: 1 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show falsy zero text', function(done) { @@ -1569,8 +1555,7 @@ describe('Test treemap interactions edge cases', function() { .then(function() { assertHoverLabelContent({ nums: 'D\n4\n0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should transition treemap traces only', function(done) { @@ -1606,8 +1591,7 @@ describe('Test treemap interactions edge cases', function() { treemapTraceCnt: 1 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to transition treemap traces via `Plotly.react`', function(done) { @@ -1628,8 +1612,7 @@ describe('Test treemap interactions edge cases', function() { .then(function() { expect(Plots.transitionFromReact).toHaveBeenCalledTimes(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1821,8 +1804,7 @@ describe('treemap uniformtext', function() { fontsizes: [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], scales: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.84], })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should uniform text scales after transition', function(done) { @@ -1887,8 +1869,7 @@ describe('treemap uniformtext', function() { fontsizes: [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], scales: [1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1], })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1935,7 +1916,6 @@ describe('treemap pathbar react', function() { return Plotly.react(gd, fig); }) .then(_assert('enable pathbar', 4)) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/updatemenus_test.js b/test/jasmine/tests/updatemenus_test.js index 78f375eead4..dd301c419c1 100644 --- a/test/jasmine/tests/updatemenus_test.js +++ b/test/jasmine/tests/updatemenus_test.js @@ -9,7 +9,7 @@ var Drawing = require('@src/components/drawing'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var TRANSITION_DELAY = 100; -var failTest = require('../assets/fail_test'); + var getBBox = require('../assets/get_bbox'); var delay = require('../assets/delay'); @@ -434,8 +434,7 @@ describe('update menus interactions', function() { expect(gd.layout.updatemenus).toBeUndefined(); assertPushMargins([false, false, false]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should drop/fold buttons when clicking on header', function(done) { @@ -463,8 +462,7 @@ describe('update menus interactions', function() { }).then(function() { assertMenus([3, 0]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('can set buttons visible or hidden', function(done) { @@ -483,8 +481,7 @@ describe('update menus interactions', function() { .then(function() { assertMenus([0, 4]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should execute the API command when execute = true', function(done) { @@ -496,8 +493,7 @@ describe('update menus interactions', function() { // Has been changed: expect(gd.data[0].line.color).toEqual('green'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should not execute the API command when execute = false', function(done) { @@ -514,8 +510,7 @@ describe('update menus interactions', function() { // Is unchanged: expect(gd.data[0].line.color).toEqual('blue'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should emit an event on button click', function(done) { @@ -541,8 +536,7 @@ describe('update menus interactions', function() { expect(data.length).toEqual(2); expect(data[1].active).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should still emit the event if method = skip', function(done) { @@ -570,8 +564,7 @@ describe('update menus interactions', function() { }).then(function() { expect(clickCnt).toEqual(1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should apply update on button click', function(done) { @@ -595,8 +588,7 @@ describe('update menus interactions', function() { }).then(function() { assertActive(gd, [0, 0]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should apply update on button click (toggle via args2 case)', function(done) { @@ -639,8 +631,7 @@ describe('update menus interactions', function() { assertItemColor(btn, bgColor); assertLineColor('base', 'red'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should update correctly on failed binding comparisons', function(done) { @@ -685,8 +676,7 @@ describe('update menus interactions', function() { .then(function() { assertActive(gd, [1]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should change color on mouse over', function(done) { @@ -720,8 +710,7 @@ describe('update menus interactions', function() { mouseEvent('mouseout', button); assertItemColor(button, activeColor); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should relayout', function(done) { @@ -776,8 +765,7 @@ describe('update menus interactions', function() { assertItemColor(selectHeader(0), 'rgb(0, 0, 0)'); assertItemColor(selectHeader(1), 'rgb(0, 0, 0)'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('applies padding on all sides', function(done) { @@ -809,8 +797,7 @@ describe('update menus interactions', function() { expect(xy1[0] - xy2[0]).toEqual(xpad); expect(xy1[1] - xy2[1]).toEqual(ypad); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('applies y padding on relayout', function(done) { @@ -834,8 +821,7 @@ describe('update menus interactions', function() { expect(x1 - x2).toBeCloseTo(padShift, 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); function assertNodeCount(query, cnt) { @@ -976,8 +962,7 @@ describe('update menus interaction with other components:', function() { expect(menuLayer.selectAll('.updatemenu-container').size()).toBe(1); expect(infoLayer.node().nextSibling).toBe(menuLayer.node()); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/violin_test.js b/test/jasmine/tests/violin_test.js index bc0e3a5ee8f..baa6d9d8c95 100644 --- a/test/jasmine/tests/violin_test.js +++ b/test/jasmine/tests/violin_test.js @@ -7,7 +7,7 @@ var Violin = require('@src/traces/violin'); var d3 = require('@plotly/d3'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var mouseEvent = require('../assets/mouse_event'); var supplyAllDefaults = require('../assets/supply_defaults'); @@ -666,7 +666,7 @@ describe('Test violin hover:', function() { }] .forEach(function(specs) { it('should generate correct hover labels ' + specs.desc, function(done) { - run(specs).catch(failTest).then(done); + run(specs).then(done, done.fail); }); }); @@ -698,8 +698,7 @@ describe('Test violin hover:', function() { mouseEvent('mousemove', 250, 250); assertViolinHoverLine([299.35, 250, 200.65, 250]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show in one-sided positive case', function(done) { @@ -709,8 +708,7 @@ describe('Test violin hover:', function() { mouseEvent('mousemove', 300, 250); assertViolinHoverLine([277.3609, 250, 80, 250]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show in one-sided negative case', function(done) { @@ -720,8 +718,7 @@ describe('Test violin hover:', function() { mouseEvent('mousemove', 200, 250); assertViolinHoverLine([222.6391, 250, 420, 250]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -755,8 +752,7 @@ describe('Test violin hover:', function() { } } }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -813,7 +809,6 @@ describe('Test violin restyle:', function() { .then(function() { _assert('with pts', {violinCnt: 1, ptsCnt: 272}); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/volume_test.js b/test/jasmine/tests/volume_test.js index 8a3ecf6be89..246a1f0ce7a 100644 --- a/test/jasmine/tests/volume_test.js +++ b/test/jasmine/tests/volume_test.js @@ -4,7 +4,7 @@ var Lib = require('@src/lib'); var supplyAllDefaults = require('../assets/supply_defaults'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var delay = require('../assets/delay'); var mouseEvent = require('../assets/mouse_event'); @@ -227,8 +227,7 @@ describe('Test volume', function() { .then(function() { assertPositions(0, 'to be OK positions'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('@gl volume should create no iso-surface and set `gl-positions: []` for traces when all the data is outside isomin and isomax', function(done) { @@ -248,8 +247,7 @@ describe('Test volume', function() { .then(function() { assertPositions(0, 'to be OK positions'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -303,8 +301,7 @@ describe('Test volume', function() { return Plotly.purge(gd); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -413,8 +410,7 @@ describe('Test volume', function() { .then(function() { return Plotly.restyle(gd, 'hovertemplate', '%{value}
(%{x},%{y},%{z})!!'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -510,8 +506,7 @@ describe('Test volume grid', function() { cellsLength: 104 }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -559,7 +554,6 @@ describe('Test volume grid', function() { }).then(function() { expect(Lib.warn).toHaveBeenCalledWith('Encountered arbitrary coordinates! Unable to input data grid.'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/waterfall_test.js b/test/jasmine/tests/waterfall_test.js index ebc253da6c4..9e51123fead 100644 --- a/test/jasmine/tests/waterfall_test.js +++ b/test/jasmine/tests/waterfall_test.js @@ -9,7 +9,7 @@ var Axes = require('@src/plots/cartesian/axes'); var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); -var failTest = require('../assets/fail_test'); + var supplyAllDefaults = require('../assets/supply_defaults'); var color = require('@src/components/color'); var rgb = color.rgb; @@ -693,8 +693,7 @@ describe('A waterfall plot', function() { expect(foundTextNodes).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should show texts (horizontal case)', function(done) { @@ -724,8 +723,7 @@ describe('A waterfall plot', function() { expect(foundTextNodes).toBe(true); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); var insideTextTestsTrace = { @@ -752,8 +750,7 @@ describe('A waterfall plot', function() { Plotly.plot(gd, [trace]) .then(assertTextFontColors([DARK, LIGHT])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use defined textfont.color for inside text instead of the contrasting default', function(done) { @@ -761,8 +758,7 @@ describe('A waterfall plot', function() { Plotly.plot(gd, [data]) .then(assertTextFontColors(Lib.repeat('#09f', 6))) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to restyle', function(done) { @@ -942,8 +938,7 @@ describe('A waterfall plot', function() { assertTextIsInsidePath(text20, path20); // inside assertTextIsInsidePath(text30, path30); // inside }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to add/remove connector nodes on restyle', function(done) { @@ -974,8 +969,7 @@ describe('A waterfall plot', function() { .then(function() { _assertNumberOfWaterfallConnectorNodes(4); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('handle BADNUM positions', function(done) { @@ -1022,8 +1016,7 @@ describe('A waterfall plot', function() { .then(function() { return checkTransition(gd, mockCopy, animateOpts, transitionOpts, connectorTests); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to deal with transform that empty out the data coordinate arrays', function(done) { @@ -1049,8 +1042,7 @@ describe('A waterfall plot', function() { expect(gd.calcdata[0][0].y).toEqual(NaN); expect(gd.calcdata[0][0].isBlank).toBe(undefined); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should coerce text-related attributes', function(done) { @@ -1133,8 +1125,7 @@ describe('A waterfall plot', function() { assertTextFont(textNodes[1], expected.outsidetextfont, 1); assertTextFont(textNodes[2], expected.insidetextfont, 2); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to add/remove text node on restyle', function(done) { @@ -1187,8 +1178,7 @@ describe('A waterfall plot', function() { .then(function() { _assertNumberOfWaterfallTextNodes(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to react with new text colors', function(done) { @@ -1220,8 +1210,7 @@ describe('A waterfall plot', function() { return Plotly.react(gd, gd.data); }) .then(assertTextFontColors(['rgb(255, 0, 0)', 'rgb(255, 0, 0)', 'rgb(255, 0, 0)'])) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should be able to adjust bars when reacting with new connector.line.width ', function(done) { @@ -1255,8 +1244,7 @@ describe('A waterfall plot', function() { var d = d3.select(path).attr('d'); expect(d).toBe('M11.33,325V264.33H102V325Z'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); checkTextTemplate([{ @@ -1323,8 +1311,7 @@ describe('waterfall visibility toggling:', function() { .then(function() { _assert('back to both visible', [0.5, 3.5], [-2.222, 2.222], 1); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1382,8 +1369,7 @@ describe('waterfall hover', function() { var mock = Lib.extendDeep({}, require('@mocks/waterfall_11.json')); Plotly.plot(gd, mock.data, mock.layout) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should return the correct hover point data (case x)', function() { @@ -1444,8 +1430,7 @@ describe('waterfall hover', function() { var out = _hover(gd, -0.25, 0.5, 'closest'); expect(out.text).toEqual('apple', 'hover text'); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should turn off hoverinfo flags with hoveinfo none or skip', function(done) { @@ -1471,8 +1456,7 @@ describe('waterfall hover', function() { .then(function() { expect(d3.selectAll('g.hovertext').size()).toBe(0); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should turn on hoverinfo flags with hoveinfo all', function(done) { @@ -1503,8 +1487,7 @@ describe('waterfall hover', function() { axis: '0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should use hovertemplate if specified', function(done) { @@ -1534,8 +1517,7 @@ describe('waterfall hover', function() { axis: '0' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should format numbers - round hover precision', function(done) { @@ -1560,8 +1542,7 @@ describe('waterfall hover', function() { axis: 'E' }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('hover measure categories with axis prefix and suffix', function(done) { @@ -1618,8 +1599,7 @@ describe('waterfall hover', function() { expect(out.extraText).toEqual(undefined); expect(out.style).toEqual([4, '#4499FF', 4, 1004.401]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); @@ -1667,8 +1647,7 @@ describe('waterfall hover', function() { expect(out).toBe(false, hoverSpec); }); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('should return correct hover data (two waterfalls, array width)', function(done) { @@ -1705,8 +1684,7 @@ describe('waterfall hover', function() { expect(out.style).toEqual([1, '#3D9970', 200, 3]); assertPos(out.pos, [222, 280, 16, 16]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); it('positions labels correctly w.r.t. narrow waterfalls', function(done) { @@ -1735,8 +1713,7 @@ describe('waterfall hover', function() { out = _hover(gd, 10, 2, 'closest'); assertPos(out.pos, [145, 155, 110, 110]); }) - .catch(failTest) - .then(done); + .then(done, done.fail); }); }); }); @@ -1912,7 +1889,6 @@ describe('waterfall uniformtext', function() { fontsizes: [12, 12, 12, 12, 12, 12, 12], scales: [0.48, 1, 1, 1, 1, 1, 1], })) - .catch(failTest) - .then(done); + .then(done, done.fail); }); });