mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-23 09:01:10 +08:00

* feat(bundle): support for file qualifiers in builder * chore: add qualifiers test app * chore: add @Deprecated for file-name-resolver * fix(hmr): hmr not working for scss files * chore: globals clean-up * shore: fix tslint * tests: uncomment test fixed by ns-dev-webpack * chore: move qualifiers app to e2e * chore: update webpack config * chore: tslint errors * test: fix wrong css import
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { createViewFromEntry } from "tns-core-modules/ui/builder";
|
|
import { assertEqual, assertNull, assertThrows } from "../../tk-unit";
|
|
|
|
const COMPONENT_MODULE = "ui/builder/component-module";
|
|
const MISSING_MODULE = "ui/builder/missing-module";
|
|
const labelId = "label";
|
|
|
|
function getViewComponent(moduleName: string) {
|
|
return createViewFromEntry({ moduleName });
|
|
}
|
|
|
|
export function test_view_is_module_root_component() {
|
|
const view = getViewComponent(COMPONENT_MODULE);
|
|
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(COMPONENT_MODULE);
|
|
const nestedView = view.getViewById(`${labelId}`);
|
|
const undefinedModule = nestedView._moduleName;
|
|
assertNull(undefinedModule, `View<${nestedView}> should NOT be a root component of a module.`);
|
|
}
|
|
|
|
export function test_load_component_from_missing_module_throws() {
|
|
assertThrows(() => getViewComponent(MISSING_MODULE),
|
|
"Loading component from a missing module SHOULD throw an error.");
|
|
}
|