Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[next] Fix <Code> component #1635

Merged
merged 3 commits into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/astro/components/Code.astro
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ function repairShikiTheme(html: string): string {

const highlighter = await shiki.getHighlighter({theme});
const _html = highlighter.codeToHtml(code, lang);
html = repairShikiTheme(_html);
const html = repairShikiTheme(_html);
---
{html}
2 changes: 1 addition & 1 deletion packages/astro/components/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//export { default as Code } from './Code.astro';
export { default as Code } from './Code.astro';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

export { default as Debug } from './Debug.astro';
export { default as Markdown } from './Markdown.astro';
export { default as Prism } from './Prism.astro';
9 changes: 2 additions & 7 deletions packages/astro/test/astro-component-code.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/**
* UNCOMMENT: fix top-level expressions in components
import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
Expand All @@ -20,7 +18,7 @@ describe('<Code', () => {
expect($('pre > code')).to.have.lengthOf(1);

// test: contains some generated spans
expect($('pre > code span').length).toBeGreaterThan(1);
expect($('pre > code span').length).to.be.greaterThan(1);
});

it('<Code lang="...">', async () => {
Expand All @@ -30,7 +28,7 @@ describe('<Code', () => {
expect($('pre').attr('class'), 'astro-code');
expect($('pre > code')).to.have.lengthOf(1);
// test: contains many generated spans
expect($('pre > code span').length).toBeGreaterThanOrEqual(6);
expect($('pre > code span').length).to.be.greaterThanOrEqual(6);
});

it('<Code theme="...">', async () => {
Expand Down Expand Up @@ -84,6 +82,3 @@ describe('<Code', () => {
]);
});
});
*/

it.skip('is skipped', () => {});