From 88027c20533489b557796e79924be556967d8cff Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Fri, 30 Aug 2024 15:23:12 +0800 Subject: [PATCH] Add test for global config --- src/fixtures/config.html | 26 ++++++++++++++++++++++++++ src/index.spec.js | 22 ++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/fixtures/config.html diff --git a/src/fixtures/config.html b/src/fixtures/config.html new file mode 100644 index 0000000..627725c --- /dev/null +++ b/src/fixtures/config.html @@ -0,0 +1,26 @@ + + + + + + Test + + + + + + diff --git a/src/index.spec.js b/src/index.spec.js index 9d24d6a..2369f19 100644 --- a/src/index.spec.js +++ b/src/index.spec.js @@ -104,3 +104,25 @@ test.describe('feature tests', () => { ).toHaveClass('markdown-alert markdown-alert-note') }) }) + +test.describe('global config', () => { + test.beforeEach(async ({ page }) => { + await page.goto('/fixtures/config.html') + }) + + test('no-shadow', async ({ page }) => { + expect(await page.locator('zero-md').evaluate((el) => !!el.shadowRoot)).toBe(false) + }) + + test('no-auto', async ({ page }) => { + expect(await page.locator('.markdown-body').textContent()).toBe('') + }) + + test('body-class', async ({ page }) => { + await expect(page.locator('.markdown-body')).toHaveClass('markdown-body test') + }) + + test('src', async ({ page }) => { + await expect(page.locator('zero-md')).toHaveAttribute('src', 'basic.md') + }) +})