Debian Codegraph @

tests/functional/plugins/body-class-plugin.spec.ts

raw
1 import { test } from '@playwright/test';
2
3 import { expectNotToHaveClass, expectToHaveClass } from '../../support/commands.js';
4 import { navigateWithSwup } from '../../support/swup.js';
5 import { prefixed } from '../../support/utils.js';
6
7 const url = prefixed('/plugins/body-class-plugin/');
8
9 test.describe('body-class plugin', () => {
10 test.beforeEach(async ({ page }) => {
11 await page.goto(url('page-1.html'));
12 });
13
14 test('updates the body class', async ({ page }) => {
15 const body = page.locator('body');
16 await expectToHaveClass(body, 'body-1');
17 await expectNotToHaveClass(body, 'body-2');
18 await navigateWithSwup(page, url('page-2.html'));
19 await expectToHaveClass(body, 'body-2');
20 await expectNotToHaveClass(body, 'body-1');
21 });
22 });