Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commitc12614c

Browse files
committed
chore: Merge branch 'dev'
2 parents88fc51d +688cee2 commitc12614c

File tree

10 files changed

+60
-26
lines changed

10 files changed

+60
-26
lines changed

‎components/Navigator/BriefView.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import MainEntries from './MainEntries'
2121

2222
constCommunityLogoHolder=`${ICON_CMD}/community_logo_holder.svg`
2323

24-
constBriefView=({ community})=>(
24+
constBriefView=({ community, curRoute})=>(
2525
<Wrapper>
2626
<Popover
2727
placement="bottomLeft"
@@ -44,7 +44,7 @@ const BriefView = ({ community }) => (
4444
</Popover>
4545
<Breadcrumbs>
4646
<BetaLogosrc={`${ICON_CMD}/beta.svg`}/>
47-
<MainEntries/>
47+
<MainEntriescurRoute={curRoute}/>
4848
</Breadcrumbs>
4949
</Wrapper>
5050
)

‎components/Navigator/DigestView.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414

1515
importMainEntriesfrom'./MainEntries'
1616

17-
constDigestView=()=>(
17+
constDigestView=({ curRoute})=>(
1818
<Breadcrumbs>
1919
<Logo/>
2020
<Popover
@@ -31,7 +31,7 @@ const DigestView = () => (
3131
<LogoTexthref="/home/posts">coderplanets</LogoText>
3232
</Popover>
3333
<BetaLogosrc={`${ICON_CMD}/beta.svg`}/>
34-
<MainEntries/>
34+
<MainEntriescurRoute={curRoute}/>
3535
</Breadcrumbs>
3636
)
3737

‎components/Navigator/MainEntries.js‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@ import DiscussLinker from '@components/DiscussLinker'
88
import{Wrapper,DotDivider,SiteLink}from'./styles/main_entries'
99

1010
constsplitMargin='8px'
11-
constMainEntries=()=>(
11+
12+
constMainEntries=({curRoute:{ mainPath}})=>(
1213
<Wrapper>
1314
<Linkhref="/home/posts"prefetchpassHref>
14-
<SiteLink>首页</SiteLink>
15+
<SiteLinktestid="header-home-link">首页</SiteLink>
1516
</Link>
1617
<DotDividerspace={splitMargin}/>
1718
<Linkhref="/communities"prefetchpassHref>
18-
<SiteLink>社区</SiteLink>
19+
<SiteLink
20+
active={mainPath==='communities'}
21+
testid="header-communities-link"
22+
>
23+
社区
24+
</SiteLink>
1925
</Link>
2026
<DotDividerspace={splitMargin}/>
2127
<Popover

‎components/Navigator/index.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ const Navigator = ({ curCommunity, layout, curRoute }) => {
2424
R.contains(mainPath,[ROUTE.USER,ROUTE.COMMUNITIES])||
2525
R.contains(subPath,[ROUTE.POST,ROUTE.JOB,ROUTE.VIDEO,ROUTE.REPO])
2626
){
27-
return<DigestView/>
27+
return<DigestViewcurRoute={curRoute}/>
2828
}
2929

3030
return(
3131
<React.Fragment>
3232
{layout===C11N.DIGEST ?(
33-
<DigestView/>
33+
<DigestViewcurRoute={curRoute}/>
3434
) :(
35-
<BriefViewcommunity={curCommunity}/>
35+
<BriefViewcommunity={curCommunity}curRoute={curRoute}/>
3636
)}
3737
</React.Fragment>
3838
)

‎components/Navigator/styles/main_entries.js‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,17 @@ export const Wrapper = styled.div`
1313
exportconstDotDivider=styled(DotDividerBase)`
1414
background-color:${theme('banner.desc')};
1515
`
16-
exportconstSiteLink=styled.a`
16+
exportconstSiteLink=styled.a.attrs(props=>({
17+
'data-testid':props.testid,
18+
}))`
1719
color:${theme('banner.desc')};
20+
background:${({ active})=>
21+
active ?theme('banner.numberHoverBg') :'transparent'};
22+
padding:${({ active})=>(active ?'5px 3px 3px 3px' :'0')};
23+
border-bottom:${({ active})=>(active ?'2px solid' :'none')};
24+
border-bottom-color:${({ active})=>
25+
active ?theme('tabs.headerActive') :''};
26+
1827
cursor: pointer;
1928
&:hover {
2029
text-decoration: underline;

‎containers/Header/styles/header.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export const InnerWrapper = styled.div`
2929
exportconstRouterWrapper=styled.div`
3030
${cs.flexGrow('align-center')};
3131
height: 100%;
32-
margin-top: 1px;
3332
`
3433
exportconstHeaderSearchIcon=styled(HeaderSearchSVG).attrs(props=>({
3534
'data-testid':props.testid,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
describe('communities page layout',()=>{
3+
// beforeEach(() => {
4+
before(()=>{
5+
cy.visit('/communities')
6+
})
7+
8+
it('basic layout',()=>{
9+
cy.id('header').should('be.visible')
10+
11+
cy.id('header-search').should('be.visible')
12+
cy.id('header-search-icon').should('be.visible')
13+
14+
cy.id('sidebar').should('be.visible')
15+
16+
cy.id('communities-banner').should('be.visible')
17+
cy.id('footer').should('be.visible')
18+
})
19+
20+
it('communities link should be highlight',()=>{
21+
cy.id('header-communities-link')
22+
.should('not.have.css','background','transparent')
23+
.and('have.css','padding','5px 3px 3px')
24+
})
25+
})
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
describe('basic layout',()=>{
1+
describe('home page layout',()=>{
22
// beforeEach(() => {
33
before(()=>{
44
cy.visit('/home/posts')
55
})
66

77
it('basic layout shoud be visible',()=>{
88
cy.id('header').should('be.visible')
9+
cy.id('header-search').should('be.visible')
10+
cy.id('header-search-icon').should('be.visible')
11+
912
cy.id('sidebar').should('be.visible')
1013

1114
cy.id('community-banner').should('be.visible')
@@ -14,18 +17,10 @@ describe('basic layout', () => {
1417
cy.id('footer').should('be.visible')
1518
})
1619

17-
it('header content',()=>{
18-
cy.id('header-search').should('be.visible')
19-
cy.id('header-search-icon').should('be.visible')
20-
})
21-
22-
it('communities page',()=>{
23-
cy.visit('/communities')
24-
cy.id('header-search').should('be.visible')
25-
cy.id('header-search-icon').should('be.visible')
26-
27-
cy.id('communities-banner').should('be.visible')
28-
29-
cy.id('footer').should('be.visible')
20+
it('home link should not be highlight',()=>{
21+
cy.id('header-home-link')
22+
// .should('have.css', 'background')
23+
// .should('not.have.css', 'border-bottom')
24+
.and('not.have.css','padding','5px 3px 3px 3px')
3025
})
3126
})
120 KB
Loading
133 KB
Loading

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp