Skip to content

Commit

Permalink
Merge pull request #45 from Jiang-Xuan/contact-page
Browse files Browse the repository at this point in the history
contact page
  • Loading branch information
Jiang-Xuan authored Nov 4, 2019
2 parents 62bf45e + 76fa443 commit 44e246a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions frondend/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import zhCN from 'antd/es/locale/zh_CN'
import Home from './Home'
import ApiDoc from './ApiDoc'
import Nav from './Nav'
import Contact from './Contact'

import './app.less'

Expand All @@ -30,6 +31,7 @@ function App () {
<Switch>
<Route exact path='/'><Home /></Route>
<Route path='/api-doc'><ApiDoc /></Route>
<Route path='/contact'><Contact /></Route>
</Switch>
</Layout.Content>
<Layout.Footer className='text-center' data-e2e-test-id='SITE_COPYRIGHT'>请勿上传违反中国大陆法律的图片,违者后果自负。Copyright Ⓒ 2019 tuchuang.space. All rights reserved.</Layout.Footer>
Expand Down
14 changes: 14 additions & 0 deletions frondend/Contact.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react'
// import PropTypes from 'prop-types'

function Contact (props) {
// const { } = props;
return (
<div>如果有疑问, 请发邮件至 645762213#qq.com(将#替换成@)</div>
)
}

Contact.propTypes = {
}

export default Contact
2 changes: 1 addition & 1 deletion frondend/Nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Nav (props) {
<Menu mode='horizontal' theme='dark' defaultSelectedKeys={['home']} selectedKeys={[pathname]} style={{ lineHeight: '64px' }}>
<Menu.Item key='/'><Link to='/'>Home</Link></Menu.Item>
<Menu.Item key='/about'><Link to='/about'>About</Link></Menu.Item>
<Menu.Item key='/contact'><Link to='/contact'>Contact</Link></Menu.Item>
<Menu.Item key='/contact' data-e2e-test-id='GOTO_CONTACT_BTN'><Link to='/contact'>Contact</Link></Menu.Item>
<Menu.Item data-e2e-test-id='GOTO_API_DOC_BTN' key='/api-doc'><Link to='/api-doc'>Api</Link></Menu.Item>
</Menu>
</>
Expand Down
12 changes: 11 additions & 1 deletion frondend/e2e/pptr.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const TEST_ID_STORE = {
/** @description 上传图片的结果区域的 delete 输入框 @type {'UPLOAD_RESULT_DELETE'} */
UPLOAD_RESULT_DELETE: 'UPLOAD_RESULT_DELETE',
/** @description 前往 api 文档的按钮 @type {'GOTO_API_DOC_BTN'} */
GOTO_API_DOC_BTN: 'GOTO_API_DOC_BTN'
GOTO_API_DOC_BTN: 'GOTO_API_DOC_BTN',
/** @description 前往 contact 页面的按钮 @type {'GOTO_CONTACT_BTN'} */
GOTO_CONTACT_BTN: 'GOTO_CONTACT_BTN'
}

jest.setTimeout(30000)
Expand Down Expand Up @@ -250,4 +252,12 @@ describe('导航条导航', () => {

expect(pathnameJsonValue).toEqual('/api-doc')
})
it('前往 contact 的链接正常', async () => {
const gotoContactBtn = await page.$(`[${E2E_TEST_ID_ATTR_NAME}="${TEST_ID_STORE.GOTO_CONTACT_BTN}"]`)
await gotoContactBtn.click()
const pathname = await page.waitForFunction('location.pathname')
const pathnameJsonValue = await pathname.jsonValue()

expect(pathnameJsonValue).toEqual('/contact')
})
})

0 comments on commit 44e246a

Please sign in to comment.