diff options
Diffstat (limited to 'packages/markdown/component/test/astro-markdown.test.js')
-rw-r--r-- | packages/markdown/component/test/astro-markdown.test.js | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/packages/markdown/component/test/astro-markdown.test.js b/packages/markdown/component/test/astro-markdown.test.js index e5a1382a5..d2b156334 100644 --- a/packages/markdown/component/test/astro-markdown.test.js +++ b/packages/markdown/component/test/astro-markdown.test.js @@ -25,25 +25,6 @@ describe('Astro Markdown', () => { expect($('#test').length).to.be.ok; }); - it('Can parse JSX expressions in markdown pages', async () => { - const html = await fixture.readFile('/jsx-expressions/index.html'); - const $ = cheerio.load(html); - - expect($('h2').html()).to.equal('Blog Post with JSX expressions'); - - expect(html).to.contain('JSX at the start of the line!'); - for (let listItem of ['test-1', 'test-2', 'test-3']) { - expect($(`#${listItem}`).html()).to.equal(`${listItem}`); - } - }); - - it('Can handle slugs with JSX expressions in markdown pages', async () => { - const html = await fixture.readFile('/slug/index.html'); - const $ = cheerio.load(html); - - expect($('h1').attr('id')).to.equal('my-blog-post'); - }); - it('Can handle code elements without extra spacing', async () => { const html = await fixture.readFile('/code-element/index.html'); const $ = cheerio.load(html); @@ -53,14 +34,6 @@ describe('Astro Markdown', () => { }); }); - it('Can handle namespaced components in markdown', async () => { - const html = await fixture.readFile('/namespace/index.html'); - const $ = cheerio.load(html); - - expect($('h1').text()).to.equal('Hello Namespace!'); - expect($('button').length).to.equal(1); - }); - it('Correctly handles component children in markdown pages (#3319)', async () => { const html = await fixture.readFile('/children/index.html'); @@ -95,12 +68,6 @@ describe('Astro Markdown', () => { expect($('pre > code').text()).to.equal('<!-- HTML comments in code fence -->'); }); - // https://github.com/withastro/astro/issues/3254 - it('Can handle scripts in markdown pages', async () => { - const html = await fixture.readFile('/script/index.html'); - expect(html).not.to.match(new RegExp('/src/scripts/test.js')); - }); - it('Can load more complex jsxy stuff', async () => { const html = await fixture.readFile('/complex/index.html'); const $ = cheerio.load(html); @@ -256,45 +223,6 @@ describe('Astro Markdown', () => { expect($('#target > ol > li > ol > li').text()).to.equal('nested hello'); }); - it('Exposes raw markdown content', async () => { - const { raw } = JSON.parse(await fixture.readFile('/raw-content.json')); - - expect(fixLineEndings(raw)).to.equal( - `\n## With components\n\n### Non-hydrated\n\n<Hello name="Astro Naut" />\n\n### Hydrated\n\n<Counter client:load />\n<SvelteButton client:load />\n` - ); - }); - - it('Exposes HTML parser for raw markdown content', async () => { - const { compiled } = JSON.parse(await fixture.readFile('/raw-content.json')); - - expect(fixLineEndings(compiled)).to.equal( - `<h2 id="with-components">With components</h2>\n<h3 id="non-hydrated">Non-hydrated</h3>\n<Hello name="Astro Naut" />\n<h3 id="hydrated">Hydrated</h3>\n<Counter client:load />\n<SvelteButton client:load />` - ); - }); - - it('Allows referencing Vite env var names in markdown (#3412)', async () => { - const html = await fixture.readFile('/vite-env-vars/index.html'); - const $ = cheerio.load(html); - - // test 1: referencing an existing var name - expect($('code').eq(0).text()).to.equal('import.meta.env.SITE'); - expect($('li').eq(0).text()).to.equal('import.meta.env.SITE'); - expect($('code').eq(3).text()).to.contain('site: import.meta.env.SITE'); - expect($('blockquote').text()).to.contain('import.meta.env.SITE'); - - // test 2: referencing a non-existing var name - expect($('code').eq(1).text()).to.equal('import.meta.env.TITLE'); - expect($('li').eq(1).text()).to.equal('import.meta.env.TITLE'); - expect($('code').eq(3).text()).to.contain('title: import.meta.env.TITLE'); - expect($('blockquote').text()).to.contain('import.meta.env.TITLE'); - - // test 3: referencing `import.meta.env` itself (without any var name) - expect($('code').eq(2).text()).to.equal('import.meta.env'); - expect($('li').eq(2).text()).to.equal('import.meta.env'); - expect($('code').eq(3).text()).to.contain('// Use Vite env vars with import.meta.env'); - expect($('blockquote').text()).to.match(/import\.meta\.env\s*$/); - }); - it('Escapes HTML tags in code blocks', async () => { const html = await fixture.readFile('/code-in-md/index.html'); const $ = cheerio.load(html); @@ -305,42 +233,6 @@ describe('Astro Markdown', () => { expect($('pre').html()).to.contain('>This should also work without any problems.<'); }); - it('Allows defining slot contents in component children', async () => { - const html = await fixture.readFile('/slots/index.html'); - const $ = cheerio.load(html); - - const slots = $('article').eq(0); - expect(slots.find('> .fragmentSlot > div').text()).to.contain('1:'); - expect(slots.find('> .fragmentSlot > div + p').text()).to.contain('2:'); - expect(slots.find('> .pSlot > p[title="hello"]').text()).to.contain('3:'); - expect(slots.find('> .defaultSlot').html()).to.match( - new RegExp( - `<div>4: Div in default slot</div>` + - // Optional extra paragraph due to the line breaks between components - `(<p></p>)?` + - `<p>5: Paragraph in fragment in default slot</p>` + - // Optional whitespace due to the line breaks between components - `[\s\n]*` + - `6: Regular text in default slot` - ) - ); - - const nestedSlots = $('article').eq(1); - expect(nestedSlots.find('> .fragmentSlot').html()).to.contain('1:'); - expect(nestedSlots.find('> .pSlot > p').text()).to.contain('2:'); - expect(nestedSlots.find('> .defaultSlot > article').text().replace(/\s+/g, ' ')).to.equal( - ` - 3: nested fragmentSlot - 4: nested pSlot - 5: nested text in default slot - `.replace(/\s+/g, ' ') - ); - - expect($('article').eq(3).text().replace(/[^❌]/g, '')).to.equal('❌❌❌'); - - expect($('article').eq(4).text().replace(/[^❌]/g, '')).to.equal('❌❌❌'); - }); - it('Generate the right props for the layout', async () => { const html = await fixture.readFile('/layout-props/index.html'); const $ = cheerio.load(html); |