-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix repeated val case in scattermapbox convert step #747
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,6 +243,10 @@ describe('scattermapbox calc', function() { | |
describe('scattermapbox convert', function() { | ||
'use strict'; | ||
|
||
beforeAll(function() { | ||
jasmine.addMatchers(customMatchers); | ||
}); | ||
|
||
function _convert(trace) { | ||
var gd = { data: [trace] }; | ||
|
||
|
@@ -397,6 +401,23 @@ describe('scattermapbox convert', function() { | |
}); | ||
}); | ||
|
||
it('for markers + circle bubbles traces with repeated values, should', function() { | ||
var opts = _convert(Lib.extendFlat({}, base, { | ||
lon: ['-96.796988', '-81.379236', '-85.311819', ''], | ||
lat: ['32.776664', '28.538335', '35.047157', '' ], | ||
marker: { size: ['5', '49', '5', ''] } | ||
})); | ||
|
||
expect(opts.circle.paint['circle-radius'].stops) | ||
.toBeCloseTo2DArray([[0, 2.5], [1, 24.5]], 'not replicate stops'); | ||
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. N.B. there are as many stop items as unique |
||
|
||
var radii = opts.circle.geojson.features.map(function(f) { | ||
return f.properties['circle-radius']; | ||
}); | ||
|
||
expect(radii).toBeCloseToArray([0, 1, 0], 'link features to correct stops'); | ||
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. ... and the geojson feature properties are mapped to repeated stops. 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. 💥! Sweet. |
||
}); | ||
|
||
function assertVisibility(opts, expectations) { | ||
var actual = ['fill', 'line', 'circle', 'symbol'].map(function(l) { | ||
return opts[l].layout.visibility; | ||
|
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.
Here
hash[key][val]
store indices in ofarrayOk
attribute. This check ⏫ was failing if a repeated value was found in the firstmarker.size
ormarker.color
item as0
is falsy.