Skip to content
Permalink
Browse files

QUnit: Include script dependencies for wp-a11y script to fix a TypeEr…

…ror.

Also, add missing message argument to Customizer notifications to ensure tests are passing.

Fixes #45066.

git-svn-id: https://develop.svn.wordpress.org/trunk@46388 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information...
ocean90 committed Oct 4, 2019
1 parent a468719 commit 25ba9074cc7d20668e7725da303ebd5bd96078bd
Showing with 6 additions and 3 deletions.
  1. +2 −0 tests/qunit/index.html
  2. +4 −3 tests/qunit/wp-admin/js/customize-controls.js
@@ -24,6 +24,8 @@
};
</script>
<script src="../../build/wp-includes/js/wp-util.js"></script>
<script src="../../build/wp-includes/js/dist/vendor/wp-polyfill.js"></script>
<script src="../../build/wp-includes/js/dist/dom-ready.js"></script>
<script src="../../build/wp-includes/js/dist/a11y.js"></script>
<script>
window._wpMediaModelsL10n = {"settings":{"ajaxurl":"\/wp-admin\/admin-ajax.php","post":{"id":0}}};
@@ -94,13 +94,14 @@ jQuery( window ).load( function (){
collection = new wp.customize.Notifications({
container: container
});
collection.add( 'mycode-1', new wp.customize.Notification( 'mycode-1' ) );
collection.add( 'mycode-1', new wp.customize.Notification( 'mycode-1', { message: 'My message 1' } ) );
collection.render();
items = collection.container.find( 'li' );
equal( items.length, 1 );
equal( items.first().data( 'code' ), 'mycode-1' );

collection.add( 'mycode-2', new wp.customize.Notification( 'mycode-2', {
message: 'My message 2',
dismissible: true
} ) );
collection.render();
@@ -187,8 +188,8 @@ jQuery( window ).load( function (){
assert.equal( 0, notificationContainerElement.find( '> ul > li' ).length );
assert.equal( 0, notificationContainerElement.height() );

settingNotification = new wp.customize.Notification( 'setting_invalidity', 'Invalid setting' );
controlOnlyNotification = new wp.customize.Notification( 'control_invalidity', 'Invalid control' );
settingNotification = new wp.customize.Notification( 'setting_invalidity', { message: 'Invalid setting' } );
controlOnlyNotification = new wp.customize.Notification( 'control_invalidity', { message: 'Invalid control' } );
control.settings['default'].notifications.add( settingNotification.code, settingNotification );
control.notifications.add( controlOnlyNotification.code, controlOnlyNotification );

0 comments on commit 25ba907

Please sign in to comment.
You can’t perform that action at this time.