666912edf9
* Galleries are managed in the widget in the same way they are managed in the post editor, both using the media manager. * Gallery widget is merged from the Core Media Widgets v0.2.0 feature plugin and it extends `WP_Widget_Media` in the same way as is done for image, audio, and video widgets. * Model syncing logic is updated to support booleans and arrays (of integers). * Placeholder areas in media widgets are now clickable shortcuts for selecting media. * Image widget placeholder is updated to match gallery widget where clicking preview is shortcut for editing media. Props westonruter, joemcgill, timmydcrawford, m1tk00, obenland, melchoyce. See #32417. Fixes #41914. git-svn-id: https://develop.svn.wordpress.org/trunk@41590 602fd350-edb4-49c9-b593-d223f7449a82
31 lines
1.4 KiB
JavaScript
31 lines
1.4 KiB
JavaScript
/* global wp */
|
|
/* jshint qunit: true */
|
|
/* eslint-env qunit */
|
|
/* eslint-disable no-magic-numbers */
|
|
|
|
( function() {
|
|
'use strict';
|
|
|
|
module( 'Gallery Media Widget' );
|
|
|
|
test( 'gallery widget control', function() {
|
|
var GalleryWidgetControl;
|
|
equal( typeof wp.mediaWidgets.controlConstructors.media_gallery, 'function', 'wp.mediaWidgets.controlConstructors.media_gallery is a function' );
|
|
GalleryWidgetControl = wp.mediaWidgets.controlConstructors.media_gallery;
|
|
ok( GalleryWidgetControl.prototype instanceof wp.mediaWidgets.MediaWidgetControl, 'wp.mediaWidgets.controlConstructors.media_gallery subclasses wp.mediaWidgets.MediaWidgetControl' );
|
|
});
|
|
|
|
test( 'gallery media model', function() {
|
|
var GalleryWidgetModel, galleryWidgetModelInstance;
|
|
equal( typeof wp.mediaWidgets.modelConstructors.media_gallery, 'function', 'wp.mediaWidgets.modelConstructors.media_gallery is a function' );
|
|
GalleryWidgetModel = wp.mediaWidgets.modelConstructors.media_gallery;
|
|
ok( GalleryWidgetModel.prototype instanceof wp.mediaWidgets.MediaWidgetModel, 'wp.mediaWidgets.modelConstructors.media_gallery subclasses wp.mediaWidgets.MediaWidgetModel' );
|
|
|
|
galleryWidgetModelInstance = new GalleryWidgetModel();
|
|
_.each( galleryWidgetModelInstance.attributes, function( value, key ) {
|
|
equal( value, GalleryWidgetModel.prototype.schema[ key ][ 'default' ], 'Should properly set default for ' + key );
|
|
});
|
|
});
|
|
|
|
})();
|