Bug 33490: Make url consistent
This ensures we populate the max_expiration_date param on the browser
url for consistency with selected dates.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f9cb6b823e)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
parent
5bf3631a4a
commit
61d4a4ffa4
|
|
@ -208,18 +208,18 @@ export default {
|
|||
},
|
||||
table_url: function () {
|
||||
let url = "/api/v1/erm/agreements"
|
||||
if (this.filters.by_expired) {
|
||||
if (!this.filters.max_expiration_date)
|
||||
this.filters.max_expiration_date = new Date()
|
||||
.toISOString()
|
||||
.substring(0, 10)
|
||||
}
|
||||
if (this.filters.by_expired)
|
||||
url +=
|
||||
"?max_expiration_date=" + this.filters.max_expiration_date
|
||||
return url
|
||||
},
|
||||
filter_table: async function () {
|
||||
if (this.filters.by_expired) {
|
||||
if (!this.filters.max_expiration_date)
|
||||
this.filters.max_expiration_date = new Date()
|
||||
.toISOString()
|
||||
.substring(0, 10)
|
||||
}
|
||||
if (!this.embedded) {
|
||||
let new_route = build_url(
|
||||
"/cgi-bin/koha/erm/agreements",
|
||||
|
|
|
|||
|
|
@ -170,10 +170,10 @@ describe("Agreement CRUD operations", () => {
|
|||
.its('request.url')
|
||||
.should('include', 'max_expiration_date='+dates["today_iso"]); // Defaults to today
|
||||
cy.get("#max_expiration_date_filter").should("have.value", dates["today_iso"]); // Input box reflects default
|
||||
cy.url().should('include', "/cgi-bin/koha/erm/agreements?by_expired=true"); // Browser url also updated
|
||||
cy.url().should('include', "/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date="+dates["today_iso"]); // Browser url also updated
|
||||
|
||||
// Now test that the url for this particular state works
|
||||
cy.visit("/cgi-bin/koha/erm/agreements?by_expired=true");
|
||||
cy.visit("/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date="+dates["today_iso"]);
|
||||
cy.wait('@getActiveAgreements').its('request.url').should('include', 'max_expiration_date='+dates["today_iso"]);
|
||||
|
||||
// Now test with a user entered date
|
||||
|
|
|
|||
Loading…
Reference in New Issue