| 1 | Index: tests/dependencies/jquery.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- tests/dependencies/jquery.php (revision 1209) |
|---|
| 4 | +++ tests/dependencies/jquery.php (working copy) |
|---|
| 5 | @@ -6,6 +6,28 @@ |
|---|
| 6 | */ |
|---|
| 7 | class Tests_Dependencies_jQuery extends WP_UnitTestCase { |
|---|
| 8 | |
|---|
| 9 | + /** |
|---|
| 10 | + * @ticket 22896 |
|---|
| 11 | + */ |
|---|
| 12 | + function test_dont_allow_deregister_core_scripts_in_admin() { |
|---|
| 13 | + $current_screen = get_current_screen(); |
|---|
| 14 | + set_current_screen( 'edit.php' ); //go into admin |
|---|
| 15 | + $this->assertTrue( is_admin() ) ; //verify in admin |
|---|
| 16 | + $checklibs = array( |
|---|
| 17 | + 'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion', |
|---|
| 18 | + 'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog', |
|---|
| 19 | + 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse', |
|---|
| 20 | + 'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable', |
|---|
| 21 | + 'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs', |
|---|
| 22 | + 'jquery-ui-tooltip', 'jquery-ui-widget', 'backbone', 'underscore', |
|---|
| 23 | + ); |
|---|
| 24 | + foreach ( $checklibs as $libtocheck ) { |
|---|
| 25 | + wp_deregister_script( $libtocheck ); //try to deregister script |
|---|
| 26 | + $this->assertTrue( wp_script_is( $libtocheck, 'registered' ) ) ; //not allowed! script should still be there |
|---|
| 27 | + } |
|---|
| 28 | + set_current_screen( $current_screen ); |
|---|
| 29 | + } |
|---|
| 30 | + |
|---|
| 31 | function test_location_of_jquery() { |
|---|
| 32 | $jquery_scripts = array( |
|---|
| 33 | 'jquery-core' => '/wp-includes/js/jquery/jquery.js', |
|---|