-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/6-vue
- Loading branch information
Showing
34 changed files
with
16,720 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# React | ||
|
||
This is an example how to use `xlsx-import` in React. | ||
It is made with [CRA](https://github.com/facebook/create-react-app) | ||
|
||
**LIB Version:** `2.3.3` | ||
|
||
## Scripts | ||
|
||
`npm start` - start dev server | ||
|
||
`npm run build` - build static artifacts | ||
|
||
`npm run test` - run all tests | ||
|
||
`npm run test:cra` - run jest only tests | ||
|
||
`npm run test:cy` - run cypress only tests | ||
|
||
`npm run cy:open` - open cypress dashboard (server must be started before this command) | ||
|
||
`npm run eject` - eject CRA | ||
|
||
## Usage | ||
|
||
```bash | ||
# install dependencies | ||
npm install | ||
|
||
# start dev server | ||
npm start | ||
``` | ||
|
||
Browser will be opened automatically. Then click on "Download and parse invoice" button. | ||
You will see invoice file imported with xlsx-import library. | ||
|
||
## What happened | ||
|
||
1. [Invoice.xlsx](public/invoice.xlsx) fetched as Blob file | ||
2. Blob file transformed into ArrayBuffer and passed to [exceljs](https://www.npmjs.com/package/exceljs) in order to obtain Workbook class | ||
3. Workbook class then passed to Importer class of xlsx-import for mapping. | ||
This is [workaround](https://github.com/Siemienik/xlsx-import/issues/4) | ||
and will be fixed in [#52](https://github.com/Siemienik/xlsx-import/issues/52) | ||
4. After mapping invoice data rendered with [Invoice](src/components/Invoice/Invoice.jsx) component | ||
|
||
## What is worth to see here | ||
|
||
1. Study config: [`invoiceConfig.js`](src/components/Invoice/invoiceConfig.js) | ||
2. Usage package in [`App.js (importInvoice function)`](src/App.js) | ||
|
||
## What later | ||
|
||
1. Study documentation: [docs](./../../README.md) | ||
2. Start using `xlsx-import` in your project | ||
3. Ask a lot, report bugs and request for help: <https://github.com/Siemienik/xlsx-import/issues> | ||
4. [Sponsor `xlsx-import` project](https://github.com/sponsors/Siemienik) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"baseUrl": "http://localhost:3000", | ||
"screenshotOnRunFailure": false, | ||
"video": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
const invoice = { | ||
buyer: { | ||
name: 'Bigos INC.', | ||
taxIdNumber: '987654321', | ||
address: 'ul. Agiede 2020, MiastoNaK', | ||
}, | ||
date: '2020-10-08T00:00:00.000Z', | ||
dueDate: '2020-10-29T00:00:00.000Z', | ||
items: [ | ||
{ | ||
item: 'Mleczko do prania', | ||
unitPrice: 16.45, | ||
quantity: 2, | ||
price: 32.9, | ||
}, | ||
{ | ||
item: 'Płyn do płukania', | ||
unitPrice: 14.55, | ||
quantity: 1, | ||
price: 14.55, | ||
}, | ||
{ | ||
item: 'Pokarm dla smoka', | ||
unitPrice: 79.99, | ||
quantity: 10, | ||
price: 799.9, | ||
}, | ||
{ | ||
item: 'Instrukcja jak latać na smoku', | ||
unitPrice: 19.89, | ||
quantity: 1, | ||
price: 19.89, | ||
}, | ||
], | ||
seller: { | ||
name: 'Krupnik LTD.', | ||
taxIdNumber: '123456789', | ||
address: 'ul. Usbewifi 5/G, MiastoNaK', | ||
accountNo: 'PL 12 1234 1234 1234 1234 1234 1234', | ||
}, | ||
total: 867.24, | ||
}; | ||
|
||
describe('The App', () => { | ||
it('successfully loads', () => { | ||
cy.visit('/'); | ||
}); | ||
|
||
it('renders parsed invoice file', () => { | ||
cy.visit('/'); | ||
cy.get('button').click().should('be.disabled'); | ||
cy.get('[data-qa-name="buyer-name"]').contains(invoice.buyer.name); | ||
cy.get('[data-qa-name="buyer-tax-id"]').contains(invoice.buyer.taxIdNumber); | ||
cy.get('[data-qa-name="buyer-address"]').contains(invoice.buyer.address); | ||
invoice.items.forEach((inv, idx) => { | ||
const parent = cy.get(`[data-qa-name="invoice-${idx}"]`); | ||
parent.get('[data-qa-name="invoice-item"]').contains(inv.item); | ||
parent.get('[data-qa-name="invoice-price"]').contains(inv.price); | ||
parent.get('[data-qa-name="invoice-quantity"]').contains(inv.quantity); | ||
parent.get('[data-qa-name="invoice-unit-price"]').contains(inv.unitPrice); | ||
}); | ||
cy.get('[data-qa-name="seller-name"]').contains(invoice.seller.name); | ||
cy.get('[data-qa-name="seller-tax-id"]').contains(invoice.seller.taxIdNumber); | ||
cy.get('[data-qa-name="seller-address"]').contains(invoice.seller.address); | ||
cy.get('[data-qa-name="seller-account"]').contains(invoice.seller.accountNo); | ||
cy.get('[data-qa-name="date"]').contains(invoice.date); | ||
cy.get('[data-qa-name="due-date"]').contains(invoice.dueDate); | ||
cy.get('[data-qa-name="total"]').contains(invoice.total); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************************** | ||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
/** | ||
* @type {Cypress.PluginConfig} | ||
*/ | ||
module.exports = (on, config) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add("login", (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// *********************************************************** | ||
// This example support/index.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
Oops, something went wrong.