diff --git a/crates/bin/docs_rs_web/templates/rustdoc/topbar.html b/crates/bin/docs_rs_web/templates/rustdoc/topbar.html index 8c9a168fa..1c2000680 100644 --- a/crates/bin/docs_rs_web/templates/rustdoc/topbar.html +++ b/crates/bin/docs_rs_web/templates/rustdoc/topbar.html @@ -12,7 +12,7 @@ } {%- if krate is defined -%} -
  • +
  • {{ crate::icons::IconCube.render_solid(false, false, "") }} {{ metadata.name }}-{{ metadata.version }} @@ -43,7 +43,7 @@ {%- if let Some(parsed_licenses) = krate.parsed_license -%}
  • - + {{- crate::icons::IconScaleUnbalancedFlip.render_solid(false, false, "") }} {%+ for item in parsed_licenses -%} {%- match item -%} diff --git a/crates/bin/docs_rs_web/templates/style/_navbar.scss b/crates/bin/docs_rs_web/templates/style/_navbar.scss index 2ce8123cc..d904c05cb 100644 --- a/crates/bin/docs_rs_web/templates/style/_navbar.scss +++ b/crates/bin/docs_rs_web/templates/style/_navbar.scss @@ -73,6 +73,10 @@ div.nav-container { &.description { font-size: 14.4px; } + + &.description.license { + white-space: normal; + } } a.pure-menu-sublink { color: var(--color-navbar-standard); diff --git a/gui-tests/long-license-text.goml b/gui-tests/long-license-text.goml new file mode 100644 index 000000000..4cfa76c2a --- /dev/null +++ b/gui-tests/long-license-text.goml @@ -0,0 +1,28 @@ +// Checks that the links have the expected color. + +go-to: |DOC_PATH| + "/sysinfo" +store-value: (menu_selector, '.crate-dropdown') +store-value: (sub_menu_selector, |menu_selector| + ' .pure-menu-children') +store-value: (license_selector, |sub_menu_selector| + ' .license') +click: |menu_selector| +wait-for-css: (|sub_menu_selector|, {"display": "block"}) +store-size: ( + |license_selector|, + {"height": original_height, "width": original_width}, +) +store-size: (|sub_menu_selector|, {"width": menu_width}) +// Menu has a border of 1px, so both sides makes it 2px total. +assert: (|menu_width| - 2) == |original_width| + +// Now we change the content of the license to make it overflow the menu's width. +store-property: (|license_selector|, {"innerHTML": html}) +set-property: ( + |license_selector|, + {"innerHTML": |html| + "OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 OR blablablablabla"}, +) +// And now, the height should have increased while the width should remain the same. +store-size: ( + |license_selector|, + {"height": new_height, "width": new_width}, +) +assert: |new_width| == |original_width| && |new_height| > |original_height|