From bf352994b5a00dee34eaed8d02c830a7d8f14309 Mon Sep 17 00:00:00 2001 From: Project Update Bot <git@users.noreply.drupalcode.org> Date: Sun, 8 Jan 2023 23:27:38 +1000 Subject: [PATCH] Issue #3290082 by eelkeblok, Project Update Bot, VladimirAus: Automated Drupal 10 compatibility fixes --- README.md | 3 +-- composer.json | 3 ++- js/toc_type.js | 6 +++--- modules/toc_api_example/toc_api_example.info.yml | 2 +- tests/src/Unit/TocFormatterTest.php | 2 +- tests/src/Unit/TocTest.php | 10 +++++----- toc_api.info.yml | 2 +- toc_api.libraries.yml | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 4654fd3..54942f6 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ website. Notes ----- -- The TOC API is based on Drupal 8's OO architecture and patterns while the +- The TOC API is based on Drupal's OO architecture and patterns while the supported feature set is based on the [Table of contents](https://www.drupal.org/project/tableofcontents) module. @@ -137,7 +137,6 @@ References ---------- - [Comparison of Table of Contents / TOC modules](https://www.drupal.org/node/2278811) -- [TOC for D7 (and D8)](https://www.drupal.org/node/1424896) Author/Maintainer diff --git a/composer.json b/composer.json index 4c1a213..0228f9b 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,8 @@ "name": "drupal/toc_api", "description": "API for building a a hierarchical table of contents from header tags.", "type": "drupal-module", - "license": "GPL-2.0+", + "keywords": ["Drupal"], + "license": "GPL-2.0-or-later", "minimum-stability": "dev", "homepage": "https://drupal.org/project/toc_api", "authors": [ diff --git a/js/toc_type.js b/js/toc_type.js index a1d5050..0ff1e0b 100644 --- a/js/toc_type.js +++ b/js/toc_type.js @@ -3,13 +3,13 @@ * TOC type options behavior. */ -(function ($, Drupal) { +(function ($, Drupal, once) { "use strict"; Drupal.behaviors.tocTypeOptions = { attach: function (context) { - $('.js-toc-type-options-header-min, .js-toc-type-options-header-max', context).once().change(toggleHeaders); + $(once('.js-toc-type-options-header-min, .js-toc-type-options-header-max', context)).change(toggleHeaders); } }; toggleHeaders(); @@ -25,4 +25,4 @@ } } -})(jQuery, Drupal); +})(jQuery, Drupal, once); diff --git a/modules/toc_api_example/toc_api_example.info.yml b/modules/toc_api_example/toc_api_example.info.yml index 3555d11..00007a7 100644 --- a/modules/toc_api_example/toc_api_example.info.yml +++ b/modules/toc_api_example/toc_api_example.info.yml @@ -2,6 +2,6 @@ name: 'TOC API example' type: module description: 'Example of a custom implementation of the TOC API that adds a table of contents to specified content types.' package: 'Example modules' -core_version_requirement: ^8.9 || ^9 +core_version_requirement: ^9.4 || ^10.0 dependencies: - toc_api:toc_api diff --git a/tests/src/Unit/TocFormatterTest.php b/tests/src/Unit/TocFormatterTest.php index e80fccb..2731c66 100755 --- a/tests/src/Unit/TocFormatterTest.php +++ b/tests/src/Unit/TocFormatterTest.php @@ -29,7 +29,7 @@ class TocFormatterTest extends UnitTestCase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->formatter = new TocFormatter(); diff --git a/tests/src/Unit/TocTest.php b/tests/src/Unit/TocTest.php index 71d6f03..4b7f024 100755 --- a/tests/src/Unit/TocTest.php +++ b/tests/src/Unit/TocTest.php @@ -32,7 +32,7 @@ class TocTest extends UnitTestCase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->container = new ContainerBuilder(); @@ -433,10 +433,10 @@ class TocTest extends UnitTestCase { // Check update content ids. $toc = new Toc('<h2>header 2</h2><h3 id="three" class="custom">header 3</h3><h4 id="four">header 4</h4><h4 id="four">header 4</h4><h2>header 2</h2>', []); $content = $toc->getContent(); - $this->assertContains('<h2 id="header-2">', $content); - $this->assertContains('<h3 id="three" class="custom">', $content); - $this->assertContains('<h4 id="four">', $content); - $this->assertContains('<h4 id="four-01">', $content); + $this->assertStringContainsString('<h2 id="header-2">', $content); + $this->assertStringContainsString('<h3 id="three" class="custom">', $content); + $this->assertStringContainsString('<h4 id="four">', $content); + $this->assertStringContainsString('<h4 id="four-01">', $content); } /** diff --git a/toc_api.info.yml b/toc_api.info.yml index c6dfd68..31ce058 100644 --- a/toc_api.info.yml +++ b/toc_api.info.yml @@ -2,5 +2,5 @@ name: 'TOC API' type: module description: 'API for building a a hierarchical table of contents from header tags.' package: 'API' -core_version_requirement: ^8.9 || ^9 +core_version_requirement: ^9.4 || ^10.0 configure: entity.toc_type.collection diff --git a/toc_api.libraries.yml b/toc_api.libraries.yml index 2eed12a..2bb5c9e 100755 --- a/toc_api.libraries.yml +++ b/toc_api.libraries.yml @@ -4,7 +4,7 @@ toc_type: js/toc_type.js: {} dependencies: - core/jquery - - core/jquery.once + - core/once toc: version: VERSION @@ -32,7 +32,7 @@ toc.menu: - core/jquery - core/drupal - core/drupalSettings - - core/jquery.once + - core/once toc.responsive: version: VERSION -- GitLab