Skip to content

Commit dbfa4fc

Browse files
committed
chore: use camel case for examples and documentation
Changes every component's initialization in examples and documentation from proper case to the preferred camel case. This change also applies to the templates of the `create` cli. Added mising VERSION static property tests for all components.
1 parent daa49ab commit dbfa4fc

File tree

15 files changed

+82
-73
lines changed

15 files changed

+82
-73
lines changed

packages/big-replay-button/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Once the player is installed you can activate the component as follows:
2424
import videojs from 'video.js';
2525
import '@srgssr/big-replay-button';
2626

27-
const player = videojs('my-player', { BigReplayButton: true });
27+
const player = videojs('my-player', { bigReplayButton: true });
2828
```
2929

3030
To apply the default styling, add the following line to your CSS file:

packages/big-replay-button/test/big-replay-button.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('BigReplayButton', () => {
1313
});
1414

1515
beforeEach(() => {
16-
player = videojs(videoElement, { BigReplayButton: true });
16+
player = videojs(videoElement, { bigReplayButton: true });
1717
});
1818

1919
afterEach(() => {
@@ -23,7 +23,7 @@ describe('BigReplayButton', () => {
2323

2424
it('should be registered and attached to the player', () => {
2525
expect(videojs.getComponent('BigReplayButton')).toBe(BigReplayButton);
26-
expect(player.BigReplayButton).toBeDefined();
26+
expect(player.bigReplayButton).toBeDefined();
2727
expect(BigReplayButton.VERSION).toBeDefined();
2828
});
2929

packages/pillarbox-debug-panel/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Once the player is installed you can activate the component as follows:
2424
import videojs from 'video.js';
2525
import '@srgssr/pillarbox-debug-panel';
2626

27-
const player = videojs('my-player', { PillarboxDebugPanel: true });
27+
const player = videojs('my-player', { pillarboxDebugPanel: true });
2828
```
2929

3030
To apply the default styling, add the following line to your CSS file:

packages/pillarbox-debug-panel/test/pillarbox-debug-panel.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ describe('PillarboxDebugPanel', () => {
3737
it('should be registered and attached to the player', () => {
3838
expect(videojs.getComponent('PillarboxDebugPanel')).toBe(PillarboxDebugPanel);
3939
expect(player.pillarboxDebugPanel).toBeDefined();
40+
expect(PillarboxDebugPanel.VERSION).toBeDefined();
4041
});
4142

4243
it('should update the UI when "loadeddata" event is triggered', () => {

packages/pillarbox-playlist/src/pillarbox-playlist-ui.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import videojs from 'video.js';
22
import './components/pillarbox-playlist-button.js';
33
import './components/modal/pillarbox-playlist-modal.js';
44
import './lang';
5+
import { version } from '../package.json';
56

67
/**
78
* @ignore
@@ -83,6 +84,9 @@ class PillarboxPlaylistUI extends Plugin {
8384
return controlBarOptions;
8485
}
8586

87+
static get VERSION() {
88+
return version;
89+
}
8690
}
8791

8892
PillarboxPlaylistUI.prototype.options_ = {

packages/pillarbox-playlist/test/pillarbox-playlist-ui.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ describe('PillarboxPlaylist', () => {
7373
});
7474
expect(pillarbox.getPlugin('pillarboxPlaylistUI')).toBe(PillarboxPlaylistUi);
7575
expect(player.pillarboxPlaylistUI).toBeDefined();
76+
expect(PillarboxPlaylistUi.VERSION).toBeDefined();
7677
});
7778

7879
it('should not to initialize if the playlist plugin is not being used', async() => {

packages/pillarbox-playlist/test/pillarbox-playlist.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ describe('PillarboxPlaylist', () => {
7777
it('should be registered and attached to the player', () => {
7878
expect(pillarbox.getPlugin('pillarboxPlaylist')).toBe(PillarboxPlaylist);
7979
expect(player.pillarboxPlaylist).toBeDefined();
80+
expect(PillarboxPlaylist.VERSION).toBeDefined();
8081
});
8182

8283
describe('load', () => {

packages/skip-button/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Once the player is installed you can activate the button as follows:
2727
import Pillarbox from '@srgssr/pillarbox-web';
2828
import '@srgssr/skip-button';
2929

30-
const player = new Pillarbox('my-player', { SkipButton: true });
30+
const player = new Pillarbox('my-player', { skipButton: true });
3131
player.src({
3232
src: 'urn:swi:video:48115940',
3333
type: 'srgssr/urn'

packages/skip-button/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
srgOptions: {
4141
dataProviderHost: ilHost
4242
},
43-
SkipButton: true
43+
skipButton: true
4444
});
4545

4646
// Load the video source for the player

packages/skip-button/test/skip-button.spec.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('SkipButton', () => {
1313
const videoElement = document.querySelector('#test-video');
1414
const Button = pillarbox.getComponent('Button');
1515

16-
player = pillarbox(videoElement, { SkipButton: true });
16+
player = pillarbox(videoElement, { skipButton: true });
1717
vi.spyOn(Button.prototype, 'handleClick').mockImplementation(()=>{});
1818

1919
});
@@ -25,7 +25,8 @@ describe('SkipButton', () => {
2525

2626
it('should be registered and attached to the player', () => {
2727
expect(pillarbox.getComponent('SkipButton')).toBe(SkipButton);
28-
expect(player.SkipButton).toBeDefined();
28+
expect(player.skipButton).toBeDefined();
29+
expect(SkipButton.VERSION).toBeDefined();
2930
});
3031

3132
it('should update the button text and show it for valid interval', () => {
@@ -38,19 +39,19 @@ describe('SkipButton', () => {
3839
};
3940

4041
// When
41-
player.SkipButton.handleTimeIntervalChange(data);
42+
player.skipButton.handleTimeIntervalChange(data);
4243

4344
// Then
44-
expect(player.SkipButton.controlText()).toBe('Skip intro');
45-
expect(player.SkipButton.hasClass('vjs-hidden')).toBeFalsy();
45+
expect(player.skipButton.controlText()).toBe('Skip intro');
46+
expect(player.skipButton.hasClass('vjs-hidden')).toBeFalsy();
4647
});
4748

4849
it('should hide the button when there is no active interval', () => {
4950
// When
50-
player.SkipButton.handleTimeIntervalChange();
51+
player.skipButton.handleTimeIntervalChange();
5152

5253
// Then
53-
expect(player.SkipButton.hasClass('vjs-hidden')).toBeTruthy();
54+
expect(player.skipButton.hasClass('vjs-hidden')).toBeTruthy();
5455
});
5556

5657
it('should seek to the end of the interval when clicked', () => {
@@ -62,8 +63,8 @@ describe('SkipButton', () => {
6263
const spy = vi.spyOn(player, 'currentTime');
6364

6465
// When
65-
player.SkipButton.handleTimeIntervalChange(data);
66-
player.SkipButton.handleClick();
66+
player.skipButton.handleTimeIntervalChange(data);
67+
player.skipButton.handleClick();
6768

6869
// Then
6970
expect(spy).toHaveBeenCalledWith(90);
@@ -79,10 +80,10 @@ describe('SkipButton', () => {
7980
vi.spyOn(Button.prototype, 'dispose').mockImplementation(() => {});
8081

8182
// When
82-
player.SkipButton.dispose();
83+
player.skipButton.dispose();
8384

8485
// Then
85-
expect(spy).toHaveBeenCalledWith('srgssr/interval', player.SkipButton.onTimeIntervalChange_);
86+
expect(spy).toHaveBeenCalledWith('srgssr/interval', player.skipButton.onTimeIntervalChange_);
8687

8788
vi.resetAllMocks();
8889
});

0 commit comments

Comments
 (0)