Skip to content
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
40 changes: 40 additions & 0 deletions packages/rspress-plugin-supersub/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { test, expect } from '@playwright/test';
import path from 'path';
import { fileURLToPath } from 'url';
import { runDevCommand, killProcess } from '../../e2e/utils.ts';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

test.describe('rspress-plugin-supersub', () => {
let devProcess: any;
let url: string;

test.beforeAll(async () => {
const result = await runDevCommand(__dirname);
devProcess = result.process;
url = result.url;
});

test.afterAll(async () => {
if (devProcess) {
await killProcess(devProcess);
}
});

test('should render superscript with <sup> tag', async ({ page }) => {
await page.goto(url, { waitUntil: 'networkidle' });
// Check if sup elements exist, which are generated by supersub plugin
// e.g., 2^10^ should render as 2<sup>10</sup>
const supElement = page.locator('sup');
await expect(supElement.first()).toBeVisible();
});

test('should render subscript with <sub> tag', async ({ page }) => {
await page.goto(url, { waitUntil: 'networkidle' });
// Check if sub elements exist, which are generated by supersub plugin
// e.g., H_2_O should render as H<sub>2</sub>O
const subElement = page.locator('sub');
await expect(subElement.first()).toBeVisible();
});
});
7 changes: 7 additions & 0 deletions packages/rspress-plugin-supersub/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
exclude: ['**/*.spec.ts', 'node_modules'],
},
});