QUnit: Include script dependencies for wp-a11y script to fix a TypeError.

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
This commit is contained in:
Dominik Schilling 2019-10-04 21:19:17 +00:00
parent a468719eb9
commit 25ba9074cc
2 changed files with 6 additions and 3 deletions

View File

@ -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}}};

View File

@ -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 );