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

fixed error #136

Closed
wants to merge 1 commit into from
Closed
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
15 changes: 3 additions & 12 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
'use strict'

const path = require('path')
// const path = require('path')

const presets = [
'@babel/preset-env',
'@babel/preset-react',
{

}
]
const presets = ['@babel/preset-env', '@babel/preset-react', {}]

const plugins = [
[
require.resolve('@babel/plugin-proposal-class-properties')
],
[require.resolve('@babel/plugin-proposal-class-properties')],
[
require.resolve('babel-plugin-module-resolver'),
{
Expand All @@ -24,7 +16,6 @@ const plugins = [
}
// require.resolve('@babel/plugin-module-resolver')
]

]

module.exports = { presets, plugins }
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"access": "public"
},
"dependencies": {
"@groceristar/pdf-export": "^1.0.41",
Copy link
Member

Choose a reason for hiding this comment

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

you installing this package into this package

"@react-pdf/renderer": "^1.4.1",
"antd": "^3.15.0",
"uuid": "^3.3.2"
Expand Down
43 changes: 20 additions & 23 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import resolve from 'rollup-plugin-node-resolve'
import babel from 'rollup-plugin-babel'
import pkg from './package.json'

const extensions = [
'.js'
]
const extensions = ['.js']

const name = 'PDFExportComponents'
// const name = 'PDFExportComponents'

export default {
input: './src/index.js',
Expand All @@ -29,10 +27,7 @@ export default {
extensions,
include: ['src/*'],
// include: ['src/**/*'],
exclude: [
'node_modules/**',
'/src/data/__tests__'
]
exclude: ['node_modules/**', '/src/data/__tests__']
// exclude: 'node_modules/**'
// presets: presets,
// plugins: plugins
Expand All @@ -46,20 +41,22 @@ export default {
// }),
],

output: [{
file: pkg.main,
format: 'cjs'
}, {
file: pkg.module,
format: 'es'
}
// {
// file: pkg.browser,
// format: 'iife',
// name,
//
// // https://rollupjs.org/guide/en#output-globals-g-globals
// globals: {}
// }
output: [
{
file: pkg.main,
format: 'cjs'
},
{
file: pkg.module,
format: 'es'
}
// {
// file: pkg.browser,
// format: 'iife',
// name,
//
// // https://rollupjs.org/guide/en#output-globals-g-globals
// globals: {}
// }
]
}
13 changes: 2 additions & 11 deletions src/components/DocumentLayouts/DocumentLayouts.test.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
import React from 'react'
import ReactDOM from 'react-dom'
import Enzyme, { shallow, configure } from 'enzyme'

import { configure } from 'enzyme'
import EnzymeAdapter from 'enzyme-adapter-react-16'

import TodaysDate from '~/TodaysDate'

import DocumentLayouts from './DocumentLayouts'

// Setup enzyme's react adapter
configure({ adapter: new EnzymeAdapter() })

describe('<TodaysDate /> component shallow only methods ', () => {
it('renders without crashing', () => {
const wrapper = shallow(<TodaysDate />)

// const wrapper = shallow(<TodaysDate />)
// expect(wrapper).toBe({});
// this 2 lines below don't make a lot of sense

// expect(wrapper).toBe(true)
// ReactDOM.render(<List />, div);
})
Expand Down
12 changes: 4 additions & 8 deletions src/components/DownloadPDFLink/DownloadPDFLink.test.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import React from 'react'
import ReactDOM from 'react-dom'
import Enzyme, { shallow, configure } from 'enzyme'
import { configure } from 'enzyme'

import EnzymeAdapter from 'enzyme-adapter-react-16'

import TodaysDate from '~/TodaysDate'
// import TodaysDate from '~/TodaysDate'

import DownloadPDFLink from './DownloadPDFLink'
// import DownloadPDFLink from './DownloadPDFLink'

// Setup enzyme's react adapter
configure({ adapter: new EnzymeAdapter() })

describe('<TodaysDate /> component shallow only methods ', () => {
it('renders without crashing', () => {
const wrapper = shallow(<TodaysDate />)

// const wrapper = shallow(<TodaysDate />)
// expect(wrapper).toBe({});
// this 2 lines below don't make a lot of sense

// expect(wrapper).toBe(true)
// ReactDOM.render(<List />, div);
})
Expand Down
20 changes: 5 additions & 15 deletions src/components/RenderList.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import React from 'react'
import ReactDOM from 'react-dom'
import Enzyme, { configure, shallow, mount } from 'enzyme'
import { configure } from 'enzyme'
import EnzymeAdapter from 'enzyme-adapter-react-16'

import RenderList1 from '~/RenderLists1/RenderLists1'
import RenderList2 from '~/RenderLists2/RenderLists2'
import RenderList3 from '~/RenderLists3/RenderLists3'
import RenderList4 from '~/RenderLists4/RenderLists4'
// import RenderList1 from '~/RenderLists1/RenderLists1'
// import RenderList2 from '~/RenderLists2/RenderLists2'
// import RenderList3 from '~/RenderLists3/RenderLists3'
// import RenderList4 from '~/RenderLists4/RenderLists4'

// @TODO it was an old version. as we want to make this components lighter - we need to find another way to do tests as we want them
// import { getFullGrocery, getRecipes } from '/selector'
Expand All @@ -19,14 +17,10 @@ configure({ adapter: new EnzymeAdapter() })
describe('Test RenderList attribute', () => {
// const data = getFullGrocery('19 Gluten-Free Foods Shopping List')
// const recipeData = getRecipes()[0]

// @TODO replace a similar tests with a function

// const wrapper = mount(<RenderList1 data={data} />);

// console.log(wrapper.prop('data'))
// expect(wrapper.prop('data')).isEmpty(false)

// it('Renderlist1 has data attribute', () => {
//
// // (typeof A === "object") && (A !== null)
Expand All @@ -37,25 +31,21 @@ describe('Test RenderList attribute', () => {
// expect(wrapper.prop('data').isEmpty()).to.equal(false)
// // expect(wrapper.props().data).toEqual(expect.any(Object))
// })

// it('Renderlist2 has data attribute', () => {
// const renderList = shallow(<RenderList2 data={data} />);
// const data = renderList.node.props.data;
// // expect(data).toBe('data')
// })

// it('Renderlist3 has data attribute', () => {
// const renderList = shallow(<RenderList3 data={data} />);
// const data = renderList.node.props.data;
// // expect(data).toBe('data')
// })

// it('Renderlist4 has data attribute', () => {
// const renderList = shallow(<RenderList4 data={recipeData} />);
// const data = renderList.node.props.data;
// // expect(data).toBe('data')
// })

// it('Render List1 should have Lists1 inside of it', () => {
// const wrapper = shallow(<RenderList1 data={data} />);
// expect(wrapper.find('List1')).toBe(true);
Expand Down
2 changes: 1 addition & 1 deletion src/components/RenderLists3/List.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'

import { Text, View, StyleSheet } from '@react-pdf/renderer'
import { Text, View } from '@react-pdf/renderer'

// this component important to generation PDF
import { listStyles as styles } from './styles'
Expand Down
30 changes: 8 additions & 22 deletions src/components/RenderLists4/RenderLists4.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
import React from 'react'

import { Text, View, StyleSheet } from '@react-pdf/renderer'
import { Text, View } from '@react-pdf/renderer'
// import List, { Item } from './List';

const RenderLists4 = ({ data }) => {
return (
<View>
<Text>
{data.title}
</Text>
<Text>
{data.directions}
</Text>
<Text>
{data.ingredients}
</Text>
<Text>
{data.prep_time}
</Text>
<Text>
{data.total_time}
</Text>
<Text>
{data.recipe_yield}
</Text>
<Text>
{data.url}
</Text>
<Text>{data.title}</Text>
<Text>{data.directions}</Text>
<Text>{data.ingredients}</Text>
<Text>{data.prep_time}</Text>
<Text>{data.total_time}</Text>
<Text>{data.recipe_yield}</Text>
<Text>{data.url}</Text>
</View>
)
}
Expand Down
Loading