<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[42042] trunk: Customize: Allow 0:00-0:59 in date/time control when 24-hour time used.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/42042">42042</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/42042","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>westonruter</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2017-10-30 16:39:06 +0000 (Mon, 30 Oct 2017)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Customize: Allow 0:00-0:59 in date/time control when 24-hour time used.

* Let min hour be 0 and max be 23 in 24-hour time; let min hour be 1 and max be 12 in 12-hour time.
* Show error notification when an invalid date value is provided, not just when not a future date.
* Fix translation of custom validity message.
* Start checking for validity after all inputs have been initially populated.
* Remove support for being able to enter 24:00.
* Cease forcing date input elements from being casted to integers, to allow for invalid inputs to be detected.

Props westonruter, Presskopp, peterwilsoncc, atachibana for testing.
See <a href="https://core.trac.wordpress.org/ticket/39896">#39896</a>, <a href="https://core.trac.wordpress.org/ticket/28721">#28721</a>.
Fixes <a href="https://core.trac.wordpress.org/ticket/42373">#42373</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjscustomizecontrolsjs">trunk/src/wp-admin/js/customize-controls.js</a></li>
<li><a href="#trunksrcwpincludescustomizeclasswpcustomizedatetimecontrolphp">trunk/src/wp-includes/customize/class-wp-customize-date-time-control.php</a></li>
<li><a href="#trunksrcwpincludesscriptloaderphp">trunk/src/wp-includes/script-loader.php</a></li>
<li><a href="#trunktestsqunitwpadminjscustomizecontrolsjs">trunk/tests/qunit/wp-admin/js/customize-controls.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjscustomizecontrolsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/customize-controls.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/customize-controls.js       2017-10-30 04:05:20 UTC (rev 42041)
+++ trunk/src/wp-admin/js/customize-controls.js 2017-10-30 16:39:06 UTC (rev 42042)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5542,7 +5542,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        control.inputElements = {};
</span><span class="cx" style="display: block; padding: 0 10px">                        control.invalidDate = false;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        _.bindAll( control, 'populateSetting', 'updateDaysForMonth', 'updateMinutesForHour', 'populateDateInputs' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 _.bindAll( control, 'populateSetting', 'updateDaysForMonth', 'populateDateInputs' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( ! control.setting ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                throw new Error( 'Missing setting' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5552,34 +5552,35 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                var input = $( this ), component, element;
</span><span class="cx" style="display: block; padding: 0 10px">                                component = input.data( 'component' );
</span><span class="cx" style="display: block; padding: 0 10px">                                element = new api.Element( input );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ( 'meridian' === component ) {
-                                       element.validate = function( value ) {
-                                               if ( 'am' !== value && 'pm' !== value ) {
-                                                       return null;
-                                               }
-                                               return value;
-                                       };
-                               } else {
-                                       element.validate = function( value ) {
-                                               var val = parseInt( value, 10 );
-                                               if ( isNaN( val ) ) {
-                                                       return null;
-                                               }
-                                               return val;
-                                       };
-                               }
-                               element.bind( control.populateSetting );
</del><span class="cx" style="display: block; padding: 0 10px">                                 control.inputElements[ component ] = element;
</span><span class="cx" style="display: block; padding: 0 10px">                                control.elements.push( element );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               // Add invalid date error once user changes (and has blurred the input).
+                               input.on( 'change', function() {
+                                       if ( control.invalidDate ) {
+                                               control.notifications.add( new api.Notification( 'invalid_date', {
+                                                       message: api.l10n.invalidDate
+                                               } ) );
+                                       }
+                               } );
+
+                               // Remove the error immediately after validity change.
+                               input.on( 'input', _.debounce( function() {
+                                       if ( ! control.invalidDate ) {
+                                               control.notifications.remove( 'invalid_date' );
+                                       }
+                               } ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                         } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        control.inputElements.month.bind( control.updateDaysForMonth );
</span><span class="cx" style="display: block; padding: 0 10px">                        control.inputElements.year.bind( control.updateDaysForMonth );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( control.params.includeTime ) {
-                               control.inputElements.hour.bind( control.updateMinutesForHour );
-                       }
</del><span class="cx" style="display: block; padding: 0 10px">                         control.populateDateInputs();
</span><span class="cx" style="display: block; padding: 0 10px">                        control.setting.bind( control.populateDateInputs );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       // Start populating setting after inputs have been populated.
+                       _.each( control.inputElements, function( element ) {
+                               element.bind( control.populateSetting );
+                       } );
</ins><span class="cx" style="display: block; padding: 0 10px">                 },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5629,7 +5630,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 * @return {boolean} If date input fields has error.
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                validateInputs: function validateInputs() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        var control = this, errorMessage, components;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 var control = this, components, validityInput;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        control.invalidDate = false;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5638,25 +5639,41 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                components.push( 'hour', 'minute' );
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        _.each( components, function( component ) {
-                               var element, el, max, min, value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 _.find( components, function( component ) {
+                               var element, max, min, value;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                element = control.inputElements[ component ];
+                               validityInput = element.element.get( 0 );
+                               max = parseInt( element.element.attr( 'max' ), 10 );
+                               min = parseInt( element.element.attr( 'min' ), 10 );
+                               value = parseInt( element(), 10 );
+                               control.invalidDate = isNaN( value ) || value > max || value < min;
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 if ( ! control.invalidDate ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        element = control.inputElements[ component ];
-                                       el = element.element.get( 0 );
-                                       max = parseInt( element.element.attr( 'max' ), 10 );
-                                       min = parseInt( element.element.attr( 'min' ), 10 );
-                                       value = element();
-                                       control.invalidDate = value > max || value < min;
-                                       errorMessage = control.invalidDate ? api.l10n.invalid + ' ' + component : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 validityInput.setCustomValidity( '' );
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        el.setCustomValidity( errorMessage );
-                                       if ( ! control.section() || api.section.has( control.section() ) && api.section( control.section() ).expanded() ) {
-                                               _.result( el, 'reportValidity' );
-                                       }
-                               }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         return control.invalidDate;
</ins><span class="cx" style="display: block; padding: 0 10px">                         } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        if ( control.inputElements.meridian && ! control.invalidDate ) {
+                               validityInput = control.inputElements.meridian.element.get( 0 );
+                               if ( 'am' !== control.inputElements.meridian.get() && 'pm' !== control.inputElements.meridian.get() ) {
+                                       control.invalidDate = true;
+                               } else {
+                                       validityInput.setCustomValidity( '' );
+                               }
+                       }
+
+                       if ( control.invalidDate ) {
+                               validityInput.setCustomValidity( api.l10n.invalidValue );
+                       } else {
+                               validityInput.setCustomValidity( '' );
+                       }
+                       if ( ! control.section() || api.section.has( control.section() ) && api.section( control.section() ).expanded() ) {
+                               _.result( validityInput, 'reportValidity' );
+                       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         return control.invalidDate;
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5669,45 +5686,21 @@
</span><span class="cx" style="display: block; padding: 0 10px">                updateDaysForMonth: function updateDaysForMonth() {
</span><span class="cx" style="display: block; padding: 0 10px">                        var control = this, daysInMonth, year, month, day;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        month = control.inputElements.month();
-                       year = control.inputElements.year();
-                       day = control.inputElements.day();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 month = parseInt( control.inputElements.month(), 10 );
+                       year = parseInt( control.inputElements.year(), 10 );
+                       day = parseInt( control.inputElements.day(), 10 );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( month && year ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                daysInMonth = new Date( year, month, 0 ).getDate();
</span><span class="cx" style="display: block; padding: 0 10px">                                control.inputElements.day.element.attr( 'max', daysInMonth );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( day > daysInMonth ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        control.inputElements.day( daysInMonth );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 control.inputElements.day( String( daysInMonth ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Updates number of minutes according to the hour selected.
-                *
-                * @since 4.9.0
-                * @return {void}
-                */
-               updateMinutesForHour: function updateMinutesForHour() {
-                       var control = this, maxHours = 24, minuteEl;
-
-                       if ( control.inputElements.meridian ) {
-                               return;
-                       }
-
-                       minuteEl = control.inputElements.minute.element;
-
-                       if ( maxHours === control.inputElements.hour() ) {
-                               control.inputElements.minute( 0 );
-                               minuteEl.data( 'default-max', minuteEl.attr( 'max' ) );
-                               minuteEl.attr( 'max', '0' );
-                       } else if ( minuteEl.data( 'default-max' ) ) {
-                               minuteEl.attr( 'max', minuteEl.data( 'default-max' ) );
-                       }
-               },
-
-               /**
</del><span class="cx" style="display: block; padding: 0 10px">                  * Populate setting value from the inputs.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 4.9.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5745,7 +5738,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        getElementValue = function( component ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                var value = control.inputElements[ component ].get();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         var value = parseInt( control.inputElements[ component ].get(), 10 );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( _.contains( [ 'month', 'day', 'hour', 'minute' ], component ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        value = pad( value, 2 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5822,7 +5815,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        _.each( control.inputElements, function( element, component ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                element.set( parsed[ component ] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( 'meridian' === component || parseInt( parsed[ component ], 10 ) !== parseInt( element(), 10 ) ) {
+                                       element.set( parsed[ component ] );
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px">                         } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        return true;
</span></span></pre></div>
<a id="trunksrcwpincludescustomizeclasswpcustomizedatetimecontrolphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/customize/class-wp-customize-date-time-control.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/customize/class-wp-customize-date-time-control.php  2017-10-30 04:05:20 UTC (rev 42041)
+++ trunk/src/wp-includes/customize/class-wp-customize-date-time-control.php    2017-10-30 16:39:06 UTC (rev 42042)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -141,8 +141,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        <legend class="title-time"><?php esc_html_e( 'Time' ); ?></legend>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <div class="time-fields clear">
</span><span class="cx" style="display: block; padding: 0 10px">                                                <label for="{{ idPrefix }}date-time-hour" class="screen-reader-text"><?php esc_html_e( 'Hour' ); ?></label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                <# var maxHour = data.twelveHourFormat ? 12 : 24; #>
-                                               <input id="{{ idPrefix }}date-time-hour" type="number" size="2" autocomplete="off" class="date-input hour" data-component="hour" min="1" max="{{ maxHour }}">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         <# var maxHour = data.twelveHourFormat ? 12 : 23; #>
+                                               <# var minHour = data.twelveHourFormat ? 1 : 0; #>
+                                               <input id="{{ idPrefix }}date-time-hour" type="number" size="2" autocomplete="off" class="date-input hour" data-component="hour" min="{{ minHour }}" max="{{ maxHour }}">
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 <span class="time-special-char date-time-separator">:</span>
</span><span class="cx" style="display: block; padding: 0 10px">                                                <label for="{{ idPrefix }}date-time-minute" class="screen-reader-text"><?php esc_html_e( 'Minute' ); ?></label>
</span><span class="cx" style="display: block; padding: 0 10px">                                                <input id="{{ idPrefix }}date-time-minute" type="number" size="2" autocomplete="off" class="date-input minute" data-component="minute" min="0" max="59">
</span></span></pre></div>
<a id="trunksrcwpincludesscriptloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/script-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/script-loader.php   2017-10-30 04:05:20 UTC (rev 42041)
+++ trunk/src/wp-includes/script-loader.php     2017-10-30 16:39:06 UTC (rev 42042)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -599,6 +599,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        esc_url( admin_url( 'theme-install.php' ) )
</span><span class="cx" style="display: block; padding: 0 10px">                ),
</span><span class="cx" style="display: block; padding: 0 10px">                'publishSettings' => __( 'Publish Settings' ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                'invalidDate'     => __( 'Invalid date.' ),
+               'invalidValue'    => __( 'Invalid value.' ),
</ins><span class="cx" style="display: block; padding: 0 10px">         ) );
</span><span class="cx" style="display: block; padding: 0 10px">        $scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunktestsqunitwpadminjscustomizecontrolsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/qunit/wp-admin/js/customize-controls.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/qunit/wp-admin/js/customize-controls.js       2017-10-30 04:05:20 UTC (rev 42041)
+++ trunk/tests/qunit/wp-admin/js/customize-controls.js 2017-10-30 16:39:06 UTC (rev 42042)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -732,11 +732,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                meridian = control.inputElements.meridian;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                year( '23' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                assert.equal( typeof year(), 'number', 'Should always return integer' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         assert.ok( control.invalidDate );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                year( '2100' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 month( '8' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                month( 'test' );
-               assert.equal( 8, month(), 'Should not accept text' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         assert.ok( ! control.invalidDate );
+               day( 'test' );
+               assert.ok( control.invalidDate );
+               day( '3' );
+               assert.ok( ! control.invalidDate );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Test control.parseDateTime();
</span><span class="cx" style="display: block; padding: 0 10px">                control.params.twelveHourFormat = false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -784,12 +788,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // Test control.updateDaysForMonth();.
</span><span class="cx" style="display: block; padding: 0 10px">                year( 2017 );
</span><span class="cx" style="display: block; padding: 0 10px">                month( 2 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                day( 28 );
+               assert.ok( ! control.invalidDate );
</ins><span class="cx" style="display: block; padding: 0 10px">                 day( 31 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                control.updateDaysForMonth();
-               assert.deepEqual( day(), 28, 'Should update to the correct days' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         assert.ok( control.invalidDate );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                day( 20 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                assert.deepEqual( day(), 20, 'Should not update if its less the correct number of days' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         assert.equal( day(), 20, 'Should not update if its less the correct number of days' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Test control.convertHourToTwentyFourHourFormat().
</span><span class="cx" style="display: block; padding: 0 10px">                assert.equal( control.convertHourToTwentyFourHourFormat( 11, 'pm' ), 23 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -854,16 +859,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                year( 2016 );
</span><span class="cx" style="display: block; padding: 0 10px">                assert.notOk( control.isFutureDate() );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                /**
-                * Test control.updateMinutesForHour().
-                * Run this at the end or else the above tests may fail.
-                */
-               hour( 24 );
-               minute( 32 );
-               control.inputElements.meridian = false; // Because it works only when the time is twenty four hour format.
-               control.updateMinutesForHour();
-               assert.deepEqual( minute(), 0 );
-
</del><span class="cx" style="display: block; padding: 0 10px">                 // Tear Down.
</span><span class="cx" style="display: block; padding: 0 10px">                wp.customize.control.remove( controlId );
</span><span class="cx" style="display: block; padding: 0 10px">        });
</span></span></pre>
</div>
</div>

</body>
</html>