Skip to content

Commit bf777ce

Browse files
committed
#7283 minor cleanup
1 parent 7aa9061 commit bf777ce

1 file changed

Lines changed: 25 additions & 21 deletions

File tree

test/playwright/unit/functional/HtmlTemplateComponent.spec.mjs

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
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';
1418

1519
Neo.vdom.Helper = VdomHelper;
1620

17-
// Create a mock application context, as the component lifecycle requires it for updates.
1821
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-
};
2622

2723
/**
2824
* @class TestComponent
@@ -94,6 +90,14 @@ class TestConditionalComponent extends FunctionalBase {
9490
TestConditionalComponent = Neo.setupClass(TestConditionalComponent);
9591

9692

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+
*/
97101
test.describe('functional/HtmlTemplateComponent', () => {
98102
let component;
99103

0 commit comments

Comments
 (0)