Skip to content

Introducing Plotly.update #875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Sep 7, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: adapt transition test to more strict 'traces' API
  • Loading branch information
etpinard committed Sep 6, 2016
commit c15a617bf053f14d03855c35bbe2ae19becb51f3
15 changes: 11 additions & 4 deletions test/jasmine/tests/transition_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var Plotly = require('@lib/index');
var Lib = require('@src/lib');
var Plots = Plotly.Plots;
var plotApiHelpers = require('@src/plot_api/helpers');

var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
Expand Down Expand Up @@ -29,8 +30,9 @@ function runTests(transitionDuration) {

it('resolves only once the transition has completed', function(done) {
var t1 = Date.now();
var traces = plotApiHelpers.coerceTraceIndices(gd, null);

Plots.transition(gd, null, {'xaxis.range': [0.2, 0.3]}, null, {redraw: true}, {duration: transitionDuration, easing: 'cubic-in-out'})
Plots.transition(gd, null, {'xaxis.range': [0.2, 0.3]}, traces, {redraw: true}, {duration: transitionDuration, easing: 'cubic-in-out'})
.then(delay(20))
.then(function() {
expect(Date.now() - t1).toBeGreaterThan(transitionDuration);
Expand All @@ -39,9 +41,11 @@ function runTests(transitionDuration) {

it('emits plotly_transitioning on transition start', function(done) {
var beginTransitionCnt = 0;
var traces = plotApiHelpers.coerceTraceIndices(gd, null);

gd.on('plotly_transitioning', function() { beginTransitionCnt++; });

Plots.transition(gd, null, {'xaxis.range': [0.2, 0.3]}, null, {redraw: true}, {duration: transitionDuration, easing: 'cubic-in-out'})
Plots.transition(gd, null, {'xaxis.range': [0.2, 0.3]}, traces, {redraw: true}, {duration: transitionDuration, easing: 'cubic-in-out'})
.then(delay(20))
.then(function() {
expect(beginTransitionCnt).toBe(1);
Expand All @@ -50,9 +54,11 @@ function runTests(transitionDuration) {

it('emits plotly_transitioned on transition end', function(done) {
var trEndCnt = 0;
var traces = plotApiHelpers.coerceTraceIndices(gd, null);

gd.on('plotly_transitioned', function() { trEndCnt++; });

Plots.transition(gd, null, {'xaxis.range': [0.2, 0.3]}, null, {redraw: true}, {duration: transitionDuration, easing: 'cubic-in-out'})
Plots.transition(gd, null, {'xaxis.range': [0.2, 0.3]}, traces, {redraw: true}, {duration: transitionDuration, easing: 'cubic-in-out'})
.then(delay(20))
.then(function() {
expect(trEndCnt).toEqual(1);
Expand All @@ -70,7 +76,8 @@ function runTests(transitionDuration) {
gd.on('plotly_transitioned', function() { currentlyRunning--; endCnt++; });

function doTransition() {
return Plots.transition(gd, [{x: [1, 2]}], null, null, {redraw: true}, {duration: transitionDuration, easing: 'cubic-in-out'});
var traces = plotApiHelpers.coerceTraceIndices(gd, null);
return Plots.transition(gd, [{x: [1, 2]}], null, traces, {redraw: true}, {duration: transitionDuration, easing: 'cubic-in-out'});
}

function checkNoneRunning() {
Expand Down