diff --git a/modules/oe_theme_helper/tests/modules/oe_theme_inpage_navigation_test/templates/oe-theme-inpage-navigation-test--content.html.twig b/modules/oe_theme_helper/tests/modules/oe_theme_inpage_navigation_test/templates/oe-theme-inpage-navigation-test--content.html.twig
index 5097d00030..da36cc3bb9 100644
--- a/modules/oe_theme_helper/tests/modules/oe_theme_inpage_navigation_test/templates/oe-theme-inpage-navigation-test--content.html.twig
+++ b/modules/oe_theme_helper/tests/modules/oe_theme_inpage_navigation_test/templates/oe-theme-inpage-navigation-test--content.html.twig
@@ -5,46 +5,57 @@
*/
#}
{# A source area with a complex selector, including encoded characters. #}
-
-
- {# A nested source area, with a selector that overlaps partially the one above. #}
-
- {# An element that will be picked by both selectors. First occurrence of an heading with "Details" as text. #}
+
+
+ {% set build = {
+ '#theme': 'oe_theme_helper_inpage_navigation_block',
+ '#title': title|default('Page contents'),
+ '#attached': {
+ 'library': [
+ 'oe_theme/inpage_navigation'
+ ]
+ }
+ } %}
+ {{ build }}
+
+ {# A nested source area, with a selector that overlaps partially the one above. #}
+
+ {# An element that will be picked by both selectors. First occurrence of an heading with "Details" as text. #}
+
Details
+
Multiple words with spaces
+
Lorem ipsum dolor sit.
+
Small heading
+
+ {# Placed inside the nested source area to verify that outer selectors search inside nested areas. #}
+
Test on attribute selector.
+
Lorem ipsum dolor sit amet.
+
+
+ {# Second occurrence of an heading with "Details" as text. #}
Details
-
Multiple words with spaces
-
Lorem ipsum dolor sit.
-
Small heading
-
- {# Placed inside the nested source area to verify that outer selectors search inside nested areas. #}
-
Test on attribute selector.
-
Lorem ipsum dolor sit amet.
-
-
- {# Second occurrence of an heading with "Details" as text. #}
-
Details
-
- {# An element with an already specified ID. #}
-
More details
-
Not targeted
+ {# An element with an already specified ID. #}
+
More details
-
Title with HTML tags
+
Not targeted
-
+
Title with HTML tags
-
~
+
-
Not targeted
+
~
-
Strip ‿\'!"#$%&()*+,./:;<=>?@[]^`{|}~ unwanted characters
+
Not targeted
- {# Scenarios to test the correct handling of object properties with Object.hasOwnProperty(). #}
- {# An element with an existing ID that can represent a property of the Object prototype. #}
-
Reserved keyword
+
Strip ‿\'!"#$%&()*+,./:;<=>?@[]^`{|}~ unwanted characters
- {# An element that will generate an ID that can represent a property of the Object prototype. #}
-
Length
+ {# Scenarios to test the correct handling of object properties with Object.hasOwnProperty(). #}
+ {# An element with an existing ID that can represent a property of the Object prototype. #}
+
Reserved keyword
-
2022, a new year
+ {# An element that will generate an ID that can represent a property of the Object prototype. #}
+
Length
+
2022, a new year
+
>
diff --git a/modules/oe_theme_helper/tests/modules/oe_theme_inpage_navigation_test/templates/oe-theme-inpage-navigation-test--no-elements.html.twig b/modules/oe_theme_helper/tests/modules/oe_theme_inpage_navigation_test/templates/oe-theme-inpage-navigation-test--no-elements.html.twig
index 3aeb1f3412..13dc5dae03 100644
--- a/modules/oe_theme_helper/tests/modules/oe_theme_inpage_navigation_test/templates/oe-theme-inpage-navigation-test--no-elements.html.twig
+++ b/modules/oe_theme_helper/tests/modules/oe_theme_inpage_navigation_test/templates/oe-theme-inpage-navigation-test--no-elements.html.twig
@@ -5,6 +5,16 @@
*/
#}
{{ attach_library('oe_theme_inpage_navigation_test/inpage_navigation_test') }}
+{% set build = {
+ '#theme': 'oe_theme_helper_inpage_navigation_block',
+ '#title': title|default('Page contents'),
+ '#attached': {
+ 'library': [
+ 'oe_theme/inpage_navigation'
+ ]
+ }
+} %}
+{{ build }}
Lorem ipsum dolor sit.
diff --git a/modules/oe_theme_helper/tests/src/FunctionalJavascript/InPageNavigationLibraryTest.php b/modules/oe_theme_helper/tests/src/FunctionalJavascript/InPageNavigationLibraryTest.php
index 4924cfe363..cd4d6f477e 100644
--- a/modules/oe_theme_helper/tests/src/FunctionalJavascript/InPageNavigationLibraryTest.php
+++ b/modules/oe_theme_helper/tests/src/FunctionalJavascript/InPageNavigationLibraryTest.php
@@ -50,13 +50,6 @@ public function setUp(): void {
* Test the inpage navigation JS library functionality.
*/
public function testLibrary(): void {
- // Place the block so there's an element that will host the generated items.
- $this->drupalPlaceBlock('oe_theme_helper_inpage_navigation', [
- 'region' => 'content',
- 'weight' => -10,
- 'label_display' => FALSE,
- 'id' => 'inpage_navigation',
- ]);
$this->drupalGet('/oe-theme-inpage-navigation-test/content');
$assert_session = $this->assertSession();
@@ -98,7 +91,8 @@ public function testLibrary(): void {
// The heading starting with a non-alpha character gets a ref- prepended.
$this->assertEquals('ref-2022-a-new-year', $container->find('xpath', '/h3[@class="heading"][text()="2022, a new year"]')->getAttribute('id'));
- $navigation = $assert_session->elementExists('css', '#block-inpage-navigation nav[data-ecl-inpage-navigation]');
+ $navigation = $assert_session->elementExists('css', '.oe-theme-ecl-inpage-navigation');
+
$assert = new InPageNavigationAssert();
$expected = [
'title' => 'Page contents',