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

chore: flaky again #6764

Merged
merged 1 commit into from
Feb 13, 2024
Merged
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
11 changes: 8 additions & 3 deletions projects/demo-cypress/src/tests/elastic-sticky.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('ElasticSticky', () => {
<div style="height: 50px">I'm header</div>
<div
style="position: sticky; height: 50px; top: 0"
(tuiElasticSticky)="change.emit($event)"
(tuiElasticSticky)="change.emit(transform($event))"
>
I'm sticky
</div>
Expand All @@ -27,6 +27,11 @@ describe('ElasticSticky', () => {
class TestComponent {
@Output()
change = new EventEmitter<number>();

transform(value: number): number {
// sometimes tuiElasticSticky emit 0.5, 0.52 or 0.53 on CI
return Number(value.toFixed(1));
}
}

beforeEach(() =>
Expand All @@ -40,11 +45,11 @@ describe('ElasticSticky', () => {

it('callback is triggered with 0.5 when half of sticky would be hidden', () => {
cy.get('#scroll').scrollTo(0, 75);
cy.get('@changeSpy').should('be.called').should('have.been.calledWithMatch', 0.5);
cy.get('@changeSpy').should('be.called').should('have.been.calledWith', 0.5);
});

it('callback is triggered with 0 when sticky is fully hidden', () => {
cy.get('#scroll').scrollTo(0, 100);
cy.get('@changeSpy').should('be.called').should('have.been.calledWithMatch', 0);
cy.get('@changeSpy').should('be.called').should('have.been.calledWith', 0);
});
});
Loading