Skip to content

Commit

Permalink
chore: flaky again
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Feb 13, 2024
1 parent 51187c7 commit a9b58c2
Showing 1 changed file with 8 additions and 3 deletions.
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);
});
});

0 comments on commit a9b58c2

Please sign in to comment.