From 9fc50c9485ded2738693288db9796b1432aafc60 Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Mon, 7 Oct 2024 19:32:19 +0300 Subject: [PATCH] Updated Pull requests layout. Fixed uitest. (#6833) Signed-off-by: Alexander Platov --- .../src/components/DayCalendar.svelte | 4 +- .../src/components/PullRequestsView.svelte | 40 +++---------------- tests/sanity/tests/planning/plan.spec.ts | 22 ++++------ tests/sanity/tests/utils.ts | 9 +++-- 4 files changed, 20 insertions(+), 55 deletions(-) diff --git a/plugins/calendar-resources/src/components/DayCalendar.svelte b/plugins/calendar-resources/src/components/DayCalendar.svelte index 85fe70bcdb..7e347832ab 100644 --- a/plugins/calendar-resources/src/components/DayCalendar.svelte +++ b/plugins/calendar-resources/src/components/DayCalendar.svelte @@ -80,11 +80,11 @@ const getTimeFormat = (hour: number, min: number = 0): string => { if (min === 0) { return ampm - ? `${hour > 12 ? hour - 12 : hour}${hour < 12 ? 'am' : 'pm'}` + ? `${hour > 12 ? hour - 12 : hour}${hour < 12 || hour === 24 ? 'am' : 'pm'}` : `${addZero(hour === 24 ? 0 : hour)}:00` } else { return ampm - ? `${hour > 12 ? hour - 12 : hour}:${addZero(min)}${hour < 12 ? 'am' : 'pm'}` + ? `${hour > 12 ? hour - 12 : hour}:${addZero(min)}${hour < 12 || hour === 24 ? 'am' : 'pm'}` : `${addZero(hour === 24 ? 0 : hour)}:${addZero(min)}` } } diff --git a/services/github/github-resources/src/components/PullRequestsView.svelte b/services/github/github-resources/src/components/PullRequestsView.svelte index c246d3aa9c..ca8143dfed 100644 --- a/services/github/github-resources/src/components/PullRequestsView.svelte +++ b/services/github/github-resources/src/components/PullRequestsView.svelte @@ -1,7 +1,7 @@ + + + - - - {#if asideFloat && $$slots.aside} -
-
{/if} diff --git a/tests/sanity/tests/planning/plan.spec.ts b/tests/sanity/tests/planning/plan.spec.ts index 3a269fce75..1155d44eec 100644 --- a/tests/sanity/tests/planning/plan.spec.ts +++ b/tests/sanity/tests/planning/plan.spec.ts @@ -6,8 +6,7 @@ import { generateTestData, getTimeForPlanner, getSecondPageByInvite, - getInviteLink, - convertDate + getInviteLink } from '../utils' import { PlanningPage } from '../model/planning/planning-page' import { NewToDo } from '../model/planning/types' @@ -351,18 +350,13 @@ test.describe('Planning ToDo tests', () => { const today = new Date() const date = new Date() date.setDate(date.getDate() + 3) + const time = getTimeForPlanner(0, 2) + const timeStart = getTimeForPlanner(-1, 2) + const timeEnd = getTimeForPlanner(2, 2) const toDoWithLabel: NewToDo = { title: `ToDo to change duration-${generateId()}`, - description: 'Description for ToDo to change duration', - slots: [ - { - dateStart: convertDate(date), - timeStart: '1400', - dateEnd: convertDate(date), - timeEnd: '1500' - } - ] + description: 'Description for ToDo to change duration' } await test.step('Prepare ToDo', async () => { @@ -373,12 +367,12 @@ test.describe('Planning ToDo tests', () => { if (diff < 0) await planningPage.clickButtonPrevDayInSchedule() else await planningPage.clickButtonNextDayInSchedule() } - await planningPage.selectTimeCell('10am').scrollIntoViewIfNeeded() + await planningPage.dragToCalendar(toDoWithLabel.title, 1, time) }) await test.step('Resize ToDo', async () => { - await planningPage.moveToDoBorderByMouse(toDoWithLabel.title, 1, '4pm', 'bottom') - await planningPage.moveToDoBorderByMouse(toDoWithLabel.title, 1, '1pm', 'top') + await planningPage.moveToDoBorderByMouse(toDoWithLabel.title, 1, timeEnd, 'bottom') + await planningPage.moveToDoBorderByMouse(toDoWithLabel.title, 1, timeStart, 'top') }) await test.step('Check time changes', async () => { diff --git a/tests/sanity/tests/utils.ts b/tests/sanity/tests/utils.ts index ce606a4686..265baa66a3 100644 --- a/tests/sanity/tests/utils.ts +++ b/tests/sanity/tests/utils.ts @@ -36,11 +36,12 @@ export function generateTestData (): TestData { } } -export function getTimeForPlanner (plusHours?: number): string { +export function getTimeForPlanner (plusHours: number = 0, cropHours: number = 0): string { let hour = new Date().getHours() - if (typeof plusHours === 'number') hour += plusHours - const ampm = hour < 13 ? 'am' : 'pm' - hour = hour < 1 ? 1 : hour >= 11 && hour < 13 ? 11 : hour >= 22 ? 10 : hour > 12 ? hour - 12 : hour + hour = hour < 1 + cropHours ? 1 + cropHours : hour >= 22 - cropHours ? 22 - cropHours : hour + hour += plusHours + const ampm = hour < 12 || hour === 24 ? 'am' : 'pm' + hour -= hour > 12 ? 12 : 0 return `${hour}${ampm}` }