Skip to content

Commit

Permalink
feat: add denyButtonText mount, support SweetAlert2 v10 🚀 (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
limonte authored Sep 8, 2020
1 parent 824a1b5 commit 0fcfee7
Show file tree
Hide file tree
Showing 5 changed files with 815 additions and 710 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The following options can be React elements:
- title
- html
- confirmButtonText
- denyButtonText
- cancelButtonText
- footer
- closeButtonHtml
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"peerDependencies": {
"react": "^16.0.0",
"react-dom": "^16.0.0",
"sweetalert2": "^9.7.0"
"sweetalert2": "^9.7.0 || ^10.0.0"
},
"devDependencies": {
"@babel/core": "^7.2.2",
Expand All @@ -63,9 +63,9 @@
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-terser": "^6.0.0",
"sweetalert2": "^9.7.0",
"typescript": "^3.1.3"
"rollup-plugin-terser": "^7.0.0",
"sweetalert2": "^10.0.0",
"typescript": "^4.0.0"
},
"jest": {
"collectCoverage": true,
Expand Down
4 changes: 4 additions & 0 deletions src/mounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export const mounts = [
key: 'confirmButtonText',
getter: swal => swal.getConfirmButton(),
},
{
key: 'denyButtonText',
getter: swal => swal.getDenyButton(),
},
{
key: 'cancelButtonText',
getter: swal => swal.getCancelButton(),
Expand Down
4 changes: 4 additions & 0 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('integration', () => {
title: <span>title</span>,
html: <span>html</span>,
confirmButtonText: <span>confirmButtonText</span>,
denyButtonText: <span>denyButtonText</span>,
cancelButtonText: <span>cancelButtonText</span>,
closeButtonHtml: <span>closeButtonHtml</span>,
footer: <span>footer</span>,
Expand All @@ -31,6 +32,9 @@ describe('integration', () => {
expect(MySwal.getConfirmButton().innerHTML).toEqual(
'<span>confirmButtonText</span>',
)
expect(MySwal.getDenyButton().innerHTML).toEqual(
'<span>denyButtonText</span>',
)
expect(MySwal.getCancelButton().innerHTML).toEqual(
'<span>cancelButtonText</span>',
)
Expand Down
Loading

0 comments on commit 0fcfee7

Please sign in to comment.