2020-03-27 01:16:58 +01:00
|
|
|
/* global wp */
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
|
|
|
|
jQuery( function( $ ) {
|
2014-12-02 23:55:48 +01:00
|
|
|
var FooSuperClass, BarSubClass, foo, bar, ConstructorTestClass, newConstructor, constructorTest, $mockElement, mockString,
|
Customize: Add global notifications area.
* Displays an error notification in the global area when a save attempt is rejected due to invalid settings. An error notification is also displayed when saving fails due to a network error or server error.
* Introduces `wp.customize.Notifications` subclass of `wp.customize.Values` to contain instances of `wp.customize.Notification` and manage their rendering into a container.
* Exposes the global notification area as `wp.customize.notifications` collection instance.
* Updates the `notifications` object on `Control` to use `Notifications` rather than `Values` and to re-use the rendering logic from the former. The old `Control#renderNotifications` method is deprecated.
* Allows notifications to be dismissed by instantiating them with a `dismissible` property.
* Allows `wp.customize.Notification` to be extended with custom templates and `render` functions.
* Triggers a `removed` event on `wp.customize.Values` instances _after_ a value has been removed from the collection.
Props delawski, westonruter, karmatosed, celloexpressions, Fab1en, melchoyce, Kelderic, afercia, adamsilverstein.
See #34893, #39896.
Fixes #35210, #31582, #37727, #37269.
git-svn-id: https://develop.svn.wordpress.org/trunk@41374 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-12 09:02:49 +02:00
|
|
|
firstInitialValue, firstValueInstance, valuesInstance, wasCallbackFired, mockValueCallback;
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.module( 'Customize Base: Class' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
|
|
|
|
FooSuperClass = wp.customize.Class.extend(
|
|
|
|
{
|
2020-03-27 01:16:58 +01:00
|
|
|
initialize: function( instanceProps ) {
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
$.extend( this, instanceProps || {} );
|
|
|
|
},
|
|
|
|
protoProp: 'protoPropValue'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
staticProp: 'staticPropValue'
|
|
|
|
}
|
|
|
|
);
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'FooSuperClass is a function', function( assert ) {
|
|
|
|
assert.equal( typeof FooSuperClass, 'function' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'FooSuperClass prototype has protoProp', function( assert ) {
|
|
|
|
assert.equal( FooSuperClass.prototype.protoProp, 'protoPropValue' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'FooSuperClass does not have protoProp', function( assert ) {
|
|
|
|
assert.equal( typeof FooSuperClass.protoProp, 'undefined' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'FooSuperClass has staticProp', function( assert ) {
|
|
|
|
assert.equal( FooSuperClass.staticProp, 'staticPropValue' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'FooSuperClass prototype does not have staticProp', function( assert ) {
|
|
|
|
assert.equal( typeof FooSuperClass.prototype.staticProp, 'undefined' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
foo = new FooSuperClass( { instanceProp: 'instancePropValue' } );
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'FooSuperClass instance foo extended Class', function( assert ) {
|
|
|
|
assert.equal( foo.extended( wp.customize.Class ), true );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'foo instance has protoProp', function( assert ) {
|
|
|
|
assert.equal( foo.protoProp, 'protoPropValue' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'foo instance does not have staticProp', function( assert ) {
|
|
|
|
assert.equal( typeof foo.staticProp, 'undefined' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'FooSuperClass instance foo ran initialize() and has supplied instanceProp', function( assert ) {
|
|
|
|
assert.equal( foo.instanceProp, 'instancePropValue' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
// @todo Test Class.applicator?
|
2020-01-29 01:43:23 +01:00
|
|
|
// @todo Do we test object.instance?
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.module( 'Customize Base: Subclass' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
|
|
|
|
BarSubClass = FooSuperClass.extend(
|
|
|
|
{
|
|
|
|
initialize: function ( instanceProps ) {
|
|
|
|
FooSuperClass.prototype.initialize.call( this, instanceProps );
|
|
|
|
this.subInstanceProp = 'subInstancePropValue';
|
|
|
|
},
|
|
|
|
subProtoProp: 'subProtoPropValue'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
subStaticProp: 'subStaticPropValue'
|
|
|
|
}
|
|
|
|
);
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'BarSubClass prototype has subProtoProp', function( assert ) {
|
|
|
|
assert.equal( BarSubClass.prototype.subProtoProp, 'subProtoPropValue' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'BarSubClass prototype has parent FooSuperClass protoProp', function( assert ) {
|
|
|
|
assert.equal( BarSubClass.prototype.protoProp, 'protoPropValue' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
bar = new BarSubClass( { instanceProp: 'instancePropValue' } );
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'BarSubClass instance bar its initialize() and parent initialize() run', function( assert ) {
|
|
|
|
assert.equal( bar.instanceProp, 'instancePropValue' );
|
|
|
|
assert.equal( bar.subInstanceProp, 'subInstancePropValue' );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'BarSubClass instance bar extended FooSuperClass', function( assert ) {
|
|
|
|
assert.equal( bar.extended( FooSuperClass ), true );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|
|
|
|
|
2014-12-02 23:55:48 +01:00
|
|
|
|
2020-01-29 01:43:23 +01:00
|
|
|
// Implements todo: Test Class.constructor() manipulation.
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.module( 'Customize Base: Constructor Manipulation' );
|
2014-12-02 23:55:48 +01:00
|
|
|
|
|
|
|
newConstructor = function ( instanceProps ) {
|
|
|
|
$.extend( this , instanceProps || {} );
|
|
|
|
};
|
|
|
|
|
|
|
|
ConstructorTestClass = wp.customize.Class.extend(
|
|
|
|
{
|
|
|
|
constructor : newConstructor,
|
|
|
|
protoProp: 'protoPropValue'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
staticProp: 'staticPropValue'
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'New constructor added to class', function( assert ) {
|
|
|
|
assert.equal( ConstructorTestClass.prototype.constructor , newConstructor );
|
2014-12-02 23:55:48 +01:00
|
|
|
});
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'Class with new constructor has protoPropValue', function( assert ) {
|
|
|
|
assert.equal( ConstructorTestClass.prototype.protoProp , 'protoPropValue' );
|
2014-12-02 23:55:48 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
constructorTest = new ConstructorTestClass( { instanceProp: 'instancePropValue' } );
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'ConstructorTestClass instance constructorTest has the new constructor', function( assert ) {
|
|
|
|
assert.equal( constructorTest.constructor, newConstructor );
|
2014-12-02 23:55:48 +01:00
|
|
|
});
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'ConstructorTestClass instance constructorTest extended Class', function( assert ) {
|
|
|
|
assert.equal( constructorTest.extended( wp.customize.Class ), true );
|
2014-12-02 23:55:48 +01:00
|
|
|
});
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'ConstructorTestClass instance constructorTest has the added instance property', function( assert ) {
|
|
|
|
assert.equal( constructorTest.instanceProp , 'instancePropValue' );
|
2014-12-02 23:55:48 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.module( 'Customize Base: wp.customizer.ensure' );
|
2014-12-02 23:55:48 +01:00
|
|
|
|
|
|
|
$mockElement = $( '<div id="mockElement"></div>' );
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'Handles jQuery argument', function( assert ) {
|
|
|
|
assert.equal( wp.customize.ensure( $mockElement ) , $mockElement );
|
2014-12-02 23:55:48 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
mockString = '<div class="mockString"></div>';
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'Handles string argument', function( assert ) {
|
|
|
|
assert.ok( wp.customize.ensure( mockString ) instanceof jQuery );
|
2014-12-02 23:55:48 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.module( 'Customize Base: Value Class' );
|
2014-12-02 23:55:48 +01:00
|
|
|
|
|
|
|
firstInitialValue = true;
|
|
|
|
firstValueInstance = new wp.customize.Value( firstInitialValue );
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'Initialized with the right value', function( assert ) {
|
|
|
|
assert.equal( firstValueInstance.get() , firstInitialValue );
|
2014-12-02 23:55:48 +01:00
|
|
|
});
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( '.set() works', function( assert ) {
|
2014-12-02 23:55:48 +01:00
|
|
|
firstValueInstance.set( false );
|
2020-03-27 01:16:58 +01:00
|
|
|
assert.equal( firstValueInstance.get() , false );
|
2014-12-02 23:55:48 +01:00
|
|
|
});
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( '.bind() adds new callback that fires on set()', function( assert ) {
|
2014-12-02 23:55:48 +01:00
|
|
|
wasCallbackFired = false;
|
|
|
|
mockValueCallback = function() {
|
|
|
|
wasCallbackFired = true;
|
|
|
|
};
|
|
|
|
firstValueInstance.bind( mockValueCallback );
|
|
|
|
firstValueInstance.set( 'newValue' );
|
2020-03-27 01:16:58 +01:00
|
|
|
assert.ok( wasCallbackFired );
|
2014-12-02 23:55:48 +01:00
|
|
|
});
|
Customize: Add setting validation model and control notifications to augment setting sanitization.
When a setting is invalid, not only will it be blocked from being saved but all other settings will be blocked as well. This ensures that Customizer saves aren't partial but are more transactional. User will be displayed the error in a notification so that they can fix and re-attempt saving.
PHP changes:
* Introduces `WP_Customize_Setting::validate()`, `WP_Customize_Setting::$validate_callback`, and the `customize_validate_{$setting_id}` filter.
* Introduces `WP_Customize_Manager::validate_setting_values()` to do validation (and sanitization) for the setting values supplied, returning a list of `WP_Error` instances for invalid settings.
* Attempting to save settings that are invalid will result in the save being blocked entirely, with the errors being sent in the `customize_save_response`. Modifies `WP_Customize_Manager::save()` to check all settings for validity issues prior to calling their `save` methods.
* Introduces `WP_Customize_Setting::json()` for parity with the other Customizer classes. This includes exporting of the `type`.
* Modifies `WP_Customize_Manager::post_value()` to apply `validate` after `sanitize`, and if validation fails, to return the `$default`.
* Introduces `customize_save_validation_before` action which fires right before the validation checks are made prior to saving.
JS changes:
* Introduces `wp.customize.Notification` in JS which to represent `WP_Error` instances returned from the server when setting validation fails.
* Introduces `wp.customize.Setting.prototype.notifications`.
* Introduces `wp.customize.Control.prototype.notifications`, which are synced with a control's settings' notifications.
* Introduces `wp.customize.Control.prototype.renderNotifications()` to re-render a control's notifications in its notification area. This is called automatically when the notifications collection changes.
* Introduces `wp.customize.settingConstructor`, allowing custom setting types to be used in the same way that custom controls, panels, and sections can be made.
* Injects a notification area into existing controls which is populated in response to the control's `notifications` collection changing. A custom control can customize the placement of the notification area by overriding the new `getNotificationsContainerElement` method.
* When a save fails due to setting invalidity, the invalidity errors will be added to the settings to then populate in the controls' notification areas, and the first such invalid control will be focused.
Props westonruter, celloexpressions, mrahmadawais.
See #35210.
See #30937.
Fixes #34893.
git-svn-id: https://develop.svn.wordpress.org/trunk@37476 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-20 23:09:40 +02:00
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.module( 'Customize Base: Values Class' );
|
Customize: Add global notifications area.
* Displays an error notification in the global area when a save attempt is rejected due to invalid settings. An error notification is also displayed when saving fails due to a network error or server error.
* Introduces `wp.customize.Notifications` subclass of `wp.customize.Values` to contain instances of `wp.customize.Notification` and manage their rendering into a container.
* Exposes the global notification area as `wp.customize.notifications` collection instance.
* Updates the `notifications` object on `Control` to use `Notifications` rather than `Values` and to re-use the rendering logic from the former. The old `Control#renderNotifications` method is deprecated.
* Allows notifications to be dismissed by instantiating them with a `dismissible` property.
* Allows `wp.customize.Notification` to be extended with custom templates and `render` functions.
* Triggers a `removed` event on `wp.customize.Values` instances _after_ a value has been removed from the collection.
Props delawski, westonruter, karmatosed, celloexpressions, Fab1en, melchoyce, Kelderic, afercia, adamsilverstein.
See #34893, #39896.
Fixes #35210, #31582, #37727, #37269.
git-svn-id: https://develop.svn.wordpress.org/trunk@41374 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-12 09:02:49 +02:00
|
|
|
|
|
|
|
valuesInstance = new wp.customize.Values();
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.test( 'Correct events are triggered when adding to or removing from Values collection', function( assert ) {
|
Customize: Add global notifications area.
* Displays an error notification in the global area when a save attempt is rejected due to invalid settings. An error notification is also displayed when saving fails due to a network error or server error.
* Introduces `wp.customize.Notifications` subclass of `wp.customize.Values` to contain instances of `wp.customize.Notification` and manage their rendering into a container.
* Exposes the global notification area as `wp.customize.notifications` collection instance.
* Updates the `notifications` object on `Control` to use `Notifications` rather than `Values` and to re-use the rendering logic from the former. The old `Control#renderNotifications` method is deprecated.
* Allows notifications to be dismissed by instantiating them with a `dismissible` property.
* Allows `wp.customize.Notification` to be extended with custom templates and `render` functions.
* Triggers a `removed` event on `wp.customize.Values` instances _after_ a value has been removed from the collection.
Props delawski, westonruter, karmatosed, celloexpressions, Fab1en, melchoyce, Kelderic, afercia, adamsilverstein.
See #34893, #39896.
Fixes #35210, #31582, #37727, #37269.
git-svn-id: https://develop.svn.wordpress.org/trunk@41374 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-12 09:02:49 +02:00
|
|
|
var hasFooOnAdd = false,
|
|
|
|
hasFooOnRemove = false,
|
|
|
|
hasFooOnRemoved = true,
|
|
|
|
valuePassedToAdd = false,
|
|
|
|
valuePassedToRemove = false,
|
|
|
|
valuePassedToRemoved = false,
|
|
|
|
wasEventFiredOnRemoval = false,
|
|
|
|
fooValue = new wp.customize.Value( 'foo' );
|
|
|
|
|
|
|
|
// Test events when adding new value.
|
|
|
|
valuesInstance.bind( 'add', function( value ) {
|
|
|
|
hasFooOnAdd = valuesInstance.has( 'foo' );
|
|
|
|
valuePassedToAdd = value;
|
|
|
|
} );
|
|
|
|
valuesInstance.add( 'foo', fooValue );
|
2020-03-27 01:16:58 +01:00
|
|
|
assert.ok( hasFooOnAdd );
|
|
|
|
assert.equal( valuePassedToAdd.get(), fooValue.get() );
|
Customize: Add global notifications area.
* Displays an error notification in the global area when a save attempt is rejected due to invalid settings. An error notification is also displayed when saving fails due to a network error or server error.
* Introduces `wp.customize.Notifications` subclass of `wp.customize.Values` to contain instances of `wp.customize.Notification` and manage their rendering into a container.
* Exposes the global notification area as `wp.customize.notifications` collection instance.
* Updates the `notifications` object on `Control` to use `Notifications` rather than `Values` and to re-use the rendering logic from the former. The old `Control#renderNotifications` method is deprecated.
* Allows notifications to be dismissed by instantiating them with a `dismissible` property.
* Allows `wp.customize.Notification` to be extended with custom templates and `render` functions.
* Triggers a `removed` event on `wp.customize.Values` instances _after_ a value has been removed from the collection.
Props delawski, westonruter, karmatosed, celloexpressions, Fab1en, melchoyce, Kelderic, afercia, adamsilverstein.
See #34893, #39896.
Fixes #35210, #31582, #37727, #37269.
git-svn-id: https://develop.svn.wordpress.org/trunk@41374 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-12 09:02:49 +02:00
|
|
|
|
|
|
|
// Test events when removing the value.
|
|
|
|
valuesInstance.bind( 'remove', function( value ) {
|
|
|
|
hasFooOnRemove = valuesInstance.has( 'foo' );
|
|
|
|
valuePassedToRemove = value;
|
|
|
|
wasEventFiredOnRemoval = true;
|
|
|
|
} );
|
|
|
|
valuesInstance.bind( 'removed', function( value ) {
|
|
|
|
hasFooOnRemoved = valuesInstance.has( 'foo' );
|
|
|
|
valuePassedToRemoved = value;
|
|
|
|
wasEventFiredOnRemoval = true;
|
|
|
|
} );
|
|
|
|
valuesInstance.remove( 'foo' );
|
2020-03-27 01:16:58 +01:00
|
|
|
assert.ok( hasFooOnRemove );
|
|
|
|
assert.equal( valuePassedToRemove.get(), fooValue.get() );
|
|
|
|
assert.ok( ! hasFooOnRemoved );
|
|
|
|
assert.equal( valuePassedToRemoved.get(), fooValue.get() );
|
Customize: Add global notifications area.
* Displays an error notification in the global area when a save attempt is rejected due to invalid settings. An error notification is also displayed when saving fails due to a network error or server error.
* Introduces `wp.customize.Notifications` subclass of `wp.customize.Values` to contain instances of `wp.customize.Notification` and manage their rendering into a container.
* Exposes the global notification area as `wp.customize.notifications` collection instance.
* Updates the `notifications` object on `Control` to use `Notifications` rather than `Values` and to re-use the rendering logic from the former. The old `Control#renderNotifications` method is deprecated.
* Allows notifications to be dismissed by instantiating them with a `dismissible` property.
* Allows `wp.customize.Notification` to be extended with custom templates and `render` functions.
* Triggers a `removed` event on `wp.customize.Values` instances _after_ a value has been removed from the collection.
Props delawski, westonruter, karmatosed, celloexpressions, Fab1en, melchoyce, Kelderic, afercia, adamsilverstein.
See #34893, #39896.
Fixes #35210, #31582, #37727, #37269.
git-svn-id: https://develop.svn.wordpress.org/trunk@41374 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-12 09:02:49 +02:00
|
|
|
|
|
|
|
// Confirm no events are fired when nonexistent value is removed.
|
|
|
|
wasEventFiredOnRemoval = false;
|
|
|
|
valuesInstance.remove( 'bar' );
|
2020-03-27 01:16:58 +01:00
|
|
|
assert.ok( ! wasEventFiredOnRemoval );
|
Customize: Add global notifications area.
* Displays an error notification in the global area when a save attempt is rejected due to invalid settings. An error notification is also displayed when saving fails due to a network error or server error.
* Introduces `wp.customize.Notifications` subclass of `wp.customize.Values` to contain instances of `wp.customize.Notification` and manage their rendering into a container.
* Exposes the global notification area as `wp.customize.notifications` collection instance.
* Updates the `notifications` object on `Control` to use `Notifications` rather than `Values` and to re-use the rendering logic from the former. The old `Control#renderNotifications` method is deprecated.
* Allows notifications to be dismissed by instantiating them with a `dismissible` property.
* Allows `wp.customize.Notification` to be extended with custom templates and `render` functions.
* Triggers a `removed` event on `wp.customize.Values` instances _after_ a value has been removed from the collection.
Props delawski, westonruter, karmatosed, celloexpressions, Fab1en, melchoyce, Kelderic, afercia, adamsilverstein.
See #34893, #39896.
Fixes #35210, #31582, #37727, #37269.
git-svn-id: https://develop.svn.wordpress.org/trunk@41374 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-12 09:02:49 +02:00
|
|
|
});
|
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.module( 'Customize Base: Notification' );
|
|
|
|
QUnit.test( 'Notification object exists and has expected properties', function ( assert ) {
|
Customize: Add setting validation model and control notifications to augment setting sanitization.
When a setting is invalid, not only will it be blocked from being saved but all other settings will be blocked as well. This ensures that Customizer saves aren't partial but are more transactional. User will be displayed the error in a notification so that they can fix and re-attempt saving.
PHP changes:
* Introduces `WP_Customize_Setting::validate()`, `WP_Customize_Setting::$validate_callback`, and the `customize_validate_{$setting_id}` filter.
* Introduces `WP_Customize_Manager::validate_setting_values()` to do validation (and sanitization) for the setting values supplied, returning a list of `WP_Error` instances for invalid settings.
* Attempting to save settings that are invalid will result in the save being blocked entirely, with the errors being sent in the `customize_save_response`. Modifies `WP_Customize_Manager::save()` to check all settings for validity issues prior to calling their `save` methods.
* Introduces `WP_Customize_Setting::json()` for parity with the other Customizer classes. This includes exporting of the `type`.
* Modifies `WP_Customize_Manager::post_value()` to apply `validate` after `sanitize`, and if validation fails, to return the `$default`.
* Introduces `customize_save_validation_before` action which fires right before the validation checks are made prior to saving.
JS changes:
* Introduces `wp.customize.Notification` in JS which to represent `WP_Error` instances returned from the server when setting validation fails.
* Introduces `wp.customize.Setting.prototype.notifications`.
* Introduces `wp.customize.Control.prototype.notifications`, which are synced with a control's settings' notifications.
* Introduces `wp.customize.Control.prototype.renderNotifications()` to re-render a control's notifications in its notification area. This is called automatically when the notifications collection changes.
* Introduces `wp.customize.settingConstructor`, allowing custom setting types to be used in the same way that custom controls, panels, and sections can be made.
* Injects a notification area into existing controls which is populated in response to the control's `notifications` collection changing. A custom control can customize the placement of the notification area by overriding the new `getNotificationsContainerElement` method.
* When a save fails due to setting invalidity, the invalidity errors will be added to the settings to then populate in the controls' notification areas, and the first such invalid control will be focused.
Props westonruter, celloexpressions, mrahmadawais.
See #35210.
See #30937.
Fixes #34893.
git-svn-id: https://develop.svn.wordpress.org/trunk@37476 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-20 23:09:40 +02:00
|
|
|
var notification = new wp.customize.Notification( 'mycode', {
|
|
|
|
'message': 'Hello World',
|
|
|
|
'type': 'update',
|
2016-09-03 00:34:48 +02:00
|
|
|
'setting': 'blogname',
|
|
|
|
'fromServer': true,
|
Customize: Add setting validation model and control notifications to augment setting sanitization.
When a setting is invalid, not only will it be blocked from being saved but all other settings will be blocked as well. This ensures that Customizer saves aren't partial but are more transactional. User will be displayed the error in a notification so that they can fix and re-attempt saving.
PHP changes:
* Introduces `WP_Customize_Setting::validate()`, `WP_Customize_Setting::$validate_callback`, and the `customize_validate_{$setting_id}` filter.
* Introduces `WP_Customize_Manager::validate_setting_values()` to do validation (and sanitization) for the setting values supplied, returning a list of `WP_Error` instances for invalid settings.
* Attempting to save settings that are invalid will result in the save being blocked entirely, with the errors being sent in the `customize_save_response`. Modifies `WP_Customize_Manager::save()` to check all settings for validity issues prior to calling their `save` methods.
* Introduces `WP_Customize_Setting::json()` for parity with the other Customizer classes. This includes exporting of the `type`.
* Modifies `WP_Customize_Manager::post_value()` to apply `validate` after `sanitize`, and if validation fails, to return the `$default`.
* Introduces `customize_save_validation_before` action which fires right before the validation checks are made prior to saving.
JS changes:
* Introduces `wp.customize.Notification` in JS which to represent `WP_Error` instances returned from the server when setting validation fails.
* Introduces `wp.customize.Setting.prototype.notifications`.
* Introduces `wp.customize.Control.prototype.notifications`, which are synced with a control's settings' notifications.
* Introduces `wp.customize.Control.prototype.renderNotifications()` to re-render a control's notifications in its notification area. This is called automatically when the notifications collection changes.
* Introduces `wp.customize.settingConstructor`, allowing custom setting types to be used in the same way that custom controls, panels, and sections can be made.
* Injects a notification area into existing controls which is populated in response to the control's `notifications` collection changing. A custom control can customize the placement of the notification area by overriding the new `getNotificationsContainerElement` method.
* When a save fails due to setting invalidity, the invalidity errors will be added to the settings to then populate in the controls' notification areas, and the first such invalid control will be focused.
Props westonruter, celloexpressions, mrahmadawais.
See #35210.
See #30937.
Fixes #34893.
git-svn-id: https://develop.svn.wordpress.org/trunk@37476 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-20 23:09:40 +02:00
|
|
|
'data': { 'foo': 'bar' }
|
|
|
|
} );
|
|
|
|
|
|
|
|
assert.equal( 'mycode', notification.code );
|
|
|
|
assert.equal( 'Hello World', notification.message );
|
|
|
|
assert.equal( 'update', notification.type );
|
2016-09-03 00:34:48 +02:00
|
|
|
assert.equal( 'blogname', notification.setting );
|
|
|
|
assert.equal( true, notification.fromServer );
|
Customize: Add setting validation model and control notifications to augment setting sanitization.
When a setting is invalid, not only will it be blocked from being saved but all other settings will be blocked as well. This ensures that Customizer saves aren't partial but are more transactional. User will be displayed the error in a notification so that they can fix and re-attempt saving.
PHP changes:
* Introduces `WP_Customize_Setting::validate()`, `WP_Customize_Setting::$validate_callback`, and the `customize_validate_{$setting_id}` filter.
* Introduces `WP_Customize_Manager::validate_setting_values()` to do validation (and sanitization) for the setting values supplied, returning a list of `WP_Error` instances for invalid settings.
* Attempting to save settings that are invalid will result in the save being blocked entirely, with the errors being sent in the `customize_save_response`. Modifies `WP_Customize_Manager::save()` to check all settings for validity issues prior to calling their `save` methods.
* Introduces `WP_Customize_Setting::json()` for parity with the other Customizer classes. This includes exporting of the `type`.
* Modifies `WP_Customize_Manager::post_value()` to apply `validate` after `sanitize`, and if validation fails, to return the `$default`.
* Introduces `customize_save_validation_before` action which fires right before the validation checks are made prior to saving.
JS changes:
* Introduces `wp.customize.Notification` in JS which to represent `WP_Error` instances returned from the server when setting validation fails.
* Introduces `wp.customize.Setting.prototype.notifications`.
* Introduces `wp.customize.Control.prototype.notifications`, which are synced with a control's settings' notifications.
* Introduces `wp.customize.Control.prototype.renderNotifications()` to re-render a control's notifications in its notification area. This is called automatically when the notifications collection changes.
* Introduces `wp.customize.settingConstructor`, allowing custom setting types to be used in the same way that custom controls, panels, and sections can be made.
* Injects a notification area into existing controls which is populated in response to the control's `notifications` collection changing. A custom control can customize the placement of the notification area by overriding the new `getNotificationsContainerElement` method.
* When a save fails due to setting invalidity, the invalidity errors will be added to the settings to then populate in the controls' notification areas, and the first such invalid control will be focused.
Props westonruter, celloexpressions, mrahmadawais.
See #35210.
See #30937.
Fixes #34893.
git-svn-id: https://develop.svn.wordpress.org/trunk@37476 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-20 23:09:40 +02:00
|
|
|
assert.deepEqual( { 'foo': 'bar' }, notification.data );
|
|
|
|
|
|
|
|
notification = new wp.customize.Notification( 'mycode2', {
|
|
|
|
'message': 'Hello Space'
|
|
|
|
} );
|
|
|
|
assert.equal( 'mycode2', notification.code );
|
|
|
|
assert.equal( 'Hello Space', notification.message );
|
|
|
|
assert.equal( 'error', notification.type );
|
|
|
|
assert.equal( null, notification.data );
|
|
|
|
} );
|
Customize: Implement customized state persistence with changesets.
Includes infrastructure developed in the Customize Snapshots feature plugin.
See https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions/
Props westonruter, valendesigns, utkarshpatel, stubgo, lgedeon, ocean90, ryankienstra, mihai2u, dlh, aaroncampbell, jonathanbardo, jorbin.
See #28721.
See #31089.
Fixes #30937.
Fixes #31517.
Fixes #30028.
Fixes #23225.
Fixes #34142.
Fixes #36485.
git-svn-id: https://develop.svn.wordpress.org/trunk@38810 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-18 22:04:36 +02:00
|
|
|
|
2020-03-27 01:16:58 +01:00
|
|
|
QUnit.module( 'Customize Base: utils.parseQueryString' );
|
|
|
|
QUnit.test( 'wp.customize.utils.parseQueryString works', function( assert ) {
|
Customize: Implement customized state persistence with changesets.
Includes infrastructure developed in the Customize Snapshots feature plugin.
See https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions/
Props westonruter, valendesigns, utkarshpatel, stubgo, lgedeon, ocean90, ryankienstra, mihai2u, dlh, aaroncampbell, jonathanbardo, jorbin.
See #28721.
See #31089.
Fixes #30937.
Fixes #31517.
Fixes #30028.
Fixes #23225.
Fixes #34142.
Fixes #36485.
git-svn-id: https://develop.svn.wordpress.org/trunk@38810 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-18 22:04:36 +02:00
|
|
|
var queryParams;
|
|
|
|
queryParams = wp.customize.utils.parseQueryString( 'a=1&b=2' );
|
|
|
|
assert.ok( _.isEqual( queryParams, { a: '1', b: '2' } ) );
|
|
|
|
|
|
|
|
queryParams = wp.customize.utils.parseQueryString( 'a+b=1&b=Hello%20World' );
|
|
|
|
assert.ok( _.isEqual( queryParams, { 'a_b': '1', b: 'Hello World' } ) );
|
|
|
|
|
|
|
|
queryParams = wp.customize.utils.parseQueryString( 'a%20b=1&b=Hello+World' );
|
|
|
|
assert.ok( _.isEqual( queryParams, { 'a_b': '1', b: 'Hello World' } ) );
|
|
|
|
|
|
|
|
queryParams = wp.customize.utils.parseQueryString( 'a=1&b' );
|
|
|
|
assert.ok( _.isEqual( queryParams, { 'a': '1', b: null } ) );
|
|
|
|
|
|
|
|
queryParams = wp.customize.utils.parseQueryString( 'a=1&b=' );
|
|
|
|
assert.ok( _.isEqual( queryParams, { 'a': '1', b: '' } ) );
|
|
|
|
} );
|
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.
https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.
props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.
git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 23:50:21 +01:00
|
|
|
});
|