@gcorevideo/player 2.23.1 → 2.23.2
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/assets/bottom-gear/bottomgear.ejs +5 -2
- package/dist/core.js +1 -1
- package/dist/index.css +1163 -1163
- package/dist/index.js +35 -11
- package/dist/player.d.ts +67 -53
- package/docs/api/{player.mediacontrol.putelement.md → player.clips.gettext.md} +10 -23
- package/docs/api/player.clips.md +14 -0
- package/docs/api/player.md +9 -0
- package/docs/api/player.mediacontrol.md +0 -14
- package/docs/api/player.poster.md +2 -10
- package/docs/api/player.posterpluginsettings.md +16 -0
- package/docs/api/player.thumbnails._constructor_.md +50 -0
- package/docs/api/player.thumbnails.md +73 -0
- package/docs/api/player.thumbnails.render.md +18 -0
- package/docs/api/player.thumbnailspluginsettings.md +4 -4
- package/lib/plugins/bottom-gear/BottomGear.d.ts +5 -2
- package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
- package/lib/plugins/bottom-gear/BottomGear.js +33 -9
- package/package.json +1 -1
- package/src/plugins/bottom-gear/BottomGear.ts +35 -10
- package/src/plugins/bottom-gear/__tests__/BottomGear.test.ts +92 -55
- package/src/plugins/bottom-gear/__tests__/__snapshots__/BottomGear.test.ts.snap +4 -4
- package/temp/player.api.json +144 -70
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -82,6 +82,8 @@ export declare enum GearEvents {
|
|
|
82
82
|
*/
|
|
83
83
|
export declare class BottomGear extends UICorePlugin {
|
|
84
84
|
private hd;
|
|
85
|
+
private numItems;
|
|
86
|
+
private collapsed;
|
|
85
87
|
/**
|
|
86
88
|
* @internal
|
|
87
89
|
*/
|
|
@@ -149,9 +151,10 @@ export declare class BottomGear extends UICorePlugin {
|
|
|
149
151
|
* Should be called by the UI plugin that added a gear item with a submenu when the latter is closed (e.g., when a "back" button is clicked).
|
|
150
152
|
*/
|
|
151
153
|
refresh(): void;
|
|
152
|
-
private
|
|
153
|
-
private
|
|
154
|
+
private toggleMenu;
|
|
155
|
+
private collapse;
|
|
154
156
|
private onCoreReady;
|
|
155
157
|
private onMediaControlRendered;
|
|
158
|
+
private mount;
|
|
156
159
|
}
|
|
157
160
|
//# sourceMappingURL=BottomGear.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomGear.d.ts","sourceRoot":"","sources":["../../../src/plugins/bottom-gear/BottomGear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuC,MAAM,cAAc,CAAA;AAOhF,OAAO,uCAAuC,CAAA;AAC9C,OAAO,gDAAgD,CAAA;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAO5C;;;GAGG;AACH,oBAAY,UAAU;IACpB;;OAEG;IACH,QAAQ,aAAa;CACtB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,EAAE,CAAQ;IAElB;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEvD;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED;;OAEG;IACM,UAAU;IASnB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,WAAW;
|
|
1
|
+
{"version":3,"file":"BottomGear.d.ts","sourceRoot":"","sources":["../../../src/plugins/bottom-gear/BottomGear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuC,MAAM,cAAc,CAAA;AAOhF,OAAO,uCAAuC,CAAA;AAC9C,OAAO,gDAAgD,CAAA;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAO5C;;;GAGG;AACH,oBAAY,UAAU;IACpB;;OAEG;IACH,QAAQ,aAAa;CACtB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,EAAE,CAAQ;IAElB,OAAO,CAAC,QAAQ,CAAK;IAErB,OAAO,CAAC,SAAS,CAAQ;IAEzB;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEvD;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED;;OAEG;IACM,UAAU;IASnB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,WAAW;IA6B1D,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,oBAAoB;IAM5B;;OAEG;IACM,MAAM;IAsBf;;;;OAIG;IACH,OAAO;IAKP,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,WAAW;IAqBnB,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,KAAK;CAOd"}
|
|
@@ -92,6 +92,8 @@ export var GearEvents;
|
|
|
92
92
|
*/
|
|
93
93
|
export class BottomGear extends UICorePlugin {
|
|
94
94
|
hd = false;
|
|
95
|
+
numItems = 0;
|
|
96
|
+
collapsed = true;
|
|
95
97
|
/**
|
|
96
98
|
* @internal
|
|
97
99
|
*/
|
|
@@ -124,7 +126,7 @@ export class BottomGear extends UICorePlugin {
|
|
|
124
126
|
*/
|
|
125
127
|
get events() {
|
|
126
128
|
return {
|
|
127
|
-
'click #gear-button': '
|
|
129
|
+
'click #gear-button': 'toggleMenu',
|
|
128
130
|
};
|
|
129
131
|
}
|
|
130
132
|
/**
|
|
@@ -178,6 +180,10 @@ export class BottomGear extends UICorePlugin {
|
|
|
178
180
|
this.$el.find('#gear-options').hide();
|
|
179
181
|
});
|
|
180
182
|
}
|
|
183
|
+
this.numItems++;
|
|
184
|
+
if (this.numItems > 0) {
|
|
185
|
+
this.$el.show();
|
|
186
|
+
}
|
|
181
187
|
return $item;
|
|
182
188
|
}
|
|
183
189
|
onActiveContainerChanged() {
|
|
@@ -191,7 +197,7 @@ export class BottomGear extends UICorePlugin {
|
|
|
191
197
|
highDefinitionUpdate(isHd) {
|
|
192
198
|
trace(`${T} highDefinitionUpdate`, { isHd });
|
|
193
199
|
this.hd = isHd;
|
|
194
|
-
this.$el.find('
|
|
200
|
+
this.$el.find('#gear-button').html(isHd ? gearHdIcon : gearIcon);
|
|
195
201
|
}
|
|
196
202
|
/**
|
|
197
203
|
* @internal
|
|
@@ -203,11 +209,13 @@ export class BottomGear extends UICorePlugin {
|
|
|
203
209
|
return this; // TODO test
|
|
204
210
|
}
|
|
205
211
|
const icon = this.hd ? gearHdIcon : gearIcon;
|
|
212
|
+
this.collapsed = true;
|
|
213
|
+
this.numItems = 0;
|
|
206
214
|
this.$el
|
|
207
215
|
.html(BottomGear.template({ icon }))
|
|
208
|
-
.
|
|
216
|
+
.hide() // until numItems > 0
|
|
217
|
+
.find('#gear-options-wrapper')
|
|
209
218
|
.hide();
|
|
210
|
-
// TODO make non-clickable when there are no items
|
|
211
219
|
setTimeout(() => {
|
|
212
220
|
this.trigger(GearEvents.RENDERED);
|
|
213
221
|
}, 0);
|
|
@@ -222,30 +230,46 @@ export class BottomGear extends UICorePlugin {
|
|
|
222
230
|
this.$el.find('.gear-sub-menu-wrapper').hide();
|
|
223
231
|
this.$el.find('#gear-options').show();
|
|
224
232
|
}
|
|
225
|
-
|
|
233
|
+
toggleMenu() {
|
|
226
234
|
this.core
|
|
227
235
|
.getPlugin('media_control')
|
|
228
236
|
.trigger(ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE, this.name);
|
|
229
|
-
this
|
|
237
|
+
this.collapsed = !this.collapsed;
|
|
238
|
+
if (this.collapsed) {
|
|
239
|
+
this.$el.find('#gear-options-wrapper').hide();
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
this.$el.find('#gear-options-wrapper').show();
|
|
243
|
+
}
|
|
244
|
+
this.$el.find('#gear-button').attr('aria-expanded', (!this.collapsed).toString());
|
|
245
|
+
trace(`${T} toggleMenu`, { hidden: this.collapsed });
|
|
230
246
|
}
|
|
231
|
-
|
|
247
|
+
collapse() {
|
|
232
248
|
trace(`${T} hide`);
|
|
249
|
+
this.collapsed = true;
|
|
233
250
|
this.$el.find('#gear-options-wrapper').hide();
|
|
251
|
+
this.$el.find('#gear-button').attr('aria-expanded', 'false');
|
|
234
252
|
}
|
|
235
253
|
onCoreReady() {
|
|
236
254
|
trace(`${T} onCoreReady`);
|
|
237
255
|
const mediaControl = this.core.getPlugin('media_control');
|
|
238
256
|
assert(mediaControl, 'media_control plugin is required');
|
|
239
257
|
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_RENDERED, this.onMediaControlRendered);
|
|
240
|
-
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_HIDE, this.
|
|
258
|
+
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_HIDE, this.collapse);
|
|
241
259
|
this.listenTo(mediaControl, ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE, (from) => {
|
|
242
260
|
if (from !== this.name) {
|
|
243
|
-
this.
|
|
261
|
+
this.collapse();
|
|
244
262
|
}
|
|
245
263
|
});
|
|
246
264
|
}
|
|
247
265
|
onMediaControlRendered() {
|
|
248
266
|
trace(`${T} onMediaControlRendered`);
|
|
267
|
+
this.mount();
|
|
268
|
+
}
|
|
269
|
+
mount() {
|
|
270
|
+
trace(`${T} mount`, {
|
|
271
|
+
numItems: this.numItems,
|
|
272
|
+
});
|
|
249
273
|
const mediaControl = this.core.getPlugin('media_control');
|
|
250
274
|
mediaControl.mount('gear', this.$el);
|
|
251
275
|
}
|
package/package.json
CHANGED
|
@@ -100,6 +100,10 @@ export enum GearEvents {
|
|
|
100
100
|
export class BottomGear extends UICorePlugin {
|
|
101
101
|
private hd = false
|
|
102
102
|
|
|
103
|
+
private numItems = 0;
|
|
104
|
+
|
|
105
|
+
private collapsed = true;
|
|
106
|
+
|
|
103
107
|
/**
|
|
104
108
|
* @internal
|
|
105
109
|
*/
|
|
@@ -137,7 +141,7 @@ export class BottomGear extends UICorePlugin {
|
|
|
137
141
|
*/
|
|
138
142
|
override get events() {
|
|
139
143
|
return {
|
|
140
|
-
'click #gear-button': '
|
|
144
|
+
'click #gear-button': 'toggleMenu',
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
|
|
@@ -197,6 +201,10 @@ export class BottomGear extends UICorePlugin {
|
|
|
197
201
|
this.$el.find('#gear-options').hide()
|
|
198
202
|
})
|
|
199
203
|
}
|
|
204
|
+
this.numItems++;
|
|
205
|
+
if (this.numItems > 0) {
|
|
206
|
+
this.$el.show()
|
|
207
|
+
}
|
|
200
208
|
return $item
|
|
201
209
|
}
|
|
202
210
|
|
|
@@ -217,7 +225,7 @@ export class BottomGear extends UICorePlugin {
|
|
|
217
225
|
private highDefinitionUpdate(isHd: boolean) {
|
|
218
226
|
trace(`${T} highDefinitionUpdate`, { isHd })
|
|
219
227
|
this.hd = isHd
|
|
220
|
-
this.$el.find('
|
|
228
|
+
this.$el.find('#gear-button').html(isHd ? gearHdIcon : gearIcon)
|
|
221
229
|
}
|
|
222
230
|
|
|
223
231
|
/**
|
|
@@ -230,13 +238,14 @@ export class BottomGear extends UICorePlugin {
|
|
|
230
238
|
return this // TODO test
|
|
231
239
|
}
|
|
232
240
|
const icon = this.hd ? gearHdIcon : gearIcon
|
|
241
|
+
this.collapsed = true;
|
|
242
|
+
this.numItems = 0;
|
|
233
243
|
this.$el
|
|
234
244
|
.html(BottomGear.template({ icon }))
|
|
235
|
-
.
|
|
245
|
+
.hide() // until numItems > 0
|
|
246
|
+
.find('#gear-options-wrapper')
|
|
236
247
|
.hide()
|
|
237
248
|
|
|
238
|
-
// TODO make non-clickable when there are no items
|
|
239
|
-
|
|
240
249
|
setTimeout(() => {
|
|
241
250
|
this.trigger(GearEvents.RENDERED)
|
|
242
251
|
}, 0)
|
|
@@ -254,16 +263,25 @@ export class BottomGear extends UICorePlugin {
|
|
|
254
263
|
this.$el.find('#gear-options').show()
|
|
255
264
|
}
|
|
256
265
|
|
|
257
|
-
private
|
|
266
|
+
private toggleMenu() {
|
|
258
267
|
this.core
|
|
259
268
|
.getPlugin('media_control')
|
|
260
269
|
.trigger(ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE, this.name)
|
|
261
|
-
this
|
|
270
|
+
this.collapsed = !this.collapsed;
|
|
271
|
+
if (this.collapsed) {
|
|
272
|
+
this.$el.find('#gear-options-wrapper').hide()
|
|
273
|
+
} else {
|
|
274
|
+
this.$el.find('#gear-options-wrapper').show()
|
|
275
|
+
}
|
|
276
|
+
this.$el.find('#gear-button').attr('aria-expanded', (!this.collapsed).toString())
|
|
277
|
+
trace(`${T} toggleMenu`, { hidden: this.collapsed })
|
|
262
278
|
}
|
|
263
279
|
|
|
264
|
-
private
|
|
280
|
+
private collapse() {
|
|
265
281
|
trace(`${T} hide`)
|
|
282
|
+
this.collapsed = true;
|
|
266
283
|
this.$el.find('#gear-options-wrapper').hide()
|
|
284
|
+
this.$el.find('#gear-button').attr('aria-expanded', 'false')
|
|
267
285
|
}
|
|
268
286
|
|
|
269
287
|
private onCoreReady() {
|
|
@@ -275,13 +293,13 @@ export class BottomGear extends UICorePlugin {
|
|
|
275
293
|
ClapprEvents.MEDIACONTROL_RENDERED,
|
|
276
294
|
this.onMediaControlRendered,
|
|
277
295
|
)
|
|
278
|
-
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_HIDE, this.
|
|
296
|
+
this.listenTo(mediaControl, ClapprEvents.MEDIACONTROL_HIDE, this.collapse)
|
|
279
297
|
this.listenTo(
|
|
280
298
|
mediaControl,
|
|
281
299
|
ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE,
|
|
282
300
|
(from: string) => {
|
|
283
301
|
if (from !== this.name) {
|
|
284
|
-
this.
|
|
302
|
+
this.collapse()
|
|
285
303
|
}
|
|
286
304
|
},
|
|
287
305
|
)
|
|
@@ -289,6 +307,13 @@ export class BottomGear extends UICorePlugin {
|
|
|
289
307
|
|
|
290
308
|
private onMediaControlRendered() {
|
|
291
309
|
trace(`${T} onMediaControlRendered`)
|
|
310
|
+
this.mount()
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
private mount() {
|
|
314
|
+
trace(`${T} mount`, {
|
|
315
|
+
numItems: this.numItems,
|
|
316
|
+
})
|
|
292
317
|
const mediaControl = this.core.getPlugin('media_control')
|
|
293
318
|
mediaControl.mount('gear', this.$el)
|
|
294
319
|
}
|
|
@@ -5,6 +5,11 @@ import { createMockCore, createMockMediaControl } from '../../../testUtils'
|
|
|
5
5
|
import { Events } from '@clappr/core'
|
|
6
6
|
import { ExtendedEvents } from '../../media-control/MediaControl'
|
|
7
7
|
|
|
8
|
+
// import { LogTracer, Logger, setTracer } from '@gcorevideo/utils'
|
|
9
|
+
|
|
10
|
+
// Logger.enable('*')
|
|
11
|
+
// setTracer(new LogTracer('BottomGear.test'))
|
|
12
|
+
|
|
8
13
|
describe('BottomGear', () => {
|
|
9
14
|
let mediaControl: any
|
|
10
15
|
let core: any
|
|
@@ -12,72 +17,104 @@ describe('BottomGear', () => {
|
|
|
12
17
|
let onGearRendered: MockedFunction<() => void>
|
|
13
18
|
beforeEach(() => {
|
|
14
19
|
core = createMockCore()
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
bottomGear = new BottomGear(core)
|
|
22
|
-
onGearRendered = vi.fn()
|
|
23
|
-
bottomGear.on(GearEvents.RENDERED, onGearRendered, null)
|
|
24
|
-
bottomGear.render()
|
|
25
|
-
core.emit(Events.CORE_READY)
|
|
26
|
-
})
|
|
27
|
-
it('should render', () => {
|
|
28
|
-
expect(bottomGear.el.innerHTML).toMatchSnapshot()
|
|
29
|
-
})
|
|
30
|
-
it('should emit event in the next cycle', async () => {
|
|
31
|
-
expect(onGearRendered).not.toHaveBeenCalled()
|
|
32
|
-
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
33
|
-
expect(onGearRendered).toHaveBeenCalled()
|
|
34
|
-
})
|
|
35
|
-
it('should render the gear menu hidden', () => {
|
|
36
|
-
expect(bottomGear.$el.find('#gear-options-wrapper').css('display')).toBe(
|
|
37
|
-
'none',
|
|
38
|
-
)
|
|
20
|
+
mediaControl = createMockMediaControl(core)
|
|
21
|
+
core.getPlugin = vi
|
|
22
|
+
.fn()
|
|
23
|
+
.mockImplementation((name) =>
|
|
24
|
+
name === 'media_control' ? mediaControl : null,
|
|
25
|
+
)
|
|
39
26
|
})
|
|
40
|
-
describe('
|
|
41
|
-
it('should not attach to media control', () => {
|
|
42
|
-
expect(mediaControl.mount).not.toHaveBeenCalledWith(
|
|
43
|
-
'gear',
|
|
44
|
-
expect.anything(),
|
|
45
|
-
)
|
|
46
|
-
})
|
|
47
|
-
})
|
|
48
|
-
describe('when media control is rendered', () => {
|
|
27
|
+
describe('basically', () => {
|
|
49
28
|
beforeEach(() => {
|
|
50
|
-
|
|
29
|
+
bottomGear = new BottomGear(core)
|
|
30
|
+
onGearRendered = vi.fn()
|
|
31
|
+
bottomGear.on(GearEvents.RENDERED, onGearRendered, null)
|
|
32
|
+
bottomGear.render()
|
|
33
|
+
core.emit(Events.CORE_READY)
|
|
34
|
+
bottomGear.addItem('test', null).html('<button>test</button>')
|
|
51
35
|
})
|
|
52
|
-
it('should
|
|
53
|
-
expect(
|
|
36
|
+
it('should render', () => {
|
|
37
|
+
expect(bottomGear.el.innerHTML).toMatchSnapshot()
|
|
54
38
|
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
39
|
+
it('should render the gear menu hidden', () => {
|
|
40
|
+
expect(bottomGear.$el.find('#gear-options-wrapper').css('display')).toBe(
|
|
41
|
+
'none',
|
|
42
|
+
)
|
|
59
43
|
})
|
|
60
|
-
it('should
|
|
61
|
-
expect(
|
|
62
|
-
|
|
63
|
-
).
|
|
44
|
+
it('should emit event in the next render cycle', async () => {
|
|
45
|
+
expect(onGearRendered).not.toHaveBeenCalled()
|
|
46
|
+
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
47
|
+
expect(onGearRendered).toHaveBeenCalled()
|
|
64
48
|
})
|
|
65
|
-
it('should
|
|
66
|
-
expect(
|
|
67
|
-
|
|
68
|
-
'bottom_gear',
|
|
49
|
+
it('should render the gear menu hidden', () => {
|
|
50
|
+
expect(bottomGear.$el.find('#gear-options-wrapper').css('display')).toBe(
|
|
51
|
+
'none',
|
|
69
52
|
)
|
|
70
53
|
})
|
|
54
|
+
describe('until media control is rendered', () => {
|
|
55
|
+
it('should not attach to media control', () => {
|
|
56
|
+
expect(mediaControl.mount).not.toHaveBeenCalledWith(
|
|
57
|
+
'gear',
|
|
58
|
+
expect.anything(),
|
|
59
|
+
)
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
describe('when media control is rendered', () => {
|
|
63
|
+
beforeEach(() => {
|
|
64
|
+
mediaControl.trigger(Events.MEDIACONTROL_RENDERED)
|
|
65
|
+
})
|
|
66
|
+
it('should attach to media control', () => {
|
|
67
|
+
expect(mediaControl.mount).toHaveBeenCalledWith('gear', bottomGear.$el)
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
describe('when clicked', () => {
|
|
71
|
+
beforeEach(() => {
|
|
72
|
+
bottomGear.$el.find('#gear-button').click()
|
|
73
|
+
})
|
|
74
|
+
it('should open the gear menu', () => {
|
|
75
|
+
expect(
|
|
76
|
+
bottomGear.$el.find('#gear-options-wrapper').css('display'),
|
|
77
|
+
).not.toBe('none')
|
|
78
|
+
expect(bottomGear.$el.find('#gear-button').attr('aria-expanded')).toBe(
|
|
79
|
+
'true',
|
|
80
|
+
)
|
|
81
|
+
})
|
|
82
|
+
it('should trigger media control menu collapse', () => {
|
|
83
|
+
expect(mediaControl.trigger).toHaveBeenCalledWith(
|
|
84
|
+
ExtendedEvents.MEDIACONTROL_MENU_COLLAPSE,
|
|
85
|
+
'bottom_gear',
|
|
86
|
+
)
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
describe('when clicked twice', () => {
|
|
90
|
+
beforeEach(() => {
|
|
91
|
+
bottomGear.$el.find('#gear-button').click()
|
|
92
|
+
bottomGear.$el.find('#gear-button').click()
|
|
93
|
+
})
|
|
94
|
+
it('should collapse the gear menu', () => {
|
|
95
|
+
expect(bottomGear.$el.find('#gear-options-wrapper').css('display')).toBe(
|
|
96
|
+
'none',
|
|
97
|
+
)
|
|
98
|
+
expect(bottomGear.$el.find('#gear-button').attr('aria-expanded')).toBe(
|
|
99
|
+
'false',
|
|
100
|
+
)
|
|
101
|
+
})
|
|
102
|
+
})
|
|
71
103
|
})
|
|
72
|
-
describe('when
|
|
104
|
+
describe('when there are no items', () => {
|
|
73
105
|
beforeEach(() => {
|
|
74
|
-
bottomGear
|
|
75
|
-
|
|
106
|
+
bottomGear = new BottomGear(core)
|
|
107
|
+
onGearRendered = vi.fn()
|
|
108
|
+
bottomGear.on(GearEvents.RENDERED, onGearRendered, null)
|
|
109
|
+
bottomGear.render()
|
|
110
|
+
core.emit(Events.CORE_READY)
|
|
76
111
|
})
|
|
77
|
-
it('should
|
|
78
|
-
expect(bottomGear.$el.
|
|
79
|
-
|
|
80
|
-
|
|
112
|
+
it('should render hidden', () => {
|
|
113
|
+
expect(bottomGear.$el.css('display')).toBe('none')
|
|
114
|
+
})
|
|
115
|
+
it('should show button after item is added', () => {
|
|
116
|
+
bottomGear.addItem('test', null).html('<button>test</button>')
|
|
117
|
+
expect(bottomGear.$el.css('display')).not.toBe('none')
|
|
81
118
|
})
|
|
82
119
|
})
|
|
83
120
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`BottomGear > should render 1`] = `
|
|
4
|
-
"<button class="media-control-button gplayer-lite-btn gcore-skin-button-color gear-icon" id="gear-button">
|
|
3
|
+
exports[`BottomGear > basically > should render 1`] = `
|
|
4
|
+
"<button class="media-control-button gplayer-lite-btn gcore-skin-button-color gear-icon" id="gear-button" aria-expanded="false" aria-controls="gear-options">
|
|
5
5
|
/assets/icons/new/gear.svg
|
|
6
6
|
</button>
|
|
7
|
-
<div class="gear-wrapper gcore-skin-bg-color" id="gear-options-wrapper" style="display:none">
|
|
8
|
-
<ul class="gear-options-list" id="gear-options" role="menu"></ul>
|
|
7
|
+
<div class="gear-wrapper gcore-skin-bg-color" id="gear-options-wrapper" style="display: none;">
|
|
8
|
+
<ul class="gear-options-list" id="gear-options" role="menu"><li data-test=""><button>test</button></li></ul>
|
|
9
9
|
</div>
|
|
10
10
|
"
|
|
11
11
|
`;
|