Ticket #32688: 32688.5.diff
| File 32688.5.diff, 4.3 KB (added by , 11 years ago) |
|---|
-
tests/qunit/fixtures/customize-menus.js
1 1 2 window._wpCustomizeNavMenusSettings = { 2 3 'nonce': 'yo', 3 4 'phpIntMax': '2147483647', … … 97 98 'untitled': '(no label)' 98 99 } 99 100 }; 100 101 101 window._wpCustomizeSettings.panels.nav_menus = { 102 102 'id': 'nav_menus', 103 103 'description': '<p>This panel is used for managing navigation menus for content you have already published on your site. You can create menus and add items for existing content such as pages, posts, categories, tags, formats, or custom links.</p><p>Menus can be displayed in locations defined by your theme or in <a href="javascript:wp.customize.panel( "widgets" ).focus();">widget areas</a> by adding a “Custom Menu” widget.</p>', … … 109 109 'instanceNumber': 2 110 110 }; 111 111 112 window._wpCustomizeSettings.sections = { 113 'menu_locations': { 114 'id': 'menu_locations', 115 'description': '<p>Your theme contains 1 menu location. Select which menu you would like to use.<\/p><p>You can also place menus in widget areas with the Custom Menu widget.<\/p>', 116 'priority': 5, 117 'panel': 'nav_menus', 118 'type': 'default', 119 'title': 'Menu Locations', 120 'content': '', 121 'active': true, 122 'instanceNumber': 13, 123 'customizeAction': 'Customizing ▸ Menus' 124 }, 125 'nav_menu[3]': { 126 'id': 'nav_menu[3]', 127 'description': '', 128 'priority': 10, 129 'panel': 'nav_menus', 130 'type': 'nav_menu', 131 'title': 'Cool Menu', 132 'content': '', 133 'active': true, 134 'instanceNumber': 15, 135 'customizeAction': 'Customizing ▸ Menus', 136 'menu_id': 3 137 }, 138 'nav_menu[2]': { 139 'id': 'nav_menu[2]', 140 'description': '', 141 'priority': 10, 142 'panel': 'nav_menus', 143 'type': 'nav_menu', 144 'title': 'Awesome menu', 145 'content': '', 146 'active': true, 147 'instanceNumber': 14, 148 'customizeAction': 'Customizing ▸ Menus', 149 'menu_id': 2 150 }, 151 'add_menu': { 152 'id': 'add_menu', 153 'description': '', 154 'priority': 999, 155 'panel': 'nav_menus', 156 'type': 'new_menu', 157 'title': 'Add a Menu', 158 'content': '<li id="accordion-section-add_menu" class="accordion-section-new-menu">\n\t\t\t<button type="button" class="button-secondary add-new-menu-item add-menu-toggle" aria-expanded="false">\n\t\t\t\tAdd a Menu\t\t\t<\/button>\n\t\t\t<ul class="new-menu-section-content"><\/ul>\n\t\t<\/li>', 159 'active': true, 160 'instanceNumber': 16, 161 'customizeAction': 'Customizing ▸ Menus' 162 } 163 }; 164 112 165 window.wpNavMenu = { 113 166 'options': { 114 167 'menuItemDepthPerLevel': 30, -
tests/qunit/wp-admin/js/customize-nav-menus.js
1 1 /* global wp */ 2 jQuery( function( ) {2 jQuery( function( $ ) { 3 3 4 4 var api = wp.customize, 5 5 settings = window._wpCustomizeNavMenusSettings, 6 navMenu = window.wpNavMenu; 6 navMenu = window.wpNavMenu, 7 customizeSettings = window._wpCustomizeSettings; 7 8 8 9 module( 'Customize Nav Menus', { 9 10 setup: function() { 10 11 window._wpCustomizeNavMenusSettings = settings; 11 12 window.wpNavMenu = navMenu; 13 wp.customize.trigger( 'ready' ); 12 14 }, 13 15 teardown: function() { 14 16 // restore defaults 15 window._wpCustomizeNavMenusSettings = settings; 16 window.wpNavMenu = navMenu; 17 window._wpCustomizeNavMenusSettings = {}; 18 window.wpNavMenu = {}; 19 window._wpCustomizeSettings = customizeSettings; 20 17 21 } 18 19 22 }); 20 23 21 24 … … 29 32 while( testIterations-- > 0 ) { 30 33 var placeholderID = api.Menus.generatePlaceholderAutoIncrementId(); 31 34 35 32 36 ok( -1 === ids.indexOf( placeholderID ) ); 33 37 ids.push( placeholderID ); 34 38 } … … 39 43 deepEqual( window._wpCustomizeNavMenusSettings, api.Menus.data ); 40 44 }); 41 45 46 test( 'empty menus should have no Menu Item Controls', function() { 47 equal( $.isEmptyObject( wp.customize.Menus.getMenuControl( "2" ).getMenuItemControls() ) , true, 'empty menus' ); 48 }); 42 49 50 43 51 });