mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
Merge branch 'master' into remove-tns-core-modules-mentions
This commit is contained in:
13
CHANGELOG.md
13
CHANGELOG.md
@ -1,3 +1,16 @@
|
||||
## [6.2.2](https://github.com/NativeScript/NativeScript/compare/6.2.1...6.2.2) (2019-11-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **android:** Fatal Exception: java.lang.OutOfMemoryError ([#8061](https://github.com/NativeScript/NativeScript/issues/8061)) ([#8098](https://github.com/NativeScript/NativeScript/issues/8098)) ([bca1271](https://github.com/NativeScript/NativeScript/commit/bca1271))
|
||||
* **frame:** nested frame wrong background after parent navigation ([#8095](https://github.com/NativeScript/NativeScript/issues/8095)) ([d983f79](https://github.com/NativeScript/NativeScript/commit/d983f79))
|
||||
* tab navigations don't work with lowercase xml ([#8016](https://github.com/NativeScript/NativeScript/issues/8016)) ([800f5bc](https://github.com/NativeScript/NativeScript/commit/800f5bc))
|
||||
* **frame:** push recreated frame back in frameStack when Don't Keep Activities enabled ([#8096](https://github.com/NativeScript/NativeScript/issues/8096)) ([47f4c25](https://github.com/NativeScript/NativeScript/commit/47f4c25))
|
||||
* **iOS:** check for iOS 13 APIs ([#8093](https://github.com/NativeScript/NativeScript/issues/8093)) ([b069ff3](https://github.com/NativeScript/NativeScript/commit/b069ff3))
|
||||
|
||||
|
||||
|
||||
<a name="6.2.1"></a>
|
||||
## [6.2.1](https://github.com/NativeScript/NativeScript/compare/6.2.0...6.2.1) (2019-11-12)
|
||||
|
||||
|
@ -93,7 +93,7 @@ class CADisplayLinkTarget extends NSObject {
|
||||
/* tslint:disable */
|
||||
export class iOSApplication implements iOSApplicationDefinition {
|
||||
/* tslint:enable */
|
||||
private _backgroundColor = majorVersion <= 12 ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
||||
private _backgroundColor = (majorVersion <= 12 || !UIColor.systemBackgroundColor) ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
||||
private _delegate: typeof UIApplicationDelegate;
|
||||
private _window: UIWindow;
|
||||
private _observers: Array<NotificationObserver>;
|
||||
@ -125,7 +125,6 @@ export class iOSApplication implements iOSApplicationDefinition {
|
||||
}
|
||||
|
||||
get systemAppearance(): "light" | "dark" | null {
|
||||
|
||||
// userInterfaceStyle is available on UITraitCollection since iOS 12.
|
||||
if (majorVersion <= 11) {
|
||||
return null;
|
||||
|
@ -9,7 +9,7 @@ const majorVersion = ios.MajorVersion;
|
||||
export class ActivityIndicator extends ActivityIndicatorBase {
|
||||
nativeViewProtected: UIActivityIndicatorView;
|
||||
|
||||
private _activityIndicatorViewStyle = majorVersion <= 12 ? UIActivityIndicatorViewStyle.Gray : UIActivityIndicatorViewStyle.Medium;
|
||||
private _activityIndicatorViewStyle = (majorVersion <= 12 || !UIActivityIndicatorViewStyle.Medium) ? UIActivityIndicatorViewStyle.Gray : UIActivityIndicatorViewStyle.Medium;
|
||||
|
||||
createNativeView() {
|
||||
const viewStyle = this._activityIndicatorViewStyle;
|
||||
|
@ -93,7 +93,9 @@ class UITabBarControllerImpl extends UITabBarController {
|
||||
|
||||
if (majorVersion >= 13) {
|
||||
const owner = this._owner.get();
|
||||
if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
if (owner &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: iosView.traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
|
@ -312,7 +312,9 @@ export namespace ios {
|
||||
|
||||
if (majorVersion >= 13) {
|
||||
const owner = this.owner.get();
|
||||
if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
if (owner &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
|
@ -205,11 +205,11 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
||||
traceWrite(`NAVIGATE`, traceCategories.Navigation);
|
||||
}
|
||||
|
||||
this._pushInFrameStack();
|
||||
|
||||
const entry = buildEntryFromArgs(param);
|
||||
const page = Builder.createViewFromEntry(entry) as Page;
|
||||
|
||||
this._pushInFrameStack();
|
||||
|
||||
const backstackEntry: BackstackEntry = {
|
||||
entry: entry,
|
||||
resolvedPage: page,
|
||||
|
@ -11,7 +11,7 @@ import * as application from "../../application";
|
||||
|
||||
import {
|
||||
_stack, FrameBase, NavigationType, Observable,
|
||||
traceCategories, traceEnabled, traceError, traceWrite, View
|
||||
traceCategories, traceEnabled, traceError, traceWrite, View, Color
|
||||
} from "./frame-common";
|
||||
|
||||
import {
|
||||
@ -88,6 +88,7 @@ function getAttachListener(): android.view.View.OnAttachStateChangeListener {
|
||||
}
|
||||
|
||||
export class Frame extends FrameBase {
|
||||
public _originalBackground: any;
|
||||
private _android: AndroidFrame;
|
||||
private _containerViewId: number = -1;
|
||||
private _tearDownPending = false;
|
||||
@ -238,6 +239,16 @@ export class Frame extends FrameBase {
|
||||
this.disposeCurrentFragment();
|
||||
}
|
||||
|
||||
onLoaded(): void {
|
||||
if (this._originalBackground) {
|
||||
this.backgroundColor = null;
|
||||
this.backgroundColor = this._originalBackground;
|
||||
this._originalBackground = null;
|
||||
}
|
||||
|
||||
super.onLoaded();
|
||||
}
|
||||
|
||||
onUnloaded() {
|
||||
super.onUnloaded();
|
||||
|
||||
@ -471,6 +482,13 @@ export class Frame extends FrameBase {
|
||||
}
|
||||
|
||||
public createNativeView() {
|
||||
// Create native view with available _currentEntry occur in Don't Keep Activities
|
||||
// scenario when Activity is recreated on app suspend/resume. Push frame back in frame stack
|
||||
// since it was removed in disposeNativeView() method.
|
||||
if (this._currentEntry) {
|
||||
this._pushInFrameStack();
|
||||
}
|
||||
|
||||
return new org.nativescript.widgets.ContentLayout(this._context);
|
||||
}
|
||||
|
||||
@ -945,6 +963,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
|
||||
|
||||
if (hasRemovingParent) {
|
||||
const bitmapDrawable = new android.graphics.drawable.BitmapDrawable(application.android.context.getResources(), this.backgroundBitmap);
|
||||
this.frame._originalBackground = this.frame.backgroundColor || new Color("White");
|
||||
this.frame.nativeViewProtected.setBackgroundDrawable(bitmapDrawable);
|
||||
this.backgroundBitmap = null;
|
||||
}
|
||||
|
@ -541,7 +541,9 @@ class UINavigationControllerImpl extends UINavigationController {
|
||||
|
||||
if (majorVersion >= 13) {
|
||||
const owner = this._owner.get();
|
||||
if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
if (owner &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: iosViewHelper.traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ export class HtmlView extends HtmlViewBase {
|
||||
null
|
||||
);
|
||||
|
||||
if (majorVersion >= 13) {
|
||||
if (majorVersion >= 13 && UIColor.labelColor) {
|
||||
this.nativeViewProtected.textColor = UIColor.labelColor;
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +287,9 @@ class UIViewControllerImpl extends UIViewController {
|
||||
|
||||
if (majorVersion >= 13) {
|
||||
const owner = this._owner.get();
|
||||
if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
if (owner &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: iosView.traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
@ -298,7 +300,7 @@ export class Page extends PageBase {
|
||||
nativeViewProtected: UIView;
|
||||
viewController: UIViewControllerImpl;
|
||||
|
||||
private _backgroundColor = majorVersion <= 12 ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
||||
private _backgroundColor = (majorVersion <= 12 && !UIColor.systemBackgroundColor) ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
||||
private _ios: UIViewControllerImpl;
|
||||
public _presentedViewController: UIViewController; // used when our page present native viewController without going through our abstraction.
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Types
|
||||
import { TabNavigationBase as TabNavigationBaseDefinition, SelectedIndexChangedEventData } from ".";
|
||||
import { TabContentItem } from "../tab-content-item";
|
||||
import { TabStrip } from "../tab-strip";
|
||||
import { TabStripItem } from "../tab-strip-item";
|
||||
import { ViewBase, AddArrayFromBuilder, AddChildFromBuilder, EventData } from "../../core/view";
|
||||
|
||||
// Requires
|
||||
import { View, Property, CoercibleProperty, isIOS, Color } from "../../core/view";
|
||||
import { View, Property, CoercibleProperty, isIOS } from "../../core/view";
|
||||
import { TabContentItem } from "../tab-content-item";
|
||||
import { TabStrip } from "../tab-strip";
|
||||
|
||||
// TODO: Impl trace
|
||||
// export const traceCategory = "TabView";
|
||||
@ -29,14 +29,14 @@ export class TabNavigationBase extends View implements TabNavigationBaseDefiniti
|
||||
}
|
||||
|
||||
public _addChildFromBuilder(name: string, value: any): void {
|
||||
if (name === "TabContentItem") {
|
||||
if (value instanceof TabContentItem) {
|
||||
if (!this.items) {
|
||||
this.items = new Array<TabContentItem>();
|
||||
}
|
||||
this.items.push(<TabContentItem>value);
|
||||
this._addView(value);
|
||||
// selectedIndexProperty.coerce(this);
|
||||
} else if (name === "TabStrip") {
|
||||
} else if (value instanceof TabStrip) {
|
||||
// Setting tabStrip will trigger onTabStripChanged
|
||||
this.tabStrip = value;
|
||||
}
|
||||
|
@ -3,8 +3,6 @@ import { TabStripItem as TabStripItemDefinition } from ".";
|
||||
import { PropertyChangeData } from "../../../data/observable";
|
||||
import { TabNavigationBase } from "../tab-navigation-base";
|
||||
import { TabStrip } from "../tab-strip";
|
||||
import { Image } from "../../image/image";
|
||||
import { Label } from "../../label/label";
|
||||
import { Color } from "../../../color";
|
||||
import { AddChildFromBuilder } from "../../core/view";
|
||||
|
||||
@ -12,8 +10,9 @@ import { AddChildFromBuilder } from "../../core/view";
|
||||
import {
|
||||
View, ViewBase, CSSType, backgroundColorProperty, backgroundInternalProperty, PseudoClassHandler
|
||||
} from "../../core/view";
|
||||
import { Tabs } from "../../tabs";
|
||||
import { isIOS } from "../../../platform";
|
||||
import { Image } from "../../image/image";
|
||||
import { Label } from "../../label/label";
|
||||
|
||||
export * from "../../core/view";
|
||||
export const traceCategory = "TabView";
|
||||
@ -173,14 +172,14 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
|
||||
}
|
||||
|
||||
public _addChildFromBuilder(name: string, value: any): void {
|
||||
if (name === "Image") {
|
||||
if (value instanceof Image) {
|
||||
this.image = <Image>value;
|
||||
this.iconSource = (<Image>value).src;
|
||||
this._addView(value);
|
||||
// selectedIndexProperty.coerce(this);
|
||||
}
|
||||
|
||||
if (name === "Label") {
|
||||
if (value instanceof Label) {
|
||||
this.label = <Label>value;
|
||||
this.title = (<Label>value).text;
|
||||
this._addView(value);
|
||||
@ -214,6 +213,8 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
|
||||
const tabStripParent = parent && <TabNavigationBase>parent.parent;
|
||||
if (this._index === tabStripParent.selectedIndex &&
|
||||
!(isIOS && tabStripParent.cssType.toLowerCase() === "tabs")) {
|
||||
// HACK: tabStripParent instanceof Tabs creates a circular dependency
|
||||
// HACK: tabStripParent.cssType === "Tabs" is a hacky workaround
|
||||
this._goToVisualState("highlighted");
|
||||
}
|
||||
} else {
|
||||
|
@ -2,7 +2,6 @@
|
||||
import { Color } from "../../../color";
|
||||
import { AddArrayFromBuilder, AddChildFromBuilder, EventData, ViewBase } from "../../core/view";
|
||||
import { TabNavigationBase } from "../tab-navigation-base";
|
||||
import { TabStripItem } from "../tab-strip-item";
|
||||
import { TabStripItemEventData, TabStrip as TabStripDefinition } from "./";
|
||||
|
||||
// Requires
|
||||
@ -10,6 +9,7 @@ import {
|
||||
backgroundColorProperty, backgroundInternalProperty, booleanConverter,
|
||||
colorProperty, CSSType, fontInternalProperty, Property, View
|
||||
} from "../../core/view";
|
||||
import { TabStripItem } from "../tab-strip-item";
|
||||
import { textTransformProperty } from "../../text-base";
|
||||
|
||||
export const traceCategory = "TabView";
|
||||
@ -44,7 +44,7 @@ export class TabStrip extends View implements TabStripDefinition, AddChildFromBu
|
||||
}
|
||||
|
||||
public _addChildFromBuilder(name: string, value: any): void {
|
||||
if (name === "TabStripItem") {
|
||||
if (value instanceof TabStripItem) {
|
||||
if (!this.items) {
|
||||
this.items = new Array<TabStripItem>();
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ export class TabViewBase extends View implements TabViewDefinition, AddChildFrom
|
||||
}
|
||||
|
||||
public _addChildFromBuilder(name: string, value: any): void {
|
||||
if (name === "TabViewItem") {
|
||||
if (value instanceof TabViewItemBase) {
|
||||
if (!this.items) {
|
||||
this.items = new Array<TabViewItemBase>();
|
||||
}
|
||||
|
@ -542,7 +542,11 @@ export class TabView extends TabViewBase {
|
||||
|
||||
public _loadUnloadTabItems(newIndex: number) {
|
||||
const items = this.items;
|
||||
const lastIndex = this.items.length - 1;
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lastIndex = items.length - 1;
|
||||
const offsideItems = this.androidTabsPosition === "top" ? this.androidOffscreenTabLimit : 1;
|
||||
|
||||
let toUnload = [];
|
||||
|
@ -78,7 +78,9 @@ class UITabBarControllerImpl extends UITabBarController {
|
||||
|
||||
if (majorVersion >= 13) {
|
||||
const owner = this._owner.get();
|
||||
if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
if (owner &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: iosView.traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
|
@ -465,7 +465,11 @@ export class Tabs extends TabsBase {
|
||||
|
||||
public _loadUnloadTabItems(newIndex: number) {
|
||||
const items = this.items;
|
||||
const lastIndex = this.items.length - 1;
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lastIndex = items.length - 1;
|
||||
const offsideItems = this.offscreenTabLimit;
|
||||
|
||||
let toUnload = [];
|
||||
|
@ -24,7 +24,7 @@ export * from "./tabs-common";
|
||||
const majorVersion = iosUtils.MajorVersion;
|
||||
|
||||
// Equivalent to dispatch_async(dispatch_get_main_queue(...)) call
|
||||
const invokeOnRunLoop = (function() {
|
||||
const invokeOnRunLoop = (function () {
|
||||
const runloop = CFRunLoopGetMain();
|
||||
|
||||
return (action: () => any) => {
|
||||
@ -100,7 +100,7 @@ class UIPageViewControllerImpl extends UIPageViewController {
|
||||
|
||||
tabBar.delegate = this.tabBarDelegate = MDCTabBarDelegateImpl.initWithOwner(new WeakRef(owner));
|
||||
|
||||
if (majorVersion <= 12) {
|
||||
if (majorVersion <= 12 || !UIColor.labelColor) {
|
||||
tabBar.tintColor = UIColor.blueColor;
|
||||
tabBar.barTintColor = UIColor.whiteColor;
|
||||
tabBar.setTitleColorForState(UIColor.blackColor, MDCTabBarItemState.Normal);
|
||||
@ -216,7 +216,9 @@ class UIPageViewControllerImpl extends UIPageViewController {
|
||||
|
||||
if (majorVersion >= 13) {
|
||||
const owner = this._owner.get();
|
||||
if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
if (owner &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: iosView.traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
@ -634,7 +636,11 @@ export class Tabs extends TabsBase {
|
||||
|
||||
public _loadUnloadTabItems(newIndex: number) {
|
||||
const items = this.items;
|
||||
const lastIndex = this.items.length - 1;
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lastIndex = items.length - 1;
|
||||
const offsideItems = this.offscreenTabLimit;
|
||||
|
||||
let toUnload = [];
|
||||
@ -766,6 +772,10 @@ export class Tabs extends TabsBase {
|
||||
|
||||
public _setCanBeLoaded(index: number) {
|
||||
const items = this.items;
|
||||
if (!this.items) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lastIndex = items.length - 1;
|
||||
const offsideItems = this.offscreenTabLimit;
|
||||
|
||||
@ -1083,10 +1093,8 @@ export class Tabs extends TabsBase {
|
||||
this._currentNativeSelectedIndex = value;
|
||||
this.viewController.setViewControllersDirectionAnimatedCompletion(controllers, navigationDirection, true, (finished: boolean) => {
|
||||
if (finished) {
|
||||
if (majorVersion < 10) {
|
||||
// HACK: UIPageViewController fix; see https://stackoverflow.com/a/17330606
|
||||
invokeOnRunLoop(() => this.viewController.setViewControllersDirectionAnimatedCompletion(controllers, navigationDirection, false, null));
|
||||
}
|
||||
// HACK: UIPageViewController fix; see https://stackoverflow.com/a/17330606
|
||||
invokeOnRunLoop(() => this.viewController.setViewControllersDirectionAnimatedCompletion(controllers, navigationDirection, false, null));
|
||||
|
||||
this._canSelectItem = true;
|
||||
this._setCanBeLoaded(value);
|
||||
|
@ -155,7 +155,7 @@ export class TextBase extends TextBaseCommon {
|
||||
this.nativeTextViewProtected.setAttributedTitleForState(attrText, UIControlState.Normal);
|
||||
}
|
||||
else {
|
||||
if (majorVersion >= 13) {
|
||||
if (majorVersion >= 13 && UIColor.labelColor) {
|
||||
this.nativeTextViewProtected.textColor = UIColor.labelColor;
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ export class TextBase extends TextBaseCommon {
|
||||
if (dict.size > 0 || isTextView) {
|
||||
if (style.color) {
|
||||
dict.set(NSForegroundColorAttributeName, style.color.ios);
|
||||
} else if (majorVersion >= 13) {
|
||||
} else if (majorVersion >= 13 && UIColor.labelColor) {
|
||||
dict.set(NSForegroundColorAttributeName, UIColor.labelColor);
|
||||
}
|
||||
}
|
||||
|
@ -116,8 +116,8 @@ export class TextView extends EditableTextBase implements TextViewDefinition {
|
||||
private _isShowingHint: boolean;
|
||||
public _isEditing: boolean;
|
||||
|
||||
private _hintColor = majorVersion <= 12 ? UIColor.blackColor.colorWithAlphaComponent(0.22) : UIColor.placeholderTextColor;
|
||||
private _textColor = majorVersion <= 12 ? null : UIColor.labelColor;
|
||||
private _hintColor = (majorVersion <= 12 || !UIColor.placeholderTextColor) ? UIColor.blackColor.colorWithAlphaComponent(0.22) : UIColor.placeholderTextColor;
|
||||
private _textColor = (majorVersion <= 12 || !UIColor.labelColor) ? null : UIColor.labelColor;
|
||||
|
||||
createNativeView() {
|
||||
const textView = NoScrollAnimationUITextView.new();
|
||||
|
@ -1,6 +1,7 @@
|
||||
import * as TKUnit from "../tk-unit";
|
||||
import * as app from "@nativescript/core/application";
|
||||
import * as platformModule from "@nativescript/core/platform";
|
||||
import { ios } from "@nativescript/core/utils/utils";
|
||||
|
||||
export function test_platform() {
|
||||
let expectedPlatform;
|
||||
@ -19,7 +20,12 @@ export function test_device_screen() {
|
||||
TKUnit.assert(platformModule.device.uuid, "Device UUID not initialized.");
|
||||
|
||||
TKUnit.assert(platformModule.device.language, "Preferred language not initialized.");
|
||||
TKUnit.assert(platformModule.device.region, "Preferred region not initialized.");
|
||||
|
||||
// NSLocale.currentLocale.objectForKey(NSLocaleCountryCode) not initialized by default on iOS13 simulator;
|
||||
// can be set through Settings -> General -> Language & Region -> Region
|
||||
if (platformModule.isAndroid || ios.MajorVersion < 13) {
|
||||
TKUnit.assert(platformModule.device.region, "Preferred region not initialized.");
|
||||
}
|
||||
|
||||
TKUnit.assert(platformModule.device.os, "OS not initialized.");
|
||||
TKUnit.assert(platformModule.device.osVersion, "OS version not initialized.");
|
||||
|
@ -202,6 +202,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;
|
||||
@ -209,12 +212,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);
|
||||
}
|
@ -763,17 +763,6 @@ export class ListViewTest extends UITest<ListView> {
|
||||
TKUnit.assertEqual(lastNativeElementVisible, false, "Last element is not visible");
|
||||
}
|
||||
|
||||
public test_scrollToIndex_should_coerce_larger_index_to_last_item_index() {
|
||||
var listView = this.testView;
|
||||
|
||||
listView.items = MANY_ITEMS;
|
||||
listView.scrollToIndex(10000);
|
||||
TKUnit.wait(0.1);
|
||||
|
||||
var lastNativeElementVisible = this.checkItemVisibleAtIndex(listView, MANY_ITEMS.length - 1);
|
||||
TKUnit.assertEqual(lastNativeElementVisible, true, "last element is visible");
|
||||
}
|
||||
|
||||
public test_scrollToIndex_should_not_throw_if_items_not_set() {
|
||||
var listView = this.testView;
|
||||
listView.scrollToIndex(10000);
|
||||
|
@ -385,7 +385,7 @@ export function test_page_backgroundColor() {
|
||||
helper.navigate(factory);
|
||||
|
||||
if (isIOS) {
|
||||
const backgroundColor = ios.MajorVersion <= 12 ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
||||
const backgroundColor = (ios.MajorVersion <= 12 || !UIColor.systemBackgroundColor) ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
||||
TKUnit.assertEqual(page.nativeView.backgroundColor, backgroundColor, "page backgroundColor is wrong");
|
||||
} else {
|
||||
const whiteColor = new Color("white");
|
||||
|
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