|
| 1 | +// Checks that the first sentence of an impl block doc is always visible even when the impl |
| 2 | +// block is collapsed. |
| 3 | +go-to: "file://" + |DOC_PATH| + "/test_docs/struct.ImplDoc.html" |
| 4 | + |
| 5 | +set-window-size: (900, 600) |
| 6 | + |
| 7 | +define-function: ( |
| 8 | + "compare-size-and-pos", |
| 9 | + [nth_impl], |
| 10 | + block { |
| 11 | + // First we collapse the impl block. |
| 12 | + store-value: (impl_path, "#implementations-list details:nth-of-type(" + |nth_impl| + ")") |
| 13 | + set-property: (|impl_path|, {"open": false}) |
| 14 | + wait-for: |impl_path| + ":not([open])" |
| 15 | + |
| 16 | + store-value: (impl_path, |impl_path| + " summary") |
| 17 | + store-size: (|impl_path|, {"height": impl_height}) |
| 18 | + store-position: (|impl_path|, {"y": impl_y}) |
| 19 | + |
| 20 | + store-size: (|impl_path| + " .docblock", {"height": doc_height}) |
| 21 | + store-position: (|impl_path| + " .docblock", {"y": doc_y}) |
| 22 | + |
| 23 | + assert: |impl_y| + |impl_height| >= |doc_y| |
| 24 | + } |
| 25 | +) |
| 26 | + |
| 27 | +call-function: ("compare-size-and-pos", {"nth_impl": 1}) |
| 28 | +// Since the first impl block has a long line, we ensure that it doesn't display all of it. |
| 29 | +assert: (|impl_y| + |impl_height|) <= (|doc_y| + |doc_height|) |
| 30 | + |
| 31 | +call-function: ("compare-size-and-pos", {"nth_impl": 2}) |
| 32 | +// The second impl block has a short line. |
| 33 | +assert: (|impl_y| + |impl_height|) >= (|doc_y| + |doc_height|) |
0 commit comments