File tree Expand file tree Collapse file tree 3 files changed +50
-4
lines changed
app/code/Magento/ProductVideo
dev/tests/js/jasmine/tests/app/code/Magento/ProductVideo/adminhtml/js Expand file tree Collapse file tree 3 files changed +50
-4
lines changed Original file line number Diff line number Diff line change 1010 <policies >
1111 <policy id =" script-src" >
1212 <values >
13- <value id =" youtube_cdn " type =" host" >s.ytimg.com</value >
14- <value id =" google_video " type =" host" >www.googleapis.com</value >
13+ <value id =" youtube_script " type =" host" >s.ytimg.com</value >
14+ <value id =" google_apis " type =" host" >www.googleapis.com</value >
1515 <value id =" vimeo" type =" host" >vimeo.com</value >
1616 <value id =" www_vimeo" type =" host" >www.vimeo.com</value >
1717 <value id =" vimeo_cdn" type =" host" >*.vimeocdn.com</value >
2020 <policy id =" img-src" >
2121 <values >
2222 <value id =" vimeo_cdn" type =" host" >*.vimeocdn.com</value >
23+ <value id =" youtube_image" type =" host" >i.ytimg.com</value >
2324 </values >
2425 </policy >
2526 <policy id =" frame-src" >
2627 <values >
2728 <value id =" player_vimeo" type =" host" >player.vimeo.com</value >
29+ <value id =" player_youtube" type =" host" >*.youtube.com</value >
2830 </values >
2931 </policy >
3032 </policies >
Original file line number Diff line number Diff line change @@ -289,10 +289,10 @@ define([
289289 * @private
290290 */
291291 destroy : function ( ) {
292- this . stop ( ) ;
293-
294292 if ( this . _player ) {
293+ this . stop ( ) ;
295294 this . _player . destroy ( ) ;
295+ this . _player = undefined ;
296296 }
297297 }
298298 } ) ;
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright © Magento, Inc. All rights reserved.
3+ * See COPYING.txt for license details.
4+ */
5+ define ( [
6+ 'jquery' ,
7+ 'Magento_ProductVideo/js/get-video-information'
8+ ] , function ( $ ) {
9+ 'use strict' ;
10+
11+ describe ( 'Testing Youtube player Widget' , function ( ) {
12+ var wdContainer ;
13+
14+ beforeEach ( function ( ) {
15+ wdContainer = $ (
16+ '<div>' +
17+ '<div class="video-information uploader"><span></span></div>' +
18+ '<div class="video-player-container">' +
19+ '<div class="product-video"></div>' +
20+ '</div>' +
21+ '</div>' ) ;
22+ } ) ;
23+
24+ afterEach ( function ( ) {
25+ $ ( wdContainer ) . remove ( ) ;
26+ } ) ;
27+
28+ it ( 'Widget does not stops player if player is no defined' , function ( ) {
29+ var video = wdContainer . find ( '.video-player-container' ) . find ( '.product-video' ) ,
30+ widget ;
31+
32+ video . videoYoutube ( ) ;
33+ widget = video . data ( 'mageVideoYoutube' ) ;
34+ widget . stop = jasmine . createSpy ( ) ;
35+ widget . _player = {
36+ destroy : jasmine . createSpy ( )
37+ } ;
38+ widget . destroy ( ) ;
39+ expect ( widget . _player ) . toBeUndefined ( ) ;
40+ widget . destroy ( ) ;
41+ expect ( widget . stop ) . toHaveBeenCalledTimes ( 1 ) ;
42+ } ) ;
43+ } ) ;
44+ } ) ;
You can’t perform that action at this time.
0 commit comments