b5f505d3dd
While these two tests will help ensure we don't repeat our mistakes, they mostly help lay the foundation for more tests that still need to be written. See #32688 Props adamsilverstein, jorbin git-svn-id: https://develop.svn.wordpress.org/trunk@33451 602fd350-edb4-49c9-b593-d223f7449a82
44 lines
1.1 KiB
JavaScript
Executable File
44 lines
1.1 KiB
JavaScript
Executable File
/* global wp */
|
|
jQuery( function( ) {
|
|
|
|
var api = wp.customize,
|
|
settings = window._wpCustomizeNavMenusSettings,
|
|
navMenu = window.wpNavMenu;
|
|
|
|
module( 'Customize Nav Menus', {
|
|
setup: function() {
|
|
window._wpCustomizeNavMenusSettings = settings;
|
|
window.wpNavMenu = navMenu;
|
|
},
|
|
teardown: function() {
|
|
// restore defaults
|
|
window._wpCustomizeNavMenusSettings = settings;
|
|
window.wpNavMenu = navMenu;
|
|
}
|
|
|
|
});
|
|
|
|
|
|
/**
|
|
* Generate 20 ids and verify they are all unique.
|
|
*/
|
|
test( 'generatePlaceholderAutoIncrementId generates unique IDs', function() {
|
|
var testIterations = 20,
|
|
ids = [ api.Menus.generatePlaceholderAutoIncrementId() ];
|
|
|
|
while( testIterations-- > 0 ) {
|
|
var placeholderID = api.Menus.generatePlaceholderAutoIncrementId();
|
|
|
|
ok( -1 === ids.indexOf( placeholderID ) );
|
|
ids.push( placeholderID );
|
|
}
|
|
|
|
} );
|
|
|
|
test( 'it should parse _wpCustomizeMenusSettings.defaults into itself', function() {
|
|
deepEqual( window._wpCustomizeNavMenusSettings, api.Menus.data );
|
|
});
|
|
|
|
|
|
});
|