Skip to content

Commit

Permalink
feat: update existing- ubscription modal
Browse files Browse the repository at this point in the history
  • Loading branch information
ant066 committed Sep 7, 2020
1 parent 21aeea9 commit 222f674
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import * as React from 'react'
import { shallow } from 'enzyme'
import { ErrorContent } from '../error-content'
import { ErrorContent, handleDownload } from '../error-content'

describe('ErrorContent', () => {
it('should match snapshot', () => {
const wrapper = shallow(<ErrorContent afterClose={jest.fn()} />)
expect(wrapper).toMatchSnapshot()
})
})

describe('handleDownload', () => {
it('should open download link', () => {
const downloadURL = 'downloadURL'
window.reapit.config.developerEditionDownloadUrl = downloadURL
window.open = jest.fn()

handleDownload()
expect(window.open).toBeCalledWith(downloadURL, '_self')
})
})
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import * as React from 'react'
import { Button, SubTitleH6, ModalHeader, ModalBody, ModalFooter, ModalProps } from '@reapit/elements'
import linkStyles from '@/styles/elements/link.scss?mod'
import routes from '@/constants/routes'
import developerEditionGuide from '@/assets/files/developer-edition-guide.pdf'

export const handleDownload = () => {
window.open(window.reapit.config.developerEditionDownloadUrl, '_self')
}

export type ErrorContentProps = Pick<ModalProps, 'afterClose'>

Expand All @@ -12,21 +16,25 @@ export const ErrorContent: React.FC<ErrorContentProps> = ({ afterClose }) => {
<ModalBody
body={
<SubTitleH6 className="has-text-weight-normal">
It looks as though you already have a subscription in place for the Developer Edition of Agency Cloud. If
you have not received your email with instructions on how to download, please let us know using the live
chat feature on the&nbsp;
<a className={linkStyles.link} target="_blank" rel="noopener noreferrer" href={routes.HELP}>
&apos;Help&apos;
It looks as though you already have a subscription in place for the Developer Edition of Agency Cloud. To
download, please use the ‘Download Now’ button below. For more information or support using the Developer
Edition, please&nbsp;
<a className={linkStyles.link} target="_blank" rel="noopener noreferrer" href={developerEditionGuide}>
click here
</a>
&nbsp;page.
</SubTitleH6>
}
/>
<ModalFooter
footerItems={
<Button variant="primary" type="button" onClick={afterClose}>
CLOSE
</Button>
<>
<Button variant="primary" type="button" onClick={afterClose}>
CLOSE
</Button>
<Button variant="primary" type="button" onClick={handleDownload}>
DOWNLOAD NOW
</Button>
</>
}
/>
</>
Expand Down

0 comments on commit 222f674

Please sign in to comment.