Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f5bccd5
First cut at slider
rreusser Sep 28, 2016
83483fd
Fix lint errors in slider
rreusser Sep 28, 2016
f69a328
Add slider transitions
rreusser Sep 28, 2016
82ea558
Expand touchable slider area
rreusser Sep 28, 2016
ca5f9f5
Add slider mock
rreusser Sep 28, 2016
c6a3e11
Rename sliders and bump circular require tolerance
rreusser Sep 28, 2016
5b74652
Add trbl padding to sliders
rreusser Sep 28, 2016
e13e0ee
Remove fanciness from slider constants
rreusser Sep 28, 2016
8fe1842
Tweak slider behavior to avoid event -> method loops
rreusser Sep 28, 2016
05ac586
Improve padding logic for updatemenus
rreusser Sep 28, 2016
4604341
Add jasmine tests for updatemenus padding
rreusser Sep 29, 2016
8558be8
add streaming maxpoints max and dflt
cldougl Sep 29, 2016
c673afe
Merge pull request #996 from plotly/maxpt_dflt
cldougl Sep 29, 2016
304174a
Add current value output to sliders
rreusser Sep 29, 2016
fce36fa
Merge pull request #989 from plotly/fix-updatemenus-padding
rreusser Sep 29, 2016
52b4a2a
First cut at slider
rreusser Sep 28, 2016
b161d55
Fix lint errors in slider
rreusser Sep 28, 2016
8d7c40d
Add slider transitions
rreusser Sep 28, 2016
30b5f2d
Expand touchable slider area
rreusser Sep 28, 2016
19442d9
Add slider mock
rreusser Sep 28, 2016
ecb7e87
Rename sliders and bump circular require tolerance
rreusser Sep 28, 2016
9c0f9ac
Add trbl padding to sliders
rreusser Sep 29, 2016
2a6f987
Remove fanciness from slider constants
rreusser Sep 28, 2016
5bd6bdd
Tweak slider behavior to avoid event -> method loops
rreusser Sep 28, 2016
4520a48
Add current value output to sliders
rreusser Sep 29, 2016
88d6728
Tweak slider colors
rreusser Sep 29, 2016
6da5b0f
Fix sliders in plot schema
rreusser Sep 29, 2016
1cad8a4
Merge branch 'slider-component' of github.com:plotly/plotly.js into s…
rreusser Sep 29, 2016
4a9edd0
Working through slider testing issues
rreusser Sep 29, 2016
6cb6d42
Add slider tests
rreusser Oct 3, 2016
4775a47
Test updateevent for sliders
rreusser Oct 3, 2016
a08f084
Update sliders baseline to reflect bugfix
rreusser Oct 3, 2016
5816c24
Fix plot schema error
rreusser Oct 3, 2016
2cfa81b
Remove unneeded lines from sliders test
rreusser Oct 4, 2016
1d52b51
Remove updatevalue and updateevent
rreusser Oct 6, 2016
892583d
Removed unused slider function
rreusser Oct 6, 2016
5015710
Clean up slider options
rreusser Oct 6, 2016
582c643
Remove unneeded/failing slider test
rreusser Oct 6, 2016
70610ec
Add suffix to currentvalue slider label
rreusser Oct 6, 2016
f25127c
don't coerce slider currentvalue attrs when !visible
rreusser Oct 6, 2016
4b608ee
Be more specific about *all* unused slider attrs not set
rreusser Oct 6, 2016
6c9034d
Test mouse movement for sliders
rreusser Oct 6, 2016
21e2f99
Make sure slider Drawing.bBox calls fall back to defined
rreusser Oct 6, 2016
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
Next Next commit
Working through slider testing issues
  • Loading branch information
rreusser committed Sep 29, 2016
commit 4a9edd0daf8b19db4a5877059c3fd51053469711
3 changes: 2 additions & 1 deletion src/components/sliders/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ module.exports = {
valType: 'enumerated',
values: ['left', 'center', 'right'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, nice job dropping the 'auto' value here.

dflt: 'left',
role: 'info',
description: [
'The alignment of the value readout relative to the length of the slider.'
].join(' ')
Expand All @@ -219,7 +220,7 @@ module.exports = {
valType: 'string',
role: 'info',
description: [
'When `currentvalue.visible` is true, this sets the prefix of the lable. If provided,',
'When currentvalue.visible is true, this sets the prefix of the lable. If provided,',
'it will be joined to the current value with a single space between.'
].join(' ')
},
Copy link
Contributor Author

@rreusser rreusser Sep 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@etpinard does the prefix definition look reasonable to you? I'm losing my mind here. The test dashboard fails:

> Plotly.PlotSchema.get().layout.layoutAttributes.sliders.currentvalue.prefix
< undefined

Where my browserifying dev environment succeeds:

> Plotly.PlotSchema.get().layout.layoutAttributes.sliders.currentvalue.prefix
< Object {valType: "string", role: "info", description: "When currentvalue.visible is true, this sets the p…to the current value with a single space between."}

I'm really struggling to find a reason for it. Currently digging into the logic to see if I've committed a crime which would get prefix filtered out sometimes

Copy link
Contributor Author

@rreusser rreusser Sep 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solved. Problem exists between keyboard, chair, and regex. (previous description lacked .join() 😬 )

Expand Down
149 changes: 149 additions & 0 deletions test/jasmine/tests/sliders_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
var Sliders = require('@src/components/sliders');
// var constants = require('@src/components/sliders/constants');

// var d3 = require('d3');
// var Plotly = require('@lib');
// var Lib = require('@src/lib');
// var createGraphDiv = require('../assets/create_graph_div');
// var destroyGraphDiv = require('../assets/destroy_graph_div');

describe('sliders defaults', function() {
Copy link
Contributor

@etpinard etpinard Oct 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO:

  • add one defaults around currentvalue.visible -> other currentvalue nested attributes

'use strict';

var supply = Sliders.supplyLayoutDefaults;

var layoutIn, layoutOut;

beforeEach(function() {
layoutIn = {};
layoutOut = {};
});

it('should set \'visible\' to false when no steps are present', function() {
layoutIn.sliders = [{
steps: [{
method: 'relayout',
args: ['title', 'Hello World']
}, {
method: 'update',
args: [ { 'marker.size': 20 }, { 'xaxis.range': [0, 10] }, [0, 1] ]
}, {
method: 'animate',
args: [ 'frame1', { transition: { duration: 500, ease: 'cubic-in-out' }}]
}]
}, {
bgcolor: 'red'
}, {
visible: false,
steps: [{
method: 'relayout',
args: ['title', 'Hello World']
}]
}];

supply(layoutIn, layoutOut);

expect(layoutOut.sliders[0].visible).toBe(true);
expect(layoutOut.sliders[0].active).toEqual(0);
expect(layoutOut.sliders[0].steps[0].args.length).toEqual(2);
expect(layoutOut.sliders[0].steps[1].args.length).toEqual(3);
expect(layoutOut.sliders[0].steps[2].args.length).toEqual(2);

expect(layoutOut.sliders[1].visible).toBe(false);
expect(layoutOut.sliders[1].active).toBeUndefined();

expect(layoutOut.sliders[2].visible).toBe(false);
expect(layoutOut.sliders[2].active).toBeUndefined();
});

it('should skip over non-object steps', function() {
layoutIn.sliders = [{
steps: [
null,
{
method: 'relayout',
args: ['title', 'Hello World']
},
'remove'
]
}];

supply(layoutIn, layoutOut);

expect(layoutOut.sliders[0].steps.length).toEqual(1);
expect(layoutOut.sliders[0].steps[0]).toEqual({
method: 'relayout',
args: ['title', 'Hello World'],
label: '',
_index: 1
});
});

it('should skip over steps with array \'args\' field', function() {
layoutIn.sliders = [{
steps: [{
method: 'restyle',
}, {
method: 'relayout',
args: ['title', 'Hello World']
}, {
method: 'relayout',
args: null
}, {}]
}];

supply(layoutIn, layoutOut);

expect(layoutOut.sliders[0].steps.length).toEqual(1);
expect(layoutOut.sliders[0].steps[0]).toEqual({
method: 'relayout',
args: ['title', 'Hello World'],
label: '',
_index: 1
});
});

it('should keep ref to input update menu container', function() {
layoutIn.sliders = [{
steps: [{
method: 'relayout',
args: ['title', 'Hello World']
}]
}, {
bgcolor: 'red'
}, {
visible: false,
steps: [{
method: 'relayout',
args: ['title', 'Hello World']
}]
}];

supply(layoutIn, layoutOut);

expect(layoutOut.sliders[0]._input).toBe(layoutIn.sliders[0]);
expect(layoutOut.sliders[1]._input).toBe(layoutIn.sliders[1]);
expect(layoutOut.sliders[2]._input).toBe(layoutIn.sliders[2]);
});

it('should default \'bgcolor\' to layout \'paper_bgcolor\'', function() {
var steps = [{
method: 'relayout',
args: ['title', 'Hello World']
}];

layoutIn.sliders = [{
steps: steps,
}, {
bgcolor: 'red',
steps: steps
}];

layoutOut.paper_bgcolor = 'blue';

supply(layoutIn, layoutOut);

expect(layoutOut.sliders[0].bgcolor).toEqual('blue');
expect(layoutOut.sliders[1].bgcolor).toEqual('red');
});
});