Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing: Remove data-test attribute from UrlInputButton output #7981

Merged
merged 1 commit into from
Jul 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion editor/components/url-input/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class UrlInputButton extends Component {
label={ __( 'Close' ) }
onClick={ this.toggle }
/>
<UrlInput value={ url || '' } onChange={ onChange } data-test="UrlInput" />
<UrlInput value={ url || '' } onChange={ onChange } />
<IconButton
icon="editor-break"
label={ __( 'Submit' ) }
Expand Down
7 changes: 4 additions & 3 deletions editor/components/url-input/test/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ReactDOM from 'react-dom';
/**
* Internal dependencies
*/
import UrlInput from '../';
import UrlInputButton from '../button';

describe( 'UrlInputButton', () => {
Expand Down Expand Up @@ -40,15 +41,15 @@ describe( 'UrlInputButton', () => {
const onChangeMock = jest.fn();
const wrapper = shallow( <UrlInputButton onChange={ onChangeMock } /> );
clickEditLink( wrapper );
wrapper.find( '[data-test=\'UrlInput\']' ).simulate( 'change' );
wrapper.find( UrlInput ).simulate( 'change' );
expect( onChangeMock ).toHaveBeenCalledTimes( 1 );
} );
it( 'should call onChange function twice when value changes twice', () => {
const onChangeMock = jest.fn();
const wrapper = shallow( <UrlInputButton onChange={ onChangeMock } /> );
clickEditLink( wrapper );
wrapper.find( '[data-test=\'UrlInput\']' ).simulate( 'change' );
wrapper.find( '[data-test=\'UrlInput\']' ).simulate( 'change' );
wrapper.find( UrlInput ).simulate( 'change' );
wrapper.find( UrlInput ).simulate( 'change' );
expect( onChangeMock ).toHaveBeenCalledTimes( 2 );
} );
it( 'should close the form when user clicks Close button', () => {
Expand Down