|
Lines 133-140
describe("kohaTable (using REST API)", () => {
Link Here
|
| 133 |
}); |
133 |
}); |
| 134 |
}); |
134 |
}); |
| 135 |
|
135 |
|
| 136 |
/* TODO Missing mock, we assume that 'Save state' is ON */ |
136 |
it("One column hidden by default then shown by user - Save state OFF", () => { |
| 137 |
it("One column hidden by default then shown by user", () => { |
|
|
| 138 |
cy.task("buildSampleObjects", { |
137 |
cy.task("buildSampleObjects", { |
| 139 |
object: "library", |
138 |
object: "library", |
| 140 |
count: RESTdefaultPageSize, |
139 |
count: RESTdefaultPageSize, |
|
Lines 152-157
describe("kohaTable (using REST API)", () => {
Link Here
|
| 152 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
151 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 153 |
|
152 |
|
| 154 |
cy.window().then(win => { |
153 |
cy.window().then(win => { |
|
|
154 |
win.table_settings.default_save_state = 0; |
| 155 |
win.table_settings.columns = win.table_settings.columns.map( |
155 |
win.table_settings.columns = win.table_settings.columns.map( |
| 156 |
c => ({ ...c, is_hidden: 0, cannot_be_toggled: 0 }) |
156 |
c => ({ ...c, is_hidden: 0, cannot_be_toggled: 0 }) |
| 157 |
); |
157 |
); |
|
Lines 181-186
describe("kohaTable (using REST API)", () => {
Link Here
|
| 181 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
181 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 182 |
|
182 |
|
| 183 |
cy.window().then(win => { |
183 |
cy.window().then(win => { |
|
|
184 |
win.table_settings.default_save_state = 0; |
| 185 |
win.table_settings.columns = win.table_settings.columns.map( |
| 186 |
c => ({ ...c, is_hidden: 0, cannot_be_toggled: 0 }) |
| 187 |
); |
| 188 |
win.table_settings.columns.find( |
| 189 |
c => c.columnname == "library_code" |
| 190 |
).is_hidden = 1; |
| 191 |
cy.get(`#${table_id} th`).should( |
| 192 |
"have.length", |
| 193 |
win.table_settings.columns.length |
| 194 |
); |
| 195 |
cy.get(`#${table_id} th`).contains("Name"); |
| 196 |
cy.get(`#${table_id} th`) |
| 197 |
.contains("Code") |
| 198 |
.should("not.exist"); |
| 199 |
}); |
| 200 |
}); |
| 201 |
}); |
| 202 |
|
| 203 |
it("One column hidden by default then shown by user - Save state is ON", () => { |
| 204 |
cy.task("buildSampleObjects", { |
| 205 |
object: "library", |
| 206 |
count: RESTdefaultPageSize, |
| 207 |
values: { library_hours: [] }, |
| 208 |
}).then(libraries => { |
| 209 |
cy.intercept("GET", "/api/v1/libraries*", { |
| 210 |
statusCode: 200, |
| 211 |
body: libraries, |
| 212 |
headers: { |
| 213 |
"X-Base-Total-Count": baseTotalCount, |
| 214 |
"X-Total-Count": baseTotalCount, |
| 215 |
}, |
| 216 |
}); |
| 217 |
|
| 218 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 219 |
|
| 220 |
cy.window().then(win => { |
| 221 |
win.table_settings.default_save_state = 1; |
| 222 |
win.table_settings.columns = win.table_settings.columns.map( |
| 223 |
c => ({ ...c, is_hidden: 0, cannot_be_toggled: 0 }) |
| 224 |
); |
| 225 |
win.table_settings.columns.find( |
| 226 |
c => c.columnname == "library_code" |
| 227 |
).is_hidden = 1; |
| 228 |
cy.get(`#${table_id} th`).should( |
| 229 |
"have.length", |
| 230 |
win.table_settings.columns.length - 1 |
| 231 |
); |
| 232 |
cy.get(`#${table_id} th`).contains("Name"); |
| 233 |
cy.get(`#${table_id} th`) |
| 234 |
.contains("Code") |
| 235 |
.should("not.exist"); |
| 236 |
cy.get(`#${table_id}_wrapper .buttons-colvis`).click(); |
| 237 |
cy.get(`#${table_id}_wrapper .dt-button-collection`) |
| 238 |
.contains("Code") |
| 239 |
.click(); |
| 240 |
cy.get(`#${table_id} th`).should( |
| 241 |
"have.length", |
| 242 |
win.table_settings.columns.length |
| 243 |
); |
| 244 |
cy.get(`#${table_id} th`).contains("Name"); |
| 245 |
cy.get(`#${table_id} th`).contains("Code"); |
| 246 |
}); |
| 247 |
|
| 248 |
cy.visit("/cgi-bin/koha/admin/branches.pl"); |
| 249 |
|
| 250 |
cy.window().then(win => { |
| 251 |
win.table_settings.default_save_state = 1; |
| 184 |
win.table_settings.columns = win.table_settings.columns.map( |
252 |
win.table_settings.columns = win.table_settings.columns.map( |
| 185 |
c => ({ ...c, is_hidden: 0, cannot_be_toggled: 0 }) |
253 |
c => ({ ...c, is_hidden: 0, cannot_be_toggled: 0 }) |
| 186 |
); |
254 |
); |
| 187 |
- |
|
|