Make WordPress Core

Ticket #32688: 32688.5.diff

File 32688.5.diff, 4.3 KB (added by jorbin, 11 years ago)
  • tests/qunit/fixtures/customize-menus.js

     
     1
    12window._wpCustomizeNavMenusSettings = {
    23        'nonce': 'yo',
    34        'phpIntMax': '2147483647',
     
    9798                'untitled': '(no label)'
    9899        }
    99100};
    100 
    101101window._wpCustomizeSettings.panels.nav_menus = {
    102102        'id': 'nav_menus',
    103103        '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 &#8220;Custom Menu&#8221; widget.</p>',
     
    109109        'instanceNumber': 2
    110110};
    111111
     112window._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 &#9656; 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 &#9656; 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 &#9656; 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 &#9656; Menus'
     162  }
     163};
     164
    112165window.wpNavMenu = {
    113166        'options': {
    114167                'menuItemDepthPerLevel': 30,
  • tests/qunit/wp-admin/js/customize-nav-menus.js

     
    11/* global wp */
    2 jQuery( function( ) {
     2jQuery( function( $ ) {
    33
    44        var api = wp.customize,
    55        settings = window._wpCustomizeNavMenusSettings,
    6         navMenu = window.wpNavMenu;
     6        navMenu = window.wpNavMenu,
     7        customizeSettings = window._wpCustomizeSettings;
    78       
    89        module( 'Customize Nav Menus', {
    910                setup: function() {
    1011            window._wpCustomizeNavMenusSettings = settings;
    1112            window.wpNavMenu = navMenu;
     13            wp.customize.trigger( 'ready' );
    1214                },
    1315                teardown: function() {
    1416                        // restore defaults
    15             window._wpCustomizeNavMenusSettings = settings;
    16             window.wpNavMenu = navMenu;
     17            window._wpCustomizeNavMenusSettings = {};
     18            window.wpNavMenu = {};
     19            window._wpCustomizeSettings = customizeSettings;
     20       
    1721                }
    18 
    1922        });
    2023
    2124
     
    2932                while( testIterations-- > 0 ) {
    3033                        var placeholderID = api.Menus.generatePlaceholderAutoIncrementId();
    3134
     35
    3236                        ok( -1 === ids.indexOf( placeholderID ) );
    3337                        ids.push( placeholderID );
    3438                }
     
    3943                deepEqual( window._wpCustomizeNavMenusSettings, api.Menus.data );
    4044        });
    4145
     46    test( 'empty menus should have no Menu Item Controls', function() {
     47        equal( $.isEmptyObject( wp.customize.Menus.getMenuControl( "2" ).getMenuItemControls() ) , true, 'empty menus' );
     48    });
    4249
     50
    4351});