File tree Expand file tree Collapse file tree 2 files changed +30
-5
lines changed
Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -434,8 +434,6 @@ export class LoginForm extends Component {
434434 return this . renderChangeUsername ( ) ;
435435 }
436436
437- const showLabel = ! this . props . isJetpack || this . props . isWoo ;
438-
439437 return (
440438 // Since the input receives focus on page load, screen reader users don't have any context
441439 // for what credentials to use. Unlike other users, they won't have seen the informative
@@ -444,9 +442,7 @@ export class LoginForm extends Component {
444442 < span className = "screen-reader-text" >
445443 { this . props . translate ( 'WordPress.com email address or username' ) }
446444 </ span >
447- { showLabel && (
448- < span aria-hidden = "true" > { this . props . translate ( 'Email address or username' ) } </ span >
449- ) }
445+ < span aria-hidden = "true" > { this . props . translate ( 'Email address or username' ) } </ span >
450446 </ >
451447 ) ;
452448 }
Original file line number Diff line number Diff line change @@ -141,4 +141,33 @@ describe( 'LoginForm', () => {
141141 const btn = screen . getByRole ( 'button' , { name : / L o g I n / i } ) ;
142142 expect ( btn ) . toBeInTheDocument ( ) ;
143143 } ) ;
144+
145+ test ( 'shows the visual email-or-username label for Jetpack logins' , async ( ) => {
146+ render ( < LoginForm isJetpack /> , {
147+ initialState : {
148+ login : { socialAccountLink : { isLinking : false } } ,
149+ route : { query : { current : { } , initial : { } } } ,
150+ } ,
151+ } ) ;
152+
153+ const label = screen . getByText ( 'Email address or username' , {
154+ selector : 'span[aria-hidden="true"]' ,
155+ } ) ;
156+ expect ( label ) . toBeInTheDocument ( ) ;
157+ } ) ;
158+
159+ test ( 'shows the username-only label when query flag is set' , async ( ) => {
160+ render ( < LoginForm /> , {
161+ initialState : {
162+ route : {
163+ query : {
164+ current : { username_only : 'true' } ,
165+ initial : { } ,
166+ } ,
167+ } ,
168+ } ,
169+ } ) ;
170+
171+ expect ( screen . getByText ( 'Your username' ) ) . toBeInTheDocument ( ) ;
172+ } ) ;
144173} ) ;
You can’t perform that action at this time.
0 commit comments