WordPress.org

Make WordPress Core

Changeset 1223 in tests for trunk/tests/dependencies/jquery.php


Ignore:
Timestamp:
02/28/2013 04:58:47 PM (9 years ago)
Author:
nacin
Message:

Test that certain core scripts cannot be deregistered in the admin. props adamsilverstein. fixes #22896.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/dependencies/jquery.php

    r1181 r1223  
    3131        $this->assertEquals( $noconflict, $end );
    3232    }
     33
     34    /**
     35     * @ticket 22896
     36     */
     37    function test_dont_allow_deregister_core_scripts_in_admin() {
     38        set_current_screen( 'edit.php' );
     39        $this->assertTrue( is_admin() ) ;
     40        $libraries = array(
     41            'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion',
     42            'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog',
     43            'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse',
     44            'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable',
     45            'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs',
     46            'jquery-ui-tooltip', 'jquery-ui-widget', 'backbone', 'underscore',
     47        );
     48        foreach ( $libraries as $library ) {
     49            // Try to deregister the script, which should fail.
     50            wp_deregister_script( $library );
     51            $this->assertTrue( wp_script_is( $library, 'registered' ) );
     52        }
     53        set_current_screen( 'front' );
     54    }
    3355}
Note: See TracChangeset for help on using the changeset viewer.