Page MenuHomeSoftware Heritage

D7426.id26910.diff
No OneTemporary

D7426.id26910.diff

diff --git a/assets/src/bundles/add_forge/create-request.js b/assets/src/bundles/add_forge/create-request.js
--- a/assets/src/bundles/add_forge/create-request.js
+++ b/assets/src/bundles/add_forge/create-request.js
@@ -55,26 +55,36 @@
}
});
- $(window).on('hashchange', () => {
- if (window.location.hash === '#browse-requests') {
- $('.nav-tabs a[href="#swh-add-forge-requests-list"]').tab('show');
- } else {
- $('.nav-tabs a[href="#swh-add-forge-submit-request"]').tab('show');
- }
- });
-
$('#swh-add-forge-requests-list-tab').on('shown.bs.tab', () => {
window.location.hash = '#browse-requests';
});
+ $('#swh-add-forge-requests-help-tab').on('shown.bs.tab', () => {
+ window.location.hash = '#help';
+ });
+
$('#swh-add-forge-tab').on('shown.bs.tab', () => {
removeUrlFragment();
});
+ $(window).on('hashchange', () => {
+ onPageHashChage();
+ });
+ onPageHashChage(); // Explicit call to handle a hash during the page load
populateRequestBrowseList(); // Load existing requests
});
}
+function onPageHashChage() {
+ if (window.location.hash === '#browse-requests') {
+ $('.nav-tabs a[href="#swh-add-forge-requests-list"]').tab('show');
+ } else if (window.location.hash === '#help') {
+ $('.nav-tabs a[href="#swh-add-forge-requests-help"]').tab('show');
+ } else {
+ $('.nav-tabs a[href="#swh-add-forge-submit-request"]').tab('show');
+ }
+}
+
export function populateRequestBrowseList() {
requestBrowseTable = $('#add-forge-request-browse')
.on('error.dt', (e, settings, techNote, message) => {
diff --git a/cypress/integration/add-forge-now-request-create.spec.js b/cypress/integration/add-forge-now-request-create.spec.js
--- a/cypress/integration/add-forge-now-request-create.spec.js
+++ b/cypress/integration/add-forge-now-request-create.spec.js
@@ -19,7 +19,7 @@
this.addForgeNowUrl = this.Urls.forge_add();
});
- it('should show both tabs for every user', function() {
+ it('should show all the tabs for every user', function() {
cy.visit(this.addForgeNowUrl);
cy.get('#swh-add-forge-tab')
@@ -27,6 +27,9 @@
cy.get('#swh-add-forge-requests-list-tab')
.should('have.class', 'nav-link');
+
+ cy.get('#swh-add-forge-requests-help-tab')
+ .should('have.class', 'nav-link');
});
it('should show create forge tab by default', function() {
@@ -61,16 +64,29 @@
cy.get('#swh-add-forge-requests-list-tab').click();
cy.get('#swh-add-forge-tab')
.should('not.have.class', 'active');
+ cy.get('#swh-add-forge-requests-list-tab')
+ .should('have.class', 'active');
+ cy.get('#swh-add-forge-requests-help-tab')
+ .should('not.have.class', 'active');
+ cy.hash().should('eq', '#browse-requests');
+ cy.get('#swh-add-forge-requests-help-tab').click();
+ cy.get('#swh-add-forge-tab')
+ .should('not.have.class', 'active');
cy.get('#swh-add-forge-requests-list-tab')
+ .should('not.have.class', 'active');
+ cy.get('#swh-add-forge-requests-help-tab')
.should('have.class', 'active');
+ cy.hash().should('eq', '#help');
cy.get('#swh-add-forge-tab').click();
cy.get('#swh-add-forge-tab')
.should('have.class', 'active');
-
cy.get('#swh-add-forge-requests-list-tab')
.should('not.have.class', 'active');
+ cy.get('#swh-add-forge-requests-help-tab')
+ .should('not.have.class', 'active');
+ cy.hash().should('eq', '');
});
it('should show create form elements to authenticated user', function() {

File Metadata

Mime Type
text/plain
Expires
Nov 5 2024, 2:54 PM (11 w, 15 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3224269

Event Timeline