In current version the option "Hide default local tasks" is broken because of missing library-entry.

In current branch a test is failing. Before I restored missing tests from old commit.

See https://git.drupalcode.org/project/sticky_local_tasks/-/jobs/6834401

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jan kellermann created an issue. See original summary.

andyf’s picture

There was 1 failure:
1) Drupal\Tests\sticky_local_tasks\Functional\StickyLocalTasksHideDefaultTest::testDefaultLocalTasks
Behat\Mink\Exception\ElementNotFoundException: Element matching xpath "//link[contains(@href, "/sticky_local_tasks/assets/css/hide_default_local_tasks.css")]" not found.
/builds/project/sticky_local_tasks/vendor/behat/mink/src/WebAssert.php:465
/builds/project/sticky_local_tasks/tests/src/Functional/StickyLocalTasksHideDefaultTest.php:45

It looks like this might've been introduced in 38557cb8689c0ac8a48711565f5224939e398cca. That removed the hide-default-local-tasks library (although it still gets conditionally attached in \Drupal\sticky_local_tasks\StickyLocalTasksBuilder::build()).

Also the config setting was removed in ec7ba618eabf0e2b97e03cec1f3f5af04fd99fbc so the initial part of the test would fail because it expects the hidden setting to be enabled by default.

As an aside, I was wondering if it might make sense to use a javascript test and check the actual visibility of the links rather than the presence of a CSS file?

jan kellermann’s picture

Status: Active » Needs review

Thank you! Sometimes we overlook the obvious...

Please review :)

jan kellermann’s picture

Assigned: jan kellermann » Unassigned
jan kellermann’s picture

Title: Test fail » Hide default local tasks is broken (was: Test fail)
Category: Task » Bug report
Issue summary: View changes
Priority: Normal » Major
andyf’s picture

Status: Needs review » Needs work

Thanks @jan kellermann. I've done a code review but haven't tested it yet. Because we released 2.0.2 without the config setting usage_options.hide_default_local_tasks set to true, it's possible some users have installed that version and haven't got the config correctly set. I think we should also add a hook_update_N() function that checks if the key exists, and if not adds it and sets it to true. I'm happy to have a go at this, but won't be able to take a look until tomorrow at the earliest.

jan kellermann’s picture

Status: Needs work » Needs review

Thank you for review. Good point. I added an entry in hook_update(). Please just have a look.

andyf’s picture

Status: Needs review » Reviewed & tested by the community

Looks great, thanks! Reviewed and tested, the hook update works, toggling the config option actually affects the display of the tasks, and the config validates. Just one super minor nitpick over a comment...

jan kellermann’s picture

Status: Reviewed & tested by the community » Fixed

Great, thank you! I fixed this and merged this MR.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.