-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Slider component #986
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
Slider component #986
Changes from 1 commit
f5bccd5
83483fd
f69a328
82ea558
ca5f9f5
c6a3e11
5b74652
e13e0ee
8fe1842
05ac586
4604341
8558be8
c673afe
304174a
fce36fa
52b4a2a
b161d55
8d7c40d
30b5f2d
19442d9
ecb7e87
9c0f9ac
2a6f987
5bd6bdd
4520a48
88d6728
6da5b0f
1cad8a4
4a9edd0
6cb6d42
4775a47
a08f084
5816c24
2cfa81b
1d52b51
892583d
5015710
582c643
70610ec
f25127c
4b608ee
6c9034d
21e2f99
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -200,6 +200,7 @@ module.exports = { | |
| valType: 'enumerated', | ||
| values: ['left', 'center', 'right'], | ||
| dflt: 'left', | ||
| role: 'info', | ||
| description: [ | ||
| 'The alignment of the value readout relative to the length of the slider.' | ||
| ].join(' ') | ||
|
|
@@ -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(' ') | ||
| }, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @etpinard does the Where my browserifying dev environment succeeds: 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Solved. Problem exists between keyboard, chair, and regex. (previous description lacked |
||
|
|
||
| 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() { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO:
|
||
| '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'); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
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.