|
Lines 206-211
describe("kohaTable (using REST API)", () => {
Link Here
|
| 206 |
}); |
206 |
}); |
| 207 |
}); |
207 |
}); |
| 208 |
|
208 |
|
|
|
209 |
it("Force visibility of one column", () => { |
| 210 |
build_libraries().then(() => { |
| 211 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 212 |
|
| 213 |
// default settings: show "Code" |
| 214 |
cy.mock_table_settings({ |
| 215 |
default_save_state: 1, |
| 216 |
columns: { library_code: { is_hidden: 0 } }, |
| 217 |
}); |
| 218 |
|
| 219 |
cy.get("@columns").then(columns => { |
| 220 |
cy.get(`#${table_id} th`).should( |
| 221 |
"have.length", |
| 222 |
columns.length |
| 223 |
); |
| 224 |
cy.get(`#${table_id} th`).contains("Name"); |
| 225 |
cy.get(`#${table_id} th`).contains("Code"); |
| 226 |
|
| 227 |
// Hide "Code" |
| 228 |
cy.get(`#${table_id}_wrapper .buttons-colvis`).click(); |
| 229 |
cy.get(`#${table_id}_wrapper .dt-button-collection`) |
| 230 |
.contains("Code") |
| 231 |
.click(); |
| 232 |
cy.get(`#${table_id} th`).should( |
| 233 |
"have.length", |
| 234 |
columns.length - 1 |
| 235 |
); |
| 236 |
cy.get(`#${table_id} th`).contains("Name"); |
| 237 |
cy.get(`#${table_id} th`) |
| 238 |
.contains("Code") |
| 239 |
.should("not.exist"); |
| 240 |
}); |
| 241 |
|
| 242 |
// "Code" has been hidden by the user |
| 243 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 244 |
|
| 245 |
// But we want to display it |
| 246 |
cy.mock_table_settings({ |
| 247 |
default_save_state: 1, |
| 248 |
columns: { |
| 249 |
library_code: { is_hidden: 0, force_visibility: 1 }, |
| 250 |
}, |
| 251 |
}); |
| 252 |
|
| 253 |
cy.get("@columns").then(columns => { |
| 254 |
cy.get(`#${table_id} th`).should( |
| 255 |
"have.length", |
| 256 |
columns.length |
| 257 |
); |
| 258 |
// Both are shown |
| 259 |
cy.get(`#${table_id} th`).contains("Name"); |
| 260 |
cy.get(`#${table_id} th`).contains("Code"); |
| 261 |
}); |
| 262 |
|
| 263 |
// Now hide it |
| 264 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 265 |
|
| 266 |
cy.mock_table_settings({ |
| 267 |
default_save_state: 1, |
| 268 |
columns: { |
| 269 |
library_code: { is_hidden: 1, force_visibility: 1 }, |
| 270 |
}, |
| 271 |
}); |
| 272 |
|
| 273 |
cy.get("@columns").then(columns => { |
| 274 |
cy.get(`#${table_id} th`).should( |
| 275 |
"have.length", |
| 276 |
columns.length - 1 |
| 277 |
); |
| 278 |
cy.get(`#${table_id} th`).contains("Name"); |
| 279 |
cy.get(`#${table_id} th`) |
| 280 |
.contains("Code") |
| 281 |
.should("not.exist"); |
| 282 |
}); |
| 283 |
}); |
| 284 |
}); |
| 285 |
|
| 209 |
it("Shareable link", { scrollBehavior: false }, () => { |
286 |
it("Shareable link", { scrollBehavior: false }, () => { |
| 210 |
build_libraries().then(() => { |
287 |
build_libraries().then(() => { |
| 211 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
288 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 212 |
- |
|
|