Skip to content

Commit

Permalink
Add more links and labels to clocks (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Sep 26, 2022
1 parent 0941284 commit e310c82
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 53 deletions.
15 changes: 2 additions & 13 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1081,20 +1081,9 @@ mod tests {
#[test]
fn clock_updates() {
let test_server = TestServer::new();

test_server.assert_response_regex(
"clock",
StatusCode::OK,
r#".*<line y2="-9" transform="rotate\(0\)"/>.*"#,
);

test_server.assert_response_regex("/clock", StatusCode::OK, ".*<text.*>0</text>.*");
test_server.bitcoin_rpc_server.mine_blocks(1);

test_server.assert_response_regex(
"clock",
StatusCode::OK,
r#".*<line y2="-9" transform="rotate\(0.00005194805194805195\)"/>.*"#,
);
test_server.assert_response_regex("/clock", StatusCode::OK, ".*<text.*>1</text>.*");
}

#[test]
Expand Down
11 changes: 7 additions & 4 deletions src/subcommand/server/templates/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ mod tests {
fn clock_svg() {
assert_regex_match!(
ClockSvg::new(Height(6929999)).to_string(),
r##"<svg.*<text.*>6929999</text>.*
<line y2="-9" transform="rotate\(359.9999480519481\)"/>
<line y2="-13" stroke-width="0.6" transform="rotate\(359.9982857142857\)"/>
<line y2="-16" stroke="#d00505" stroke-width="0.2" transform="rotate\(179.82142857142858\)"/>.*</svg>
r##"<svg.*>.*
<text.*>6929999</text>.*
<line y2="-9" transform="rotate\(359.9999480519481\)"><title>Subsidy</title></line>.*
<line y2="-13" stroke-width="0.6" transform="rotate\(359.9982857142857\)"><title>Epoch</title></line>.*
<line y2="-16" stroke="#d00505" stroke-width="0.2" transform="rotate\(179.82142857142858\)"><title>Period</title></line>.*
<circle r="0.7" stroke="#d00505" stroke-width="0.3"/>.*
</svg>
"##,
);
}
Expand Down
72 changes: 36 additions & 36 deletions templates/clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e310c82

Please sign in to comment.