From 43534502f906682abd82f0ce80c8ffe4e2f94c68 Mon Sep 17 00:00:00 2001 From: Martin Yankov Date: Fri, 28 Jun 2019 10:07:33 +0300 Subject: [PATCH] feat: add background color css to tab strip (#7414) --- .../background-color-page.css | 7 ++ .../background-color-page.xml | 6 +- .../app/bottom-navigation/color-page.xml | 16 ++-- .../app/bottom-navigation/icon-change-page.ts | 2 +- .../bottom-navigation/icon-change-page.xml | 2 +- .../icon-title-placement-page.xml | 6 +- .../app/bottom-navigation/issue-5470-page.xml | 2 +- .../app/tabs/background-color-page.css | 7 ++ .../app/tabs/background-color-page.xml | 22 ++--- e2e/ui-tests-app/app/tabs/color-page.xml | 22 ++--- e2e/ui-tests-app/app/tabs/default-page.ts | 10 +-- e2e/ui-tests-app/app/tabs/default-page.xml | 4 +- e2e/ui-tests-app/app/tabs/icon-change-page.ts | 8 +- .../app/tabs/icon-change-page.xml | 8 +- .../app/tabs/icon-title-placement-page.xml | 30 +++---- e2e/ui-tests-app/app/tabs/issue-5470-page.xml | 8 +- e2e/ui-tests-app/app/tabs/main-page.ts | 14 +-- e2e/ui-tests-app/app/tabs/tabs-page.ts | 17 ++++ e2e/ui-tests-app/app/tabs/tabs-page.xml | 89 +++++++++++++++++++ .../bottom-navigation.android.ts | 30 ++++++- .../bottom-navigation.ios.ts | 13 +++ .../tab-navigation-base.d.ts | 12 +++ .../tab-navigation-base.ts | 17 +++- .../tab-strip/tab-strip.d.ts | 6 +- .../tab-strip/tab-strip.ts | 28 +++++- tns-core-modules/ui/tabs/tabs.android.ts | 25 ++++++ tns-core-modules/ui/tabs/tabs.ios.ts | 11 +++ 27 files changed, 334 insertions(+), 88 deletions(-) create mode 100644 e2e/ui-tests-app/app/bottom-navigation/background-color-page.css create mode 100644 e2e/ui-tests-app/app/tabs/background-color-page.css create mode 100644 e2e/ui-tests-app/app/tabs/tabs-page.ts create mode 100644 e2e/ui-tests-app/app/tabs/tabs-page.xml diff --git a/e2e/ui-tests-app/app/bottom-navigation/background-color-page.css b/e2e/ui-tests-app/app/bottom-navigation/background-color-page.css new file mode 100644 index 000000000..27ce526db --- /dev/null +++ b/e2e/ui-tests-app/app/bottom-navigation/background-color-page.css @@ -0,0 +1,7 @@ +BottomNavigation { + background-color: gold; +} + +TabStrip { + background-color: skyblue; +} \ No newline at end of file diff --git a/e2e/ui-tests-app/app/bottom-navigation/background-color-page.xml b/e2e/ui-tests-app/app/bottom-navigation/background-color-page.xml index a931de491..8c771d54f 100644 --- a/e2e/ui-tests-app/app/bottom-navigation/background-color-page.xml +++ b/e2e/ui-tests-app/app/bottom-navigation/background-color-page.xml @@ -3,7 +3,7 @@ - + @@ -11,13 +11,13 @@ - - diff --git a/e2e/ui-tests-app/app/bottom-navigation/color-page.xml b/e2e/ui-tests-app/app/bottom-navigation/color-page.xml index b174dcfba..ea3ab58d7 100644 --- a/e2e/ui-tests-app/app/bottom-navigation/color-page.xml +++ b/e2e/ui-tests-app/app/bottom-navigation/color-page.xml @@ -4,20 +4,20 @@ - - + + - - + + - - + + \ No newline at end of file diff --git a/e2e/ui-tests-app/app/bottom-navigation/icon-change-page.ts b/e2e/ui-tests-app/app/bottom-navigation/icon-change-page.ts index 5301c28e9..199c5c566 100644 --- a/e2e/ui-tests-app/app/bottom-navigation/icon-change-page.ts +++ b/e2e/ui-tests-app/app/bottom-navigation/icon-change-page.ts @@ -1,7 +1,7 @@ import { BottomNavigation, SelectedIndexChangedEventData } from "tns-core-modules/ui/bottom-navigation"; export function onSelectedIndexChanged(args: SelectedIndexChangedEventData) { - const bottomNav = args.object as BottomNavigation; + const bottomNav = args.object; const newItem = bottomNav.tabStrip.items[args.newIndex]; if (newItem) { diff --git a/e2e/ui-tests-app/app/bottom-navigation/icon-change-page.xml b/e2e/ui-tests-app/app/bottom-navigation/icon-change-page.xml index 4b77e353a..014b9a249 100644 --- a/e2e/ui-tests-app/app/bottom-navigation/icon-change-page.xml +++ b/e2e/ui-tests-app/app/bottom-navigation/icon-change-page.xml @@ -1,4 +1,4 @@ - + diff --git a/e2e/ui-tests-app/app/bottom-navigation/icon-title-placement-page.xml b/e2e/ui-tests-app/app/bottom-navigation/icon-title-placement-page.xml index 36b74e3f0..d3b604304 100644 --- a/e2e/ui-tests-app/app/bottom-navigation/icon-title-placement-page.xml +++ b/e2e/ui-tests-app/app/bottom-navigation/icon-title-placement-page.xml @@ -11,19 +11,19 @@ - - - diff --git a/e2e/ui-tests-app/app/bottom-navigation/issue-5470-page.xml b/e2e/ui-tests-app/app/bottom-navigation/issue-5470-page.xml index c1f8d3785..c5993a4d8 100644 --- a/e2e/ui-tests-app/app/bottom-navigation/issue-5470-page.xml +++ b/e2e/ui-tests-app/app/bottom-navigation/issue-5470-page.xml @@ -23,5 +23,5 @@ - + \ No newline at end of file diff --git a/e2e/ui-tests-app/app/tabs/background-color-page.css b/e2e/ui-tests-app/app/tabs/background-color-page.css new file mode 100644 index 000000000..6c53c0e65 --- /dev/null +++ b/e2e/ui-tests-app/app/tabs/background-color-page.css @@ -0,0 +1,7 @@ +Tabs { + background-color: gold; +} + +TabStrip { + background-color: skyblue; +} \ No newline at end of file diff --git a/e2e/ui-tests-app/app/tabs/background-color-page.xml b/e2e/ui-tests-app/app/tabs/background-color-page.xml index a931de491..12860bc43 100644 --- a/e2e/ui-tests-app/app/tabs/background-color-page.xml +++ b/e2e/ui-tests-app/app/tabs/background-color-page.xml @@ -1,24 +1,24 @@ - + - + - - + + - - + + - - + + - + \ No newline at end of file diff --git a/e2e/ui-tests-app/app/tabs/color-page.xml b/e2e/ui-tests-app/app/tabs/color-page.xml index b174dcfba..a0dfb57aa 100644 --- a/e2e/ui-tests-app/app/tabs/color-page.xml +++ b/e2e/ui-tests-app/app/tabs/color-page.xml @@ -1,23 +1,23 @@ - + - + - - + + - - + + - - + + - + \ No newline at end of file diff --git a/e2e/ui-tests-app/app/tabs/default-page.ts b/e2e/ui-tests-app/app/tabs/default-page.ts index 6ef17fcfa..50e5c8233 100644 --- a/e2e/ui-tests-app/app/tabs/default-page.ts +++ b/e2e/ui-tests-app/app/tabs/default-page.ts @@ -1,17 +1,17 @@ import { EventData } from "tns-core-modules/data/observable"; import { Page } from "tns-core-modules/ui/page"; -import { BottomNavigation } from "tns-core-modules/ui/bottom-navigation"; +import { Tabs } from "tns-core-modules/ui/tabs"; export function goToFirst(args: EventData) { const page = (args.object).page; - const bottomNav = page.getViewById("bottomNav"); + const tabsNav = page.getViewById("tabsNav"); - bottomNav.selectedIndex = 0; + tabsNav.selectedIndex = 0; } export function goToSecond(args: EventData) { const page = (args.object).page; - const bottomNav = page.getViewById("bottomNav"); + const tabsNav = page.getViewById("tabsNav"); - bottomNav.selectedIndex = 1; + tabsNav.selectedIndex = 1; } diff --git a/e2e/ui-tests-app/app/tabs/default-page.xml b/e2e/ui-tests-app/app/tabs/default-page.xml index 260450593..396478113 100644 --- a/e2e/ui-tests-app/app/tabs/default-page.xml +++ b/e2e/ui-tests-app/app/tabs/default-page.xml @@ -1,6 +1,6 @@ - + @@ -18,7 +18,7 @@ --> - + diff --git a/e2e/ui-tests-app/app/tabs/icon-change-page.ts b/e2e/ui-tests-app/app/tabs/icon-change-page.ts index 5301c28e9..1a466d6a6 100644 --- a/e2e/ui-tests-app/app/tabs/icon-change-page.ts +++ b/e2e/ui-tests-app/app/tabs/icon-change-page.ts @@ -1,14 +1,14 @@ -import { BottomNavigation, SelectedIndexChangedEventData } from "tns-core-modules/ui/bottom-navigation"; +import { Tabs, SelectedIndexChangedEventData } from "tns-core-modules/ui/tabs"; export function onSelectedIndexChanged(args: SelectedIndexChangedEventData) { - const bottomNav = args.object as BottomNavigation; + const tabsNav = args.object; - const newItem = bottomNav.tabStrip.items[args.newIndex]; + const newItem = tabsNav.tabStrip.items[args.newIndex]; if (newItem) { newItem.iconSource = "res://icon"; } - const oldItem = bottomNav.tabStrip.items[args.oldIndex]; + const oldItem = tabsNav.tabStrip.items[args.oldIndex]; if (oldItem) { oldItem.iconSource = "res://testlogo"; } diff --git a/e2e/ui-tests-app/app/tabs/icon-change-page.xml b/e2e/ui-tests-app/app/tabs/icon-change-page.xml index 4b77e353a..e6ddb809f 100644 --- a/e2e/ui-tests-app/app/tabs/icon-change-page.xml +++ b/e2e/ui-tests-app/app/tabs/icon-change-page.xml @@ -1,8 +1,8 @@ - - + + - + @@ -19,5 +19,5 @@ + \ No newline at end of file diff --git a/e2e/ui-tests-app/app/tabs/icon-title-placement-page.xml b/e2e/ui-tests-app/app/tabs/icon-title-placement-page.xml index 36b74e3f0..4caed0e7e 100644 --- a/e2e/ui-tests-app/app/tabs/icon-title-placement-page.xml +++ b/e2e/ui-tests-app/app/tabs/icon-title-placement-page.xml @@ -1,30 +1,30 @@ - + - + - - - + + + - - + + - - + + - - + + - + \ No newline at end of file diff --git a/e2e/ui-tests-app/app/tabs/issue-5470-page.xml b/e2e/ui-tests-app/app/tabs/issue-5470-page.xml index c1f8d3785..a47f48d18 100644 --- a/e2e/ui-tests-app/app/tabs/issue-5470-page.xml +++ b/e2e/ui-tests-app/app/tabs/issue-5470-page.xml @@ -1,9 +1,9 @@ - + - + @@ -22,6 +22,6 @@ - - + + \ No newline at end of file diff --git a/e2e/ui-tests-app/app/tabs/main-page.ts b/e2e/ui-tests-app/app/tabs/main-page.ts index d34357eec..b7d492781 100644 --- a/e2e/ui-tests-app/app/tabs/main-page.ts +++ b/e2e/ui-tests-app/app/tabs/main-page.ts @@ -11,14 +11,14 @@ export function pageLoaded(args: EventData) { export function loadExamples() { const examples = new Map(); - examples.set("default", "tabs/default-page"); - examples.set("issue-5470", "tabs/issue-5470-page"); + examples.set("tabs", "tabs/tabs-page"); + examples.set("issue-5470", "tabs/issue-5470"); examples.set("background-color", "tabs/background-color-page"); - examples.set("color", "tabs/color-page"); - examples.set("icon-title-placement", "tabs/icon-title-placement-page"); - examples.set("icon-change", "tabs/icon-change-page"); - examples.set("swipe-enabled", "tabs/swipe-enabled-page"); - examples.set("tabs-position", "tabs/tabs-position-page"); + examples.set("color", "tabs/color"); + examples.set("icon-title-placement", "tabs/icon-title-placement"); + examples.set("icon-change", "tabs/icon-change"); + examples.set("swipe-enabled", "tabs/swipe-enabled"); + examples.set("tabs-position", "tabs/tabs-position"); return examples; } diff --git a/e2e/ui-tests-app/app/tabs/tabs-page.ts b/e2e/ui-tests-app/app/tabs/tabs-page.ts new file mode 100644 index 000000000..50e5c8233 --- /dev/null +++ b/e2e/ui-tests-app/app/tabs/tabs-page.ts @@ -0,0 +1,17 @@ +import { EventData } from "tns-core-modules/data/observable"; +import { Page } from "tns-core-modules/ui/page"; +import { Tabs } from "tns-core-modules/ui/tabs"; + +export function goToFirst(args: EventData) { + const page = (args.object).page; + const tabsNav = page.getViewById("tabsNav"); + + tabsNav.selectedIndex = 0; +} + +export function goToSecond(args: EventData) { + const page = (args.object).page; + const tabsNav = page.getViewById("tabsNav"); + + tabsNav.selectedIndex = 1; +} diff --git a/e2e/ui-tests-app/app/tabs/tabs-page.xml b/e2e/ui-tests-app/app/tabs/tabs-page.xml new file mode 100644 index 000000000..396478113 --- /dev/null +++ b/e2e/ui-tests-app/app/tabs/tabs-page.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + +