From 5fbab66d239ecc47f9c4609d8713e49199fa4c1d Mon Sep 17 00:00:00 2001 From: Ze Yu Date: Sat, 2 May 2020 16:22:07 +0800 Subject: [PATCH] Fix several b-modal selector names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bootstrap vue migration causes modal elements to be transformed into b-modal. Let’s change the leftover selector names to match the new name. --- src/Page.js | 6 +++--- src/plugins/algolia.js | 2 +- test/functional/test_site/expected/index.html | 1 - test/functional/test_site/expected/siteData.json | 1 - .../functional/test_site_algolia_plugin/expected/index.html | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Page.js b/src/Page.js index a5405d90c3..6780991727 100644 --- a/src/Page.js +++ b/src/Page.js @@ -338,7 +338,7 @@ class Page { return; } const $ = cheerio.load(content); - $('modal').remove(); + $('b-modal').remove(); this._collectNavigableHeadings($, $.root()[0], elementSelector); } @@ -405,7 +405,7 @@ class Page { collectHeadingsAndKeywordsInContent(content, lastHeading, excludeHeadings, sourceTraversalStack) { let $ = cheerio.load(content); const headingsSelector = Page.generateHeadingSelector(this.headingIndexingLevel); - $('modal').remove(); + $('b-modal').remove(); $('panel').not('panel panel') .each((index, panel) => { const slotHeader = $(panel).children('[slot="header"]'); @@ -468,7 +468,7 @@ class Page { }); $ = cheerio.load(content); if (this.headingIndexingLevel > 0) { - $('modal').remove(); + $('b-modal').remove(); $('panel').remove(); if (!excludeHeadings) { $(headingsSelector).each((i, heading) => { diff --git a/src/plugins/algolia.js b/src/plugins/algolia.js index 754a34ab7e..02759870e7 100644 --- a/src/plugins/algolia.js +++ b/src/plugins/algolia.js @@ -25,7 +25,7 @@ function addNoIndexClasses(content) { const $ = cheerio.load(content, { xmlMode: false }); const noIndexSelectors = [ 'dropdown', - 'modal', + 'b-modal', 'panel:not([expanded])', 'popover div[slot=content]', 'question div[slot=hint]', diff --git a/test/functional/test_site/expected/index.html b/test/functional/test_site/expected/index.html index 8498974650..6002d95d8e 100644 --- a/test/functional/test_site/expected/index.html +++ b/test/functional/test_site/expected/index.html @@ -709,7 +709,6 @@
Inner panel header without src‎ Panel with src from another Markbind site header‎ Panel with src from another Markbind site header‎ - Panel inside modal‎ Unexpanded panel header‎ Markbind Plugin Pre-render‎ diff --git a/test/functional/test_site/expected/siteData.json b/test/functional/test_site/expected/siteData.json index 93996138de..7c33d63594 100644 --- a/test/functional/test_site/expected/siteData.json +++ b/test/functional/test_site/expected/siteData.json @@ -45,7 +45,6 @@ "outer-nested-panel-without-src": "Outer nested panel without src", "panel-with-src-from-another-markbind-site-header": "Panel with src from another Markbind site header", "panel-with-src-from-another-markbind-site-header-2": "Panel with src from another Markbind site header", - "panel-inside-modal": "Panel inside modal", "unexpanded-panel-header": "Unexpanded panel header", "keyword-should-be-tagged-to-this-heading-not-the-panel-heading": "Keyword should be tagged to this heading, not the panel heading", "panel-normal-source-content-headings": "Panel normal source content headings", diff --git a/test/functional/test_site_algolia_plugin/expected/index.html b/test/functional/test_site_algolia_plugin/expected/index.html index deb3eb51fc..65e66db8ef 100644 --- a/test/functional/test_site_algolia_plugin/expected/index.html +++ b/test/functional/test_site_algolia_plugin/expected/index.html @@ -40,7 +40,7 @@
  • Two
  • Modal content should have algolia-no-index class

    - + Content should have `algolia-no-index` class Trigger should not have `algolia-no-index` class