Page MenuHomeSoftware Heritage

D5109.diff
No OneTemporary

D5109.diff

diff --git a/cypress/integration/home.spec.js b/cypress/integration/home.spec.js
--- a/cypress/integration/home.spec.js
+++ b/cypress/integration/home.spec.js
@@ -10,6 +10,17 @@
const url = '/';
describe('Home Page Tests', function() {
+
+ it('should have focus on search form after page load', function() {
+ cy.visit(url);
+
+ cy.get('#swh-origins-url-patterns')
+ .should('have.attr', 'autofocus');
+ // for some reason, autofocus is not honored when running cypress tests
+ // while it is in non controlled browsers
+ // .should('have.focus');
+ });
+
it('should display positive stats for each category', function() {
cy.server();
diff --git a/cypress/integration/origin-search.spec.js b/cypress/integration/origin-search.spec.js
--- a/cypress/integration/origin-search.spec.js
+++ b/cypress/integration/origin-search.spec.js
@@ -51,6 +51,14 @@
cy.visit(url);
});
+ it('should have focus on search form after page load', function() {
+ cy.get('#swh-origins-url-patterns')
+ .should('have.attr', 'autofocus');
+ // for some reason, autofocus is not honored when running cypress tests
+ // while it is in non controlled browsers
+ // .should('have.focus');
+ });
+
it('should show in result when url is searched', function() {
cy.get('#swh-origins-url-patterns')
.type(origin.url);
diff --git a/swh/web/templates/includes/origin-search-form.html b/swh/web/templates/includes/origin-search-form.html
--- a/swh/web/templates/includes/origin-search-form.html
+++ b/swh/web/templates/includes/origin-search-form.html
@@ -7,7 +7,9 @@
<form class="form-horizontal" id="swh-search-origins">
<div class="input-group">
- <input class="form-control" placeholder="Enter a SWHID to resolve or string pattern(s) to search for in origin urls" type="text" id="swh-origins-url-patterns"/>
+ <input class="form-control"
+ placeholder="Enter a SWHID to resolve or string pattern(s) to search for in origin urls"
+ type="text" id="swh-origins-url-patterns" autofocus>
<div class="input-group-append">
<button class="btn btn-primary" type="submit"><i class="swh-search-icon mdi mdi-24px mdi-magnify" aria-hidden="true"></i></button>
</div>

File Metadata

Mime Type
text/plain
Expires
Nov 4 2024, 5:58 PM (9 w, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3220282

Event Timeline