Skip to content

Commit 0c83adc

Browse files
authored
fix(youtube-player): compatibility with latest typings (#22223)
Updates the `youtube-player` package to the latest typings and resolves a test failure.
1 parent 9528120 commit 0c83adc

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@angular/forms": "^12.0.0-next.5",
6161
"@angular/platform-browser": "^12.0.0-next.5",
6262
"@types/googlemaps": "^3.43.1",
63-
"@types/youtube": "^0.0.40",
63+
"@types/youtube": "^0.0.42",
6464
"@webcomponents/custom-elements": "^1.1.0",
6565
"core-js-bundle": "^3.8.2",
6666
"material-components-web": "11.0.0-canary.0cde52f5a.0",

src/youtube-player/fake-youtube-player.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
// A re-creation of YT.PlayerState since enum values cannot be bound to the window
10-
// object.
9+
// A re-creation of YT.PlayerState since enum values cannot be bound to the window object.
1110
const playerState = {
1211
UNSTARTED: -1,
1312
ENDED: 0,
@@ -17,6 +16,13 @@ const playerState = {
1716
CUED: 5,
1817
};
1918

19+
// Re-creation of `YT.ModestBranding` since it was changed
20+
// to a plain enum which we can't reference in tests.
21+
const modestBranding = {
22+
Full: 0,
23+
Modest: 1
24+
};
25+
2026
interface FakeYtNamespace {
2127
playerCtorSpy: jasmine.Spy;
2228
playerSpy: jasmine.SpyObj<YT.Player>;
@@ -84,6 +90,7 @@ export function createFakeYtNamespace(): FakeYtNamespace {
8490
namespace: {
8591
'Player': playerCtorSpy as unknown as typeof YT.Player,
8692
'PlayerState': playerState,
93+
'ModestBranding': modestBranding
8794
} as typeof YT,
8895
};
8996
}

src/youtube-player/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"homepage": "https://github.com/angular/components/tree/master/src/youtube-player#readme",
1919
"dependencies": {
20-
"@types/youtube": "^0.0.38",
20+
"@types/youtube": "^0.0.42",
2121
"tslib": "0.0.0-TSLIB"
2222
},
2323
"peerDependencies": {

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,10 +2220,10 @@
22202220
dependencies:
22212221
yaml "*"
22222222

2223-
"@types/youtube@^0.0.40":
2224-
version "0.0.40"
2225-
resolved "https://registry.yarnpkg.com/@types/youtube/-/youtube-0.0.40.tgz#93502cc42e4ce06a59db1e2d6fd986260dca31d3"
2226-
integrity sha512-gMiHfad1VGQ7CoXkhrjWiROPpLTSJydvBO73Z9JIIZ+FpZ2BX9q9Zf/tanP+KUTFoKUqHVv6+xt7sF2gztQ4Og==
2223+
"@types/youtube@^0.0.42":
2224+
version "0.0.42"
2225+
resolved "https://registry.yarnpkg.com/@types/youtube/-/youtube-0.0.42.tgz#c3568e3e82e04cbd00cac3b66564ebcd21fd9d90"
2226+
integrity sha512-Nqo3HMPFPcNyZ7HNFZJjpH+N4yXqpxBItG+41e7nL9zednovMRZMXWj36CctSznbBcbj6ucvkJDo5iZ8SKqLIw==
22272227

22282228
"@typescript-eslint/[email protected]":
22292229
version "4.14.0"

0 commit comments

Comments
 (0)