mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix: tab navigations don't work with lowercase xml (#8016)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"main": "app.js",
|
||||
"android": {
|
||||
"v8Flags": "--expose_gc"
|
||||
"v8Flags": "--expose_gc",
|
||||
"markingMode": "none"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,6 +199,9 @@ allTests["LABEL"] = labelTests;
|
||||
import * as bottomNavigationTests from "./ui/bottom-navigation/bottom-navigation-tests";
|
||||
allTests["BOTTOM-NAVIGATION"] = bottomNavigationTests;
|
||||
|
||||
import * as bottomNavigationTestsNew from "./ui/bottom-navigation/bottom-navigation-tests-new";
|
||||
allTests["BOTTOM-NAVIGATION-NEW"] = bottomNavigationTestsNew;
|
||||
|
||||
import * as bottomNavigationNavigationTests from "./ui/bottom-navigation/bottom-navigation-navigation-tests";
|
||||
// TODO: uncomment this
|
||||
// allTests["BOTTOM-NAVIGATION-NAVIGATION"] = bottomNavigationNavigationTests;
|
||||
@@ -206,12 +209,18 @@ import * as bottomNavigationNavigationTests from "./ui/bottom-navigation/bottom-
|
||||
import * as tabsTests from "./ui/tabs/tabs-tests";
|
||||
allTests["TABS"] = tabsTests;
|
||||
|
||||
import * as tabsTestsNew from "./ui/tabs/tabs-tests-new";
|
||||
allTests["TABS-NEW"] = tabsTestsNew;
|
||||
|
||||
import * as tabsNavigationTests from "./ui/tabs/tabs-navigation-tests";
|
||||
allTests["TABS-NAVIGATION"] = tabsNavigationTests;
|
||||
|
||||
import * as tabViewTests from "./ui/tab-view/tab-view-tests";
|
||||
allTests["TAB-VIEW"] = tabViewTests;
|
||||
|
||||
import * as tabViewTestsNew from "./ui/tab-view/tab-view-tests-new";
|
||||
allTests["TAB-VIEW-NEW"] = tabViewTestsNew;
|
||||
|
||||
import * as tabViewNavigationTests from "./ui/tab-view/tab-view-navigation-tests";
|
||||
allTests["TAB-VIEW-NAVIGATION"] = tabViewNavigationTests;
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Image, Label, BottomNavigation, Builder, TabContentItem, TabStrip, TabStripItem } from "@nativescript/core/ui";
|
||||
import * as TKUnit from "../../tk-unit";
|
||||
|
||||
export function test_lowercase_declaration() {
|
||||
const root = Builder.parse(`
|
||||
<bottom-navigation>
|
||||
<tab-strip id="tab-strip">
|
||||
<tab-strip-item id="tab-strip-item">
|
||||
<image src="res://icon" id="tab-strip-item-image" />
|
||||
<label text="test" id="tab-strip-item-label" />
|
||||
</tab-strip-item>
|
||||
</tab-strip>
|
||||
<tab-content-item id="tab-content-item">
|
||||
<label text="test" id="tab-content-item-label" />
|
||||
</tab-content-item>
|
||||
</bottom-navigation>
|
||||
`);
|
||||
|
||||
const tabStrip = root.getViewById("tab-strip");
|
||||
const tabStripItem = root.getViewById("tab-strip-item");
|
||||
const tabStripItemImage = root.getViewById("tab-strip-item-image");
|
||||
const tabStripItemLabel = root.getViewById("tab-strip-item-label");
|
||||
const tabContentItem = root.getViewById("tab-content-item");
|
||||
const tabContentItemLabel = root.getViewById("tab-content-item-label");
|
||||
|
||||
TKUnit.assert(root instanceof BottomNavigation, "Expected result: BottomNavigation!; Actual result: " + root);
|
||||
TKUnit.assert(tabStrip instanceof TabStrip, "Expected result: TabStrip!; Actual result: " + tabStrip);
|
||||
TKUnit.assert(tabStripItem instanceof TabStripItem, "Expected result: TabStripItem!; Actual result: " + tabStripItem);
|
||||
TKUnit.assert(tabStripItemImage instanceof Image, "Expected result: Image!; Actual result: " + tabStripItemImage);
|
||||
TKUnit.assert(tabStripItemLabel instanceof Label, "Expected result: Label!; Actual result: " + tabStripItemLabel);
|
||||
TKUnit.assert(tabContentItem instanceof TabContentItem, "Expected result: TabContentItem!; Actual result: " + tabContentItem);
|
||||
TKUnit.assert(tabContentItemLabel instanceof Label, "Expected result: Label!; Actual result: " + tabContentItemLabel);
|
||||
}
|
||||
19
tests/app/ui/tab-view/tab-view-tests-new.ts
Normal file
19
tests/app/ui/tab-view/tab-view-tests-new.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Label, Builder, TabView, TabViewItem } from "@nativescript/core/ui";
|
||||
import * as TKUnit from "../../tk-unit";
|
||||
|
||||
export function test_lowercase_declaration() {
|
||||
const root = Builder.parse(`
|
||||
<tab-view>
|
||||
<tab-view-item id="tab-view-item">
|
||||
<label text="test" id="tab-view-item-label" />
|
||||
</tab-view-item>
|
||||
</tab-view>
|
||||
`);
|
||||
|
||||
const tabViewItem = root.getViewById("tab-view-item");
|
||||
const tabViewItemLabel = root.getViewById("tab-view-item-label");
|
||||
|
||||
TKUnit.assert(root instanceof TabView, "Expected result: TabView!; Actual result: " + root);
|
||||
TKUnit.assert(tabViewItem instanceof TabViewItem, "Expected result: TabViewItem!; Actual result: " + tabViewItem);
|
||||
TKUnit.assert(tabViewItemLabel instanceof Label, "Expected result: Label!; Actual result: " + tabViewItemLabel);
|
||||
}
|
||||
33
tests/app/ui/tabs/tabs-tests-new.ts
Normal file
33
tests/app/ui/tabs/tabs-tests-new.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Image, Label, Builder, TabContentItem, Tabs, TabStrip, TabStripItem } from "@nativescript/core/ui";
|
||||
import * as TKUnit from "../../tk-unit";
|
||||
|
||||
export function test_lowercase_declaration() {
|
||||
const root = Builder.parse(`
|
||||
<tabs>
|
||||
<tab-strip id="tab-strip">
|
||||
<tab-strip-item id="tab-strip-item">
|
||||
<image src="res://icon" id="tab-strip-item-image" />
|
||||
<label text="test" id="tab-strip-item-label" />
|
||||
</tab-strip-item>
|
||||
</tab-strip>
|
||||
<tab-content-item id="tab-content-item">
|
||||
<label text="test" id="tab-content-item-label" />
|
||||
</tab-content-item>
|
||||
</tabs>
|
||||
`);
|
||||
|
||||
const tabStrip = root.getViewById("tab-strip");
|
||||
const tabStripItem = root.getViewById("tab-strip-item");
|
||||
const tabStripItemImage = root.getViewById("tab-strip-item-image");
|
||||
const tabStripItemLabel = root.getViewById("tab-strip-item-label");
|
||||
const tabContentItem = root.getViewById("tab-content-item");
|
||||
const tabContentItemLabel = root.getViewById("tab-content-item-label");
|
||||
|
||||
TKUnit.assert(root instanceof Tabs, "Expected result: Tabs!; Actual result: " + root);
|
||||
TKUnit.assert(tabStrip instanceof TabStrip, "Expected result: TabStrip!; Actual result: " + tabStrip);
|
||||
TKUnit.assert(tabStripItem instanceof TabStripItem, "Expected result: TabStripItem!; Actual result: " + tabStripItem);
|
||||
TKUnit.assert(tabStripItemImage instanceof Image, "Expected result: Image!; Actual result: " + tabStripItemImage);
|
||||
TKUnit.assert(tabStripItemLabel instanceof Label, "Expected result: Label!; Actual result: " + tabStripItemLabel);
|
||||
TKUnit.assert(tabContentItem instanceof TabContentItem, "Expected result: TabContentItem!; Actual result: " + tabContentItem);
|
||||
TKUnit.assert(tabContentItemLabel instanceof Label, "Expected result: Label!; Actual result: " + tabContentItemLabel);
|
||||
}
|
||||
Reference in New Issue
Block a user