mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 05:18:39 +08:00

* feat(HMR): style view at runtime test: module root view component test: update livesync tests refactor: _onLivesync function * style: remove a comment * refactor: rename the property
27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
import { path } from "tns-core-modules/file-system";
|
|
import { loadPage } from "tns-core-modules/ui/builder";
|
|
import { assertEqual, assertNull } from "../../TKUnit";
|
|
|
|
const COMPONENT_MODULE = "component-module";
|
|
const LABEL = "label";
|
|
|
|
function getViewComponent() {
|
|
const moduleNamePath = path.join(__dirname, COMPONENT_MODULE);
|
|
const fileName = path.join(__dirname, `${COMPONENT_MODULE}.xml`);
|
|
const view = loadPage(moduleNamePath, fileName);
|
|
return view;
|
|
}
|
|
|
|
export function test_view_is_module_root_component() {
|
|
const view = getViewComponent();
|
|
const actualModule = view._moduleName;
|
|
assertEqual(actualModule, COMPONENT_MODULE, `View<${view}> is NOT root component of module <${COMPONENT_MODULE}>.`);
|
|
}
|
|
|
|
export function test_view_is_NOT_module_root_component() {
|
|
const view = getViewComponent();
|
|
const nestedView = view.getViewById(`${LABEL}`);
|
|
const undefinedModule = nestedView._moduleName;
|
|
assertNull(undefinedModule, `View<${nestedView}> should NOT be a root component of a module.`);
|
|
}
|