File tree 3 files changed +27
-25
lines changed
src/librustdoc/html/static
3 files changed +27
-25
lines changed Original file line number Diff line number Diff line change @@ -1627,24 +1627,27 @@ a.tooltip:hover::after {
1627
1627
color : var (--copy-path-button-color );
1628
1628
background : var (--main-background-color );
1629
1629
height : 34px ;
1630
+ width : 33px ;
1630
1631
margin-left : 10px ;
1631
1632
padding : 0 ;
1632
1633
padding-left : 2px ;
1633
1634
border : 0 ;
1634
- width : 33px ;
1635
- line-height : 0 ;
1636
1635
font-size : 0 ;
1637
1636
}
1638
-
1639
- # copy-path : before {
1637
+ # copy-path ::before {
1640
1638
filter : var (--copy-path-img-filter );
1641
1639
content : url ('clipboard-24048e6d87f63d07.svg' );
1642
- width : 19px ;
1643
- height : 18px ;
1644
1640
}
1645
- # copy-path : hover : before {
1641
+ # copy-path : hover :: before {
1646
1642
filter : var (--copy-path-img-hover-filter );
1647
1643
}
1644
+ # copy-path .clicked ::before {
1645
+ /* Checkmark <https://www.svgrepo.com/svg/335033/checkmark> */
1646
+ content : url ('data:image/svg+xml,<svg viewBox="-1 -1 23 23" xmlns="http://www.w3.org/2000/svg" \
1647
+ fill= "black" height="18px">\
1648
+ <g> <path d= "M9 19.414l-6.707-6.707 1.414-1.414L9 16.586 20.293 5.293l1.414 1.414" > </path>\
1649
+ </ g></svg>');
1650
+ }
1648
1651
1649
1652
@keyframes rotating {
1650
1653
from {
Original file line number Diff line number Diff line change @@ -1798,31 +1798,15 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
1798
1798
document . execCommand ( "copy" ) ;
1799
1799
document . body . removeChild ( el ) ;
1800
1800
1801
- // There is always one children, but multiple childNodes.
1802
- but . children [ 0 ] . style . display = "none" ;
1803
-
1804
- let tmp ;
1805
- if ( but . childNodes . length < 2 ) {
1806
- tmp = document . createTextNode ( "✓" ) ;
1807
- but . appendChild ( tmp ) ;
1808
- } else {
1809
- onEachLazy ( but . childNodes , e => {
1810
- if ( e . nodeType === Node . TEXT_NODE ) {
1811
- tmp = e ;
1812
- return true ;
1813
- }
1814
- } ) ;
1815
- tmp . textContent = "✓" ;
1816
- }
1801
+ but . classList . add ( "clicked" ) ;
1817
1802
1818
1803
if ( reset_button_timeout !== null ) {
1819
1804
window . clearTimeout ( reset_button_timeout ) ;
1820
1805
}
1821
1806
1822
1807
function reset_button ( ) {
1823
- tmp . textContent = "" ;
1824
1808
reset_button_timeout = null ;
1825
- but . children [ 0 ] . style . display = "" ;
1809
+ but . classList . remove ( "clicked" ) ;
1826
1810
}
1827
1811
1828
1812
reset_button_timeout = window . setTimeout ( reset_button , 1000 ) ;
Original file line number Diff line number Diff line change
1
+ // Checks that the "copy path" button is not triggering JS error and its display
2
+ // isn't broken.
3
+ go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
4
+
5
+ // First we store the size of the button before we click on it.
6
+ store-size: ("#copy-path", {"width": width, "height": height})
7
+ click: "#copy-path"
8
+ // We wait for the new text to appear.
9
+ wait-for: "#copy-path.clicked"
10
+ // We check that the size didn't change.
11
+ assert-size: ("#copy-path.clicked", {"width": |width|, "height": |height|})
12
+ // We wait for the button to turn back to its original state.
13
+ wait-for: "#copy-path:not(.clicked)"
14
+ // We check that the size is still the same.
15
+ assert-size: ("#copy-path:not(.clicked)", {"width": |width|, "height": |height|})
You can’t perform that action at this time.
0 commit comments