|
1 | | -import {test, expect} from '@playwright/test'; |
2 | | -import Neo from '../../../../src/Neo.mjs'; |
3 | | -Neo.config.environment = 'development'; |
4 | | -import FunctionalBase from '../../../../src/functional/component/Base.mjs'; |
5 | | -import VdomHelper from '../../../../src/vdom/Helper.mjs'; |
6 | | -import {html} from '../../../../src/functional/util/html.mjs'; |
7 | | - |
8 | | -// IMPORTANT: This test file uses real components and expects them to render. |
9 | | -// We need to enable unitTestMode for isolation, but also allow VDOM updates. |
10 | | -Neo.config.unitTestMode = true; |
11 | | -Neo.config.allowVdomUpdatesInTests = true; |
12 | | -// This ensures that the VdomHelper uses the correct renderer for the assertions. |
13 | | -Neo.config.useDomApiRenderer = true; |
| 1 | +import { setup } from '../../setup.mjs'; |
| 2 | + |
| 3 | +setup({ |
| 4 | + appConfig: { |
| 5 | + name: 'HtmlTemplateTest' |
| 6 | + }, |
| 7 | + neoConfig: { |
| 8 | + allowVdomUpdatesInTests: true, |
| 9 | + useDomApiRenderer : true |
| 10 | + } |
| 11 | +}); |
| 12 | + |
| 13 | +import {test, expect} from '@playwright/test'; |
| 14 | +import Neo from '../../../../src/Neo.mjs'; |
| 15 | +import FunctionalBase from '../../../../src/functional/component/Base.mjs'; |
| 16 | +import VdomHelper from '../../../../src/vdom/Helper.mjs'; |
| 17 | +import {html} from '../../../../src/functional/util/html.mjs'; |
14 | 18 |
|
15 | 19 | Neo.vdom.Helper = VdomHelper; |
16 | 20 |
|
17 | | -// Create a mock application context, as the component lifecycle requires it for updates. |
18 | 21 | const appName = 'HtmlTemplateTest'; |
19 | | -Neo.apps = Neo.apps || {}; |
20 | | -Neo.apps[appName] = { |
21 | | - name : appName, |
22 | | - fire : Neo.emptyFn, |
23 | | - isMounted : () => true, |
24 | | - vnodeInitialising: false |
25 | | -}; |
26 | 22 |
|
27 | 23 | /** |
28 | 24 | * @class TestComponent |
@@ -94,6 +90,14 @@ class TestConditionalComponent extends FunctionalBase { |
94 | 90 | TestConditionalComponent = Neo.setupClass(TestConditionalComponent); |
95 | 91 |
|
96 | 92 |
|
| 93 | +/** |
| 94 | + * @summary Verifies the functionality of functional components using html-tagged template literals. |
| 95 | + * |
| 96 | + * This test suite ensures that functional components with `enableHtmlTemplates: true` |
| 97 | + * can correctly parse an `html` template literal in their `render()` method to create a VDOM structure. |
| 98 | + * It validates initial rendering, reactive updates from config changes, support for nested components |
| 99 | + * within a template, and proper handling of conditional rendering logic. |
| 100 | + */ |
97 | 101 | test.describe('functional/HtmlTemplateComponent', () => { |
98 | 102 | let component; |
99 | 103 |
|
|
0 commit comments