mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge branch 'release'
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
.font-awesome {
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.font-size {
|
||||
font-size: 36;
|
||||
}
|
||||
|
||||
TabStripItem:active {
|
||||
background-color: magenta;
|
||||
}
|
||||
|
||||
.tabsClass0 {
|
||||
}
|
||||
|
||||
.tabsClass1 {
|
||||
background-color: #79d2a6;
|
||||
highlight-color: green;
|
||||
selected-item-color: yellow;
|
||||
un-selected-item-color: blue;
|
||||
}
|
||||
|
||||
.tabsClass2 {
|
||||
background-color: orangered;
|
||||
highlight-color: lightgreen;
|
||||
selected-item-color: whitesmoke;
|
||||
un-selected-item-color: pink;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { View } from "tns-core-modules/ui/core/view";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
import { BottomNavigation } from "tns-core-modules/ui/bottom-navigation";
|
||||
|
||||
export function onButtonTap(args) {
|
||||
const page = <Page>(<View>args.object).page;
|
||||
const bottomNavigation = <BottomNavigation>(page.getViewById("bottomNavigation"));
|
||||
|
||||
switch (bottomNavigation.tabStrip.className) {
|
||||
case "tabsClass0":
|
||||
bottomNavigation.tabStrip.className = "tabsClass1";
|
||||
break;
|
||||
case "tabsClass1":
|
||||
bottomNavigation.tabStrip.className = "tabsClass2";
|
||||
break;
|
||||
case "tabsClass2":
|
||||
bottomNavigation.tabStrip.className = "tabsClass0";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
export function onChangeIconSourceTap(args) {
|
||||
const page = <Page>(<View>args.object).page;
|
||||
const bottomNavigation = <BottomNavigation>(page.getViewById("bottomNavigation"));
|
||||
|
||||
const tabStripItem0 = bottomNavigation.tabStrip.items[0];
|
||||
const tabStripItem1 = bottomNavigation.tabStrip.items[1];
|
||||
const tabStripItem2 = bottomNavigation.tabStrip.items[2];
|
||||
|
||||
const iconSource0 = tabStripItem0.iconSource;
|
||||
|
||||
tabStripItem0.iconSource = tabStripItem1.iconSource;
|
||||
|
||||
tabStripItem1.iconClass = "font-awesome font-size";
|
||||
tabStripItem1.iconSource = tabStripItem2.iconSource;
|
||||
|
||||
tabStripItem2.iconClass = "font-awesome font-size";
|
||||
tabStripItem2.iconSource = iconSource0;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
|
||||
<GridLayout rows="auto,*">
|
||||
<StackLayout row="0" >
|
||||
<Button text="Change TabStrip styles dynamically" id="changeStyle" automationText="changeStyle" tap="onButtonTap" />
|
||||
<Button text="Change Icon source dynamically" id="changeIconSource" automationText="changeIconSource" tap="onChangeIconSourceTap" />
|
||||
</StackLayout>
|
||||
<GridLayout row="1">
|
||||
<BottomNavigation automationText="tabNavigation" id="bottomNavigation" >
|
||||
<TabStrip class="tabsClass0">
|
||||
<TabStripItem>
|
||||
<Label text="Home"></Label>
|
||||
<Image src="font://" class="font-awesome font-size"></Image>
|
||||
</TabStripItem>
|
||||
<TabStripItem>
|
||||
<Label text="Favorites"></Label>
|
||||
<Image src="res://add_to_fav"></Image>
|
||||
</TabStripItem>
|
||||
<TabStripItem>
|
||||
<Label text="Up"></Label>
|
||||
<Image src="res://up"></Image>
|
||||
</TabStripItem>
|
||||
</TabStrip>
|
||||
<TabContentItem>
|
||||
<GridLayout>
|
||||
<Label text="Home Page" class="h2 text-center">
|
||||
</Label>
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
<TabContentItem>
|
||||
<GridLayout>
|
||||
<Label text="Favorites Page" class="h2 text-center">
|
||||
</Label>
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
<TabContentItem>
|
||||
<GridLayout>
|
||||
<Label text="Up Page" class="h2 text-center">
|
||||
</Label>
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
</BottomNavigation>
|
||||
</GridLayout>
|
||||
</GridLayout>
|
||||
</Page>
|
||||
@@ -27,6 +27,7 @@ export function loadExamples() {
|
||||
examples.set("custom-tabstrip", "bottom-navigation/custom-tabstrip-page");
|
||||
examples.set("reselect", "bottom-navigation/reselect-page");
|
||||
examples.set("item-color", "bottom-navigation/item-color-page");
|
||||
examples.set("dynamic-color-change", "bottom-navigation/dynamic-color-change-page");
|
||||
|
||||
return examples;
|
||||
}
|
||||
|
||||
28
e2e/ui-tests-app/app/tabs/dynamic-color-change-page.css
Normal file
28
e2e/ui-tests-app/app/tabs/dynamic-color-change-page.css
Normal file
@@ -0,0 +1,28 @@
|
||||
.font-awesome {
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.font-size {
|
||||
font-size: 36;
|
||||
}
|
||||
|
||||
TabStripItem:active {
|
||||
background-color: magenta;
|
||||
}
|
||||
|
||||
.tabsClass0 {
|
||||
}
|
||||
|
||||
.tabsClass1 {
|
||||
background-color: #79d2a6;
|
||||
highlight-color: green;
|
||||
selected-item-color: yellow;
|
||||
un-selected-item-color: blue;
|
||||
}
|
||||
|
||||
.tabsClass2 {
|
||||
background-color: orangered;
|
||||
highlight-color: lightgreen;
|
||||
selected-item-color: whitesmoke;
|
||||
un-selected-item-color: pink;
|
||||
}
|
||||
39
e2e/ui-tests-app/app/tabs/dynamic-color-change-page.ts
Normal file
39
e2e/ui-tests-app/app/tabs/dynamic-color-change-page.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { View } from "tns-core-modules/ui/core/view";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
import { Tabs } from "tns-core-modules/ui/tabs";
|
||||
|
||||
export function onButtonTap(args) {
|
||||
const page = <Page>(<View>args.object).page;
|
||||
const tabs = <Tabs>(page.getViewById("tabs"));
|
||||
|
||||
switch (tabs.tabStrip.className) {
|
||||
case "tabsClass0":
|
||||
tabs.tabStrip.className = "tabsClass1";
|
||||
break;
|
||||
case "tabsClass1":
|
||||
tabs.tabStrip.className = "tabsClass2";
|
||||
break;
|
||||
case "tabsClass2":
|
||||
tabs.tabStrip.className = "tabsClass0";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
export function onChangeIconSourceTap(args) {
|
||||
const page = <Page>(<View>args.object).page;
|
||||
const tabs = <Tabs>(page.getViewById("tabs"));
|
||||
|
||||
const tabStripItem0 = tabs.tabStrip.items[0];
|
||||
const tabStripItem1 = tabs.tabStrip.items[1];
|
||||
const tabStripItem2 = tabs.tabStrip.items[2];
|
||||
|
||||
const iconSource0 = tabStripItem0.iconSource;
|
||||
|
||||
tabStripItem0.iconSource = tabStripItem1.iconSource;
|
||||
|
||||
tabStripItem1.iconClass = "font-awesome font-size";
|
||||
tabStripItem1.iconSource = tabStripItem2.iconSource;
|
||||
|
||||
tabStripItem2.iconClass = "font-awesome font-size";
|
||||
tabStripItem2.iconSource = iconSource0;
|
||||
}
|
||||
44
e2e/ui-tests-app/app/tabs/dynamic-color-change-page.xml
Normal file
44
e2e/ui-tests-app/app/tabs/dynamic-color-change-page.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
|
||||
<GridLayout rows="auto,*">
|
||||
<StackLayout row="0" >
|
||||
<Button text="Change TabStrip styles dynamically" id="changeStyle" automationText="changeStyle" tap="onButtonTap" />
|
||||
<Button text="Change Icon source dynamically" id="changeIconSource" automationText="changeIconSource" tap="onChangeIconSourceTap" />
|
||||
</StackLayout>
|
||||
<GridLayout row="1">
|
||||
<Tabs automationText="tabNavigation" id="tabs" >
|
||||
<TabStrip class="tabsClass0">
|
||||
<TabStripItem>
|
||||
<Label text="Home"></Label>
|
||||
<Image src="font://" class="font-awesome font-size"></Image>
|
||||
</TabStripItem>
|
||||
<TabStripItem>
|
||||
<Label text="Favorites"></Label>
|
||||
<Image src="res://add_to_fav"></Image>
|
||||
</TabStripItem>
|
||||
<TabStripItem>
|
||||
<Label text="Up"></Label>
|
||||
<Image src="res://up"></Image>
|
||||
</TabStripItem>
|
||||
</TabStrip>
|
||||
<TabContentItem>
|
||||
<GridLayout>
|
||||
<Label text="Home Page" class="h2 text-center">
|
||||
</Label>
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
<TabContentItem>
|
||||
<GridLayout>
|
||||
<Label text="Favorites Page" class="h2 text-center">
|
||||
</Label>
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
<TabContentItem>
|
||||
<GridLayout>
|
||||
<Label text="Up Page" class="h2 text-center">
|
||||
</Label>
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
</Tabs>
|
||||
</GridLayout>
|
||||
</GridLayout>
|
||||
</Page>
|
||||
@@ -34,6 +34,7 @@ export function loadExamples() {
|
||||
examples.set("custom-tabstrip", "tabs/custom-tabstrip-page");
|
||||
examples.set("frame-in-tabs", "tabs/frame-in-tabs");
|
||||
examples.set("item-color", "tabs/item-color-page");
|
||||
examples.set("dynamic-color-change", "tabs/dynamic-color-change-page");
|
||||
|
||||
return examples;
|
||||
}
|
||||
|
||||
@@ -319,4 +319,53 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
|
||||
await bottomNavigationBasePage.navigateBackToSuitMainPage();
|
||||
});
|
||||
|
||||
it(`${spec}-dynamic-color-change`, async function () {
|
||||
await bottomNavigationBasePage.navigateToSample("dynamic-color-change");
|
||||
await bottomNavigationBasePage.refreshTabItems();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
// go through the tabs and check that they are loaded
|
||||
await bottomNavigationBasePage.tabOnItem(1);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await bottomNavigationBasePage.tabOnItem(2);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await bottomNavigationBasePage.tabOnItem(0);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
// change icon sources and check the result
|
||||
const changeIconSource = await driver.waitForElement("changeIconSource");
|
||||
await changeIconSource.click();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
const changeStyleBtn = await driver.waitForElement("changeStyle");
|
||||
await changeStyleBtn.click();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
// change icon sources again
|
||||
await changeIconSource.click();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await bottomNavigationBasePage.tabOnItem(1);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
// change style again
|
||||
await changeStyleBtn.click();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await bottomNavigationBasePage.tabOnItem(2);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await changeIconSource.click();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
// change style again
|
||||
await changeStyleBtn.click();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
|
||||
await bottomNavigationBasePage.navigateBackToSuitMainPage();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -318,4 +318,53 @@ describe(`${imagePrefix}-suite`, async function () {
|
||||
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
|
||||
await tabsViewBasePage.navigateBackToSuitMainPage();
|
||||
});
|
||||
|
||||
it(`${spec}-dynamic-color-change`, async function () {
|
||||
await tabsViewBasePage.navigateToSample("dynamic-color-change");
|
||||
await tabsViewBasePage.refreshTabItems();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
// go through the tabs and check that they are loaded
|
||||
await tabsViewBasePage.tabOnItem(1);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await tabsViewBasePage.tabOnItem(2);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await tabsViewBasePage.tabOnItem(0);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
// change icon sources and check the result
|
||||
const changeIconSource = await driver.waitForElement("changeIconSource");
|
||||
await changeIconSource.click();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
const changeStyleBtn = await driver.waitForElement("changeStyle");
|
||||
await changeStyleBtn.click();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
// change icon sources again
|
||||
await changeIconSource.click();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await tabsViewBasePage.tabOnItem(1);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
// change style again
|
||||
await changeStyleBtn.click();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await tabsViewBasePage.tabOnItem(2);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await changeIconSource.click();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
// change style again
|
||||
await changeStyleBtn.click();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
|
||||
await tabsViewBasePage.navigateBackToSuitMainPage();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user