-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
71 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ package-lock.json | |
cypress/videos | ||
cypress/screenshots | ||
.env | ||
.vscode/ |
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,34 @@ | ||
import React, { Component } from 'react' | ||
import { RingLoader } from 'react-spinners' | ||
import { Container } from 'semantic-ui-react' | ||
import axios from 'axios' | ||
import ReactHtmlParser from 'react-html-parser' | ||
|
||
export default class PremiumMembershipPage extends Component { | ||
state = { premiumMembershipPage: null } | ||
componentDidMount () { | ||
axios.get('api/v1/static-pages/premium') | ||
.then(response => { | ||
this.setState({ premiumMembershipPage: response.data }) | ||
}) | ||
} | ||
|
||
render () { | ||
let { premiumMembershipPage } = this.state | ||
if (premiumMembershipPage) { | ||
return ( | ||
<Container> | ||
<div> | ||
{ ReactHtmlParser(premiumMembershipPage) } | ||
</div> | ||
</Container> | ||
) | ||
} else { | ||
return ( | ||
<Container> | ||
<RingLoader sizeUnit={'px'} size={200} color={'#34495E'} /> | ||
</Container> | ||
) | ||
} | ||
} | ||
} |
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,34 @@ | ||
import React from 'react' | ||
import { mount } from 'enzyme' | ||
import PremiumMembershipPage from '../../containers/PremiumMembershipPage' | ||
import moxios from 'moxios' | ||
|
||
describe('PremiumMembershipPage', () => { | ||
let wrapper | ||
beforeEach(() => { | ||
moxios.install() | ||
wrapper = mount(<PremiumMembershipPage />) | ||
}) | ||
|
||
afterEach(() => { | ||
moxios.uninstall() | ||
}) | ||
|
||
it('fetches the premium static page after component mounts', done => { | ||
expect.assertions(1) | ||
moxios.wait(() => { | ||
let request = moxios.requests.mostRecent() | ||
request.respondWith({ | ||
status: 200, | ||
response: '<h1 id="premium-membership">Premium Membership</h1>' | ||
}).then(() => { | ||
expect(wrapper.html()).toContain('<h1 id="premium-membership">Premium Membership</h1>') | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
it('displays a spinner while fetching the static membership plans page', () => { | ||
expect(wrapper.find('Loader').props().loading).toBe(true) | ||
}) | ||
}) |