|
Lines 131-136
describe("Display patron - autocomplete", () => {
Link Here
|
| 131 |
}); |
131 |
}); |
| 132 |
}); |
132 |
}); |
| 133 |
}); |
133 |
}); |
|
|
134 |
|
| 135 |
it("should have correct punctuation when surname is missing", function () { |
| 136 |
cy.task("buildSampleObjects", { |
| 137 |
object: "patron", |
| 138 |
count: 1, |
| 139 |
values: { surname: null }, |
| 140 |
}).then(patrons => { |
| 141 |
cy.intercept("GET", "/api/v1/patrons*", { |
| 142 |
statusCode: 200, |
| 143 |
body: patrons, |
| 144 |
headers: { |
| 145 |
"X-Base-Total-Count": "1", |
| 146 |
"X-Total-Count": "1", |
| 147 |
}, |
| 148 |
}); |
| 149 |
|
| 150 |
cy.visit("/cgi-bin/koha/mainpage.pl"); |
| 151 |
|
| 152 |
const patron = patrons[0]; |
| 153 |
cy.get("#findborrower").type(patron.firstname); |
| 154 |
|
| 155 |
// invert_name is set |
| 156 |
cy.get(`ul.ui-autocomplete li a`).should($el => { |
| 157 |
let re = new RegExp( |
| 158 |
`^${patron.preferred_name} ${patron.middle_name} \\(${patron.other_name}\\) \\(${patron.cardnumber}\\)` |
| 159 |
); |
| 160 |
const displayedText = $el.text().replace(/ /g, " ").trim(); |
| 161 |
expect(displayedText).to.match(re); |
| 162 |
}); |
| 163 |
}); |
| 164 |
}); |
| 134 |
}); |
165 |
}); |
| 135 |
|
166 |
|
| 136 |
describe("Display patron - no search", () => { |
167 |
describe("Display patron - no search", () => { |
| 137 |
- |
|
|