Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): take into account scrollbar in active zone #6790

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ import {DOCUMENT} from '@angular/common';
import {Directive, ElementRef, Inject, Input, NgZone, Self} from '@angular/core';
import {ANIMATION_FRAME} from '@ng-web-apis/common';
import {POLLING_TIME} from '@taiga-ui/cdk/constants';
import {
tuiScrollFrom,
tuiStopPropagation,
tuiTypedFromEvent,
tuiZonefree,
} from '@taiga-ui/cdk/observables';
import {tuiScrollFrom, tuiTypedFromEvent, tuiZonefree} from '@taiga-ui/cdk/observables';
import {TuiDestroyService} from '@taiga-ui/cdk/services';
import {TUI_SCROLL_REF} from '@taiga-ui/cdk/tokens';
import {merge, Observable} from 'rxjs';
Expand Down Expand Up @@ -48,7 +43,6 @@ export class TuiScrollbarDirective {
merge(
mousedownWrapper$.pipe(map(event => this.getScrolled(event, 0.5, 0.5))),
mousedown$.pipe(
tuiStopPropagation(),
switchMap(event => {
const rect = nativeElement.getBoundingClientRect();
const vertical = getOffsetVertical(event, rect);
Expand Down
11 changes: 11 additions & 0 deletions projects/demo-playwright/tests/core/dropdown/dropdown.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,15 @@
await page.keyboard.press('Escape');
await expect(page).toHaveScreenshot('09-dropdown.png');
});

test('Scrollbar dropdown in active zone', async ({page}) => {
await tuiGoto(page, '/directives/dropdown/API?tuiDropdownMaxHeight=150');

const api = new TuiDocumentationPagePO(page).apiPageExample;

await api.locator('button').click();
await expect(page).toHaveScreenshot('10-dropdown.png');
await page.locator('tui-dropdown').locator('tui-scrollbar .t-thumb').click();
await expect(page).toHaveScreenshot('11-dropdown.png');

Check failure on line 80 in projects/demo-playwright/tests/core/dropdown/dropdown.spec.ts

View workflow job for this annotation

GitHub Actions / playwright / (1 of 4)

[chromium] › tests/core/dropdown/dropdown.spec.ts:72:9 › Dropdown › Scrollbar dropdown in active zone

1) [chromium] › tests/core/dropdown/dropdown.spec.ts:72:9 › Dropdown › Scrollbar dropdown in active zone Error: Screenshot comparison failed: 45610 pixels (ratio 0.03 of all image pixels) are different. Expected: /home/runner/work/taiga-ui/taiga-ui/projects/demo-playwright/snapshots/tests/core/dropdown/dropdown.spec.ts-snapshots/11-dropdown-chromium-linux.png Received: /home/runner/work/taiga-ui/taiga-ui/projects/demo-playwright/tests-results/tests-core-dropdown-dropdown-Dropdown-Scrollbar-dropdown-in-active-zone-chromium/11-dropdown-actual.png Diff: /home/runner/work/taiga-ui/taiga-ui/projects/demo-playwright/tests-results/tests-core-dropdown-dropdown-Dropdown-Scrollbar-dropdown-in-active-zone-chromium/11-dropdown-diff.png Call log: - page._expectScreenshot with timeout 5000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - 45610 pixels (ratio 0.03 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - captured a stable screenshot - 45610 pixels (ratio 0.03 of all image pixels) are different. 78 | await expect(page).toHaveScreenshot('10-dropdown.png'); 79 | await page.locator('tui-dropdown').locator('tui-scrollbar .t-thumb').click(); > 80 | await expect(page).toHaveScreenshot('11-dropdown.png'); | ^ 81 | }); 82 | }); 83 | at /home/runner/work/taiga-ui/taiga-ui/projects/demo-playwright/tests/core/dropdown/dropdown.spec.ts:80:28

Check failure on line 80 in projects/demo-playwright/tests/core/dropdown/dropdown.spec.ts

View workflow job for this annotation

GitHub Actions / playwright / (1 of 4)

[chromium] › tests/core/dropdown/dropdown.spec.ts:72:9 › Dropdown › Scrollbar dropdown in active zone

1) [chromium] › tests/core/dropdown/dropdown.spec.ts:72:9 › Dropdown › Scrollbar dropdown in active zone Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Screenshot comparison failed: 45610 pixels (ratio 0.03 of all image pixels) are different. Expected: /home/runner/work/taiga-ui/taiga-ui/projects/demo-playwright/snapshots/tests/core/dropdown/dropdown.spec.ts-snapshots/11-dropdown-chromium-linux.png Received: /home/runner/work/taiga-ui/taiga-ui/projects/demo-playwright/tests-results/tests-core-dropdown-dropdown-Dropdown-Scrollbar-dropdown-in-active-zone-chromium-retry1/11-dropdown-actual.png Diff: /home/runner/work/taiga-ui/taiga-ui/projects/demo-playwright/tests-results/tests-core-dropdown-dropdown-Dropdown-Scrollbar-dropdown-in-active-zone-chromium-retry1/11-dropdown-diff.png Call log: - page._expectScreenshot with timeout 5000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - 45610 pixels (ratio 0.03 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - captured a stable screenshot - 45610 pixels (ratio 0.03 of all image pixels) are different. 78 | await expect(page).toHaveScreenshot('10-dropdown.png'); 79 | await page.locator('tui-dropdown').locator('tui-scrollbar .t-thumb').click(); > 80 | await expect(page).toHaveScreenshot('11-dropdown.png'); | ^ 81 | }); 82 | }); 83 | at /home/runner/work/taiga-ui/taiga-ui/projects/demo-playwright/tests/core/dropdown/dropdown.spec.ts:80:28
});
});
Loading