diff --git a/tests/qunit/index.html b/tests/qunit/index.html
index 47c5ee21ca..5e74951fcd 100644
|
a
|
b
|
|
| 651 | 651 | <# } #> |
| 652 | 652 | </script> |
| 653 | 653 | |
| | 654 | <script type="text/html" id="tmpl-wp-media-widget-image-fields"> |
| | 655 | <# var elementIdPrefix = 'el' + String( Math.random() ) + '_'; #> |
| | 656 | <# if ( data.url ) { #> |
| | 657 | <p class="media-widget-image-link"> |
| | 658 | <label for="{{ elementIdPrefix }}linkUrl"><?php esc_html_e( 'Link to:' ); ?></label> |
| | 659 | <input id="{{ elementIdPrefix }}linkUrl" type="text" class="widefat link" value="{{ data.link_url }}" placeholder="https://" pattern="((\w+:)?\/\/\w.*|\w+:(?!\/\/$)|\/|\?|#).*"> |
| | 660 | </p> |
| | 661 | <# } #> |
| | 662 | </script> |
| | 663 | |
| 654 | 664 | <script type="text/html" id="tmpl-widget-media-media_video-control"> |
| 655 | 665 | <# var elementIdPrefix = 'el' + String( Math.random() ) + '_' #> |
| 656 | 666 | <p> |
diff --git a/tests/qunit/wp-admin/js/widgets/test-media-image-widget.js b/tests/qunit/wp-admin/js/widgets/test-media-image-widget.js
index b474fc19e9..95de578c7e 100644
|
a
|
b
|
|
| 3 | 3 | /* eslint-env qunit */ |
| 4 | 4 | /* eslint-disable no-magic-numbers */ |
| 5 | 5 | |
| 6 | | ( function() { |
| | 6 | ( function( setTimeout ) { |
| 7 | 7 | 'use strict'; |
| 8 | 8 | |
| 9 | 9 | QUnit.module( 'Image Media Widget' ); |
| … |
… |
|
| 84 | 84 | var imageWidgetControlInstance, imageWidgetModelInstance, done; |
| 85 | 85 | done = assert.async(); |
| 86 | 86 | |
| | 87 | assert.expect( 2 ); |
| | 88 | |
| 87 | 89 | imageWidgetModelInstance = new wp.mediaWidgets.modelConstructors.media_image(); |
| 88 | 90 | imageWidgetControlInstance = new wp.mediaWidgets.controlConstructors.media_image({ |
| 89 | 91 | el: jQuery( '<div></div>' ), |
| … |
… |
|
| 95 | 97 | |
| 96 | 98 | // Due to renderPreview being deferred. |
| 97 | 99 | setTimeout( function() { |
| 98 | | assert.equal( imageWidgetControlInstance.$el.find( 'img[src="http://s.w.org/style/images/wp-header-logo.png"]' ).length, 1, 'One image should be rendered' ); |
| | 100 | assert.equal( imageWidgetControlInstance.$el.find( 'img' ).length, 1, 'One image should be rendered' ); |
| 99 | 101 | done(); |
| 100 | 102 | }, 50 ); |
| 101 | 103 | |
| 102 | | done(); |
| | 104 | this.clock.tick( 51 ); |
| 103 | 105 | }); |
| 104 | 106 | |
| 105 | 107 | QUnit.test( 'image media model', function( assert ) { |
| … |
… |
|
| 114 | 116 | }); |
| 115 | 117 | }); |
| 116 | 118 | |
| 117 | | })(); |
| | 119 | })( window.setTimeout ); |
diff --git a/tests/qunit/wp-admin/js/widgets/test-media-video-widget.js b/tests/qunit/wp-admin/js/widgets/test-media-video-widget.js
index f1574f095c..a2f882dfa7 100644
|
a
|
b
|
|
| 3 | 3 | /* eslint-env qunit */ |
| 4 | 4 | /* eslint-disable no-magic-numbers */ |
| 5 | 5 | |
| 6 | | ( function() { |
| | 6 | ( function( setTimeout ) { |
| 7 | 7 | 'use strict'; |
| 8 | 8 | |
| 9 | 9 | QUnit.module( 'Video Media Widget' ); |
| … |
… |
|
| 40 | 40 | var videoWidgetControlInstance, videoWidgetModelInstance, done; |
| 41 | 41 | done = assert.async(); |
| 42 | 42 | |
| | 43 | //assert.expect( 2 ); |
| | 44 | |
| 43 | 45 | videoWidgetModelInstance = new wp.mediaWidgets.modelConstructors.media_video(); |
| 44 | 46 | videoWidgetControlInstance = new wp.mediaWidgets.controlConstructors.media_video({ |
| 45 | 47 | el: jQuery( '<div></div>' ), |
| 46 | 48 | syncContainer: jQuery( '<div></div>' ), |
| 47 | 49 | model: videoWidgetModelInstance |
| 48 | 50 | }); |
| 49 | | assert.equal( videoWidgetControlInstance.$el.find( 'a' ).length, 0, 'No video links should be rendered' ); |
| | 51 | assert.equal( videoWidgetControlInstance.$el.find( 'source' ).length, 0, 'No video links should be rendered' ); |
| 50 | 52 | videoWidgetControlInstance.model.set({ error: false, url: 'https://videos.files.wordpress.com/AHz0Ca46/wp4-7-vaughan-r8-mastered_hd.mp4' }); |
| 51 | 53 | |
| 52 | 54 | // Due to renderPreview being deferred. |
| 53 | 55 | setTimeout( function() { |
| 54 | | assert.equal( videoWidgetControlInstance.$el.find( 'a[href="https://videos.files.wordpress.com/AHz0Ca46/wp4-7-vaughan-r8-mastered_hd.mp4"]' ).length, 1, 'One video link should be rendered' ); |
| | 56 | assert.equal( videoWidgetControlInstance.$el.find( 'source[src="https://videos.files.wordpress.com/AHz0Ca46/wp4-7-vaughan-r8-mastered_hd.mp4"]' ).length, 1, 'One video link should be rendered' ); |
| 55 | 57 | done(); |
| 56 | 58 | }, 50 ); |
| 57 | 59 | |
| 58 | | done(); |
| | 60 | this.clock.tick( 51 ); |
| 59 | 61 | }); |
| 60 | 62 | |
| 61 | 63 | QUnit.test( 'video media model', function( assert ) { |
| … |
… |
|
| 70 | 72 | }); |
| 71 | 73 | }); |
| 72 | 74 | |
| 73 | | })(); |
| | 75 | })( window.setTimeout ); |