Make WordPress Core

Ticket #32688: 32688.3.diff

File 32688.3.diff, 6.1 KB (added by adamsilverstein, 11 years ago)

svn add new files

  • tests/qunit/fixtures/customize-menus.js

     
     1window._wpCustomizeMenusSettings = {
     2        'nonce': 'yo',
     3        'phpIntMax': '2147483647',
     4        'menuItemTransport': 'postMessage',
     5        'allMenus': [{
     6                'term_id': '2',
     7                'name': 'Awesome menu',
     8                'slug': 'awesome-menu',
     9                'term_group': '0',
     10                'term_taxonomy_id': '2',
     11                'taxonomy': 'nav_menu',
     12                'description': '',
     13                'parent': '0',
     14                'count': '0'
     15        }, {
     16                'term_id': '3',
     17                'name': 'Cool Menu',
     18                'slug': 'cool-menu',
     19                'term_group': '0',
     20                'term_taxonomy_id': '3',
     21                'taxonomy': 'nav_menu',
     22                'description': '',
     23                'parent': '0',
     24                'count': '0'
     25        }],
     26        'defaultSettingValues': {
     27                'nav_menu': {
     28                        'name': '',
     29                        'description': '',
     30                        'parent': 0,
     31                        'auto_add': false
     32                },
     33                'nav_menu_item': {
     34                        'object_id': 0,
     35                        'object': '',
     36                        'menu_item_parent': 0,
     37                        'position': 0,
     38                        'type': 'custom',
     39                        'title': '',
     40                        'url': '',
     41                        'target': '',
     42                        'attr_title': '',
     43                        'description': '',
     44                        'classes': '',
     45                        'xfn': '',
     46                        'status': 'publish',
     47                        'original_title': '',
     48                        'nav_menu_term_id': 0
     49                }
     50        },
     51        'itemTypes': {
     52                'postTypes': {
     53                        'page': {
     54                                'label': 'Page'
     55                        },
     56                        'post': {
     57                                'label': 'Post'
     58                        }
     59                },
     60                'taxonomies': {
     61                        'post_tag': {
     62                                'label': 'Tag'
     63                        },
     64                        'post_format': {
     65                                'label': 'Format'
     66                        },
     67                        'category': {
     68                                'label': 'Category'
     69                        }
     70                }
     71        },
     72        'l10n': {
     73                'custom_label': 'Custom Link',
     74                'customizingMenus': 'Customizing ▸ Menus',
     75                'invalidTitleTpl': '%s (Invalid)',
     76                'itemAdded': 'Menu item added',
     77                'itemDeleted': 'Menu item deleted',
     78                'itemsFound': 'Number of items found: %d',
     79                'itemsFoundMore': 'Additional items found: %d',
     80                'itemsLoadingMore': 'Loading more results... please wait.',
     81                'menuAdded': 'Menu created',
     82                'menuDeleted': 'Menu deleted',
     83                'menuLocation': '(Currently set to: %s)',
     84                'menuNameLabel': 'Menu Name',
     85                'movedDown': 'Menu item moved down',
     86                'movedLeft': 'Menu item moved out of submenu',
     87                'movedRight': 'Menu item is now a sub-item',
     88                'movedUp': 'Menu item moved up',
     89                'pendingTitleTpl': '%s (Pending)',
     90                'postTypeLabel': 'Post Type',
     91                'reorderLabelOff': 'Close reorder mode',
     92                'reorderLabelOn': 'Reorder menu items',
     93                'reorderModeOff': 'Reorder mode closed',
     94                'reorderModeOn': 'Reorder mode enabled',
     95                'taxonomyTermLabel': 'Taxonomy',
     96                'unnamed': '(unnamed)',
     97                'untitled': '(no label)'
     98        }
     99};
     100
     101window._wpCustomizeSettings.panels.nav_menus = {
     102        'id': 'nav_menus',
     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 &#8220;Custom Menu&#8221; widget.</p>',
     104        'priority': 100,
     105        'type': 'nav_menus',
     106        'title': 'Menus',
     107        'content': '',
     108        'active': true,
     109        'instanceNumber': 2
     110};
     111
     112window.wpNavMenu = {
     113        "options": {
     114                "menuItemDepthPerLevel": 30,
     115                "globalMaxDepth": 11,
     116                "sortableItems": "> *",
     117                "targetTolerance": 0
     118        },
     119        "menusChanged": false,
     120        "isRTL": false,
     121        "negateIfRTL": 1
     122}
  • tests/qunit/index.html

     
    88                <script src="../../src/wp-includes/js/jquery/ui/core.js"></script>
    99                <script src="../../src/wp-includes/js/underscore.min.js"></script>
    1010                <script src="../../src/wp-includes/js/backbone.min.js"></script>
     11                <script src="../../src/wp-includes/js/wp-backbone.js"></script>
    1112                <script src="../../src/wp-includes/js/zxcvbn.min.js"></script>
    1213                <script src="../../src/wp-includes/js/wp-util.js"></script>
    1314
     
    2324                <div id="qunit-fixture">
    2425                        <script src="fixtures/customize-header.js"></script>
    2526                        <script src="fixtures/customize-settings.js"></script>
     27                        <script src="fixtures/customize-menus.js"></script>
    2628                </div>
    2729                <p><a href="editor">TinyMCE tests</a></p>
    2830
     
    3234                <script src="../../src/wp-includes/js/customize-models.js"></script>
    3335                <script src="../../src/wp-includes/js/shortcode.js"></script>
    3436                <script src="../../src/wp-admin/js/customize-controls.js"></script>
     37                <script src="../../src/wp-admin/js/customize-nav-menus.js"></script>
    3538                <script src="../../src/wp-admin/js/word-count.js"></script>
    3639
    3740                <!-- Unit tests -->
     
    4144                <script src="wp-includes/js/shortcode.js"></script>
    4245                <script src="wp-admin/js/customize-controls.js"></script>
    4346                <script src="wp-admin/js/customize-controls-utils.js"></script>
     47                <script src="wp-admin/js/customize-nav-menus.js"></script>
    4448                <script src="wp-admin/js/word-count.js"></script>
    4549
    4650                <!-- Customizer templates for sections -->
  • tests/qunit/wp-admin/js/customize-nav-menus.js

     
     1/* global wp */
     2
     3jQuery( function( $ ) {
     4
     5        var api = wp.customize;
     6        module( 'Customize Nav Menus', {
     7                setup: function() {
     8                        // Init the menus?
     9
     10                },
     11                teardown: function() {
     12                        // Maybe restore things?
     13                }
     14
     15        });
     16
     17        test( 'jQuery is not WordPress', function() {
     18                notEqual( $, wp );
     19        });
     20        $.extend( api.Menus.data, window._wpCustomizeMenusSettings );
     21
     22        /**
     23         * Generate 10 ids and verify they are all unique.
     24         */
     25        test( 'generatePlaceholderAutoIncrementId generates unique IDs', function() {
     26                var testIterations = 10;
     27
     28                while( testIterations-- > 0 ) {
     29
     30                        var placeholderID = api.Menus.generatePlaceholderAutoIncrementId(),
     31                                placeholderID2 = api.Menus.generatePlaceholderAutoIncrementId();
     32
     33                        notEqual ( placeholderID, placeholderID2, 'generatePlaceholderAutoIncrementId IDs unique.' );
     34                }
     35
     36        });
     37
     38
     39
     40});