Skip to content

Commit

Permalink
Merge pull request #48 from marp-team/apply-class-on-pseudo-layer
Browse files Browse the repository at this point in the history
Bugfix: Pass class attribute to pseudo section on advanced background
  • Loading branch information
yhatt authored Aug 8, 2018
2 parents 1268bdb + f864e31 commit a6d2bc1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions src/markdown/background_image.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
12 changes: 9 additions & 3 deletions test/markdown/background_image.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,12 @@ describe('Marpit background image plugin', () => {
})
})

context('with paginate directive', () => {
const $ = $load(mdSVG().render('<!-- paginate: true -->\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')
Expand All @@ -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)
})
})
Expand Down

0 comments on commit a6d2bc1

Please sign in to comment.