Lines 114-116
describe("ExtendedPatronAttributes", () => {
Link Here
|
114 |
}); |
114 |
}); |
115 |
}); |
115 |
}); |
116 |
}); |
116 |
}); |
117 |
- |
117 |
|
|
|
118 |
describe("Filters", () => { |
119 |
const table_id = "memberresultst"; |
120 |
|
121 |
beforeEach(() => { |
122 |
cleanup(); |
123 |
cy.login(); |
124 |
cy.title().should("eq", "Koha staff interface"); |
125 |
cy.window().then(win => { |
126 |
win.localStorage.clear(); |
127 |
}); |
128 |
}); |
129 |
|
130 |
it.only("Keep filters in the column filters", () => { |
131 |
cy.task("buildSampleObjects", { |
132 |
object: "patron", |
133 |
count: RESTdefaultPageSize, |
134 |
values: {}, |
135 |
}).then(patrons => { |
136 |
// Needs more properties to not explode |
137 |
// account_balace: balance_str.escapeHtml(...).format_price is not a function |
138 |
patrons = patrons.map(p => ({ ...p, account_balance: 0 })); |
139 |
|
140 |
cy.intercept("GET", "/api/v1/patrons*", { |
141 |
statusCode: 200, |
142 |
body: patrons, |
143 |
headers: { |
144 |
"X-Base-Total-Count": baseTotalCount, |
145 |
"X-Total-Count": baseTotalCount, |
146 |
}, |
147 |
}); |
148 |
|
149 |
cy.visit("/cgi-bin/koha/members/members-home.pl"); |
150 |
|
151 |
cy.window().then(win => { |
152 |
win.categories_map = patrons.reduce((map, p) => { |
153 |
map[p.category_id] = p.category_id; |
154 |
return map; |
155 |
}, {}); |
156 |
}); |
157 |
cy.get("form.patron_search_form .branchcode_filter").select("CPL"); |
158 |
cy.get("form.patron_search_form .categorycode_filter").select("S"); |
159 |
cy.get("form.patron_search_form input[type='submit']").click(); |
160 |
|
161 |
cy.get(`#${table_id}_wrapper .dt-info`).contains( |
162 |
`Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries` |
163 |
); |
164 |
|
165 |
cy.get(`#${table_id} thead tr`).should("have.length", 2); |
166 |
|
167 |
cy.get( |
168 |
`#${table_id} thead tr th[data-filter='libraries'] select` |
169 |
).should("have.value", "^CPL$"); |
170 |
// Lowercase see bug 32517 and related code in datatables.js |
171 |
cy.get( |
172 |
`#${table_id} thead tr th[data-filter='categories'] select` |
173 |
).should("have.value", "^s$"); |
174 |
|
175 |
cy.get(`#${table_id}_wrapper .dt_button_clear_filter`).click(); |
176 |
cy.get( |
177 |
`#${table_id} thead tr th[data-filter='libraries'] select` |
178 |
).should("have.value", ""); |
179 |
// Lowercase see bug 32517 and related code in datatables.js |
180 |
cy.get( |
181 |
`#${table_id} thead tr th[data-filter='categories'] select` |
182 |
).should("have.value", ""); |
183 |
}); |
184 |
}); |
185 |
}); |