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

fix(theme): remove default fill for legends.text theme #1181

Merged
merged 2 commits into from
Oct 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/core/src/theming/defaultTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ export const defaultTheme = {
},
},
legends: {
text: {
fill: '#333333',
},
text: {},
},
labels: {
text: {},
Expand Down
24 changes: 8 additions & 16 deletions packages/legends/tests/svg/LegendSvgItem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import React, { Component } from 'react'
import React from 'react'
import renderer from 'react-test-renderer'
import { mount } from 'enzyme'
import { defaultTheme, themeContext } from '@nivo/core'
import { default as BaseLegendSvgItem } from '../../src/svg/LegendSvgItem'
import { ThemeProvider } from '@nivo/core'
import BaseLegendSvgItem from '../../src/svg/LegendSvgItem'
import * as shapes from '../../src/svg/symbols'
import {
DIRECTION_LEFT_TO_RIGHT,
Expand Down Expand Up @@ -38,19 +38,11 @@ const directions = [
DIRECTION_BOTTOM_TO_TOP,
]

const withTheme = WrappedComponent => {
return class ThemedLegendSvgItem extends Component {
render() {
return (
<themeContext.Provider value={defaultTheme}>
<WrappedComponent {...this.props} />
</themeContext.Provider>
)
}
}
}

const LegendSvgItem = withTheme(BaseLegendSvgItem)
const LegendSvgItem = props => (
<ThemeProvider>
<BaseLegendSvgItem {...props} />
</ThemeProvider>
)

directions.forEach(direction => {
it(`should support ${direction} direction`, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ exports[`should support bottom-to-top direction 1`] = `
Object {
"dominantBaseline": "alphabetic",
"fill": "#333333",
"fontFamily": "sans-serif",
"fontSize": 11,
"pointerEvents": "none",
"userSelect": "none",
}
Expand Down Expand Up @@ -95,6 +97,8 @@ exports[`should support bottom-to-top direction justified 1`] = `
Object {
"dominantBaseline": "text-before-edge",
"fill": "#333333",
"fontFamily": "sans-serif",
"fontSize": 11,
"pointerEvents": "none",
"userSelect": "none",
}
Expand Down Expand Up @@ -149,6 +153,8 @@ exports[`should support left-to-right direction 1`] = `
Object {
"dominantBaseline": "central",
"fill": "#333333",
"fontFamily": "sans-serif",
"fontSize": 11,
"pointerEvents": "none",
"userSelect": "none",
}
Expand Down Expand Up @@ -203,6 +209,8 @@ exports[`should support left-to-right direction justified 1`] = `
Object {
"dominantBaseline": "central",
"fill": "#333333",
"fontFamily": "sans-serif",
"fontSize": 11,
"pointerEvents": "none",
"userSelect": "none",
}
Expand Down Expand Up @@ -257,6 +265,8 @@ exports[`should support right-to-left direction 1`] = `
Object {
"dominantBaseline": "central",
"fill": "#333333",
"fontFamily": "sans-serif",
"fontSize": 11,
"pointerEvents": "none",
"userSelect": "none",
}
Expand Down Expand Up @@ -311,6 +321,8 @@ exports[`should support right-to-left direction justified 1`] = `
Object {
"dominantBaseline": "central",
"fill": "#333333",
"fontFamily": "sans-serif",
"fontSize": 11,
"pointerEvents": "none",
"userSelect": "none",
}
Expand Down Expand Up @@ -365,6 +377,8 @@ exports[`should support top-to-bottom direction 1`] = `
Object {
"dominantBaseline": "text-before-edge",
"fill": "#333333",
"fontFamily": "sans-serif",
"fontSize": 11,
"pointerEvents": "none",
"userSelect": "none",
}
Expand Down Expand Up @@ -419,6 +433,8 @@ exports[`should support top-to-bottom direction justified 1`] = `
Object {
"dominantBaseline": "alphabetic",
"fill": "#333333",
"fontFamily": "sans-serif",
"fontSize": 11,
"pointerEvents": "none",
"userSelect": "none",
}
Expand Down