Skip to content

Commit

Permalink
fix(core): take into account scrollbar in active zone
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Feb 14, 2024
1 parent b079160 commit 084ea5d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
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 @@ test.describe('Dropdown', () => {
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
});
});

0 comments on commit 084ea5d

Please sign in to comment.