@ray-js/ipc-player-integration 0.0.53-beta.10 → 0.0.53-beta.11

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.
@@ -91,17 +91,21 @@ export const VideoBitKBP = props => {
91
91
  })
92
92
  }, /*#__PURE__*/React.createElement(View, {
93
93
  className: "ipc-player-plugin-videoBitKBP"
94
+ }, /*#__PURE__*/React.createElement(View, {
95
+ className: "ipc-player-plugin-videoBitKBP-content"
94
96
  }, hasSignal && /*#__PURE__*/React.createElement(View, {
95
97
  className: "ipc-player-plugin-videoBitKBP-signal"
96
98
  }, /*#__PURE__*/React.createElement(Text, {
97
99
  className: clsx('icon-panel', 'icon-panel-wi-Fi', 'ipc-player-plugin-videoBitKBP-signal-icon')
98
- }), /*#__PURE__*/React.createElement(Text, null, signalStrength), /*#__PURE__*/React.createElement(Text, {
99
- className: "ipc-player-plugin-videoBitKBP-unit-percent"
100
+ }), /*#__PURE__*/React.createElement(Text, {
101
+ className: "ipc-player-plugin-videoBitKBP-signal-text"
102
+ }, signalStrength), /*#__PURE__*/React.createElement(Text, {
103
+ className: "ipc-player-plugin-videoBitKBP-signal-text ipc-player-plugin-videoBitKBP-unit-percent"
100
104
  }, signalStrength > 0 ? '%' : 'dBm')), hasSignal && (hasKbps || hasClarity) && /*#__PURE__*/React.createElement(View, {
101
105
  className: "ipc-player-plugin-videoBitKBP-divider"
102
106
  }), (hasKbps || hasClarity) && /*#__PURE__*/React.createElement(View, {
103
107
  className: "ipc-player-plugin-videoBitKBP-kbps"
104
108
  }, /*#__PURE__*/React.createElement(Text, {
105
109
  className: "ipc-player-plugin-videoBitKBP-kbps-text"
106
- }, bitrateLabel))));
110
+ }, bitrateLabel)))));
107
111
  };
@@ -18,24 +18,33 @@
18
18
  background-color: rgba(255, 255, 255, 0.2);
19
19
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
20
20
  }
21
- .ipc-player-plugin-videoBitKBP-signal {
21
+ .ipc-player-plugin-videoBitKBP-content {
22
22
  display: flex;
23
- align-items: center;
23
+ align-items: baseline;
24
+ }
25
+ .ipc-player-plugin-videoBitKBP-signal,
26
+ .ipc-player-plugin-videoBitKBP-kbps {
27
+ display: flex;
28
+ align-items: baseline;
29
+ height: calc(16px * var(--ipc-player-size-scale, 1));
30
+ line-height: calc(16px * var(--ipc-player-size-scale, 1));
24
31
  }
25
32
  .ipc-player-plugin-videoBitKBP-signal-icon {
33
+ align-self: center;
26
34
  font-size: calc(14px * var(--ipc-player-size-scale, 1));
27
35
  margin-right: calc(4px * var(--ipc-player-size-scale, 1));
28
36
  }
37
+ .ipc-player-plugin-videoBitKBP-signal-text,
38
+ .ipc-player-plugin-videoBitKBP-kbps-text {
39
+ line-height: calc(16px * var(--ipc-player-size-scale, 1));
40
+ }
29
41
  .ipc-player-plugin-videoBitKBP-divider {
42
+ align-self: center;
30
43
  width: 1px;
31
44
  height: calc(10px * var(--ipc-player-size-scale, 1));
32
45
  background-color: var(--iconColor);
33
46
  margin: 0 calc(4px * var(--ipc-player-size-scale, 1));
34
47
  }
35
- .ipc-player-plugin-videoBitKBP-kbps {
36
- display: flex;
37
- align-items: center;
38
- }
39
48
  .ipc-player-plugin-videoBitKBP-kbps-text {
40
49
  white-space: nowrap;
41
50
  }
@@ -1,8 +1,10 @@
1
+ import "core-js/modules/esnext.iterator.constructor.js";
2
+ import "core-js/modules/esnext.iterator.map.js";
1
3
  import React from 'react';
2
4
  import ReactDOM from 'react-dom';
3
5
  import { renderToStaticMarkup } from 'react-dom/server';
4
6
  import { act } from 'react-dom/test-utils';
5
- import { getVideoBitrateKbps } from '@ray-js/ray-ipc-utils';
7
+ import { getVideoBitrateKbps, requestWifiSignal } from '@ray-js/ray-ipc-utils';
6
8
  let mockStoreState;
7
9
  jest.mock('@ray-js/ray', () => ({
8
10
  View: _ref => {
@@ -97,6 +99,48 @@ describe('VideoBitKBP auto clarity', () => {
97
99
  ReactDOM.unmountComponentAtNode(container);
98
100
  }
99
101
  });
102
+ it('keeps signal and auto clarity in the same bitrate badge', async () => {
103
+ const container = document.createElement('div');
104
+ getVideoBitrateKbps.mockResolvedValue({
105
+ code: 0,
106
+ data: {
107
+ kbps: '128'
108
+ }
109
+ });
110
+ requestWifiSignal.mockResolvedValue({
111
+ code: 0,
112
+ data: '-60'
113
+ });
114
+ mockStoreState = {
115
+ resolution: 'AUTO',
116
+ autoClarity: 'HD',
117
+ playState: 1
118
+ };
119
+ try {
120
+ var _container$querySelec, _container$querySelec2, _container$querySelec3, _container$querySelec4, _container$querySelec5;
121
+ await act(async () => {
122
+ ReactDOM.render(/*#__PURE__*/React.createElement(VideoBitKBP, {
123
+ devId: 'device'
124
+ }), container);
125
+ });
126
+ expect((_container$querySelec = container.querySelector('.ipc-player-plugin-videoBitKBP-signal')) === null || _container$querySelec === void 0 ? void 0 : _container$querySelec.textContent).toBe('-60dBm');
127
+ expect((_container$querySelec2 = container.querySelector('.ipc-player-plugin-videoBitKBP-kbps')) === null || _container$querySelec2 === void 0 ? void 0 : _container$querySelec2.textContent).toBe('ipc_player_resolution_HD 128 KB/S');
128
+ expect(Array.from((_container$querySelec3 = (_container$querySelec4 = container.querySelector('.ipc-player-plugin-videoBitKBP-content')) === null || _container$querySelec4 === void 0 ? void 0 : _container$querySelec4.children) !== null && _container$querySelec3 !== void 0 ? _container$querySelec3 : []).map(element => element.className)).toEqual(['ipc-player-plugin-videoBitKBP-signal', 'ipc-player-plugin-videoBitKBP-divider', 'ipc-player-plugin-videoBitKBP-kbps']);
129
+ mockStoreState = {
130
+ resolution: 'HD',
131
+ autoClarity: 'HD',
132
+ playState: 1
133
+ };
134
+ act(() => {
135
+ ReactDOM.render(/*#__PURE__*/React.createElement(VideoBitKBP, {
136
+ devId: 'device'
137
+ }), container);
138
+ });
139
+ expect((_container$querySelec5 = container.querySelector('.ipc-player-plugin-videoBitKBP-kbps')) === null || _container$querySelec5 === void 0 ? void 0 : _container$querySelec5.textContent).toBe('128 KB/S');
140
+ } finally {
141
+ ReactDOM.unmountComponentAtNode(container);
142
+ }
143
+ });
100
144
  it('shows actual clarity independently of bitrate, signal and play state', () => {
101
145
  const markup = renderWidget('AUTO', 'HD', 2);
102
146
  expect(markup).toContain('ipc_player_resolution_HD');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.53-beta.10",
3
+ "version": "0.0.53-beta.11",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [