diff --git a/docs/assets/how-to-use/example.html b/docs/assets/how-to-use/example.html index 153253af..c1b3df4f 100644 --- a/docs/assets/how-to-use/example.html +++ b/docs/assets/how-to-use/example.html @@ -1,4 +1,4 @@ - +
" + "![bg](test)\n\n", ), - { xmlMode: true } + { xmlMode: true }, ) it('assigns scoped attribute to the section element in pseudo layer', () => { @@ -446,7 +446,7 @@ describe('Marpit background image plugin', () => { const pseudoSection = pseudoFO.find('> section') expect(Object.keys(pseudoSection.attr())).toContainEqual( - expect.stringMatching(/^data-marpit-scope-/) + expect.stringMatching(/^data-marpit-scope-/), ) }) }) @@ -465,7 +465,7 @@ describe('Marpit background image plugin', () => { context('with background color definition', () => { const $ = $load(mdSVG().render('![bg](red) ![bg](test)')) const bgSection = $( - 'section[data-marpit-advanced-background="background"]' + 'section[data-marpit-advanced-background="background"]', ) it('assigns backgroundColor style to background layer', () => diff --git a/test/markdown/collect.js b/test/markdown/collect.js index 24cae027..46708df7 100644 --- a/test/markdown/collect.js +++ b/test/markdown/collect.js @@ -86,7 +86,7 @@ describe('Marpit collect plugin', () => { expect(original).toBe( marpit.lastSlideTokens .map((tokens) => markdownIt.renderer.render(tokens, markdownIt.options)) - .join('') + .join(''), ) }) @@ -103,7 +103,7 @@ describe('Marpit collect plugin', () => { ]) expect(lastComments[1]).toStrictEqual([ expect.stringContaining( - 'Comment would collect if yaml has only invalid directive' + 'Comment would collect if yaml has only invalid directive', ), ]) expect(lastComments[2]).toHaveLength(0) @@ -128,7 +128,7 @@ describe('Marpit collect plugin', () => { if (t.content === 'inline comment') markAsParsed(t, 'test') } } - } + }, ) }) .render(text) @@ -157,7 +157,7 @@ describe('Marpit collect plugin', () => { - `) + `), ).toHaveLength(1) // markdownlint @@ -166,7 +166,7 @@ describe('Marpit collect plugin', () => { deliberate space * in * emphasis - `) + `), ).toHaveLength(0) expect( comments(dedent` @@ -174,7 +174,7 @@ describe('Marpit collect plugin', () => { any violations you want - `) + `), ).toHaveLength(0) // remark-lint (remark-message-control) @@ -189,7 +189,7 @@ describe('Marpit collect plugin', () => { ## Hello - `) + `), ).toHaveLength(0) expect( comments(dedent` @@ -197,7 +197,7 @@ describe('Marpit collect plugin', () => { * **foo** * __bar__ - `) + `), ).toHaveLength(0) }) }) diff --git a/test/markdown/directives/apply.js b/test/markdown/directives/apply.js index fea7584a..88725629 100644 --- a/test/markdown/directives/apply.js +++ b/test/markdown/directives/apply.js @@ -39,7 +39,7 @@ describe('Marpit directives apply plugin', () => { token.meta.marpitDirectives.unknownDir = 'directive' } }) - } + }, ) }) @@ -203,7 +203,7 @@ describe('Marpit directives apply plugin', () => { expect(style.color).toBe('black') Array.from({ length: 6 }, (v, k) => k + 1).forEach((i) => - expect(style[`--injection${i}`]).toBeUndefined() + expect(style[`--injection${i}`]).toBeUndefined(), ) }) }) diff --git a/test/markdown/directives/parse.js b/test/markdown/directives/parse.js index 46b42ad3..bac674b4 100644 --- a/test/markdown/directives/parse.js +++ b/test/markdown/directives/parse.js @@ -121,7 +121,7 @@ describe('Marpit directives parse plugin', () => { const parsed = md().parse(text) const [first, second, third] = parsed.reduce( (arr, t) => (t.type === 'marpit_slide_open' ? [...arr, t] : arr), - [] + [], ) expect(first.meta.marpitDirectives).toStrictEqual({}) @@ -143,14 +143,14 @@ describe('Marpit directives parse plugin', () => { const parsed = md().parse(text) const [first, second, third] = parsed.reduce( (arr, t) => (t.type === 'marpit_slide_open' ? [...arr, t] : arr), - [] + [], ) expect(first.meta.marpitDirectives).toStrictEqual({}) expect(second.meta.marpitDirectives).toStrictEqual({ class: 'test' }) expect(third.meta.marpitDirectives).toStrictEqual({}) }) - } + }, ) context('with class directive', () => { @@ -159,7 +159,7 @@ describe('Marpit directives parse plugin', () => { it('supports class definition by array', () => { const flatParsed = md().parse('') const [flatOpen] = flatParsed.filter( - (t) => t.type === 'marpit_slide_open' + (t) => t.type === 'marpit_slide_open', ) expect(flatOpen.meta.marpitDirectives).toMatchObject(expected) @@ -172,7 +172,7 @@ describe('Marpit directives parse plugin', () => { --- `) const [multilineOpen] = multilineParsed.filter( - (t) => t.type === 'marpit_slide_open' + (t) => t.type === 'marpit_slide_open', ) expect(multilineOpen.meta.marpitDirectives).toMatchObject(expected) }) diff --git a/test/markdown/heading_divider.js b/test/markdown/heading_divider.js index 96b87854..76bc80a0 100644 --- a/test/markdown/heading_divider.js +++ b/test/markdown/heading_divider.js @@ -15,7 +15,7 @@ describe('Marpit heading divider plugin', () => { const pickHrAndHeading = (tokens) => tokens.filter( - (t, idx) => t.type === 'hr' || (idx > 0 && tokens[idx - 1].type === 'hr') + (t, idx) => t.type === 'hr' || (idx > 0 && tokens[idx - 1].type === 'hr'), ) describe('Constructor option', () => { @@ -106,7 +106,7 @@ describe('Marpit heading divider plugin', () => { it('maps corresponded line of slide to heading', () => { const tokens = mdWithSlide(marpitStub(4)).parse(markdownText) const [first, second, third, fourth] = tokens.filter( - (t) => t.type === 'marpit_slide_open' + (t) => t.type === 'marpit_slide_open', ) expect(first.map).toStrictEqual([0, 1]) @@ -131,7 +131,7 @@ describe('Marpit heading divider plugin', () => { marpitInstance = { customDirectives: { global: {}, local: {} }, options: {}, - } + }, ) => { const instance = new MarkdownIt('commonmark') instance.marpit = marpitInstance @@ -189,7 +189,7 @@ describe('Marpit heading divider plugin', () => { expect(hrAndHeadings[3].type).toBe('heading_open') expect(hrAndHeadings[3].tag).toBe('h4') }) - } + }, ) context('with headingDivider constructor option', () => { diff --git a/test/markdown/image.js b/test/markdown/image.js index c5d1159a..8ca7dbe7 100644 --- a/test/markdown/image.js +++ b/test/markdown/image.js @@ -36,7 +36,7 @@ describe('Marpit image plugin', () => { context('with header image via directive', () => { const tokens = md().parse( - '\n\n![](content.png)' + '\n\n![](content.png)', ) it('uses primitive string as src attribute for all images', () => { @@ -101,7 +101,7 @@ describe('Marpit image plugin', () => { it('removes recognized Marpit keywords from alt attribute of the output image', () => { const output = md().render( - `![w:100px \t This is example\timage \t h:200px](https://example.com/test.jpg)` + `![w:100px \t This is example\timage \t h:200px](https://example.com/test.jpg)`, ) const $ = load(output) @@ -123,7 +123,7 @@ describe('Marpit image plugin', () => { expect(colorDirective(colorMd('currentColor'))).toBe('currentColor') expect(colorDirective(colorMd('rgb(255,128,0)'))).toBe('rgb(255,128,0)') expect(colorDirective(colorMd('rgba(16,32,64,0.5)'))).toBe( - 'rgba(16,32,64,0.5)' + 'rgba(16,32,64,0.5)', ) }) diff --git a/test/markdown/inline_svg.js b/test/markdown/inline_svg.js index a9351251..63ebb618 100644 --- a/test/markdown/inline_svg.js +++ b/test/markdown/inline_svg.js @@ -22,7 +22,7 @@ describe('Marpit inline SVG plugin', () => { return instance .use(slide) .use((pluginMd) => - pluginMd.core.ruler.push('marpit_directives_parse', () => {}) + pluginMd.core.ruler.push('marpit_directives_parse', () => {}), ) .use(inlineSVG) } @@ -42,8 +42,8 @@ describe('Marpit inline SVG plugin', () => { expect( $( - 'svg[viewBox][data-marpit-svg] > foreignObject[width][height] > section' - ) + 'svg[viewBox][data-marpit-svg] > foreignObject[width][height] > section', + ), ).toHaveLength(2) }) @@ -90,7 +90,7 @@ describe('Marpit inline SVG plugin', () => { context('with specified default theme', () => { const defaultTheme = Theme.fromCSS( 'section { width: 160px; height: 90px; }', - { [skipThemeValidationSymbol]: true } + { [skipThemeValidationSymbol]: true }, ) const defaultThemeSelector = [ diff --git a/test/markdown/style/assign.js b/test/markdown/style/assign.js index f4ab651d..de39b1f4 100644 --- a/test/markdown/style/assign.js +++ b/test/markdown/style/assign.js @@ -42,7 +42,7 @@ describe('Marpit style assign plugin', () => { it('assigns parsed styles to Marpit lastStyles property with scoped', () => { const marpit = marpitStub() const $ = load( - md(marpit).render('') + md(marpit).render(''), ) const [style] = marpit.lastStyles @@ -127,7 +127,7 @@ describe('Marpit style assign plugin', () => { const dividedMatched = dividedCss.match(/@keyframes (abc-\w+)/) expect(dividedMatched).toBeTruthy() expect(dividedCss).toContain( - `animation-name: foo,${dividedMatched[1]} ,bar;` + `animation-name: foo,${dividedMatched[1]} ,bar;`, ) // animation shorthands @@ -148,13 +148,13 @@ describe('Marpit style assign plugin', () => { const shorthandMatched = shorthandCss.match(/@keyframes (steps-\w+)/) expect(shorthandMatched).toBeTruthy() expect(shorthandCss).toContain( - `animation: ${shorthandMatched[1]} 1s linear 0s infinite;` + `animation: ${shorthandMatched[1]} 1s linear 0s infinite;`, ) expect(shorthandCss).toContain( - `animation: 1s steps(6) 0s infinite ${shorthandMatched[1]};` + `animation: 1s steps(6) 0s infinite ${shorthandMatched[1]};`, ) expect(shorthandCss).toContain( - `animation: 1s foo, 2s ${shorthandMatched[1]}, 3s bar;` + `animation: 1s foo, 2s ${shorthandMatched[1]}, 3s bar;`, ) }) diff --git a/test/markdown/style/parse.js b/test/markdown/style/parse.js index 015ed622..7db4934d 100644 --- a/test/markdown/style/parse.js +++ b/test/markdown/style/parse.js @@ -65,7 +65,9 @@ describe('Marpit style parse plugin', () => { it('parses scoped attribute with another attribute', () => { const [token] = pickStyles( - markdown.parse(``) + markdown.parse( + ``, + ), ) expect(token.meta.marpitStyleScoped).toBe(true) }) diff --git a/test/markdown/sweep.js b/test/markdown/sweep.js index 515ad905..6ea52d13 100644 --- a/test/markdown/sweep.js +++ b/test/markdown/sweep.js @@ -48,7 +48,7 @@ describe('Marpit sweep plugin', () => { ![notBg](keep) ![bg](keep) with contents - `) + `), ) expect($('p')).toHaveLength(2) diff --git a/test/marpit.js b/test/marpit.js index 004359ec..1d73716b 100644 --- a/test/marpit.js +++ b/test/marpit.js @@ -112,7 +112,7 @@ describe('Marpit', () => { // Local directive (Alias + internal meta) const [localFirst, , , localSecond] = marpit.markdown.parse( - '\n***\n' + '\n***\n', ) expect(localFirst.meta.marpitDirectives).toStrictEqual({ test: 'local', @@ -177,7 +177,7 @@ describe('Marpit', () => { expect(opts.containers[0].tag).toBe('div') expect(opts.containers[0].class).toBe('marpit') expect(opts.inlineSVG).toStrictEqual( - expect.objectContaining({ enabled: false }) + expect.objectContaining({ enabled: false }), ) expect(opts.printable).toBe(true) return 'CSS' @@ -200,7 +200,7 @@ describe('Marpit', () => { expect(render).toBeCalledWith( expect.any(Array), instance.markdown.options, - { env: 'env' } + { env: 'env' }, ) }) @@ -283,7 +283,7 @@ describe('Marpit', () => { return findBackdropRules(css).then((rules) => { expect(rules).toHaveLength(2) expect( - rules.find((r) => r.selector.endsWith('svg[data-marpit-svg]')) + rules.find((r) => r.selector.endsWith('svg[data-marpit-svg]')), ).toBeTruthy() }) }) @@ -313,14 +313,14 @@ describe('Marpit', () => { () => { it('does not redirects ::backdrop selector to container SVG', () => { const { css } = instance({ backdropSelector: false }).render( - backdropStyle + backdropStyle, ) return findBackdropRules(css).then((rules) => { expect(rules).toHaveLength(1) }) }) - } + }, ) }) @@ -333,7 +333,7 @@ describe('Marpit', () => { .then((ret) => ret.root.walkDecls('background-image', (decl) => { expect(decl.value).toBe('url("test")') - }) + }), ) }) }) @@ -397,7 +397,7 @@ describe('Marpit', () => { expect($('style')).toHaveLength(0) expect(rendered.css.trim().endsWith('{ --style: appended; }')).toBe( - true + true, ) expect(rendered.css).toContain('/* @import "valid-theme"; */') }) @@ -411,7 +411,7 @@ describe('Marpit', () => { expect(css).toContain('[data-marpit-scope-') expect(Object.keys($('section').attr())).toContainEqual( - expect.stringMatching(/^data-marpit-scope-/) + expect.stringMatching(/^data-marpit-scope-/), ) }) }) @@ -517,7 +517,7 @@ describe('Marpit', () => { instance.themeSet.add('/* @theme test */ :root { background: red; }') expect(instance.renderStyle('test')).toContain( - 'div.marpit > :where(section)' + 'div.marpit > :where(section)', ) }) }) diff --git a/test/plugin.js b/test/plugin.js index 0096e507..7470f3b9 100644 --- a/test/plugin.js +++ b/test/plugin.js @@ -30,7 +30,7 @@ describe('Plugin interface', () => { const plugin = marpitPlugin(jest.fn()) expect(() => new markdownIt().use(plugin)).toThrowError( - 'Marpit plugin has detected incompatible markdown-it instance.' + 'Marpit plugin has detected incompatible markdown-it instance.', ) }) }) diff --git a/test/postcss/import/hoisting.js b/test/postcss/import/hoisting.js index 3151f606..142e441c 100644 --- a/test/postcss/import/hoisting.js +++ b/test/postcss/import/hoisting.js @@ -24,11 +24,11 @@ describe('Marpit PostCSS import hoisting plugin', () => { it('rolls up invalid @charset rule', () => run('h1 { color: red; }\n@charset "utf-8";').then(({ css }) => - expect(css).toBe('@charset "utf-8";\nh1 { color: red; }') + expect(css).toBe('@charset "utf-8";\nh1 { color: red; }'), )) it('applies the first rule when style has multiple @charset rules', () => run('h1 { color: red; }\n@charset "utf-16";\n@charset "utf-8";').then( - ({ css }) => expect(css).toBe('@charset "utf-16";\nh1 { color: red; }') + ({ css }) => expect(css).toBe('@charset "utf-16";\nh1 { color: red; }'), )) }) diff --git a/test/postcss/import/parse.js b/test/postcss/import/parse.js index ce42bc0e..2dc9d3c9 100644 --- a/test/postcss/import/parse.js +++ b/test/postcss/import/parse.js @@ -19,7 +19,7 @@ describe('Marpit PostCSS import parse plugin', () => { expect(imported.node.type).toBe('atrule') expect(imported.value).toBe('theme') - } + }, )) it('parses multiple @import rules', () => @@ -42,16 +42,16 @@ describe('Marpit PostCSS import parse plugin', () => { it('does not parse @import rule when it specifies URL data type', () => run("@import url('https://example.com/example.css')").then((result) => - expect(result.marpitImport).toHaveLength(0) + expect(result.marpitImport).toHaveLength(0), )) it('does not parse @import rule when it is not preceded any rules', () => Promise.all([ run("b { color: red; }\n@import 'theme';").then((result) => - expect(result.marpitImport).toHaveLength(0) + expect(result.marpitImport).toHaveLength(0), ), run("@keyframes {}\n@import 'theme';").then((result) => - expect(result.marpitImport).toHaveLength(0) + expect(result.marpitImport).toHaveLength(0), ), ])) }) diff --git a/test/postcss/import/replace.js b/test/postcss/import/replace.js index e37e5a34..94ed3f9c 100644 --- a/test/postcss/import/replace.js +++ b/test/postcss/import/replace.js @@ -21,7 +21,7 @@ describe('Marpit PostCSS import replace plugin', () => { it('imports another theme', () => run('@import "imported";\n\nsection { width: 100px; }').then(({ css }) => - expect(css).toBe('h1 { font-size: 3em; }\n\nsection { width: 100px; }') + expect(css).toBe('h1 { font-size: 3em; }\n\nsection { width: 100px; }'), )) it('supports nested import', () => @@ -30,23 +30,23 @@ describe('Marpit PostCSS import replace plugin', () => { h3 { font-size: 1em; } h2 { font-size: 2em; } h1 { font-size: 10em; } - `) + `), )) it('ignores when the specified theme is not defined in ThemeSet', () => run('@import "unknown";').then(({ css }) => - expect(css).toBe('@import "unknown";') + expect(css).toBe('@import "unknown";'), )) context('with using @import-theme rule', () => { it('imports to the beginning of CSS', () => run('body { color: red; }\n\n@import-theme "imported"').then(({ css }) => - expect(css).toBe('h1 { font-size: 3em; }\nbody { color: red; }') + expect(css).toBe('h1 { font-size: 3em; }\nbody { color: red; }'), )) it('ignores when the rule is contained in selector', () => run('body { @import-theme "imported"; }').then(({ css }) => - expect(css).toBe('body { @import-theme "imported"; }') + expect(css).toBe('body { @import-theme "imported"; }'), )) }) @@ -72,10 +72,10 @@ describe('Marpit PostCSS import replace plugin', () => { it('throws error when circular import is detected', () => Promise.all([ expect(run('@import "circular"')).rejects.toThrow( - 'Circular "circular" theme import is detected.' + 'Circular "circular" theme import is detected.', ), expect(run('@import "nested-circular"')).rejects.toThrow( - 'Circular "nested-circular" theme import is detected.' + 'Circular "nested-circular" theme import is detected.', ), ])) }) diff --git a/test/postcss/import/suppress.js b/test/postcss/import/suppress.js index 5a3f793d..271b4adf 100644 --- a/test/postcss/import/suppress.js +++ b/test/postcss/import/suppress.js @@ -11,8 +11,8 @@ describe('Marpit PostCSS import suppress plugin', () => { it('comments out @import and @import-theme rules with valid theme', () => run('@import "imported";\n@import-theme "imported";').then(({ css }) => expect(css).toBe( - '/* @import "imported"; */\n/* @import-theme "imported"; */' - ) + '/* @import "imported"; */\n/* @import-theme "imported"; */', + ), )) it('ignores @import and @import-theme rules with invalid theme', () => { diff --git a/test/postcss/pagination.js b/test/postcss/pagination.js index 16d2ec2f..0efad407 100644 --- a/test/postcss/pagination.js +++ b/test/postcss/pagination.js @@ -10,80 +10,80 @@ describe('Marpit PostCSS pagination plugin', () => { it('comments out the content declaration of section::after not for pagination', () => Promise.all([ expect(run("section::after { content: 'test'; }")).resolves.toBe( - "section::after { /* content: 'test'; */ }" + "section::after { /* content: 'test'; */ }", ), expect(run("section:after { content: 'test'; }")).resolves.toBe( - "section:after { /* content: 'test'; */ }" + "section:after { /* content: 'test'; */ }", ), ])) it('comments out the content declaration of section::after with id/class selector', () => Promise.all([ expect(run("section#id::after { content: ''; }")).resolves.toBe( - "section#id::after { /* content: ''; */ }" + "section#id::after { /* content: ''; */ }", ), expect(run("section.class::after { content: ''; }")).resolves.toBe( - "section.class::after { /* content: ''; */ }" + "section.class::after { /* content: ''; */ }", ), ])) it('comments out the content declaration of section::after with attribute selector', () => Promise.all([ expect(run("section[abc='1']::after { content: ''; }")).resolves.toBe( - "section[abc='1']::after { /* content: ''; */ }" + "section[abc='1']::after { /* content: ''; */ }", ), expect(run("section[abc][def]::after { content: ''; }")).resolves.toBe( - "section[abc][def]::after { /* content: ''; */ }" + "section[abc][def]::after { /* content: ''; */ }", ), expect(run('section[a*="b"]::after { content: \'\'; }')).resolves.toBe( - 'section[a*="b"]::after { /* content: \'\'; */ }' + 'section[a*="b"]::after { /* content: \'\'; */ }', ), ])) it('comments out the content declaration of section::after with pseudo-class', () => Promise.all([ expect(run("section:hover::after { content: ''; }")).resolves.toBe( - "section:hover::after { /* content: ''; */ }" + "section:hover::after { /* content: ''; */ }", ), expect(run("section:not(:empty)::after { content: ''; }")).resolves.toBe( - "section:not(:empty)::after { /* content: ''; */ }" + "section:not(:empty)::after { /* content: ''; */ }", ), ])) it('keeps the content declaration of section::after for pagination', () => Promise.all([ expect( - run('section::after { content: attr(data-marpit-pagination); }') + run('section::after { content: attr(data-marpit-pagination); }'), ).resolves.toBe( - 'section::after { content: attr(data-marpit-pagination); }' + 'section::after { content: attr(data-marpit-pagination); }', ), expect( run( - 'section::after { content: attr(data-marpit-pagination) "/" attr(data-marpit-pagination-total); }' - ) + 'section::after { content: attr(data-marpit-pagination) "/" attr(data-marpit-pagination-total); }', + ), ).resolves.toBe( - 'section::after { content: attr(data-marpit-pagination) "/" attr(data-marpit-pagination-total); }' + 'section::after { content: attr(data-marpit-pagination) "/" attr(data-marpit-pagination-total); }', ), ])) it('keeps the content declaration of section::after with combinators', () => Promise.all([ expect(run("section div::after { content: ''; }")).resolves.toBe( - "section div::after { content: ''; }" + "section div::after { content: ''; }", ), expect(run("section > div::after { content: ''; }")).resolves.toBe( - "section > div::after { content: ''; }" + "section > div::after { content: ''; }", ), expect(run("section+section::after { content: ''; }")).resolves.toBe( - "section+section::after { content: ''; }" + "section+section::after { content: ''; }", ), expect(run("section~p::after { content: ''; }")).resolves.toBe( - "section~p::after { content: ''; }" + "section~p::after { content: ''; }", ), ])) it('keeps the content declaration of section-like-element::after', () => expect(run("section-like-element::after { content: ''; }")).resolves.toBe( - "section-like-element::after { content: ''; }" + "section-like-element::after { content: ''; }", )) }) diff --git a/test/postcss/pseudo_selector/replace.js b/test/postcss/pseudo_selector/replace.js index 2905c598..e4f8ab7a 100644 --- a/test/postcss/pseudo_selector/replace.js +++ b/test/postcss/pseudo_selector/replace.js @@ -52,7 +52,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { const container = new Element('div') return run(css, container).then((result) => - expect(result.root.first.selector).toBe('div > section') + expect(result.root.first.selector).toBe('div > section'), ) }) }) @@ -62,7 +62,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { const containers = [new Element('div'), new Element('span')] return run(css, containers).then((result) => - expect(result.root.first.selector).toBe('div > span > section') + expect(result.root.first.selector).toBe('div > span > section'), ) }) @@ -75,8 +75,8 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { return run(css, containers).then((result) => expect(result.root.first.selector).toBe( - 'marp\\.custom-element > emotion-\\1F60D > section' - ) + 'marp\\.custom-element > emotion-\\1F60D > section', + ), ) }) }) @@ -86,7 +86,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { const container = new Element('div', { class: 'foo bar' }) return run(css, container).then((result) => - expect(result.root.first.selector).toBe('div.foo.bar > section') + expect(result.root.first.selector).toBe('div.foo.bar > section'), ) }) @@ -94,7 +94,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { const container = new Element('div', { class: 'one two one' }) return run(css, container).then((result) => - expect(result.root.first.selector).toBe('div.one.two > section') + expect(result.root.first.selector).toBe('div.one.two > section'), ) }) @@ -103,8 +103,8 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { return run(css, container).then((result) => expect(result.root.first.selector).toBe( - 'div.\\31 23.\\.foo\\.bar.\\#test > section' - ) + 'div.\\31 23.\\.foo\\.bar.\\#test > section', + ), ) }) }) @@ -114,7 +114,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { const container = new Element('div', { id: 'identifier' }) return run(css, container).then((result) => - expect(result.root.first.selector).toBe('div#identifier > section') + expect(result.root.first.selector).toBe('div#identifier > section'), ) }) @@ -122,7 +122,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { const container = new Element('div', { class: 'one two', id: 'id' }) return run(css, container).then((result) => - expect(result.root.first.selector).toBe('div.one.two#id > section') + expect(result.root.first.selector).toBe('div.one.two#id > section'), ) }) @@ -131,8 +131,8 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { return run(css, container).then((result) => expect(result.root.first.selector).toBe( - 'div#\\30 123\\<\\#\\>4567 > section' - ) + 'div#\\30 123\\<\\#\\>4567 > section', + ), ) }) }) @@ -144,7 +144,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { context('when slide element is null', () => { it('remove pseudo elements', () => run(css, undefined, null).then((result) => - expect(result.root.first.selector).toBe('h1') + expect(result.root.first.selector).toBe('h1'), )) }) @@ -153,7 +153,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { const container = new Element('div') return run(css, undefined, container).then((result) => - expect(result.root.first.selector).toBe('div h1') + expect(result.root.first.selector).toBe('div h1'), ) }) }) @@ -163,7 +163,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { const containers = [new Element('svg'), new Element('foreignObject')] return run(css, undefined, containers).then((result) => - expect(result.root.first.selector).toBe('svg > foreignObject h1') + expect(result.root.first.selector).toBe('svg > foreignObject h1'), ) }) @@ -175,8 +175,8 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { return run(css, undefined, containers).then((result) => expect(result.root.first.selector).toBe( - 'marp\\.custom-element > emotion-\\1F60D h1' - ) + 'marp\\.custom-element > emotion-\\1F60D h1', + ), ) }) }) @@ -186,7 +186,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { const container = new Element('div', { class: 'foo bar' }) return run(css, undefined, container).then((result) => - expect(result.root.first.selector).toBe('div.foo.bar h1') + expect(result.root.first.selector).toBe('div.foo.bar h1'), ) }) @@ -194,7 +194,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { const container = new Element('div', { class: 'one two one' }) return run(css, undefined, container).then((result) => - expect(result.root.first.selector).toBe('div.one.two h1') + expect(result.root.first.selector).toBe('div.one.two h1'), ) }) @@ -203,8 +203,8 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { return run(css, undefined, container).then((result) => expect(result.root.first.selector).toBe( - 'div.\\31 23.\\.foo\\.bar.\\#test h1' - ) + 'div.\\31 23.\\.foo\\.bar.\\#test h1', + ), ) }) }) @@ -214,7 +214,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { const container = new Element('div', { id: 'identifier' }) return run(css, undefined, container).then((result) => - expect(result.root.first.selector).toBe('div#identifier h1') + expect(result.root.first.selector).toBe('div#identifier h1'), ) }) @@ -222,7 +222,7 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { const container = new Element('div', { class: 'one two', id: 'id' }) return run(css, undefined, container).then((result) => - expect(result.root.first.selector).toBe('div.one.two#id h1') + expect(result.root.first.selector).toBe('div.one.two#id h1'), ) }) @@ -231,8 +231,8 @@ describe('Marpit PostCSS pseudo selector replace plugin', () => { return run(css, undefined, container).then((result) => expect(result.root.first.selector).toBe( - 'div#\\30 123\\<\\#\\>4567 h1' - ) + 'div#\\30 123\\<\\#\\>4567 h1', + ), ) }) }) diff --git a/test/postcss/root/font_size.js b/test/postcss/root/font_size.js index 5ab4d1cb..f6dd305e 100644 --- a/test/postcss/root/font_size.js +++ b/test/postcss/root/font_size.js @@ -21,19 +21,19 @@ describe('CSS variable injection', () => { // With combinator expect(run('section.klass { font-size: 16px; }').css).toContain( - `section.klass { ${rootFontSizeCustomProp}: 16px; }` + `section.klass { ${rootFontSizeCustomProp}: 16px; }`, ) expect(run('section#id { font-size: 16px; }').css).toContain( - `section#id { ${rootFontSizeCustomProp}: 16px; }` + `section#id { ${rootFontSizeCustomProp}: 16px; }`, ) expect(run('section[data-header] { font-size: 16px; }').css).toContain( - `section[data-header] { ${rootFontSizeCustomProp}: 16px; }` + `section[data-header] { ${rootFontSizeCustomProp}: 16px; }`, ) expect(run('section:hover { font-size: 16px; }').css).toContain( - `section:hover { ${rootFontSizeCustomProp}: 16px; }` + `section:hover { ${rootFontSizeCustomProp}: 16px; }`, ) expect(run('section::after { font-size: 16px; }').css).toContain( - `section::after { ${rootFontSizeCustomProp}: 16px; }` + `section::after { ${rootFontSizeCustomProp}: 16px; }`, ) // Universal selector in modularized transform (explicit and implicit) @@ -57,7 +57,7 @@ describe('CSS variable injection', () => { section>section { ${rootFontSizeCustomProp}: 16px; } ` expect(runWithModularize('section>section { font-size: 16px; }').css).toBe( - nested + nested, ) }) @@ -69,7 +69,7 @@ describe('CSS variable injection', () => { font-size: 1rem; font-size: 18px !important; } - `).css + `).css, ).toBe(dedent` section { font-size: 16px; diff --git a/test/postcss/root/increasing_specificity.js b/test/postcss/root/increasing_specificity.js index 861392eb..ebe5c505 100644 --- a/test/postcss/root/increasing_specificity.js +++ b/test/postcss/root/increasing_specificity.js @@ -12,16 +12,16 @@ describe('Marpit PostCSS root increasing specificity plugin', () => { it('replaces specific pseudo-class into ":where(section):not([\\20 root])" to increase specificity', () => { expect(run(`section${pseudoClass} {}`).css).toBe( - ':where(section):not([\\20 root]) {}' + ':where(section):not([\\20 root]) {}', ) // With replaced :root selector via root replace plugin expect(run(`:root {}`).css).toBe(':where(section):not([\\20 root]) {}') expect(run(`section :root {}`).css).toBe( - 'section :where(section):not([\\20 root]) {}' + 'section :where(section):not([\\20 root]) {}', ) expect(run(`:root.klass div {}`).css).toBe( - ':where(section):not([\\20 root]).klass div {}' + ':where(section):not([\\20 root]).klass div {}', ) }) }) diff --git a/test/postcss/root/rem.js b/test/postcss/root/rem.js index cc1def3f..2f61de87 100644 --- a/test/postcss/root/rem.js +++ b/test/postcss/root/rem.js @@ -8,23 +8,23 @@ describe('Marpit PostCSS rem plugin', () => { it('replaces rem unit in all declarations into calculated value', () => { expect(run('h1 { font-size: 2rem; }').css).toBe( - `h1 { font-size: calc(var(${rootFontSizeCustomProp}, 1rem) * 2); }` + `h1 { font-size: calc(var(${rootFontSizeCustomProp}, 1rem) * 2); }`, ) expect( run(dedent` h2 { font-size: 1.5rem; } h3 { font-size: .9rem; } - `).css + `).css, ).toBe(dedent` h2 { font-size: calc(var(${rootFontSizeCustomProp}, 1rem) * 1.5); } h3 { font-size: calc(var(${rootFontSizeCustomProp}, 1rem) * .9); } `) expect( - run('@media screen { h4 { height: calc(12px + .6rem); } }').css + run('@media screen { h4 { height: calc(12px + .6rem); } }').css, ).toBe( - `@media screen { h4 { height: calc(12px + calc(var(${rootFontSizeCustomProp}, 1rem) * .6)); } }` + `@media screen { h4 { height: calc(12px + calc(var(${rootFontSizeCustomProp}, 1rem) * .6)); } }`, ) }) @@ -37,7 +37,7 @@ describe('Marpit PostCSS rem plugin', () => { // The case of mixed expect(run("section { font: regular 2rem '2rem font'; }").css).toBe( - `section { font: regular calc(var(${rootFontSizeCustomProp}, 1rem) * 2) '2rem font'; }` + `section { font: regular calc(var(${rootFontSizeCustomProp}, 1rem) * 2) '2rem font'; }`, ) }) diff --git a/test/postcss/root/replace.js b/test/postcss/root/replace.js index 55e85e98..78e666d4 100644 --- a/test/postcss/root/replace.js +++ b/test/postcss/root/replace.js @@ -11,50 +11,50 @@ describe('Marpit PostCSS root replace plugin', () => { // Various usages of :root selector expect(run(':root :root { --bg: #fff; }').css).toBe( - 'section section { --bg: #fff; }' + 'section section { --bg: #fff; }', ) expect(run(':marpit-slide>:root { --bg: #fff; }').css).toBe( - ':marpit-slide>section { --bg: #fff; }' + ':marpit-slide>section { --bg: #fff; }', ) expect(run(':root+:root { --bg: #fff; }').css).toBe( - 'section+section { --bg: #fff; }' + 'section+section { --bg: #fff; }', ) expect(run(':root.klass~:root { --bg: #fff; }').css).toBe( - 'section.klass~section { --bg: #fff; }' + 'section.klass~section { --bg: #fff; }', ) expect(run(':root:not(:root.klass) { --bg: #fff; }').css).toBe( - 'section:not(section.klass) { --bg: #fff; }' + 'section:not(section.klass) { --bg: #fff; }', ) expect( run(dedent` @media screen { :root { --bg: #fff; } } - `).css + `).css, ).toContain('section { --bg: #fff; }') expect( run(dedent` @supports (--foo: bar) { :root { --bg: #fff; } } - `).css + `).css, ).toContain('section { --bg: #fff; }') // "section:root" also replaces into "section" expect(run('section:root { --bg: #fff; }').css).toBe( - 'section { --bg: #fff; }' + 'section { --bg: #fff; }', ) }) it('does not replace ":root" in non-selector', () => { expect(run('p[data-value=":root"] { --bg: #fff; }').css).toBe( - 'p[data-value=":root"] { --bg: #fff; }' + 'p[data-value=":root"] { --bg: #fff; }', ) }) it('leaves :root selector for other elements', () => { expect(run('html:root :root { --bg: #fff; }').css).toBe( - 'html:root section { --bg: #fff; }' + 'html:root section { --bg: #fff; }', ) }) }) diff --git a/test/postcss/section_size.js b/test/postcss/section_size.js index 97053ac5..cd8c0c47 100644 --- a/test/postcss/section_size.js +++ b/test/postcss/section_size.js @@ -16,7 +16,7 @@ describe('Marpit PostCSS section size plugin', () => { expect(result.marpitSectionSize).toStrictEqual({ width: '123px', height: '456px', - }) + }), )) it('supports grouping selector', () => @@ -24,12 +24,12 @@ describe('Marpit PostCSS section size plugin', () => { expect(result.marpitSectionSize).toStrictEqual({ width: '234px', height: '567px', - }) + }), )) it('ignores section selector with pusedo selector', () => run('section:first-child { width: 123px; height: 456px; }').then((result) => - expect(result.marpitSectionSize).toStrictEqual({}) + expect(result.marpitSectionSize).toStrictEqual({}), )) context('with preferedPseudoClass', () => { @@ -40,12 +40,12 @@ describe('Marpit PostCSS section size plugin', () => { it('prefers defined size within section selector with specific pseudo selector than plain selector', () => run( - 'section:test { width: 123px; height: 123px; } section { width: 456px; height: 456px; } ' + 'section:test { width: 123px; height: 123px; } section { width: 456px; height: 456px; } ', ).then((result) => expect(result.marpitSectionSize).toStrictEqual({ width: '123px', height: '123px', - }) + }), )) }) }) diff --git a/test/postcss/svg_backdrop.js b/test/postcss/svg_backdrop.js index d0fd8eb1..07a88ef8 100644 --- a/test/postcss/svg_backdrop.js +++ b/test/postcss/svg_backdrop.js @@ -14,7 +14,7 @@ describe('Marpit PostCSS SVG backdrop plugin', () => { expect(redirected.name).toBe('media') expect(redirected.params).toBe('screen') expect(redirected.nodes.toString()).toMatchInlineSnapshot( - `":marpit-container > svg[data-marpit-svg] { background: white; }"` + `":marpit-container > svg[data-marpit-svg] { background: white; }"`, ) })) }) diff --git a/test/theme.js b/test/theme.js index 1c35665c..0dbab347 100644 --- a/test/theme.js +++ b/test/theme.js @@ -25,7 +25,7 @@ describe('Theme', () => { it('throws error', () => expect(() => Theme.fromCSS(css)).toThrow( - 'Marpit theme CSS requires @theme meta.' + 'Marpit theme CSS requires @theme meta.', )) context('with specified internal symbol for skipping validation', () => { @@ -102,7 +102,7 @@ describe('Theme', () => { * @unknown B */ `, - { metaType: { string: String, array: Array } } + { metaType: { string: String, array: Array } }, ) expect(instance.meta.string).toBe('B') @@ -118,7 +118,7 @@ describe('Theme', () => { * @theme B */ `, - { metaType: { theme: Array } } + { metaType: { theme: Array } }, ) expect(instance.meta.theme).toStrictEqual('B') diff --git a/test/theme_set.js b/test/theme_set.js index ca1e3f1f..ec3976a1 100644 --- a/test/theme_set.js +++ b/test/theme_set.js @@ -75,12 +75,12 @@ describe('ThemeSet', () => { it('throws error when passed theme is not an instance of Theme', () => expect(() => instance.addTheme('/* @theme test-theme */')).toThrow( - 'ThemeSet can add only an instance of Theme.' + 'ThemeSet can add only an instance of Theme.', )) it('throws error when passed theme has not name', () => { expect(() => instance.addTheme(new Theme(undefined, ''))).toThrow( - 'An instance of Theme requires name.' + 'An instance of Theme requires name.', ) }) @@ -155,14 +155,14 @@ describe('ThemeSet', () => { beforeEach(() => { arrayMetaTheme = Theme.fromCSS( '/* @theme array-meta */\n/* @array A */\n/* @array B */', - { metaType: { array: Array } } + { metaType: { array: Array } }, ) // Meta value instance.add('/* @theme meta */\n/* @meta-value A */') instance.add('/* @theme meta-imported */\n@import "meta";') instance.add( - '/* @theme meta-override */\n/* @meta-value B */\n@import "meta";' + '/* @theme meta-override */\n/* @meta-value B */\n@import "meta";', ) // Array meta @@ -170,23 +170,23 @@ describe('ThemeSet', () => { instance.addTheme( Theme.fromCSS( '/* @theme array-meta-imported */\n/* @array C */\n@import "array-meta";', - { metaType: { array: Array } } - ) + { metaType: { array: Array } }, + ), ) instance.addTheme( Theme.fromCSS( '/* @theme array-meta-double-imported */\n/* @array D */\n@import "array-meta-imported";', - { metaType: { array: Array } } - ) + { metaType: { array: Array } }, + ), ) instance.add( - '/* @theme array-meta-override-by-string */\n/* @array str */\n@import "array-meta";' + '/* @theme array-meta-override-by-string */\n/* @array str */\n@import "array-meta";', ) instance.addTheme( Theme.fromCSS( '/* @theme string-meta-override-by-array */\n/* @meta-value B */\n/* @meta-value C */\n@import "meta";', - { metaType: { 'meta-value': Array } } - ) + { metaType: { 'meta-value': Array } }, + ), ) }) @@ -227,7 +227,7 @@ describe('ThemeSet', () => { 'C', ]) expect( - getThemeMeta('array-meta-double-imported', 'array') + getThemeMeta('array-meta-double-imported', 'array'), ).toStrictEqual(['A', 'B', 'C', 'D']) }) }) @@ -237,13 +237,13 @@ describe('ThemeSet', () => { () => { it('returns the meta value only from a primary theme', () => { expect(getThemeMeta('array-meta-override-by-string', 'array')).toBe( - 'str' + 'str', ) expect( - getThemeMeta('string-meta-override-by-array', 'meta-value') + getThemeMeta('string-meta-override-by-array', 'meta-value'), ).toStrictEqual(['B', 'C']) }) - } + }, ) }) @@ -343,10 +343,10 @@ describe('ThemeSet', () => { it('throws error when circular import is detected', () => { expect(() => getThemeProp('circular-import', 'width')).toThrow( - 'Circular "circular-import" theme import is detected.' + 'Circular "circular-import" theme import is detected.', ) expect(() => getThemeProp('nested-circular', 'width')).toThrow( - 'Circular "nested-circular" theme import is detected.' + 'Circular "nested-circular" theme import is detected.', ) }) @@ -411,7 +411,7 @@ describe('ThemeSet', () => { expect(printCSS.split('@media print').length - 1).toBe(2) expect(printCSS).toContain( - '@media print { section body { background: red; } }' + '@media print { section body { background: red; } }', ) // `@media marpit-print` internal at-rule will remove.