Make WordPress Core


Ignore:
Timestamp:
11/17/2016 06:01:13 PM (10 years ago)
Author:
SergeyBiryukov
Message:

Taxonomy: Prevent wp_list_categories() from producing not well-nested output if hide_title_if_empty is true.

Props chesio.
Fixes #38839. See #33460.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/category/wpListCategories.php

    r36008 r39280  
    264264
    265265                $this->assertContains( '<li class="categories">Categories', $found );
     266        }
     267
     268        /**
     269         * @ticket 38839
     270         */
     271        public function test_hide_title_if_empty_should_not_output_stray_closing_tags() {
     272                $cat = self::factory()->category->create();
     273
     274                $found = wp_list_categories( array(
     275                        'echo' => false,
     276                        'show_option_none' => '',
     277                        'child_of' => 1,
     278                        'hide_title_if_empty' => true,
     279                ) );
     280
     281                $this->assertNotContains( '</ul></li>', $found );
    266282        }
    267283
Note: See TracChangeset for help on using the changeset viewer.