spec: show birthdays until a week out
This commit is contained in:
parent
79a054ab40
commit
974bdcac34
3 changed files with 26 additions and 3 deletions
|
|
@ -49,7 +49,7 @@ test('bullet points in free text display well', async ({ page }) => {
|
|||
|
||||
});
|
||||
|
||||
twst('page title has contact primary name', async ({ page }) => {
|
||||
test('page title has contact primary name', async ({ page }) => {
|
||||
await expect(page.title()).toContain("Test Testerson");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -43,3 +43,26 @@ test('sidebar is sorted alphabetically', async ({ page }) => {
|
|||
|
||||
await expect(page.getByRole('navigation')).toHaveText(/Alfa\s*Golf\s*Zulu/);
|
||||
});
|
||||
|
||||
test('always shows at least one birthday a week away', async ({ page }) => {
|
||||
const monthday = d => d.toISOString().split("T")[0].replace(/^\d{4}/, '-');
|
||||
const today = monthday(new Date());
|
||||
const tomorrow = monthday((() => {
|
||||
let date = new Date();
|
||||
date.setDate(date.getDate() + 1);
|
||||
return date;
|
||||
})());
|
||||
const inAMonth = monthday((() => {
|
||||
let date = new Date();
|
||||
date.setDate(date.getDate() + 28);
|
||||
return date;
|
||||
})());
|
||||
await verifyCreateUser(page, { names: ['Alfa'], birthday: today });
|
||||
await verifyCreateUser(page, { names: ['Beta'], birthday: tomorrow });
|
||||
await verifyCreateUser(page, { names: ['Echo'], birthday: today });
|
||||
await verifyCreateUser(page, { names: ['Golf'], birthday: tomorrow });
|
||||
await verifyCreateUser(page, { names: ['Zulu'], birthday: inAMonth });
|
||||
|
||||
await expect(page.locator('#upcoming').getByRole('link')).toHaveCount(5);
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ fn birthdays_section(
|
|||
div id="birthdays" {
|
||||
h2 { "Birthdays" }
|
||||
#birthday-sections {
|
||||
.datelist {
|
||||
.datelist #upcoming {
|
||||
h3 { "upcoming" }
|
||||
@for contact in &upcoming_birthdays[0..std::cmp::min(3, upcoming_birthdays.len())] {
|
||||
a href=(format!("/contact/{}", contact.contact_id)) {
|
||||
|
|
@ -68,7 +68,7 @@ fn birthdays_section(
|
|||
}
|
||||
}
|
||||
}
|
||||
.datelist {
|
||||
.datelist #recent {
|
||||
h3 { "recent" }
|
||||
@for contact in &prev_birthdays[0..std::cmp::min(3, prev_birthdays.len())] {
|
||||
a href=(format!("/contact/{}", contact.contact_id)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue