File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,34 @@ describe('compile/legend', () => {
153153 expect ( def . title ) . toBe ( 'foo' ) ;
154154 } ) ;
155155
156+ it ( 'should produce a Vega legend with gradientLength for color with a discrete scale type' , ( ) => {
157+ const model = parseUnitModelWithScale ( {
158+ mark : 'point' ,
159+ encoding : {
160+ x : { field : 'a' , type : 'nominal' } ,
161+ color : {
162+ field : 'a' ,
163+ type : 'quantitative' ,
164+ scale : { type : 'quantile' } ,
165+ legend : {
166+ gradientLength : 100
167+ }
168+ }
169+ }
170+ } ) ;
171+
172+ const def = parseLegendForChannel ( model , COLOR ) . combine ( ) ;
173+ // TODO: Check if we are open to enabling toMatchSnapshot testing instead?
174+ expect ( def ) . toEqual ( {
175+ disable : false ,
176+ gradientLength : 100 ,
177+ labelOverlap : 'greedy' ,
178+ stroke : 'color' ,
179+ title : 'a' ,
180+ type : 'discrete'
181+ } ) ;
182+ } ) ;
183+
156184 [ SIZE , SHAPE , OPACITY , STROKEWIDTH ] . forEach ( channel => {
157185 it ( `should produce a Vega legend object with correct type and scale for ${ channel } ` , ( ) => {
158186 const spec : NormalizedUnitSpec = {
You can’t perform that action at this time.
0 commit comments