Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
/* globals wp */
/* jshint qunit: true */
/* eslint-env qunit */
/* eslint-disable no-magic-numbers */
( function ( ) {
'use strict' ;
2020-03-27 01:16:58 +01:00
QUnit . module ( 'Image Media Widget' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
2020-03-27 01:16:58 +01:00
QUnit . test ( 'image widget control' , function ( assert ) {
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
var ImageWidgetControl , imageWidgetControlInstance , imageWidgetModelInstance , mappedProps , testImageUrl , templateProps ;
testImageUrl = 'http://s.w.org/style/images/wp-header-logo.png' ;
2020-03-27 01:16:58 +01:00
assert . equal ( typeof wp . mediaWidgets . controlConstructors . media _image , 'function' , 'wp.mediaWidgets.controlConstructors.media_image is a function' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
ImageWidgetControl = wp . mediaWidgets . controlConstructors . media _image ;
2020-03-27 01:16:58 +01:00
assert . ok ( ImageWidgetControl . prototype instanceof wp . mediaWidgets . MediaWidgetControl , 'wp.mediaWidgets.controlConstructors.media_image subclasses wp.mediaWidgets.MediaWidgetControl' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
imageWidgetModelInstance = new wp . mediaWidgets . modelConstructors . media _image ( ) ;
imageWidgetControlInstance = new ImageWidgetControl ( {
2017-06-25 20:47:13 +02:00
el : jQuery ( '<div></div>' ) ,
syncContainer : jQuery ( '<div></div>' ) ,
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
model : imageWidgetModelInstance
} ) ;
// Test mapModelToPreviewTemplateProps() when no data is set.
templateProps = imageWidgetControlInstance . mapModelToPreviewTemplateProps ( ) ;
2020-03-27 01:16:58 +01:00
assert . equal ( templateProps . caption , undefined , 'mapModelToPreviewTemplateProps should not return attributes that are should_preview_update false' ) ;
assert . equal ( templateProps . attachment _id , 0 , 'mapModelToPreviewTemplateProps should return default values' ) ;
assert . equal ( templateProps . currentFilename , '' , 'mapModelToPreviewTemplateProps should return a currentFilename' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
// Test mapModelToPreviewTemplateProps() when data is set on model.
imageWidgetControlInstance . model . set ( { url : testImageUrl , alt : 'some alt text' , link _type : 'none' } ) ;
templateProps = imageWidgetControlInstance . mapModelToPreviewTemplateProps ( ) ;
2020-03-27 01:16:58 +01:00
assert . equal ( templateProps . currentFilename , 'wp-header-logo.png' , 'mapModelToPreviewTemplateProps should set currentFilename based off of url' ) ;
assert . equal ( templateProps . url , testImageUrl , 'mapModelToPreviewTemplateProps should return the proper url' ) ;
assert . equal ( templateProps . alt , 'some alt text' , 'mapModelToPreviewTemplateProps should return the proper alt text' ) ;
assert . equal ( templateProps . link _type , undefined , 'mapModelToPreviewTemplateProps should ignore attributes that are not needed in the preview' ) ;
assert . equal ( templateProps . error , false , 'mapModelToPreviewTemplateProps should return error state' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
// Test mapModelToPreviewTemplateProps() when error is set on model.
imageWidgetControlInstance . model . set ( 'error' , 'missing_attachment' ) ;
templateProps = imageWidgetControlInstance . mapModelToPreviewTemplateProps ( ) ;
2020-03-27 01:16:58 +01:00
assert . equal ( templateProps . error , 'missing_attachment' , 'mapModelToPreviewTemplateProps should return error string' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
// Reset model.
imageWidgetControlInstance . model . set ( { error : false , attachment _id : 0 , url : null } ) ;
// Test isSelected().
2020-03-27 01:16:58 +01:00
assert . equal ( imageWidgetControlInstance . isSelected ( ) , false , 'media_image.isSelected() should return false when no media is selected' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
imageWidgetControlInstance . model . set ( { error : 'missing_attachment' , attachment _id : 777 } ) ;
2020-03-27 01:16:58 +01:00
assert . equal ( imageWidgetControlInstance . isSelected ( ) , false , 'media_image.isSelected() should return false when media is selected and error is set' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
imageWidgetControlInstance . model . set ( { error : false , attachment _id : 777 } ) ;
2020-03-27 01:16:58 +01:00
assert . equal ( imageWidgetControlInstance . isSelected ( ) , true , 'media_image.isSelected() should return true when media is selected and no error exists' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
imageWidgetControlInstance . model . set ( { error : false , attachment _id : 0 , url : testImageUrl } ) ;
2020-03-27 01:16:58 +01:00
assert . equal ( imageWidgetControlInstance . isSelected ( ) , true , 'media_image.isSelected() should return true when url is set and no error exists' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
// Reset model.
imageWidgetControlInstance . model . set ( { error : false , attachment _id : 0 , url : null } ) ;
// Test editing of widget title.
imageWidgetControlInstance . render ( ) ;
imageWidgetControlInstance . $el . find ( '.title' ) . val ( 'Chicken and Ribs' ) . trigger ( 'input' ) ;
2020-03-27 01:16:58 +01:00
assert . equal ( imageWidgetModelInstance . get ( 'title' ) , 'Chicken and Ribs' , 'Changing title should update model title attribute' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
2020-01-29 01:43:23 +01:00
// Test mapMediaToModelProps.
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
mappedProps = imageWidgetControlInstance . mapMediaToModelProps ( { link : 'file' , url : testImageUrl } ) ;
2020-03-27 01:16:58 +01:00
assert . equal ( mappedProps . link _url , testImageUrl , 'mapMediaToModelProps should set file link_url according to mediaFrameProps.link' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
mappedProps = imageWidgetControlInstance . mapMediaToModelProps ( { link : 'post' , postUrl : 'https://wordpress.org/image-2/' } ) ;
2020-03-27 01:16:58 +01:00
assert . equal ( mappedProps . link _url , 'https://wordpress.org/image-2/' , 'mapMediaToModelProps should set file link_url according to mediaFrameProps.link' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
mappedProps = imageWidgetControlInstance . mapMediaToModelProps ( { link : 'custom' , linkUrl : 'https://wordpress.org' } ) ;
2020-03-27 01:16:58 +01:00
assert . equal ( mappedProps . link _url , 'https://wordpress.org' , 'mapMediaToModelProps should set custom link_url according to mediaFrameProps.linkUrl' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
// Test mapModelToMediaFrameProps().
imageWidgetControlInstance . model . set ( { error : false , url : testImageUrl , 'link_type' : 'custom' , 'link_url' : 'https://wordpress.org' , 'size' : 'custom' , 'width' : 100 , 'height' : 150 , 'title' : 'widget title' , 'image_title' : 'title of image' } ) ;
mappedProps = imageWidgetControlInstance . mapModelToMediaFrameProps ( imageWidgetControlInstance . model . toJSON ( ) ) ;
2020-03-27 01:16:58 +01:00
assert . equal ( mappedProps . linkUrl , 'https://wordpress.org' , 'mapModelToMediaFrameProps should set linkUrl from model.link_url' ) ;
assert . equal ( mappedProps . link , 'custom' , 'mapModelToMediaFrameProps should set link from model.link_type' ) ;
assert . equal ( mappedProps . width , 100 , 'mapModelToMediaFrameProps should set width when model.size is custom' ) ;
assert . equal ( mappedProps . height , 150 , 'mapModelToMediaFrameProps should set height when model.size is custom' ) ;
assert . equal ( mappedProps . title , 'title of image' , 'mapModelToMediaFrameProps should set title from model.image_title' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
} ) ;
2020-03-27 01:16:58 +01:00
QUnit . test ( 'image widget control renderPreview' , function ( assert ) {
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
var imageWidgetControlInstance , imageWidgetModelInstance , done ;
done = assert . async ( ) ;
imageWidgetModelInstance = new wp . mediaWidgets . modelConstructors . media _image ( ) ;
imageWidgetControlInstance = new wp . mediaWidgets . controlConstructors . media _image ( {
2017-06-25 20:47:13 +02:00
el : jQuery ( '<div></div>' ) ,
syncContainer : jQuery ( '<div></div>' ) ,
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
model : imageWidgetModelInstance
} ) ;
2020-03-27 01:16:58 +01:00
assert . equal ( imageWidgetControlInstance . $el . find ( 'img' ) . length , 0 , 'No images should be rendered' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
imageWidgetControlInstance . model . set ( { error : false , url : 'http://s.w.org/style/images/wp-header-logo.png' } ) ;
// Due to renderPreview being deferred.
setTimeout ( function ( ) {
2020-03-27 01:16:58 +01:00
assert . equal ( imageWidgetControlInstance . $el . find ( 'img[src="http://s.w.org/style/images/wp-header-logo.png"]' ) . length , 1 , 'One image should be rendered' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
done ( ) ;
} , 50 ) ;
2020-03-27 01:16:58 +01:00
done ( ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
} ) ;
2020-03-27 01:16:58 +01:00
QUnit . test ( 'image media model' , function ( assert ) {
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
var ImageWidgetModel , imageWidgetModelInstance ;
2020-03-27 01:16:58 +01:00
assert . equal ( typeof wp . mediaWidgets . modelConstructors . media _image , 'function' , 'wp.mediaWidgets.modelConstructors.media_image is a function' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
ImageWidgetModel = wp . mediaWidgets . modelConstructors . media _image ;
2020-03-27 01:16:58 +01:00
assert . ok ( ImageWidgetModel . prototype instanceof wp . mediaWidgets . MediaWidgetModel , 'wp.mediaWidgets.modelConstructors.media_image subclasses wp.mediaWidgets.MediaWidgetModel' ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
imageWidgetModelInstance = new ImageWidgetModel ( ) ;
_ . each ( imageWidgetModelInstance . attributes , function ( value , key ) {
2020-03-27 01:16:58 +01:00
assert . equal ( value , ImageWidgetModel . prototype . schema [ key ] [ 'default' ] , 'Should properly set default for ' + key ) ;
Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!
Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.
git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 23:10:54 +02:00
} ) ;
} ) ;
} ) ( ) ;