Skip to content

Commit

Permalink
refactor: default export is renamed to Chart (#836)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: default export is renamed to Chart
  • Loading branch information
dangreen authored Nov 3, 2021
1 parent 30d5c2d commit 131daa0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @todo Make named export instead of default
export { Chart as default } from './chart';
export type { ChartProps } from './types';
export * from './chart';
export * from './typedCharts';
2 changes: 1 addition & 1 deletion stories/Chart.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect, useReducer } from 'react';
import { InteractionItem } from 'chart.js';
import 'chartjs-adapter-date-fns';
import Chart from '../src';
import { Chart } from '../src';
import * as multitypeChart from '../sandboxes/chart/multitype/App';
import * as eventsChart from '../sandboxes/chart/events/App';
import * as data from './Chart.data';
Expand Down
17 changes: 15 additions & 2 deletions test/chart.test-d.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import { expectError } from 'tsd';
import React from 'react';
import { Plugin } from 'chart.js';
import Chart, { Scatter, Doughnut } from '../src';
import { data as multiTypeData } from '../sandboxes/chart/multitype/App';
import { Chart, Scatter, Doughnut } from '../src';

const data = {
datasets: [],
};
const multiTypeData = {
datasets: [
{
type: 'line' as const,
label: 'Dataset 1',
data: [],
},
{
type: 'bar' as const,
label: 'Dataset 2',
data: [],
},
],
};

/**
* Should check type-specific props
Expand Down
2 changes: 1 addition & 1 deletion test/chart.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { render, cleanup, fireEvent } from '@testing-library/react';
import ChartJS from 'chart.js/auto';
import Chart from '../src';
import { Chart } from '../src';

describe('<Chart />', () => {
const data = {
Expand Down

0 comments on commit 131daa0

Please sign in to comment.