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

refactor: default export is renamed to Chart #836

Merged
merged 1 commit into from
Nov 3, 2021
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
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