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 10
10
<policies >
11
11
<policy id =" script-src" >
12
12
<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 >
15
15
<value id =" vimeo" type =" host" >vimeo.com</value >
16
16
<value id =" www_vimeo" type =" host" >www.vimeo.com</value >
17
17
<value id =" vimeo_cdn" type =" host" >*.vimeocdn.com</value >
20
20
<policy id =" img-src" >
21
21
<values >
22
22
<value id =" vimeo_cdn" type =" host" >*.vimeocdn.com</value >
23
+ <value id =" youtube_image" type =" host" >i.ytimg.com</value >
23
24
</values >
24
25
</policy >
25
26
<policy id =" frame-src" >
26
27
<values >
27
28
<value id =" player_vimeo" type =" host" >player.vimeo.com</value >
29
+ <value id =" player_youtube" type =" host" >*.youtube.com</value >
28
30
</values >
29
31
</policy >
30
32
</policies >
Original file line number Diff line number Diff line change @@ -289,10 +289,10 @@ define([
289
289
* @private
290
290
*/
291
291
destroy : function ( ) {
292
- this . stop ( ) ;
293
-
294
292
if ( this . _player ) {
293
+ this . stop ( ) ;
295
294
this . _player . destroy ( ) ;
295
+ this . _player = undefined ;
296
296
}
297
297
}
298
298
} ) ;
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