File tree 2 files changed +19
-3
lines changed
src/librustdoc/html/static/js
2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -2334,11 +2334,16 @@ ${item.displayPath}<span class="${type}">${name}</span>\
2334
2334
}
2335
2335
2336
2336
function makeTabHeader ( tabNb , text , nbElems ) {
2337
+ // https://blog.horizon-eda.org/misc/2020/02/19/ui.html
2338
+ let fmtNbElems =
2339
+ nbElems < 10 ? `\u{2007}\u{2007}(${ nbElems } )` :
2340
+ nbElems < 100 ? `\u{2007}(${ nbElems } )` :
2341
+ `(${ nbElems } )` ;
2337
2342
if ( searchState . currentTab === tabNb ) {
2338
2343
return "<button class=\"selected\">" + text +
2339
- " <span class=\"count\">( " + nbElems + ") </span></button>" ;
2344
+ "<span class=\"count\">" + fmtNbElems + "</span></button>" ;
2340
2345
}
2341
- return "<button>" + text + " <span class=\"count\">( " + nbElems + ") </span></button>" ;
2346
+ return "<button>" + text + "<span class=\"count\">" + fmtNbElems + "</span></button>" ;
2342
2347
}
2343
2348
2344
2349
/**
Original file line number Diff line number Diff line change 1
1
// Checking the colors of the search tab headers.
2
- go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=something "
2
+ go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=foo "
3
3
show-text: true
4
4
5
5
define-function: (
@@ -74,3 +74,14 @@ call-function: ("check-colors", {
74
74
"border_top_selected": "2px solid #0089ff",
75
75
"border_top_hover": "2px solid #0089ff",
76
76
})
77
+
78
+ // Check the size and count in tabs
79
+ assert-text: ("#search-tabs > button:nth-child(1) > .count", " (23)")
80
+ assert-text: ("#search-tabs > button:nth-child(2) > .count", " (4)")
81
+ assert-text: ("#search-tabs > button:nth-child(3) > .count", " (0)")
82
+ store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth})
83
+ assert-property: ("#search-tabs > button:nth-child(2)", {"offsetWidth": |buttonWidth|})
84
+ assert-property: ("#search-tabs > button:nth-child(3)", {"offsetWidth": |buttonWidth|})
85
+ store-property: ("#search-tabs > button:nth-child(1) > .count", {"offsetWidth": countWidth})
86
+ assert-property: ("#search-tabs > button:nth-child(2) > .count", {"offsetWidth": |countWidth|})
87
+ assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth": |countWidth|})
You can’t perform that action at this time.
0 commit comments