-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Mapbox access token catches #776
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,18 +180,26 @@ describe('mapbox credentials', function() { | |
}); | ||
|
||
it('should throw error if token is invalid', function(done) { | ||
var cnt = 0; | ||
|
||
Plotly.plot(gd, [{ | ||
type: 'scattermapbox', | ||
lon: [10, 20, 30], | ||
lat: [10, 20, 30] | ||
}], {}, { | ||
mapboxAccessToken: dummyToken | ||
}).catch(function(err) { | ||
cnt++; | ||
expect(err).toEqual(new Error(constants.mapOnErrorMsg)); | ||
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. This assertion ⏫ did not get evaluated before. That is this I wish jasmine had the something similar to TAP's |
||
}).then(done); | ||
}).then(function() { | ||
expect(cnt).toEqual(1); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should use access token in mapbox layout options if present', function(done) { | ||
var cnt = 0; | ||
|
||
Plotly.plot(gd, [{ | ||
type: 'scattermapbox', | ||
lon: [10, 20, 30], | ||
|
@@ -202,7 +210,10 @@ describe('mapbox credentials', function() { | |
} | ||
}, { | ||
mapboxAccessToken: dummyToken | ||
}).catch(function() { | ||
cnt++; | ||
}).then(function() { | ||
expect(cnt).toEqual(0); | ||
expect(gd._fullLayout.mapbox.accesstoken).toEqual(MAPBOX_ACCESS_TOKEN); | ||
done(); | ||
}); | ||
|
@@ -493,21 +504,19 @@ describe('mapbox plots', function() { | |
}); | ||
|
||
it('should be able to update the access token', function(done) { | ||
var promise = Plotly.relayout(gd, 'mapbox.accesstoken', 'wont-work'); | ||
|
||
promise.catch(function(err) { | ||
Plotly.relayout(gd, 'mapbox.accesstoken', 'wont-work').catch(function(err) { | ||
expect(gd._fullLayout.mapbox.accesstoken).toEqual('wont-work'); | ||
expect(err).toEqual(new Error(constants.mapOnErrorMsg)); | ||
}); | ||
expect(gd._promises.length).toEqual(1); | ||
|
||
promise.then(function() { | ||
return Plotly.relayout(gd, 'mapbox.accesstoken', MAPBOX_ACCESS_TOKEN); | ||
}).then(function() { | ||
expect(gd._fullLayout.mapbox.accesstoken).toEqual(MAPBOX_ACCESS_TOKEN); | ||
}).then(done); | ||
expect(gd._promises.length).toEqual(0); | ||
done(); | ||
}); | ||
}); | ||
|
||
|
||
it('should be able to update traces', function(done) { | ||
function assertDataPts(lengths) { | ||
var lines = getGeoJsonData(gd, 'lines'), | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Now, clear the
gd._promises
onrestyle
andrelayout
instead.