mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor(builder): handle modules with "/" or "~/" (#7418)
This commit is contained in:
committed by
Manol Donev
parent
4437cd622b
commit
8851835cb1
@@ -1,5 +1,5 @@
|
||||
import { createViewFromEntry } from "tns-core-modules/ui/builder";
|
||||
import { assertEqual, assertNull, assertThrows } from "../../tk-unit";
|
||||
import { assertEqual, assertNull, assertThrows, assertNotNull } from "../../tk-unit";
|
||||
|
||||
const COMPONENT_MODULE = "ui/builder/component-module";
|
||||
const MISSING_MODULE = "ui/builder/missing-module";
|
||||
@@ -22,7 +22,17 @@ export function test_view_is_NOT_module_root_component() {
|
||||
assertNull(undefinedModule, `View<${nestedView}> should NOT be a root component of a module.`);
|
||||
}
|
||||
|
||||
export function test_load_component_from_missing_module_throws() {
|
||||
export function test_create_view_from_entry_from_missing_module_throws() {
|
||||
assertThrows(() => getViewComponent(MISSING_MODULE),
|
||||
"Loading component from a missing module SHOULD throw an error.");
|
||||
}
|
||||
|
||||
export function test_create_view_from_entry_with_path_with_slash() {
|
||||
const view = getViewComponent("/" + COMPONENT_MODULE);
|
||||
assertNotNull(view, `Module starting with "/" could not be loaded`);
|
||||
}
|
||||
|
||||
export function test_create_view_from_entry_with_path_with_tilde() {
|
||||
const view = getViewComponent("~/" + COMPONENT_MODULE);
|
||||
assertNotNull(view, `Module starting with "~/" could not be loaded`);
|
||||
}
|
||||
Reference in New Issue
Block a user