-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwork.rs
More file actions
58 lines (50 loc) · 1.95 KB
/
work.rs
File metadata and controls
58 lines (50 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use maud::Render;
use crate::views::{page, partials};
pub struct Work;
impl Render for Work {
fn render(&self) -> maud::Markup {
let content = partials::components::portfolio::content::work_index_content();
let body = partials::components::portfolio::Page {
content: maud::html! {
(partials::components::portfolio::WorkIndexSection { content })
(partials::components::portfolio::SupportingTeaserSection {
content: &content.open_source_teaser,
})
},
}
.render();
page::Layout::builder()
.title(&content.page_title.to_string())
.content(body)
.nav_mode(page::NavMode::Portfolio)
.current_route(crate::paths::Route::Work)
.build()
.render()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn renders_case_studies_and_open_source_teaser() {
let content = partials::components::portfolio::content::work_index_content();
let markup = Work.render().into_string();
let lead_title = content.title.to_string();
let cases_title = content.cases_title.to_string();
let teaser_title = content.open_source_teaser.title.to_string();
assert!(markup.contains(lead_title.as_str()));
assert!(markup.contains(cases_title.as_str()));
assert!(markup.contains(teaser_title.as_str()));
assert!(!markup.contains("data-code-block"));
assert!(!markup.contains("data-portfolio-crate-switcher"));
assert!(!markup.contains("images/work/chat-realtime"));
assert!(!markup.contains("Automation at scale case preview"));
assert!(
markup.find(lead_title.as_str()).unwrap()
< markup.find(cases_title.as_str()).unwrap()
);
assert!(
markup.find(cases_title.as_str()).unwrap() < markup.find(teaser_title.as_str()).unwrap()
);
}
}