[wp-trac] [WordPress Trac] #37782: Duplicate Page Entry in View All Pages when generating a Menu
WordPress Trac
noreply at wordpress.org
Tue Mar 19 10:01:09 UTC 2019
#37782: Duplicate Page Entry in View All Pages when generating a Menu
-------------------------------------+-------------------------------------
Reporter: garrett-eclipse | Owner: garrett-eclipse
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 5.2
Component: Menus | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses: ui, administration,
has-unit-tests | privacy
-------------------------------------+-------------------------------------
Comment (by garrett-eclipse):
Thanks for the tests @birgire
I've updated the
[https://core.trac.wordpress.org/attachment/ticket/37782/37782.7.diff
37782.7.diff] patch merging in your tests and fixing a few CS issues and
setting `get_post_states` function to 5.2.0.
Running the tests I'm getting two failures;
{{{
There were 2 failures:
1)
Tests_Menu_WpNavMenuItemPostTypeMetaBox::test_should_contain_no_items_without_pages
Failed asserting that ' <div id="posttype-page" class="posttypediv">\n
<ul id="posttype-page-tabs" class="posttype-tabs add-menu-
item-tabs">\n
<li class="tabs">\n
<a class="nav-tab-link" data-type="tabs-
panel-posttype-page-most-recent" href="#tabs-panel-posttype-page-most-
recent">\n
Most Recent
</a>\n
</li>\n
<li >\n
<a class="nav-tab-link" data-type="page-
all" href="#page-all">\n
View All
</a>\n
</li>\n
<li >\n
<a class="nav-tab-link" data-type="tabs-
panel-posttype-page-search" href="#tabs-panel-posttype-page-search">\n
Search
</a>\n
</li>\n
</ul><!-- .posttype-tabs -->\n
\n
<div id="tabs-panel-posttype-page-most-recent" class
="tabs-panel tabs-panel-active">\n
<ul id="pagechecklist-most-recent"
class="categorychecklist form-no-clear">\n
</ul>\n
</div><!-- /.tabs-panel -->\n
\n
<div class="tabs-panel tabs-panel-inactive" id="tabs-
panel-posttype-page-search">\n
<p class="quick-search-
wrap">\n
<label for="quick-search-posttype-page"
class="screen-reader-text">Search</label>\n
<input type="search" class="quick-search"
value="" name="quick-search-posttype-page" id="quick-search-posttype-page"
/>\n
<span class="spinner"></span>\n
<input type="submit" name="submit" id
="submit-quick-search-posttype-page" class="button button-small quick-
search-submit hide-if-js" value="Search" /> </p>\n
\n
<ul id="page-search-checklist" data-wp-
lists="list:page" class="categorychecklist form-no-clear">\n
</ul>\n
</div><!-- /.tabs-panel -->\n
\n
<div id="page-all" class="tabs-panel tabs-panel-view-all
tabs-panel-inactive">\n
<ul id="pagechecklist"
data-wp-lists="list:page" class="categorychecklist form-no-clear">\n
</ul>\n
</div><!-- /.tabs-panel -->\n
\n
<p class="button-controls wp-clearfix">\n
<span class="list-controls">\n
<a href="\n
?page-tab=all&selectall=1
#posttype-page" class="select-all aria-button-if-js">Select All</a>\n
</span>\n
\n
<span class="add-to-menu">\n
<input type="submit" class="button submit-
add-to-menu right" value="Add to Menu" name="add-post-type-menu-item" id
="submit-posttype-page" />\n
<span class="spinner"></span>\n
</span>\n
</p>\n
\n
</div><!-- /.posttypediv -->\n
' contains "No items".
/Users/garretthyder/WordPress/37782-suppress_duplicate_home/tests/phpunit/tests/menu/wpNavMenuItemPostTypeMetaBox.php:40
2)
Tests_Menu_WpNavMenuItemPostTypeMetaBox::test_should_contain_front_page_only_once_when_viewing_all
Failed asserting that '<div id="page-all" class="tabs-panel tabs-panel-
view-all tabs-panel-inactive"> <ul
id="pagechecklist" data-wp-lists="list:page" class="categorychecklist
form-no-clear"> <li><label class="menu-item-
title"><input type="checkbox" class="menu-item-checkbox" name="menu-
item[-7][menu-item-object-id]" value="1307" /> My Test Page — <span
class='post-state'>Front Page</span></label><input type="hidden" class
="menu-item-db-id" name="menu-item[-7][menu-item-db-id]" value="0"
/><input type="hidden" class="menu-item-object" name="menu-item[-7][menu-
item-object]" value="page" /><input type="hidden" class="menu-item-parent-
id" name="menu-item[-7][menu-item-parent-id]" value="0" /><input
type="hidden" class="menu-item-type" name="menu-item[-7][menu-item-type]"
value="post_type" /><input type="hidden" class="menu-item-title" name
="menu-item[-7][menu-item-title]" value="My Test Page" /><input
type="hidden" class="menu-item-url" name="menu-item[-7][menu-item-url]"
value="http://example.org/" /><input type="hidden" class="menu-item-
target" name="menu-item[-7][menu-item-target]" value="" /><input
type="hidden" class="menu-item-attr_title" name="menu-item[-7][menu-item-
attr_title]" value="" /><input type="hidden" class="menu-item-classes"
name="menu-item[-7][menu-item-classes]" value="" /><input type="hidden"
class="menu-item-xfn" name="menu-item[-7][menu-item-xfn]" value="" /></li>
</ul> </div>' contains "> Home: My Test
Page</label>".
/Users/garretthyder/WordPress/37782-suppress_duplicate_home/tests/phpunit/tests/menu/wpNavMenuItemPostTypeMetaBox.php:118
}}}
Would you mind taking a look.
The `test_should_contain_no_items_without_pages` test is checking for 'No
items' but when there's no pages the list is simply empty and doesn't
contain the 'No items' text.
The `test_should_contain_front_page_only_once_when_viewing_all` fails as
the labelling changed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37782#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list