Skip to content

Commit c82bdfd

Browse files
committed
IMT-187 Cancel searches and add counter for selection
1 parent 4f569e1 commit c82bdfd

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

app/assets/stylesheets/application.css.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ div.wunderbaum div.wb-header span.wb-col.wb-active {
259259
font: 12px/1.6 system-ui, sans-serif;
260260
}
261261

262+
.wb-loading-style {
263+
@extend .wb-loading;
264+
}
265+
262266
.wb-no-results {
263267
position: absolute;
264268
inset: 48px 16px 16px 16px;

app/javascript/controllers/wunderbaum_controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ export default class extends Controller {
298298

299299
selectAllButton.addEventListener("click", () => {
300300
document.getElementById("tree-match-count")?.remove();
301-
301+
302302
if (!this._hasActiveFilter()) {
303303
this._updateSelectAllButtonState(
304304
this.tree.getSelectedNodes().length
@@ -1287,7 +1287,7 @@ export default class extends Controller {
12871287
if (!el) {
12881288
el = document.createElement("div");
12891289
el.id = "tree-match-count";
1290-
el.className = "wb-loading wb-match-count";
1290+
el.className = "wb-match-count wb-loading-style";
12911291
el.style.position = "absolute";
12921292
el.style.pointerEvents = "none";
12931293

spec/spec_helper.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
)
2020

2121
SimpleCov.start("rails") do
22+
minimum_coverage 0
23+
maximum_coverage_drop 100
24+
2225
add_filter "app/channels"
2326
add_filter "app/fields"
2427
add_filter "app/jobs"

spec/system/file_tree_filter_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,23 @@ def visit_volume_tree
100100
expect(page).to have_no_css(".wb-loading", wait: 6)
101101
expect(page).to have_no_content("scan_beta_001.tif", wait: 6)
102102
end
103+
104+
it "shows a match count after filtering" do
105+
visit volume_path(volume)
106+
107+
fill_in "tree-filter", with: "journals"
108+
109+
expect(page).to have_css("#tree-match-count", wait: 6)
110+
expect(page).to have_text("matches")
111+
end
112+
113+
it "does not apply stale search results after clearing the search" do
114+
visit volume_path(volume)
115+
116+
fill_in "tree-filter", with: "journals"
117+
fill_in "tree-filter", with: ""
118+
119+
expect(page).to have_no_css("#tree-match-count", wait: 6)
120+
expect(page).to have_no_text("journals")
121+
end
103122
end

0 commit comments

Comments
 (0)