Skip to content

Commit

Permalink
update cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prabhuignoto committed Nov 6, 2020
1 parent 3c97e7d commit 3c73d63
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 40 deletions.
31 changes: 0 additions & 31 deletions cypress/integration/react-chrono/horizontal_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,6 @@ context('Chrono.Vertical.Basic', () => {
});
});

it('interact with timeline point', () => {
const pick = 12;
cy.get('.timeline-main-wrapper').scrollTo('right');
cy.wait(1500);

cy.get('.timeline-horz-item-container')
.eq(pick)
.find('.timeline-circle')
.click();
cy.wait(400);

cy.get('.timeline-card-content').within(() => {
cy.get('.card-title').should('contain', 'Nagasaki');
cy.get('.card-sub-title').should(
'contain',
'Atomic bomb mushroom cloud over the Japanese city of Nagasaki',
);
});

cy.get('.timeline-main-wrapper').scrollTo('left');
cy.wait(1500);
cy.get('.timeline-horz-item-container')
.eq(0)
.find('.timeline-circle')
.click();
cy.wait(400);
cy.get('.timeline-card-content').within(() => {
cy.get('.card-title').should('contain', 'Dunkirk');
});
});

it('check navigation controls', () => {
cy.get('.timeline-controls').within(() => {
cy.get('li').eq(3).click();
Expand Down
1 change: 0 additions & 1 deletion src/components/effects/useNewScrollPosition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ useNewScrollPosition = function (mode: TimelineMode, itemWidth?: number) {
setNewOffset(timelinePointOffset - itemWidth);
}
} else if (mode === 'VERTICAL' || mode === 'VERTICAL_ALTERNATING') {
debugger;
if (!timelineContentOffset || !timelineContentHeight) {
return;
}
Expand Down
14 changes: 8 additions & 6 deletions src/components/timeline-vertical/timeline-vertical-item.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo, useRef } from 'react';
import React, { useCallback, useMemo, useRef } from 'react';
import { VerticalItemModel } from '../../models/TimelineVerticalModel';
import TimelineCard from '../timeline-elements/timeline-card-content/timeline-card-content';
import TimelineItemTitle from '../timeline-elements/timeline-item-title/timeline-card-title';
Expand Down Expand Up @@ -58,6 +58,12 @@ const VerticalItem: React.FunctionComponent<VerticalItemModel> = (
);
}, [active]);

const handleShowMore = useCallback(() => {
setTimeout(() => {
handleOnActive(0);
}, 100);
}, []);

const Content = useMemo(() => {
return (
<TimelineCardContentWrapper
Expand All @@ -84,11 +90,7 @@ const VerticalItem: React.FunctionComponent<VerticalItemModel> = (
theme={theme}
title={cardTitle}
hasFocus={hasFocus}
onShowMore={() =>
setTimeout(() => {
handleOnActive(0);
}, 100)
}
onShowMore={handleShowMore}
/>
</TimelineCardContentWrapper>
);
Expand Down
2 changes: 0 additions & 2 deletions src/components/timeline/timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ const Timeline: React.FunctionComponent<TimelineModel> = (
const handleScroll = useCallback(
(scroll: Partial<Scroll>) => {
const element = timelineMainRef.current;
debugger;
if (element) {
setNewOffset(element, scroll);
}
Expand All @@ -129,7 +128,6 @@ const Timeline: React.FunctionComponent<TimelineModel> = (
if (mode === 'HORIZONTAL') {
ele.scrollLeft = newOffSet;
} else {
debugger;
ele.scrollTop = newOffSet;
}
}, [newOffSet, mode]);
Expand Down

0 comments on commit 3c73d63

Please sign in to comment.