@times-components/ts-components 1.145.1-9176eda9ce171a0f5596bdc9d385a1fc60b23ea1.12 → 1.145.1-b504636a05999d83c7874b53febd7e86130e9cea.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/travel-mini-cta/index.d.ts +3 -0
- package/dist/components/travel-mini-cta/index.js +86 -0
- package/dist/components/travel-mini-cta/styles.d.ts +42 -0
- package/dist/components/travel-mini-cta/styles.js +273 -0
- package/dist/components/travel-mini-cta/travel-mini-cta.stories.d.ts +110 -0
- package/dist/components/travel-mini-cta/travel-mini-cta.stories.js +121 -0
- package/dist/components/travel-mini-cta/types.d.ts +10 -0
- package/dist/components/{trip-cards → travel-mini-cta}/types.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/utils/applyDarkMode.d.ts +1 -0
- package/dist/utils/applyDarkMode.js +12 -0
- package/dist/utils/getMediaQuery.d.ts +11 -0
- package/dist/utils/getMediaQuery.js +19 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +3 -0
- package/package.json +3 -3
- package/rnw.js +1 -1
- package/src/components/travel-mini-cta/index.tsx +164 -0
- package/src/components/travel-mini-cta/styles.ts +336 -0
- package/src/components/travel-mini-cta/travel-mini-cta.stories.tsx +157 -0
- package/src/components/travel-mini-cta/types.ts +10 -0
- package/src/index.ts +1 -2
- package/src/utils/applyDarkMode.ts +12 -0
- package/src/utils/getMediaQuery.ts +25 -0
- package/src/utils/index.ts +2 -0
- package/dist/components/carousel-component/CarouselComponent.stories.d.ts +0 -1
- package/dist/components/carousel-component/CarouselComponent.stories.js +0 -146
- package/dist/components/carousel-component/CarouselItem.d.ts +0 -3
- package/dist/components/carousel-component/CarouselItem.js +0 -11
- package/dist/components/carousel-component/DefaultNavigationArrow.d.ts +0 -8
- package/dist/components/carousel-component/DefaultNavigationArrow.js +0 -6
- package/dist/components/carousel-component/DefaultPageDot.d.ts +0 -8
- package/dist/components/carousel-component/DefaultPageDot.js +0 -4
- package/dist/components/carousel-component/__tests__/CarouselComponent.test.d.ts +0 -1
- package/dist/components/carousel-component/__tests__/CarouselComponent.test.js +0 -163
- package/dist/components/carousel-component/__tests__/CarouselItem.test.d.ts +0 -1
- package/dist/components/carousel-component/__tests__/CarouselItem.test.js +0 -80
- package/dist/components/carousel-component/__tests__/DefaultNavigationArrow.test.d.ts +0 -1
- package/dist/components/carousel-component/__tests__/DefaultNavigationArrow.test.js +0 -62
- package/dist/components/carousel-component/__tests__/DefaultPageDot.test.d.ts +0 -1
- package/dist/components/carousel-component/__tests__/DefaultPageDot.test.js +0 -68
- package/dist/components/carousel-component/hooks/__tests__/useCarousel.test.d.ts +0 -1
- package/dist/components/carousel-component/hooks/__tests__/useCarousel.test.js +0 -459
- package/dist/components/carousel-component/hooks/useCarousel.d.ts +0 -2
- package/dist/components/carousel-component/hooks/useCarousel.js +0 -175
- package/dist/components/carousel-component/index.d.ts +0 -4
- package/dist/components/carousel-component/index.js +0 -20
- package/dist/components/carousel-component/styles.d.ts +0 -27
- package/dist/components/carousel-component/styles.js +0 -169
- package/dist/components/carousel-component/types.d.ts +0 -53
- package/dist/components/carousel-component/types.js +0 -2
- package/dist/components/trip-cards/SkeletonCard.d.ts +0 -6
- package/dist/components/trip-cards/SkeletonCard.js +0 -21
- package/dist/components/trip-cards/TripCard.d.ts +0 -3
- package/dist/components/trip-cards/TripCard.js +0 -49
- package/dist/components/trip-cards/TripCards.stories.d.ts +0 -1
- package/dist/components/trip-cards/TripCards.stories.js +0 -189
- package/dist/components/trip-cards/TripCardsLayout.d.ts +0 -3
- package/dist/components/trip-cards/TripCardsLayout.js +0 -37
- package/dist/components/trip-cards/__tests__/SkeletonCard.test.d.ts +0 -1
- package/dist/components/trip-cards/__tests__/SkeletonCard.test.js +0 -139
- package/dist/components/trip-cards/__tests__/TripCard.test.d.ts +0 -1
- package/dist/components/trip-cards/__tests__/TripCard.test.js +0 -95
- package/dist/components/trip-cards/__tests__/TripCardsLayout.test.d.ts +0 -1
- package/dist/components/trip-cards/__tests__/TripCardsLayout.test.js +0 -277
- package/dist/components/trip-cards/__tests__/assets.test.d.ts +0 -1
- package/dist/components/trip-cards/__tests__/assets.test.js +0 -165
- package/dist/components/trip-cards/__tests__/helpers.test.d.ts +0 -1
- package/dist/components/trip-cards/__tests__/helpers.test.js +0 -214
- package/dist/components/trip-cards/__tests__/index.test.d.ts +0 -1
- package/dist/components/trip-cards/__tests__/index.test.js +0 -433
- package/dist/components/trip-cards/__tests__/mockData.test.d.ts +0 -1
- package/dist/components/trip-cards/__tests__/mockData.test.js +0 -57
- package/dist/components/trip-cards/__tests__/skeletonStyles.test.d.ts +0 -1
- package/dist/components/trip-cards/__tests__/skeletonStyles.test.js +0 -194
- package/dist/components/trip-cards/assets/BoatIcon.d.ts +0 -1
- package/dist/components/trip-cards/assets/BoatIcon.js +0 -4
- package/dist/components/trip-cards/assets/CalendarIcon.d.ts +0 -1
- package/dist/components/trip-cards/assets/CalendarIcon.js +0 -4
- package/dist/components/trip-cards/assets/ChevronRightIcon.d.ts +0 -1
- package/dist/components/trip-cards/assets/ChevronRightIcon.js +0 -4
- package/dist/components/trip-cards/assets/LocationIcon.d.ts +0 -1
- package/dist/components/trip-cards/assets/LocationIcon.js +0 -4
- package/dist/components/trip-cards/assets/MoonIcon.d.ts +0 -1
- package/dist/components/trip-cards/assets/MoonIcon.js +0 -4
- package/dist/components/trip-cards/assets/index.d.ts +0 -6
- package/dist/components/trip-cards/assets/index.js +0 -7
- package/dist/components/trip-cards/helpers.d.ts +0 -4
- package/dist/components/trip-cards/helpers.js +0 -116
- package/dist/components/trip-cards/index.d.ts +0 -4
- package/dist/components/trip-cards/index.js +0 -70
- package/dist/components/trip-cards/mockData.d.ts +0 -3
- package/dist/components/trip-cards/mockData.js +0 -317
- package/dist/components/trip-cards/skeletonStyles.d.ts +0 -9
- package/dist/components/trip-cards/skeletonStyles.js +0 -37
- package/dist/components/trip-cards/styles.d.ts +0 -38
- package/dist/components/trip-cards/styles.js +0 -401
- package/dist/components/trip-cards/types.d.ts +0 -119
- package/src/components/carousel-component/CarouselComponent.stories.tsx +0 -220
- package/src/components/carousel-component/CarouselItem.tsx +0 -25
- package/src/components/carousel-component/DefaultNavigationArrow.tsx +0 -37
- package/src/components/carousel-component/DefaultPageDot.tsx +0 -20
- package/src/components/carousel-component/__tests__/CarouselComponent.test.tsx +0 -259
- package/src/components/carousel-component/__tests__/CarouselItem.test.tsx +0 -140
- package/src/components/carousel-component/__tests__/DefaultNavigationArrow.test.tsx +0 -153
- package/src/components/carousel-component/__tests__/DefaultPageDot.test.tsx +0 -105
- package/src/components/carousel-component/hooks/__tests__/useCarousel.test.ts +0 -625
- package/src/components/carousel-component/hooks/useCarousel.ts +0 -231
- package/src/components/carousel-component/index.tsx +0 -92
- package/src/components/carousel-component/styles.ts +0 -185
- package/src/components/carousel-component/types.ts +0 -62
- package/src/components/trip-cards/SkeletonCard.tsx +0 -62
- package/src/components/trip-cards/TripCard.tsx +0 -143
- package/src/components/trip-cards/TripCards.stories.tsx +0 -254
- package/src/components/trip-cards/TripCardsLayout.tsx +0 -108
- package/src/components/trip-cards/__tests__/SkeletonCard.test.tsx +0 -169
- package/src/components/trip-cards/__tests__/TripCard.test.tsx +0 -120
- package/src/components/trip-cards/__tests__/TripCardsLayout.test.tsx +0 -532
- package/src/components/trip-cards/__tests__/assets.test.tsx +0 -206
- package/src/components/trip-cards/__tests__/helpers.test.ts +0 -264
- package/src/components/trip-cards/__tests__/index.test.tsx +0 -495
- package/src/components/trip-cards/__tests__/mockData.test.ts +0 -67
- package/src/components/trip-cards/__tests__/skeletonStyles.test.tsx +0 -256
- package/src/components/trip-cards/assets/BoatIcon.tsx +0 -17
- package/src/components/trip-cards/assets/CalendarIcon.tsx +0 -17
- package/src/components/trip-cards/assets/ChevronRightIcon.tsx +0 -20
- package/src/components/trip-cards/assets/LocationIcon.tsx +0 -17
- package/src/components/trip-cards/assets/MoonIcon.tsx +0 -17
- package/src/components/trip-cards/assets/index.ts +0 -7
- package/src/components/trip-cards/helpers.ts +0 -151
- package/src/components/trip-cards/index.tsx +0 -119
- package/src/components/trip-cards/mockData.ts +0 -345
- package/src/components/trip-cards/skeletonStyles.ts +0 -46
- package/src/components/trip-cards/styles.ts +0 -446
- package/src/components/trip-cards/types.ts +0 -128
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
import { DefaultNavigationArrow } from '../DefaultNavigationArrow';
|
|
5
|
-
|
|
6
|
-
describe('DefaultNavigationArrow', () => {
|
|
7
|
-
const mockOnClick = jest.fn();
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
mockOnClick.mockClear();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('renders left arrow', () => {
|
|
14
|
-
render(
|
|
15
|
-
<DefaultNavigationArrow
|
|
16
|
-
direction="left"
|
|
17
|
-
onClick={mockOnClick}
|
|
18
|
-
disabled={false}
|
|
19
|
-
/>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const button = screen.getByLabelText('Previous items');
|
|
23
|
-
expect(button).toBeInTheDocument();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('renders right arrow', () => {
|
|
27
|
-
render(
|
|
28
|
-
<DefaultNavigationArrow
|
|
29
|
-
direction="right"
|
|
30
|
-
onClick={mockOnClick}
|
|
31
|
-
disabled={false}
|
|
32
|
-
/>
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const button = screen.getByLabelText('Next items');
|
|
36
|
-
expect(button).toBeInTheDocument();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('calls onClick when clicked', () => {
|
|
40
|
-
render(
|
|
41
|
-
<DefaultNavigationArrow
|
|
42
|
-
direction="left"
|
|
43
|
-
onClick={mockOnClick}
|
|
44
|
-
disabled={false}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
const button = screen.getByLabelText('Previous items');
|
|
49
|
-
fireEvent.click(button);
|
|
50
|
-
|
|
51
|
-
expect(mockOnClick).toHaveBeenCalledTimes(1);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('does not call onClick when disabled', () => {
|
|
55
|
-
render(
|
|
56
|
-
<DefaultNavigationArrow
|
|
57
|
-
direction="left"
|
|
58
|
-
onClick={mockOnClick}
|
|
59
|
-
disabled={true}
|
|
60
|
-
/>
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
const button = screen.getByLabelText('Previous items');
|
|
64
|
-
fireEvent.click(button);
|
|
65
|
-
|
|
66
|
-
expect(mockOnClick).not.toHaveBeenCalled();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('applies disabled styling when disabled', () => {
|
|
70
|
-
render(
|
|
71
|
-
<DefaultNavigationArrow
|
|
72
|
-
direction="left"
|
|
73
|
-
onClick={mockOnClick}
|
|
74
|
-
disabled={true}
|
|
75
|
-
/>
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const button = screen.getByLabelText('Previous items');
|
|
79
|
-
expect(button).toHaveAttribute('disabled');
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('renders SVG icon', () => {
|
|
83
|
-
const { container } = render(
|
|
84
|
-
<DefaultNavigationArrow
|
|
85
|
-
direction="left"
|
|
86
|
-
onClick={mockOnClick}
|
|
87
|
-
disabled={false}
|
|
88
|
-
/>
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
const svg = container.querySelector('svg');
|
|
92
|
-
expect(svg).toBeInTheDocument();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('has correct aria-label for accessibility', () => {
|
|
96
|
-
const { rerender } = render(
|
|
97
|
-
<DefaultNavigationArrow
|
|
98
|
-
direction="left"
|
|
99
|
-
onClick={mockOnClick}
|
|
100
|
-
disabled={false}
|
|
101
|
-
/>
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
expect(screen.getByLabelText('Previous items')).toBeInTheDocument();
|
|
105
|
-
|
|
106
|
-
rerender(
|
|
107
|
-
<DefaultNavigationArrow
|
|
108
|
-
direction="right"
|
|
109
|
-
onClick={mockOnClick}
|
|
110
|
-
disabled={false}
|
|
111
|
-
/>
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
expect(screen.getByLabelText('Next items')).toBeInTheDocument();
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('renders as a button element', () => {
|
|
118
|
-
render(
|
|
119
|
-
<DefaultNavigationArrow
|
|
120
|
-
direction="left"
|
|
121
|
-
onClick={mockOnClick}
|
|
122
|
-
disabled={false}
|
|
123
|
-
/>
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
const button = screen.getByLabelText('Previous items');
|
|
127
|
-
expect(button.tagName).toBe('BUTTON');
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it('applies correct styles based on direction', () => {
|
|
131
|
-
const { container, rerender } = render(
|
|
132
|
-
<DefaultNavigationArrow
|
|
133
|
-
direction="left"
|
|
134
|
-
onClick={mockOnClick}
|
|
135
|
-
disabled={false}
|
|
136
|
-
/>
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
let button = container.querySelector('button');
|
|
140
|
-
expect(button).toBeInTheDocument();
|
|
141
|
-
|
|
142
|
-
rerender(
|
|
143
|
-
<DefaultNavigationArrow
|
|
144
|
-
direction="right"
|
|
145
|
-
onClick={mockOnClick}
|
|
146
|
-
disabled={false}
|
|
147
|
-
/>
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
button = container.querySelector('button');
|
|
151
|
-
expect(button).toBeInTheDocument();
|
|
152
|
-
});
|
|
153
|
-
});
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
import { DefaultPageDot } from '../DefaultPageDot';
|
|
5
|
-
|
|
6
|
-
describe('DefaultPageDot', () => {
|
|
7
|
-
const mockOnClick = jest.fn();
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
mockOnClick.mockClear();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('renders active dot', () => {
|
|
14
|
-
render(<DefaultPageDot active={true} onClick={mockOnClick} index={0} />);
|
|
15
|
-
|
|
16
|
-
const button = screen.getByRole('button');
|
|
17
|
-
expect(button).toBeInTheDocument();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('renders inactive dot', () => {
|
|
21
|
-
render(<DefaultPageDot active={false} onClick={mockOnClick} index={0} />);
|
|
22
|
-
|
|
23
|
-
const button = screen.getByRole('button');
|
|
24
|
-
expect(button).toBeInTheDocument();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('calls onClick when clicked', () => {
|
|
28
|
-
render(<DefaultPageDot active={false} onClick={mockOnClick} index={0} />);
|
|
29
|
-
|
|
30
|
-
const button = screen.getByRole('button');
|
|
31
|
-
fireEvent.click(button);
|
|
32
|
-
|
|
33
|
-
expect(mockOnClick).toHaveBeenCalledTimes(1);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('renders multiple dots with different indices', () => {
|
|
37
|
-
const { rerender } = render(
|
|
38
|
-
<DefaultPageDot active={true} onClick={mockOnClick} index={0} />
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
expect(screen.getByRole('button')).toBeInTheDocument();
|
|
42
|
-
|
|
43
|
-
rerender(<DefaultPageDot active={false} onClick={mockOnClick} index={1} />);
|
|
44
|
-
|
|
45
|
-
expect(screen.getByRole('button')).toBeInTheDocument();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('handles active state changes', () => {
|
|
49
|
-
const { rerender } = render(
|
|
50
|
-
<DefaultPageDot active={false} onClick={mockOnClick} index={0} />
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const button = screen.getByRole('button');
|
|
54
|
-
expect(button).toBeInTheDocument();
|
|
55
|
-
|
|
56
|
-
rerender(<DefaultPageDot active={true} onClick={mockOnClick} index={0} />);
|
|
57
|
-
|
|
58
|
-
expect(button).toBeInTheDocument();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('applies different styling for active vs inactive state', () => {
|
|
62
|
-
const { container, rerender } = render(
|
|
63
|
-
<DefaultPageDot active={false} onClick={mockOnClick} index={0} />
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const inactiveButton = container.querySelector('button');
|
|
67
|
-
expect(inactiveButton).toBeInTheDocument();
|
|
68
|
-
|
|
69
|
-
rerender(<DefaultPageDot active={true} onClick={mockOnClick} index={0} />);
|
|
70
|
-
|
|
71
|
-
const activeButton = container.querySelector('button');
|
|
72
|
-
expect(activeButton).toBeInTheDocument();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('renders as a button element', () => {
|
|
76
|
-
render(<DefaultPageDot active={true} onClick={mockOnClick} index={0} />);
|
|
77
|
-
|
|
78
|
-
const button = screen.getByRole('button');
|
|
79
|
-
expect(button.tagName).toBe('BUTTON');
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('passes correct index to onClick handler', () => {
|
|
83
|
-
const { rerender } = render(
|
|
84
|
-
<DefaultPageDot active={false} onClick={mockOnClick} index={2} />
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
const button = screen.getByRole('button');
|
|
88
|
-
fireEvent.click(button);
|
|
89
|
-
|
|
90
|
-
expect(mockOnClick).toHaveBeenCalledTimes(1);
|
|
91
|
-
|
|
92
|
-
rerender(<DefaultPageDot active={false} onClick={mockOnClick} index={5} />);
|
|
93
|
-
|
|
94
|
-
fireEvent.click(button);
|
|
95
|
-
expect(mockOnClick).toHaveBeenCalledTimes(2);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('is focusable for keyboard navigation', () => {
|
|
99
|
-
render(<DefaultPageDot active={false} onClick={mockOnClick} index={0} />);
|
|
100
|
-
|
|
101
|
-
const button = screen.getByRole('button');
|
|
102
|
-
button.focus();
|
|
103
|
-
expect(document.activeElement).toBe(button);
|
|
104
|
-
});
|
|
105
|
-
});
|