Skip to content
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

Add fallback for Color.fromCssColorString #5174

Merged
merged 2 commits into from
Jan 27, 2021
Merged

Add fallback for Color.fromCssColorString #5174

merged 2 commits into from
Jan 27, 2021

Conversation

nf-s
Copy link
Contributor

@nf-s nf-s commented Jan 25, 2021

Add fallback for Color.fromCssColorString

The type signature for Color.fromCssColorString(col:string) => Color is incorrect as it can return undefined.

For example, this catalog has a CSV with an enum color map with an invalid CSS color:

When the catalog item is added to the workbench the map will crash.

This PR adds default colors for wherever Color.fromCssColorString is used.

I also deleted some old JS files:

  • lib/Models/LegendHelper.js
  • lib/Models/TableColumnStyle.js
  • lib/Models/TableDataSource.js
  • test/Models/LegendHelperSpec.js
  • test/Models/TableDataSourceSpec.js

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated CHANGES.md with what I changed.

Copy link
Contributor

@KeyboardSounds KeyboardSounds left a comment

Choose a reason for hiding this comment

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

Can you fix the type declaration in terriajs-cesium as well? We're using custom type decs for Cesium still I think so it's a problem on our end. Unless we're not, in which case we should create an issue in Cesium, because sharing is caring.

@nf-s nf-s merged commit dc48388 into next Jan 27, 2021
@nf-s nf-s deleted the fix-color-strings branch January 27, 2021 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants