@times-components/ts-components 1.144.1-d88954832f63cdbc40779d5cd4f06c4568affa14.22 → 1.145.1-ffc8fe2350c1f6194dbd798c9b12b0d865cd13fb.0

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/components/opta/football/opta-match-stats/commentary/__tests__/OptaMatchStatsCommentary.test.js +36 -9
  3. package/dist/components/opta/football/opta-match-stats/shared/styles.js +33 -26
  4. package/dist/components/opta/football/opta-match-stats/stats-graphs/WidgetContainer.js +14 -1
  5. package/dist/components/opta/football/opta-match-stats/{matchday-live/__tests__/OptaMatchStatsMatchdayLive.test.d.ts → stats-graphs/__tests__/WidgetContainer.test.d.ts} +0 -1
  6. package/dist/components/opta/football/opta-match-stats/stats-graphs/__tests__/WidgetContainer.test.js +57 -0
  7. package/dist/components/opta/football/opta-match-stats/summary/WidgetContainer.js +12 -4
  8. package/dist/components/opta/football/opta-match-stats/summary/__tests__/WidgetContainer.test.d.ts +1 -0
  9. package/dist/components/opta/football/opta-match-stats/summary/__tests__/WidgetContainer.test.js +70 -0
  10. package/dist/components/opta/shared/fixtures-ticker/OptaFixturesTicker.d.ts +1 -0
  11. package/dist/components/opta/shared/fixtures-ticker/OptaFixturesTicker.js +12 -3
  12. package/dist/components/opta/shared/fixtures-ticker/styles.d.ts +1 -0
  13. package/dist/components/opta/shared/fixtures-ticker/styles.js +8 -1
  14. package/dist/components/opta/utils/__tests__/useAddFixtureNavigation.test.d.ts +1 -0
  15. package/dist/components/opta/utils/__tests__/useAddFixtureNavigation.test.js +200 -0
  16. package/dist/components/opta/utils/useAddFixtureNavigation.d.ts +7 -0
  17. package/dist/components/opta/utils/useAddFixtureNavigation.js +77 -0
  18. package/dist/index.d.ts +0 -1
  19. package/dist/index.js +1 -2
  20. package/package.json +13 -12
  21. package/rnw.js +1 -1
  22. package/src/components/opta/football/opta-match-stats/commentary/__tests__/OptaMatchStatsCommentary.test.tsx +45 -10
  23. package/src/components/opta/football/opta-match-stats/commentary/__tests__/__snapshots__/OptaMatchStatsCommentary.test.tsx.snap +25 -10
  24. package/src/components/opta/football/opta-match-stats/shared/styles.ts +36 -28
  25. package/src/components/opta/football/opta-match-stats/stats-graphs/WidgetContainer.tsx +15 -0
  26. package/src/components/opta/football/opta-match-stats/stats-graphs/__tests__/WidgetContainer.test.tsx +117 -0
  27. package/src/components/opta/football/opta-match-stats/stats-graphs/__tests__/__snapshots__/OptaMatchStatsGraphs.test.tsx.snap +2 -2
  28. package/src/components/opta/football/opta-match-stats/summary/WidgetContainer.tsx +13 -3
  29. package/src/components/opta/football/opta-match-stats/summary/__tests__/WidgetContainer.test.tsx +125 -0
  30. package/src/components/opta/football/opta-match-stats/summary/__tests__/__snapshots__/OptaMatchStatsSummary.test.tsx.snap +1 -1
  31. package/src/components/opta/shared/fixtures-ticker/OptaFixturesTicker.tsx +19 -2
  32. package/src/components/opta/shared/fixtures-ticker/__tests__/__snapshots__/OptaFixturesTicker.test.tsx.snap +5 -5
  33. package/src/components/opta/shared/fixtures-ticker/styles.ts +9 -0
  34. package/src/components/opta/utils/__tests__/useAddFixtureNavigation.test.tsx +235 -0
  35. package/src/components/opta/utils/useAddFixtureNavigation.ts +101 -0
  36. package/src/index.ts +0 -3
  37. package/dist/components/opta/football/opta-match-stats/matchday-live/DesktopWidget.d.ts +0 -10
  38. package/dist/components/opta/football/opta-match-stats/matchday-live/DesktopWidget.js +0 -69
  39. package/dist/components/opta/football/opta-match-stats/matchday-live/MobileWidget.d.ts +0 -12
  40. package/dist/components/opta/football/opta-match-stats/matchday-live/MobileWidget.js +0 -90
  41. package/dist/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.d.ts +0 -12
  42. package/dist/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.js +0 -10
  43. package/dist/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.stories.d.ts +0 -1
  44. package/dist/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.stories.js +0 -24
  45. package/dist/components/opta/football/opta-match-stats/matchday-live/__tests__/OptaMatchStatsMatchdayLive.test.js +0 -48
  46. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/MatchdayLiveController.d.ts +0 -1
  47. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/MatchdayLiveController.js +0 -19
  48. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/NavigationWrapper.d.ts +0 -12
  49. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/NavigationWrapper.js +0 -67
  50. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/WidgetContainer.d.ts +0 -6
  51. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/WidgetContainer.js +0 -714
  52. package/src/components/opta/football/opta-match-stats/matchday-live/DesktopWidget.tsx +0 -108
  53. package/src/components/opta/football/opta-match-stats/matchday-live/MobileWidget.tsx +0 -158
  54. package/src/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.stories.tsx +0 -38
  55. package/src/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.tsx +0 -23
  56. package/src/components/opta/football/opta-match-stats/matchday-live/__tests__/OptaMatchStatsMatchdayLive.test.tsx +0 -61
  57. package/src/components/opta/football/opta-match-stats/matchday-live/__tests__/__snapshots__/OptaMatchStatsMatchdayLive.test.tsx.snap +0 -22
  58. package/src/components/opta/football/opta-match-stats/matchday-live/styles/MatchdayLiveController.tsx +0 -19
  59. package/src/components/opta/football/opta-match-stats/matchday-live/styles/NavigationWrapper.tsx +0 -81
  60. package/src/components/opta/football/opta-match-stats/matchday-live/styles/WidgetContainer.tsx +0 -745
@@ -11,11 +11,24 @@ jest.mock('@times-components/image', () => ({
11
11
  const mockInitSettings = jest.fn();
12
12
  const mockInitStyleSheet = jest.fn();
13
13
  const mockInitComponent = jest.fn();
14
- const mockHasMatchEvents = jest.fn();
15
14
 
16
15
  const mockInitElement = () => {
17
16
  const element = document.createElement('div');
18
- element.appendChild(document.createTextNode('Widget'));
17
+ element.className = 'Opta-Root';
18
+ // Create structure with timestamps to exercise useUpdateTimestamps
19
+ const list = document.createElement('ul');
20
+ list.className = 'Opta-Striped';
21
+ const li = document.createElement('li');
22
+ const time1 = document.createElement('span');
23
+ time1.className = 'Opta-Time';
24
+ time1.innerHTML = ' ';
25
+ const time2 = document.createElement('span');
26
+ time2.className = 'Opta-Time';
27
+ time2.textContent = "45'";
28
+ li.appendChild(time1);
29
+ li.appendChild(time2);
30
+ list.appendChild(li);
31
+ element.appendChild(list);
19
32
  return element;
20
33
  };
21
34
 
@@ -35,25 +48,47 @@ const requiredProps = {
35
48
  match: '2041900'
36
49
  };
37
50
 
38
- describe('OptaMatchStatsSummary', () => {
51
+ describe('OptaMatchStatsCommentary', () => {
39
52
  beforeEach(() => {
40
53
  jest.clearAllMocks();
41
54
  });
42
55
 
43
- it('should render correctly', async () => {
44
- const { asFragment } = render(
45
- <OptaMatchStatsCommentary {...requiredProps} />
56
+ it('renders and initialises widget', async () => {
57
+ const { asFragment, queryByTestId } = render(
58
+ <OptaMatchStatsCommentary {...requiredProps} isApp />
46
59
  );
47
60
 
48
- act(() => {
49
- mockInitComponent();
50
- mockHasMatchEvents();
61
+ expect(queryByTestId('placeholder')).toBeInTheDocument();
62
+
63
+ // allow promises in useEffect chain to resolve
64
+ await act(async () => {
65
+ await Promise.resolve();
51
66
  });
52
67
 
53
68
  expect(mockInitSettings).toHaveBeenCalledTimes(1);
54
69
  expect(mockInitStyleSheet).toHaveBeenCalledTimes(1);
55
70
  expect(mockInitComponent).toHaveBeenCalledTimes(1);
56
-
57
71
  expect(asFragment()).toMatchSnapshot();
58
72
  });
73
+
74
+ it('marks empty timestamps via useUpdateTimestamps', async () => {
75
+ jest.useFakeTimers();
76
+ const { container } = render(
77
+ <OptaMatchStatsCommentary {...requiredProps} />
78
+ );
79
+
80
+ await act(async () => {
81
+ mockInitComponent();
82
+ });
83
+
84
+ act(() => {
85
+ jest.advanceTimersByTime(500);
86
+ });
87
+
88
+ const emptyTimes = container.querySelectorAll(
89
+ '.Opta-Time.Opta-Time--empty'
90
+ );
91
+ expect(emptyTimes.length).toBeGreaterThan(0);
92
+ jest.useRealTimers();
93
+ });
59
94
  });
@@ -1,22 +1,37 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`OptaMatchStatsSummary should render correctly 1`] = `
3
+ exports[`OptaMatchStatsCommentary renders and initialises widget 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
- class="sc-bxivhb gSyDv"
6
+ class="sc-bxivhb hlADP"
7
7
  >
8
8
  <h3>
9
9
  Commentary
10
10
  </h3>
11
11
  <div
12
- class="sc-ifAKCX kVWUck"
13
- />
14
- </div>
15
- <div
16
- class="sc-bwzfXH eSqyJ"
17
- data-testid="placeholder"
18
- >
19
- Placeholder
12
+ class="sc-ifAKCX kvhXew"
13
+ >
14
+ <div
15
+ class="Opta-Root"
16
+ >
17
+ <ul
18
+ class="Opta-Striped"
19
+ >
20
+ <li>
21
+ <span
22
+ class="Opta-Time"
23
+ >
24
+  
25
+ </span>
26
+ <span
27
+ class="Opta-Time"
28
+ >
29
+ 45'
30
+ </span>
31
+ </li>
32
+ </ul>
33
+ </div>
34
+ </div>
20
35
  </div>
21
36
  </DocumentFragment>
22
37
  `;
@@ -16,35 +16,43 @@ export const WidgetWrapper = styled.div<{
16
16
  isApp: boolean;
17
17
  roundedCorners?: boolean;
18
18
  }>`
19
- background-color: ${backgroundColor};
20
- color: ${textColor};
21
- border: 1px solid ${borderColor};
22
- ${props =>
23
- props.isApp &&
24
- `
19
+ background-color: ${backgroundColor};
20
+ color: ${textColor};
21
+ ${props =>
22
+ props.isApp &&
23
+ `
25
24
  @media(prefers-color-scheme: dark) {
26
25
  background-color: ${darkBackgroundColor} !important;
27
26
  color: ${darkTextColor} !important;
28
- border: 1px solid ${darkBorderColor};
29
27
  }
30
- `} border-radius: 8px;
31
- overflow: hidden;
32
- @media (max-width: ${maxMDBreakpoint}px) {
33
- border-radius: ${props =>
34
- props.roundedCorners ? '0px 0px 8px 8px' : '0px'};
35
- }
36
-
37
- h3 {
38
- text-align: center;
39
- font-family: ${fonts.headline};
40
- font-size: 24px;
41
- font-weight: 800;
42
- padding-top: 24px;
43
- padding-bottom: 8px;
44
- margin: 0;
45
-
46
- @media (max-width: ${maxMDBreakpoint}px) {
47
- display: none;
48
- }
49
- }
50
- `;
28
+ `}
29
+
30
+ border: 1px solid ${borderColor};
31
+ border-radius: 8px;
32
+ overflow: hidden;
33
+ @media (max-width: ${maxMDBreakpoint}px) {
34
+ border-radius: ${props =>
35
+ props.roundedCorners ? '0px 0px 8px 8px' : '0px'};
36
+ }
37
+ ${props =>
38
+ props.isApp &&
39
+ `
40
+ @media(prefers-color-scheme: dark) {
41
+ border-color: ${darkBorderColor};
42
+ }
43
+ `}
44
+
45
+ h3 {
46
+ text-align: center;
47
+ font-family: ${fonts.headline};
48
+ font-size: 24px;
49
+ font-weight: 800;
50
+ padding-top: 24px;
51
+ padding-bottom: 8px;
52
+ margin: 0;
53
+
54
+ @media (max-width: ${maxMDBreakpoint}px) {
55
+ display: none;
56
+ }
57
+ }
58
+ `;
@@ -45,6 +45,13 @@ export const WidgetContainer = styled.div<{
45
45
  .Opta-Nav {
46
46
  background-color: ${backgroundColor};
47
47
  border-bottom: 1px solid ${borderColor};
48
+ ${props =>
49
+ props.isApp &&
50
+ `
51
+ @media(prefers-color-scheme: dark) {
52
+ border-color: ${darkBorderColor} !important;
53
+ }
54
+ `}
48
55
 
49
56
  ul {
50
57
  display: flex;
@@ -106,10 +113,18 @@ export const WidgetContainer = styled.div<{
106
113
  a {
107
114
  border: 1px solid ${borderColor};
108
115
  border-radius: 100px;
116
+ ${props =>
117
+ props.isApp &&
118
+ `
119
+ @media(prefers-color-scheme: dark) {
120
+ border: 1px solid ${darkBorderColor};
121
+ }
122
+ `}
109
123
  }
110
124
  }
111
125
 
112
126
  a {
127
+ -webkit-tap-highlight-color: transparent;
113
128
  display: flex;
114
129
  align-items: center;
115
130
  justify-content: center;
@@ -0,0 +1,117 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import { WidgetContainer } from '../WidgetContainer';
5
+
6
+ const HomeColour = { light: '#123456', dark: '#abcdef' };
7
+ const AwayColour = { light: '#654321', dark: '#fedcba' };
8
+
9
+ describe('OptaMatchStatsGraphs WidgetContainer styles', () => {
10
+ it('renders default styles and structure', () => {
11
+ const { container } = render(
12
+ <WidgetContainer
13
+ isApp={false}
14
+ homeTeamColor={HomeColour}
15
+ awayTeamColor={AwayColour}
16
+ >
17
+ <div className="Opta-Nav">
18
+ <ul>
19
+ <li>
20
+ <a href="#">Tab 1</a>
21
+ </li>
22
+ <li className="Opta-On">
23
+ <a href="#">Tab 2</a>
24
+ </li>
25
+ </ul>
26
+ </div>
27
+ <div className="Opta-Stats-Bars-Text">Shots</div>
28
+ <div className="Opta-Stats-Bars">
29
+ <table>
30
+ <tbody>
31
+ <tr>
32
+ <td className="Opta-Outer Opta-Outer-bigger">H</td>
33
+ <td>
34
+ <div className="Opta-Bars-Full">
35
+ <div
36
+ className="Opta-Percent Opta-Home"
37
+ style={{ width: '70%' }}
38
+ />
39
+ <div
40
+ className="Opta-Percent Opta-Away"
41
+ style={{ width: '30%' }}
42
+ />
43
+ </div>
44
+ </td>
45
+ <td className="Opta-Outer Opta-Outer-bigger">A</td>
46
+ </tr>
47
+ </tbody>
48
+ </table>
49
+ </div>
50
+ </WidgetContainer>
51
+ );
52
+ expect(container.querySelector('.Opta-Nav')).toBeInTheDocument();
53
+ expect(
54
+ container.querySelector('.Opta-Stats-Bars-Text')
55
+ ).toBeInTheDocument();
56
+ expect(
57
+ container.querySelector('.Opta-Percent.Opta-Home')
58
+ ).toBeInTheDocument();
59
+ expect(
60
+ container.querySelector('.Opta-Percent.Opta-Away')
61
+ ).toBeInTheDocument();
62
+ expect(
63
+ container.querySelector('.Opta-Outer.Opta-Outer-bigger')
64
+ ).toBeInTheDocument();
65
+ });
66
+
67
+ it('renders app styles supporting dark mode', () => {
68
+ const { container } = render(
69
+ <WidgetContainer
70
+ isApp={true}
71
+ homeTeamColor={HomeColour}
72
+ awayTeamColor={AwayColour}
73
+ >
74
+ <div className="Opta-Cf Opta-js-main" />
75
+ <div className="Opta-Nav">
76
+ <ul>
77
+ <li>
78
+ <a href="#">Tab</a>
79
+ </li>
80
+ </ul>
81
+ </div>
82
+ <div className="Opta-Stats-Bars-Text">Passes</div>
83
+ <div className="Opta-Stats-Bars">
84
+ <table>
85
+ <tbody>
86
+ <tr>
87
+ <td className="Opta-Outer Opta-Outer-bigger">H</td>
88
+ <td>
89
+ <div className="Opta-Bars-Full">
90
+ <div
91
+ className="Opta-Percent Opta-Home"
92
+ style={{ width: '40%' }}
93
+ />
94
+ <div
95
+ className="Opta-Percent Opta-Away"
96
+ style={{ width: '60%' }}
97
+ />
98
+ </div>
99
+ </td>
100
+ <td className="Opta-Outer Opta-Outer-bigger">A</td>
101
+ </tr>
102
+ </tbody>
103
+ </table>
104
+ </div>
105
+ </WidgetContainer>
106
+ );
107
+
108
+ expect(
109
+ container.querySelector('.Opta-Cf.Opta-js-main')
110
+ ).toBeInTheDocument();
111
+ expect(container.querySelector('.Opta-Nav')).toBeInTheDocument();
112
+ expect(container.querySelectorAll('.Opta-Percent').length).toBe(2);
113
+ expect(
114
+ container.querySelectorAll('.Opta-Outer.Opta-Outer-bigger').length
115
+ ).toBe(2);
116
+ });
117
+ });
@@ -3,13 +3,13 @@
3
3
  exports[`OptaMatchStatsSummary should render correctly 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
- class="sc-bxivhb hZVjBp"
6
+ class="sc-bxivhb JyPwY"
7
7
  >
8
8
  <h3>
9
9
  Match Stats
10
10
  </h3>
11
11
  <div
12
- class="sc-ifAKCX gIQeKs"
12
+ class="sc-ifAKCX CKDCL"
13
13
  />
14
14
  </div>
15
15
  <div
@@ -7,7 +7,8 @@ import {
7
7
  darkTextColor,
8
8
  borderColor,
9
9
  maxMDBreakpoint,
10
- textColor
10
+ textColor,
11
+ darkBorderColor
11
12
  } from '../shared/styles';
12
13
 
13
14
  export const WidgetContainer = styled.div<{
@@ -16,17 +17,18 @@ export const WidgetContainer = styled.div<{
16
17
  awayTeamColor: TeamColor;
17
18
  }>`
18
19
  background-color: ${backgroundColor};
20
+ border: 1px solid ${borderColor};
21
+ border-radius: 8px;
19
22
  ${props =>
20
23
  props.isApp &&
21
24
  `
22
25
  @media(prefers-color-scheme: dark) {
23
26
  background-color: ${darkBackgroundColor} !important;
24
27
  color: ${darkTextColor} !important;
28
+ border-color: ${darkBorderColor} !important;
25
29
  }
26
30
  `}
27
31
 
28
- border: 1px solid ${borderColor};
29
- border-radius: 8px;
30
32
  @media (max-width: ${maxMDBreakpoint}px) {
31
33
  border-radius: 8px 8px 0 0;
32
34
  }
@@ -43,6 +45,14 @@ export const WidgetContainer = styled.div<{
43
45
  text-align: center;
44
46
  border-bottom: 1px solid ${borderColor};
45
47
 
48
+ ${props =>
49
+ props.isApp &&
50
+ `
51
+ @media(prefers-color-scheme: dark) {
52
+ border-color: ${darkBorderColor} !important;
53
+ }
54
+ `}
55
+
46
56
  // Score row
47
57
  tr:nth-of-type(1) {
48
58
  order: 2;
@@ -0,0 +1,125 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import { WidgetContainer } from '../WidgetContainer';
5
+
6
+ const HomeColour = { light: '#123456', dark: '#abcdef' };
7
+ const AwayColour = { light: '#654321', dark: '#fedcba' };
8
+
9
+ describe('OptaMatchSummary WidgetContainer styles', () => {
10
+ it('renders default styles and header layout', () => {
11
+ const { container } = render(
12
+ <WidgetContainer
13
+ isApp={false}
14
+ homeTeamColor={HomeColour}
15
+ awayTeamColor={AwayColour}
16
+ >
17
+ <div className="Opta">
18
+ <div className="Opta_W" />
19
+ </div>
20
+ <table className="Opta-MatchHeader">
21
+ <tbody>
22
+ <tr>
23
+ <td className="Opta-Team Opta-Home">Home</td>
24
+ <td className="Opta-Score Opta-Home">
25
+ <span>
26
+ <span className="Opta-Team-Score">1</span>
27
+ </span>
28
+ </td>
29
+ <td className="Opta-Score Opta-Away">
30
+ <span>
31
+ <span className="Opta-Team-Score">2</span>
32
+ </span>
33
+ </td>
34
+ <td className="Opta-Team Opta-Away">Away</td>
35
+ <td className="Opta-Divider Opta-Dash">-</td>
36
+ </tr>
37
+ <tr className="Opta-Score-Extras">
38
+ <td>
39
+ <span className="Opta-Date">Fri 1 Dec</span>
40
+ </td>
41
+ </tr>
42
+ <tr>
43
+ <td>
44
+ <div>
45
+ <span className="Opta-MatchHeader-Venue">
46
+ <span className="Opta-MatchHeader-VenueLabel">Venue</span>
47
+ </span>
48
+ </div>
49
+ </td>
50
+ </tr>
51
+ </tbody>
52
+ </table>
53
+ <div className="Opta-Matchdata" />
54
+ <div className="Opta-Cf">
55
+ <ul className="Opta-Events Opta-Home">
56
+ <li>
57
+ <span className="Opta-Event-Text Opta-Home">
58
+ <span className="Opta-Event-Player">Player</span>
59
+ </span>
60
+ <span className="Opta-Event-Time">45'</span>
61
+ <span className="Opta-Icon" />
62
+ </li>
63
+ </ul>
64
+ </div>
65
+ </WidgetContainer>
66
+ );
67
+
68
+ expect(container.querySelector('.Opta_W')).toBeInTheDocument();
69
+ expect(
70
+ container.querySelector('.Opta-MatchHeader tbody')
71
+ ).toBeInTheDocument();
72
+ expect(container.querySelector('.Opta-Date')).toBeInTheDocument();
73
+ expect(
74
+ container.querySelector('.Opta-MatchHeader-VenueLabel')
75
+ ).toBeInTheDocument();
76
+ expect(
77
+ container.querySelector('.Opta-Events.Opta-Home')
78
+ ).toBeInTheDocument();
79
+ expect(container.querySelector('.Opta-Event-Time')).toBeInTheDocument();
80
+ });
81
+
82
+ it('renders app styles and away events layout', () => {
83
+ const { container } = render(
84
+ <WidgetContainer
85
+ isApp={true}
86
+ homeTeamColor={HomeColour}
87
+ awayTeamColor={AwayColour}
88
+ >
89
+ <table className="Opta-MatchHeader">
90
+ <tbody>
91
+ <tr className="Opta-Score-Extras">
92
+ <td>
93
+ <abbr className="Opta-Date">Sat 2 Dec</abbr>
94
+ </td>
95
+ </tr>
96
+ <tr>
97
+ <td>
98
+ <div>
99
+ <span className="Opta-Competition">League</span>
100
+ </div>
101
+ </td>
102
+ </tr>
103
+ </tbody>
104
+ </table>
105
+ <div className="Opta-Cf">
106
+ <ul className="Opta-Events Opta-Away">
107
+ <li>
108
+ <span className="Opta-Event-Text Opta-Away">
109
+ <span className="Opta-Event-Player">Player</span>
110
+ </span>
111
+ <span className="Opta-Event-Time">12'</span>
112
+ <span className="Opta-Icon" />
113
+ </li>
114
+ </ul>
115
+ </div>
116
+ </WidgetContainer>
117
+ );
118
+
119
+ expect(container.querySelector('.Opta-Competition')).toBeInTheDocument();
120
+ expect(
121
+ container.querySelector('.Opta-Events.Opta-Away')
122
+ ).toBeInTheDocument();
123
+ expect(container.querySelector('.Opta-Event-Time')).toBeInTheDocument();
124
+ });
125
+ });
@@ -3,7 +3,7 @@
3
3
  exports[`OptaMatchStatsSummary should render correctly 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
- class="sc-ifAKCX bzhjEs"
6
+ class="sc-ifAKCX eIVfcL"
7
7
  />
8
8
  <div
9
9
  class="sc-bwzfXH eSqyJ"
@@ -15,6 +15,7 @@ import { Container, WidgetContainer } from './styles';
15
15
  import { isNationalCompetition } from '../../utils/replaceTeamDetails';
16
16
  import { useUpdateTeamDetails } from '../../utils/useUpdateTeamDetails';
17
17
  import { useFixturePageLink } from '../../utils/useFixturePageLink';
18
+ import { useAddFixtureNavigation } from '../../utils/useAddFixtureNavigation';
18
19
 
19
20
  export type OptaSport = 'cricket' | 'rugby' | 'football';
20
21
 
@@ -30,6 +31,7 @@ export type OptaFixturesTickerProps = {
30
31
  showButtons?: boolean;
31
32
  fixturesPageUrl?: string;
32
33
  sport: OptaSport;
34
+ enableMatchStatsNavigation?: boolean;
33
35
  };
34
36
 
35
37
  export const OptaFixturesTicker: React.FC<OptaFixturesTickerProps> = React.memo(
@@ -44,7 +46,8 @@ export const OptaFixturesTicker: React.FC<OptaFixturesTickerProps> = React.memo(
44
46
  isApp,
45
47
  showButtons,
46
48
  fixturesPageUrl,
47
- sport
49
+ sport,
50
+ enableMatchStatsNavigation = false
48
51
  }) => {
49
52
  const ref = React.createRef<HTMLDivElement>();
50
53
  const isNationalComp = isNationalCompetition(competition, sport);
@@ -100,6 +103,15 @@ export const OptaFixturesTicker: React.FC<OptaFixturesTickerProps> = React.memo(
100
103
  !isApp &&
101
104
  useFixturePageLink(ref, 'Opta-Room', fixturesPageUrl);
102
105
 
106
+ enableMatchStatsNavigation &&
107
+ sport === 'football' &&
108
+ useAddFixtureNavigation({
109
+ ref,
110
+ sport,
111
+ competition,
112
+ season
113
+ });
114
+
103
115
  return (
104
116
  <Container>
105
117
  {!isReady && (
@@ -107,7 +119,12 @@ export const OptaFixturesTicker: React.FC<OptaFixturesTickerProps> = React.memo(
107
119
  <Placeholder />
108
120
  </PlaceholderContainer>
109
121
  )}
110
- <WidgetContainer isApp={isApp} showButtons={showButtons} ref={ref} />
122
+ <WidgetContainer
123
+ ref={ref}
124
+ isApp={isApp}
125
+ showButtons={showButtons}
126
+ enableMatchStatsNavigation={enableMatchStatsNavigation}
127
+ />
111
128
  </Container>
112
129
  );
113
130
  }
@@ -11,7 +11,7 @@ exports[`OptaFixturesTicker rugby should render correctly 1`] = `
11
11
  Placeholder
12
12
  </div>
13
13
  <div
14
- class="sc-htpNat sc-EHOje ihtnqS"
14
+ class="sc-htpNat sc-EHOje hnHrPs"
15
15
  />
16
16
  </div>
17
17
  </DocumentFragment>
@@ -28,7 +28,7 @@ exports[`OptaFixturesTicker with flags should render correctly 1`] = `
28
28
  Placeholder
29
29
  </div>
30
30
  <div
31
- class="sc-htpNat sc-EHOje ihtnqS"
31
+ class="sc-htpNat sc-EHOje hnHrPs"
32
32
  />
33
33
  </div>
34
34
  </DocumentFragment>
@@ -45,7 +45,7 @@ exports[`OptaFixturesTicker without flags should render correctly 1`] = `
45
45
  Placeholder
46
46
  </div>
47
47
  <div
48
- class="sc-htpNat sc-EHOje ihtnqS"
48
+ class="sc-htpNat sc-EHOje hnHrPs"
49
49
  />
50
50
  </div>
51
51
  </DocumentFragment>
@@ -62,7 +62,7 @@ exports[`OptaFixturesTicker without flags should render correctly with fixturesP
62
62
  Placeholder
63
63
  </div>
64
64
  <div
65
- class="sc-htpNat sc-EHOje ihtnqS"
65
+ class="sc-htpNat sc-EHOje hnHrPs"
66
66
  />
67
67
  </div>
68
68
  </DocumentFragment>
@@ -79,7 +79,7 @@ exports[`OptaFixturesTicker without flags should render correctly with isApp pro
79
79
  Placeholder
80
80
  </div>
81
81
  <div
82
- class="sc-htpNat sc-EHOje jWTkmX"
82
+ class="sc-htpNat sc-EHOje jXTwgb"
83
83
  />
84
84
  </div>
85
85
  </DocumentFragment>
@@ -48,6 +48,7 @@ export const WidgetContainerOverride = styled(WidgetContainerBase)`
48
48
  export const WidgetContainer = styled(WidgetContainerBase)<{
49
49
  isApp?: boolean;
50
50
  showButtons?: boolean;
51
+ enableMatchStatsNavigation?: boolean;
51
52
  }>`
52
53
 
53
54
 
@@ -205,6 +206,14 @@ export const WidgetContainer = styled(WidgetContainerBase)<{
205
206
  display: flex;
206
207
  flex-direction: column;
207
208
 
209
+ ${({ enableMatchStatsNavigation }) =>
210
+ enableMatchStatsNavigation &&
211
+ `
212
+ &:hover {
213
+ cursor: pointer;
214
+ }
215
+ `}
216
+
208
217
  > div {
209
218
  background-color: white !important;
210
219
  }