[wp-trac] [WordPress Trac] #31897: Update Customizer nonces via Heartbeat API

WordPress Trac noreply at wordpress.org
Wed Mar 22 19:16:08 UTC 2017


#31897: Update Customizer nonces via Heartbeat API
-------------------------------------------------+-------------------------
 Reporter:  westonruter                          |       Owner:
     Type:  enhancement                          |      Status:  assigned
 Priority:  low                                  |   Milestone:  Future
Component:  Customize                            |  Release
 Severity:  normal                               |     Version:  3.4
 Keywords:  needs-unit-tests needs-refresh has-  |  Resolution:
  patch                                          |     Focuses:  javascript
-------------------------------------------------+-------------------------

Comment (by westonruter):

 For QUnit tests, I think it would involve doing `jQuery( document
 ).trigger( 'heartbeat-tick.wp-refresh-nonces', [ { 'wp-customize-
 nonces':{…} } ] )` and making sure that this results in `nonce-refresh`
 being triggered on `wp.customize`.

 Likewise, when doing `jQuery( document ).trigger( 'heartbeat-send.wp-
 refresh-nonces', [ { 'wp-customize-nonces':{…} } ] )` that the current
 `wp.customize.settings.nonce` gets populated into the heartbeat data being
 passed in.

 The QUnit tests would go into `tests/qunit/wp-admin/js/customize-
 controls.js`, I think.

 For PHPUnit, similarly, we'd want to apply filters on `heartbeat_received`
 and `heartbeat_settings` to make sure the supplied arrays get the expected
 values amended onto them via `wp_heartbeat_refresh_customizer_nonces()`
 and `wp_heartbeat_settings_customizer_filter()` respectively. This would
 go into `tests/phpunit/tests/customize/manager.php`

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31897#comment:32>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list