Skip to content

Commit

Permalink
Replaced <a href=> with <button> elements (#299)
Browse files Browse the repository at this point in the history
* Replaced <a href=> with <button> elements, otherwise it produces warnings during build process

* Fixed test
  • Loading branch information
Igor Komlew authored Aug 14, 2020
1 parent 33be58d commit b4b0f6e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion webapp-admin/src/__tests__/dialogbox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('dialog box', function() {
// Check all the expected elements are rendered
var divs = ReactTestUtils.scryRenderedDOMComponentsWithTag(page, 'div');
expect(divs.length).toBe(2);
var anchors = ReactTestUtils.scryRenderedDOMComponentsWithTag(page, 'a');
var anchors = ReactTestUtils.scryRenderedDOMComponentsWithTag(page, 'button');
expect(anchors.length).toBe(2);

expect(handleYesClick.mock.calls.length).toBe(0);
Expand Down
8 changes: 4 additions & 4 deletions webapp-admin/src/components/DialogBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class DialogBox extends Component {
<div className="p-card warning">
<p>{this.props.message}</p>
<div>
<a href="" onClick={this.props.handleCancelClick} className={classNo}>
<button onClick={this.props.handleCancelClick} className={classNo}>
{T('no')}
</a>
<a href="" onClick={this.props.handleYesClick} className={classYes}>
</button>
<button onClick={this.props.handleYesClick} className={classYes}>
{T('yes')}
</a>
</button>
</div>
</div>
);
Expand Down
14 changes: 8 additions & 6 deletions webapp-admin/src/components/ModelRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ class ModelRow extends Component {
<div>
<a href={'/models/'.concat(this.props.model.id, '/edit')} className="p-button--brand small" title={T('edit-model')}><i className="fa fa-pencil"></i></a>
&nbsp;
<a href="" onClick={this.props.delete} data-key={this.props.model.id} className="p-button--neutral small" title={T('delete-model')}>
<i className="fa fa-trash" data-key={this.props.model.id}></i></a>
<button onClick={this.props.delete} data-key={this.props.model.id} className="p-button--neutral small" title={T('delete-model')}>
<i className="fa fa-trash" data-key={this.props.model.id}></i>
</button>
</div>
);
} else {
Expand All @@ -63,18 +64,19 @@ class ModelRow extends Component {
{this.renderActions()}
</td>
<td className="overflow" title={this.props.model.model}>
<a href="" onClick={this.copyToClipboard} data-key={this.props.model['api-key']} className="p-button--neutral small" title={T('copy-api-key')}>
<i className="fa fa-clipboard" data-key={this.props.model['api-key']} /></a>
<button onClick={this.copyToClipboard} data-key={this.props.model['api-key']} className="p-button--neutral small" title={T('copy-api-key')}>
<i className="fa fa-clipboard" data-key={this.props.model['api-key']} />
</button>
&nbsp;
{this.props.model.model}
</td>
<td className="overflow" title={fingerprint} >{fingerprint}</td>
<td className="overflow" title={fingerprintUser} >{fingerprintUser}</td>
<td>{this.props.model['key-active'] && this.props.model['key-active-user'] ? <i className="fa fa-check"></i> : <i className="fa fa-times"></i>}</td>
<td className="overflow" title={fingerprintModel} >
<a href="" className="p-button--neutral small" title={T('assertion-settings')} data-key={this.props.model.id} onClick={this.props.showAssert}>
<button className="p-button--neutral small" title={T('assertion-settings')} data-key={this.props.model.id} onClick={this.props.showAssert}>
<i className="fa fa-sliders" aria-hidden="true" data-key={this.props.model.id} />
</a>
</button>
</td>
</tr>
)
Expand Down
12 changes: 6 additions & 6 deletions webapp-admin/src/components/SubstoreList.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ class SubstoreList extends Component {
} else {
return (
<div>
<a href="" data-key={b.id} onClick={this.handleShowEdit} className="p-button--brand small" title={T('edit-model')}>
<button data-key={b.id} onClick={this.handleShowEdit} className="p-button--brand small" title={T('edit-model')}>
<i data-key={b.id} className="fa fa-pencil" />
</a>
</button>
&nbsp;
<a href="" data-key={b.id} onClick={this.handleShowDelete} className="p-button--neutral small" title={T('delete-model')}>
<button data-key={b.id} onClick={this.handleShowDelete} className="p-button--neutral small" title={T('delete-model')}>
<i data-key={b.id} className="fa fa-trash" />
</a>
</button>
</div>
)
}
Expand Down Expand Up @@ -175,9 +175,9 @@ class SubstoreList extends Component {
<h2 className="p-card__title col-5">{T('substores')}</h2>
&nbsp;
<div className="col-1">
<a href="" onClick={this.handleShowNew} className="p-button--brand" title={T('new-substore-device')}>
<button onClick={this.handleShowNew} className="p-button--brand" title={T('new-substore-device')}>
<i className="fa fa-plus"></i>
</a>
</button>
</div>
</div>

Expand Down
5 changes: 3 additions & 2 deletions webapp-admin/src/components/UserRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ class UserRow extends Component {
<div>
<a href={'/users/'.concat(this.props.user.ID, '/edit')} className="p-button--brand" title={T('edit-user')}><i className="fa fa-pencil"></i></a>
&nbsp;
<a href="" onClick={this.props.delete} data-key={this.props.user.ID} className="p-button--neutral" title={T('delete-user')}>
<i className="fa fa-trash" data-key={this.props.user.ID}></i></a>
<button onClick={this.props.delete} data-key={this.props.user.ID} className="p-button--neutral" title={T('delete-user')}>
<i className="fa fa-trash" data-key={this.props.user.ID}></i>
</button>
</div>
);
} else {
Expand Down

0 comments on commit b4b0f6e

Please sign in to comment.