diff --git a/templates/form/tinymce_type.html.twig b/templates/form/tinymce_type.html.twig index c775e20..291bdc4 100644 --- a/templates/form/tinymce_type.html.twig +++ b/templates/form/tinymce_type.html.twig @@ -10,4 +10,12 @@ >{{ value }} + {%- endblock -%} diff --git a/tests/e2e/tests-noscript.spec.ts b/tests/e2e/tests-noscript.spec.ts new file mode 100644 index 0000000..bcc2703 --- /dev/null +++ b/tests/e2e/tests-noscript.spec.ts @@ -0,0 +1,20 @@ +import { test, expect } from '@playwright/test'; +test.use({ javaScriptEnabled: false }); + +test.describe('Without Javascript', () => { + test('Form type', async ({ page }) => { + await page.goto('http://localhost/test/form'); + + const textarea = page.getByRole('textbox').getByText('Initial text value'); + + // Validate fallback textarea is present and has initial content + await expect(textarea).toBeVisible(); + await expect(textarea).toHaveValue('
Initial text value
'); + // Update the content and submit the form + await textarea.fill('Initial text value has been updated!'); + await page.getByRole('button', { name: 'Submit' }).click(); + + // Validate form data is received correctly + await expect(page.getByText('Initial text value has been updated!')).toBeVisible(); + }); +}); diff --git a/tests/e2e/tests.spec.ts b/tests/e2e/tests.spec.ts index 56858a1..db8ab1f 100644 --- a/tests/e2e/tests.spec.ts +++ b/tests/e2e/tests.spec.ts @@ -1,47 +1,49 @@ import { test, expect } from '@playwright/test'; -test('Form type', async ({ page }) => { - await page.goto('http://localhost/test/form'); +test.describe('With Javascript', () => { + test('Form type', async ({ page }) => { + await page.goto('http://localhost/test/form'); - // Validate initial content - await expect(page.frameLocator('iframe[title="Rich Text Area"]').getByText('Initial text value')).toBeVisible(); + // Validate initial content + await expect(page.frameLocator('iframe[title="Rich Text Area"]').getByText('Initial text value')).toBeVisible(); - // Validate YAML configuration-provided attribute - await expect(page.getByLabel('Bold')).toBeVisible(); + // Validate YAML configuration-provided attribute + await expect(page.getByLabel('Bold')).toBeVisible(); - // Validate user-provided attribute - await expect(page.locator('button').filter({ hasText: 'Format' })).toBeVisible(); + // Validate user-provided attribute + await expect(page.locator('button').filter({ hasText: 'Format' })).toBeVisible(); - // Update the content and submit the form - await page.frameLocator('iframe[title="Rich Text Area"]').getByLabel('Rich Text Area. Press ALT-0').fill('Initial text value has been updated!'); - await page.getByRole('button', { name: 'Submit' }).click(); + // Update the content and submit the form + await page.frameLocator('iframe[title="Rich Text Area"]').getByLabel('Rich Text Area. Press ALT-0').fill('Initial text value has been updated!'); + await page.getByRole('button', { name: 'Submit' }).click(); - // Validate form data is received correctly - await expect(page.getByText('Initial text value has been updated!')).toBeVisible(); -}); + // Validate form data is received correctly + await expect(page.getByText('Initial text value has been updated!')).toBeVisible(); + }); -test('Template', async ({ page }) => { - await page.goto('http://localhost/test/template'); + test('Template', async ({ page }) => { + await page.goto('http://localhost/test/template'); - // Validate initial content - await expect(page.frameLocator('iframe[title="Rich Text Area"]').getByText('Initial text value')).toBeVisible(); + // Validate initial content + await expect(page.frameLocator('iframe[title="Rich Text Area"]').getByText('Initial text value')).toBeVisible(); - // Validate YAML configuration-provided attribute - await expect(page.getByLabel('Bold')).toBeVisible(); + // Validate YAML configuration-provided attribute + await expect(page.getByLabel('Bold')).toBeVisible(); - // Validate user-provided attribute - await expect(page.locator('button').filter({ hasText: 'Format' })).toBeVisible(); -}); + // Validate user-provided attribute + await expect(page.locator('button').filter({ hasText: 'Format' })).toBeVisible(); + }); -test('Javascript', async ({ page }) => { - await page.goto('http://localhost/test/javascript'); + test('Javascript', async ({ page }) => { + await page.goto('http://localhost/test/javascript'); - // Validate initial content - await expect(page.frameLocator('iframe[title="Rich Text Area"]').getByText('Initial text value')).toBeVisible(); + // Validate initial content + await expect(page.frameLocator('iframe[title="Rich Text Area"]').getByText('Initial text value')).toBeVisible(); - // Validate YAML configuration-provided attribute - await expect(page.getByLabel('Bold')).toBeVisible(); + // Validate YAML configuration-provided attribute + await expect(page.getByLabel('Bold')).toBeVisible(); - // Validate user-provided attribute - await expect(page.locator('button').filter({ hasText: 'Format' })).toBeVisible(); + // Validate user-provided attribute + await expect(page.locator('button').filter({ hasText: 'Format' })).toBeVisible(); + }); });