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

Upgrade carbon charts #1835

Merged
merged 5 commits into from
Nov 30, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions __mocks__/@carbon/charts-react/bar-chart-grouped.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const React = require('react');

module.exports = () =>
React.createElement('div', { id: 'mock-bar-chart-grouped' });
4 changes: 4 additions & 0 deletions __mocks__/@carbon/charts-react/bar-chart-simple.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const React = require('react');

module.exports = () =>
React.createElement('div', { id: 'mock-bar-chart-simple' });
4 changes: 4 additions & 0 deletions __mocks__/@carbon/charts-react/bar-chart-stacked.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const React = require('react');

module.exports = () =>
React.createElement('div', { id: 'mock-bar-chart-stacked' });
3 changes: 3 additions & 0 deletions __mocks__/@carbon/charts-react/line-chart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const React = require('react');

module.exports = () => React.createElement('div', { id: 'mock-line-chart' });
3 changes: 3 additions & 0 deletions __mocks__/@carbon/charts-react/pie-chart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const React = require('react');

module.exports = () => React.createElement('div', { id: 'mock-pie-chart' });
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ module.exports = {
'^(?!.*\\.(js|jsx|css|json)$)': '<rootDir>/config/jest/fileTransform.js',
},
testPathIgnorePatterns: ['/config/', '/lib/'],
transformIgnorePatterns: ['/node_modules/(?!(@carbon/charts)).+(.jsx?)'],
transformIgnorePatterns: [
'/node_modules/(?!(@carbon/charts)).+(.jsx?)',
'/__mocks__/.+(.jsx?)',
],
watchPathIgnorePatterns: ['/coverage/', '/results/', '/.git/'],
moduleFileExtensions: ['js', 'json', 'jsx'],
snapshotSerializers: ['enzyme-to-json/serializer'],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
},
"dependencies": {
"@babel/runtime": "^7.10.2",
"@carbon/charts": "^0.41.1",
"@carbon/charts-react": "^0.40.13",
"@carbon/charts": "^0.41.6",
"@carbon/charts-react": "^0.41.6",
"@carbon/colors": "10.15.0",
"@carbon/icons-react": "10.17.0",
"@carbon/layout": "10.12.0",
Expand Down
12 changes: 6 additions & 6 deletions src/components/BarChartCard/BarChartCard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('BarChartCard', () => {

it('does not show bar chart when loading', () => {
const wrapper = mount(<BarChartCard {...barChartCardProps} isLoading />);
expect(wrapper.find('SimpleBarChart')).toHaveLength(0);
expect(wrapper.find('#mock-bar-chart-simple')).toHaveLength(0);
});

it('does not show bar chart when empty data', () => {
Expand All @@ -60,7 +60,7 @@ describe('BarChartCard', () => {
values={barChartData.quarters.filter((q) => q.quarter === 'NOT_VALID')}
/>
);
expect(wrapper.find('SimpleBarChart')).toHaveLength(0);
expect(wrapper.find('#mock-bar-chart-simple')).toHaveLength(0);
});

it('shows table when isExpanded', () => {
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('BarChartCard', () => {
values={barChartData.quarters.filter((a) => a.quarter === '2020-Q1')}
/>
);
expect(wrapper.find('GroupedBarChart')).toHaveLength(1);
expect(wrapper.find('#mock-bar-chart-grouped')).toHaveLength(1);
});

it('shows stackedBarChart', () => {
Expand All @@ -130,7 +130,7 @@ describe('BarChartCard', () => {
values={barChartData.quarters.filter((a) => a.quarter === '2020-Q3')}
/>
);
expect(wrapper.find('StackedBarChart')).toHaveLength(1);
expect(wrapper.find('#mock-bar-chart-stacked')).toHaveLength(1);
});

it('shows a timeSeries chart', () => {
Expand All @@ -152,7 +152,7 @@ describe('BarChartCard', () => {
values={barChartData.timestamps.filter((t) => t.city === 'Amsterdam')}
/>
);
expect(wrapper.find('StackedBarChart')).toHaveLength(1);
expect(wrapper.find('#mock-bar-chart-stacked')).toHaveLength(1);
});

it('shows a horizontal chart', () => {
Expand Down Expand Up @@ -180,7 +180,7 @@ describe('BarChartCard', () => {
values={barChartData.quarters.filter((a) => a.quarter === '2020-Q1')}
/>
);
expect(wrapper.find('GroupedBarChart')).toHaveLength(1);
expect(wrapper.find('#mock-bar-chart-grouped')).toHaveLength(1);
});

it('i18n string test', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/BarCh
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-grouped"
/>
</div>
</div>
Expand Down Expand Up @@ -213,7 +213,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/BarCh
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-grouped"
/>
</div>
</div>
Expand Down Expand Up @@ -507,7 +507,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/BarCh
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-simple"
/>
</div>
</div>
Expand Down Expand Up @@ -675,7 +675,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/BarCh
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-simple"
/>
</div>
</div>
Expand Down Expand Up @@ -798,7 +798,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/BarCh
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-simple"
/>
</div>
</div>
Expand Down Expand Up @@ -921,7 +921,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/BarCh
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-stacked"
/>
</div>
</div>
Expand Down Expand Up @@ -1089,7 +1089,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/BarCh
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-stacked"
/>
</div>
</div>
Expand Down Expand Up @@ -1257,7 +1257,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/BarCh
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-stacked"
/>
</div>
</div>
Expand Down Expand Up @@ -1380,7 +1380,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/BarCh
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-stacked"
/>
</div>
</div>
Expand Down Expand Up @@ -1470,7 +1470,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/BarCh
className="iot--bar-chart-container iot--bar-chart-container--editable"
>
<div
className="chart-holder"
id="mock-bar-chart-grouped"
/>
</div>
</div>
Expand Down Expand Up @@ -1641,7 +1641,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/BarCh
className="iot--bar-chart-container iot--bar-chart-container--expanded"
>
<div
className="chart-holder"
id="mock-bar-chart-stacked"
/>
<div
className="iot--bar-chart-card--stateful-table iot--table-container bx--data-table-container"
Expand Down Expand Up @@ -2839,7 +2839,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/BarCh
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-stacked"
/>
</div>
</div>
Expand Down
36 changes: 18 additions & 18 deletions src/components/Dashboard/__snapshots__/Dashboard.story.storyshot
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-simple"
/>
</div>
</div>
Expand Down Expand Up @@ -1336,7 +1336,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down Expand Up @@ -2008,7 +2008,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down Expand Up @@ -2752,7 +2752,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-simple"
/>
</div>
</div>
Expand Down Expand Up @@ -3755,7 +3755,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down Expand Up @@ -4427,7 +4427,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down Expand Up @@ -5199,7 +5199,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-simple"
/>
</div>
</div>
Expand Down Expand Up @@ -6202,7 +6202,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down Expand Up @@ -6874,7 +6874,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down Expand Up @@ -7428,7 +7428,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-grouped"
/>
</div>
</div>
Expand Down Expand Up @@ -7898,7 +7898,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down Expand Up @@ -10223,7 +10223,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-simple"
/>
</div>
</div>
Expand Down Expand Up @@ -11226,7 +11226,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down Expand Up @@ -11898,7 +11898,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down Expand Up @@ -12419,7 +12419,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down Expand Up @@ -25045,7 +25045,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-simple"
/>
</div>
</div>
Expand Down Expand Up @@ -26048,7 +26048,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down Expand Up @@ -26720,7 +26720,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--pie-chart-container"
>
<div
className="chart-holder"
id="mock-pie-chart"
/>
</div>
<span
Expand Down Expand Up @@ -2671,7 +2671,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--time-series-card--wrapper"
>
<div
className="chart-holder"
id="mock-line-chart"
/>
</div>
</div>
Expand Down Expand Up @@ -2965,7 +2965,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Dashb
className="iot--bar-chart-container"
>
<div
className="chart-holder"
id="mock-bar-chart-simple"
/>
</div>
</div>
Expand Down
Loading