mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Add source information in the xml builder, print source file as part for veiw.toString
This commit is contained in:
5
apps/tests/xml-declaration/examples/test-page.xml
Normal file
5
apps/tests/xml-declaration/examples/test-page.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
|
||||
<GridLayout id="grid">
|
||||
<Label id="label" text="Text" />
|
||||
</GridLayout>
|
||||
</Page>
|
||||
@@ -24,6 +24,7 @@ import viewModule = require("ui/core/view");
|
||||
import platform = require("platform");
|
||||
import gesturesModule = require("ui/gestures");
|
||||
import segmentedBar = require("ui/segmented-bar");
|
||||
import { Source } from "utils/debug";
|
||||
|
||||
export function test_load_IsDefined() {
|
||||
TKUnit.assert(types.isFunction(builder.load), "ui/builder should have load method!");
|
||||
@@ -974,3 +975,14 @@ export function test_TabViewHasCorrectParentChain() {
|
||||
model.set("testPassed", false);
|
||||
helper.navigateToModuleAndRunTest(("." + moduleName + "/mymodulewithxml/TabViewParentChain"), model, testFunc);
|
||||
}
|
||||
|
||||
export function test_hasSourceCodeLocations() {
|
||||
var basePath = "xml-declaration/";
|
||||
var page = <Page>builder.load(__dirname + "/examples/test-page.xml");
|
||||
var grid = page.getViewById("grid");
|
||||
var gridSource = Source.get(grid);
|
||||
TKUnit.assertEqual(gridSource.toString(), "file:///app/" + basePath + "examples/test-page.xml:2:3");
|
||||
var label = page.getViewById("label");
|
||||
var labelSource = Source.get(label);
|
||||
TKUnit.assertEqual(labelSource.toString(), "file:///app/" + basePath + "examples/test-page.xml:3:5");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user