diff --git a/CHANGELOG.md b/CHANGELOG.md index ae959618..06872cf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +- Bugfix: Pass `class` attribute to pseudo section on advanced background ([#48](https://github.com/marp-team/marpit/pull/48)) + ## v0.0.10 - 2018-08-05 - **[BREAKING]** Improve appending/prepending style on `ThemeSet#pack` ([#47](https://github.com/marp-team/marpit/pull/47)) diff --git a/src/markdown/background_image.js b/src/markdown/background_image.js index 64d586b2..40c10f21 100644 --- a/src/markdown/background_image.js +++ b/src/markdown/background_image.js @@ -214,6 +214,7 @@ function backgroundImage(md) { }, wrapTokens('marpit_advanced_pseudo_section', { tag: 'section', + class: open.attrGet('class'), style: style.toString(), 'data-marpit-advanced-background': 'pseudo', 'data-marpit-pagination': open.attrGet( diff --git a/test/markdown/background_image.js b/test/markdown/background_image.js index 4abf7f26..93521187 100644 --- a/test/markdown/background_image.js +++ b/test/markdown/background_image.js @@ -299,8 +299,12 @@ describe('Marpit background image plugin', () => { }) }) - context('with paginate directive', () => { - const $ = $load(mdSVG().render('\n\n![bg](test)')) + context('with paginate and class directive', () => { + const $ = $load( + mdSVG().render( + '---\npaginate: true\nclass: pseudo layer\n---\n\n![bg](test)' + ) + ) it('assigns data-marpit-pagination attribute to pseudo layer', () => { const foreignObjects = $('svg > foreignObject') @@ -312,7 +316,9 @@ describe('Marpit background image plugin', () => { ) expect( - pseudoFO.find('> section').is('[data-marpit-pagination="1"]') + pseudoFO + .find('> section.pseudo.layer') + .is('[data-marpit-pagination="1"]') ).toBe(true) }) })