mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 05:18:39 +08:00
Merge pull request #3479 from NativeScript/run-more-green-tests
Minor fixes + more green tests
This commit is contained in:
@ -58,7 +58,7 @@ export function applyTapWithActionBarHiddenAndSpan(args) {
|
|||||||
reset(page);
|
reset(page);
|
||||||
|
|
||||||
page.backgroundSpanUnderStatusBar = true;
|
page.backgroundSpanUnderStatusBar = true;
|
||||||
page.actionBarHidden = true;;
|
page.actionBarHidden = true;
|
||||||
var css = "#test-element { " + args.object.tag + " }";
|
var css = "#test-element { " + args.object.tag + " }";
|
||||||
page.css = css;
|
page.css = css;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ import * as stackLayoutDef from "ui/layouts/stack-layout";
|
|||||||
// }
|
// }
|
||||||
// else if (view.ios) {
|
// else if (view.ios) {
|
||||||
// var fontSize = (<UIButton>view._nativeView).titleLabel.font.pointSize;
|
// var fontSize = (<UIButton>view._nativeView).titleLabel.font.pointSize;
|
||||||
// (<UIButton>view._nativeView).titleLabel.font = UIFont.fontWithNameSize(nativeValue, fontSize);;
|
// (<UIButton>view._nativeView).titleLabel.font = UIFont.fontWithNameSize(nativeValue, fontSize);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ export function createPage() {
|
|||||||
|
|
||||||
var fileName = resolver.resolveFileName(moduleNamePath, "xml");
|
var fileName = resolver.resolveFileName(moduleNamePath, "xml");
|
||||||
lbl.text = fileName;
|
lbl.text = fileName;
|
||||||
lbl.textWrap = true;;
|
lbl.textWrap = true;
|
||||||
|
|
||||||
page.content = lbl;
|
page.content = lbl;
|
||||||
return page;
|
return page;
|
||||||
|
@ -53,7 +53,7 @@ allTests["FILE-NAME-RESOLVER"] = require("./file-name-resolver-tests/file-name-r
|
|||||||
allTests["WEAK-EVENTS"] = require("./weak-event-listener-tests");
|
allTests["WEAK-EVENTS"] = require("./weak-event-listener-tests");
|
||||||
allTests["CONNECTIVITY"] = require("./connectivity-tests");
|
allTests["CONNECTIVITY"] = require("./connectivity-tests");
|
||||||
|
|
||||||
// allTests["PROXY-VIEW-CONTAINER"] = require("./ui/proxy-view-container/proxy-view-container-tests")
|
allTests["PROXY-VIEW-CONTAINER"] = require("./ui/proxy-view-container/proxy-view-container-tests")
|
||||||
allTests["SCROLL-VIEW"] = require("./ui/scroll-view/scroll-view-tests");
|
allTests["SCROLL-VIEW"] = require("./ui/scroll-view/scroll-view-tests");
|
||||||
allTests["ACTION-BAR"] = require("./ui/action-bar/action-bar-tests");
|
allTests["ACTION-BAR"] = require("./ui/action-bar/action-bar-tests");
|
||||||
allTests["XML-DECLARATION"] = require("./xml-declaration/xml-declaration-tests");
|
allTests["XML-DECLARATION"] = require("./xml-declaration/xml-declaration-tests");
|
||||||
@ -67,12 +67,12 @@ allTests["STYLE-PROPERTIES"] = require("./ui/styling/style-properties-tests");
|
|||||||
allTests["FRAME"] = require("./ui/frame/frame-tests");
|
allTests["FRAME"] = require("./ui/frame/frame-tests");
|
||||||
allTests["VIEW"] = require("./ui/view/view-tests");
|
allTests["VIEW"] = require("./ui/view/view-tests");
|
||||||
allTests["STYLE"] = require("./ui/styling/style-tests");
|
allTests["STYLE"] = require("./ui/styling/style-tests");
|
||||||
// allTests["VISUAL-STATE"] = require("./ui/styling/visual-state-tests");
|
allTests["VISUAL-STATE"] = require("./ui/styling/visual-state-tests");
|
||||||
// allTests["VALUE-SOURCE"] = require("./ui/styling/value-source-tests");
|
// allTests["VALUE-SOURCE"] = require("./ui/styling/value-source-tests");
|
||||||
allTests["CSS-SELECTOR-PARSER"] = require("./ui/styling/css-selector-parser");
|
allTests["CSS-SELECTOR-PARSER"] = require("./ui/styling/css-selector-parser");
|
||||||
// allTests["CSS-SELECTOR"] = require("./ui/styling/css-selector");
|
allTests["CSS-SELECTOR"] = require("./ui/styling/css-selector");
|
||||||
allTests["BUTTON"] = require("./ui/button/button-tests");
|
allTests["BUTTON"] = require("./ui/button/button-tests");
|
||||||
// allTests["BORDER"] = require("./ui/border/border-tests");
|
allTests["BORDER"] = require("./ui/border/border-tests");
|
||||||
allTests["LABEL"] = require("./ui/label/label-tests");
|
allTests["LABEL"] = require("./ui/label/label-tests");
|
||||||
allTests["TAB-VIEW"] = require("./ui/tab-view/tab-view-tests");
|
allTests["TAB-VIEW"] = require("./ui/tab-view/tab-view-tests");
|
||||||
// allTests["TAB-VIEW-NAVIGATION"] = require("./ui/tab-view/tab-view-navigation-tests");
|
// allTests["TAB-VIEW-NAVIGATION"] = require("./ui/tab-view/tab-view-navigation-tests");
|
||||||
@ -90,9 +90,9 @@ allTests["LIST-PICKER"] = require("./ui/list-picker/list-picker-tests");
|
|||||||
allTests["DATE-PICKER"] = require("./ui/date-picker/date-picker-tests");
|
allTests["DATE-PICKER"] = require("./ui/date-picker/date-picker-tests");
|
||||||
allTests["TIME-PICKER"] = require("./ui/time-picker/time-picker-tests");
|
allTests["TIME-PICKER"] = require("./ui/time-picker/time-picker-tests");
|
||||||
// allTests["WEB-VIEW"] = require("./ui/web-view/web-view-tests");
|
// allTests["WEB-VIEW"] = require("./ui/web-view/web-view-tests");
|
||||||
// allTests["HTML-VIEW"] = require("./ui/html-view/html-view-tests");
|
allTests["HTML-VIEW"] = require("./ui/html-view/html-view-tests");
|
||||||
// allTests["REPEATER"] = require("./ui/repeater/repeater-tests");
|
// allTests["REPEATER"] = require("./ui/repeater/repeater-tests");
|
||||||
// allTests["SEARCH-BAR"] = require('./ui/search-bar/search-bar-tests');
|
allTests["SEARCH-BAR"] = require('./ui/search-bar/search-bar-tests');
|
||||||
allTests["SEGMENTED-BAR"] = require("./ui/segmented-bar/segmented-bar-tests");
|
allTests["SEGMENTED-BAR"] = require("./ui/segmented-bar/segmented-bar-tests");
|
||||||
// allTests["ANIMATION"] = require("./ui/animation/animation-tests");
|
// allTests["ANIMATION"] = require("./ui/animation/animation-tests");
|
||||||
// allTests["CSS-ANIMATION"] = require("./ui/animation/css-animation-tests");
|
// allTests["CSS-ANIMATION"] = require("./ui/animation/css-animation-tests");
|
||||||
|
@ -51,7 +51,7 @@ if (platform.device.os === platform.platformNames.ios) {
|
|||||||
ai.color = new color.Color("red");
|
ai.color = new color.Color("red");
|
||||||
|
|
||||||
function testAction(views: Array<viewModule.View>) {
|
function testAction(views: Array<viewModule.View>) {
|
||||||
TKUnit.assertEqual(ai.color.ios.CGColor, ai.ios.color.CGColor, "ai.color");
|
TKUnit.assertEqual(ai.color.ios.CGColor, ai.nativeView.color.CGColor, "ai.color");
|
||||||
};
|
};
|
||||||
|
|
||||||
helper.buildUIAndRunTest(ai, testAction);
|
helper.buildUIAndRunTest(ai, testAction);
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
import * as TKUnit from "../../TKUnit";
|
import * as TKUnit from "../../TKUnit";
|
||||||
import * as helper from "../helper";
|
import * as helper from "../helper";
|
||||||
import {View} from "ui/core/view";
|
import { View } from "ui/core/view";
|
||||||
import {Button} from "ui/button";
|
import { Button } from "ui/button";
|
||||||
import {Page} from "ui/page";
|
import { Page } from "ui/page";
|
||||||
import {ScrollView} from "ui/scroll-view";
|
import { ScrollView } from "ui/scroll-view";
|
||||||
import {LayoutBase} from "ui/layouts/layout-base"
|
import { LayoutBase } from "ui/layouts/layout-base";
|
||||||
import {StackLayout} from "ui/layouts/stack-layout"
|
import { StackLayout } from "ui/layouts/stack-layout";
|
||||||
import {GridLayout} from "ui/layouts/grid-layout"
|
import { GridLayout } from "ui/layouts/grid-layout";
|
||||||
import {ProxyViewContainer} from "ui/proxy-view-container";
|
import { ProxyViewContainer } from "ui/proxy-view-container";
|
||||||
import {ListView} from "ui/list-view";
|
import { ListView } from "ui/list-view";
|
||||||
|
|
||||||
export function test_add_children_to_attached_proxy() {
|
export function test_add_children_to_attached_proxy() {
|
||||||
var outer = new StackLayout();
|
const outer = new StackLayout();
|
||||||
var proxy = new ProxyViewContainer();
|
const proxy = new ProxyViewContainer();
|
||||||
|
|
||||||
function testAction(views: Array<View>) {
|
function testAction(views: Array<View>) {
|
||||||
outer.addChild(createBtn("1"));
|
outer.addChild(createBtn("1"));
|
||||||
@ -30,8 +30,8 @@ export function test_add_children_to_attached_proxy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function test_children_immediately_registered_in_parent_grid_layout() {
|
export function test_children_immediately_registered_in_parent_grid_layout() {
|
||||||
var outer = new GridLayout();
|
const outer = new GridLayout();
|
||||||
var proxy = new ProxyViewContainer();
|
const proxy = new ProxyViewContainer();
|
||||||
|
|
||||||
function testAction(views: Array<View>) {
|
function testAction(views: Array<View>) {
|
||||||
outer.addChild(proxy);
|
outer.addChild(proxy);
|
||||||
@ -44,10 +44,11 @@ export function test_children_immediately_registered_in_parent_grid_layout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function test_children_registered_in_parent_grid_layout_on_attach() {
|
export function test_children_registered_in_parent_grid_layout_on_attach() {
|
||||||
var outer = new GridLayout();
|
const outer = new GridLayout();
|
||||||
var proxy = new ProxyViewContainer();
|
const proxy = new ProxyViewContainer();
|
||||||
|
|
||||||
function testAction(views: Array<View>) {
|
function testAction(views: Array<View>) {
|
||||||
|
|
||||||
proxy.addChild(createBtn("1"));
|
proxy.addChild(createBtn("1"));
|
||||||
outer.addChild(proxy);
|
outer.addChild(proxy);
|
||||||
|
|
||||||
@ -58,8 +59,8 @@ export function test_children_registered_in_parent_grid_layout_on_attach() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function test_add_children_to_detached_proxy() {
|
export function test_add_children_to_detached_proxy() {
|
||||||
var outer = new StackLayout();
|
const outer = new StackLayout();
|
||||||
var proxy = new ProxyViewContainer();
|
const proxy = new ProxyViewContainer();
|
||||||
|
|
||||||
function testAction(views: Array<View>) {
|
function testAction(views: Array<View>) {
|
||||||
outer.addChild(createBtn("1"));
|
outer.addChild(createBtn("1"));
|
||||||
@ -78,8 +79,8 @@ export function test_add_children_to_detached_proxy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function test_remove_proxy() {
|
export function test_remove_proxy() {
|
||||||
var outer = new StackLayout();
|
const outer = new StackLayout();
|
||||||
var proxy = new ProxyViewContainer();
|
const proxy = new ProxyViewContainer();
|
||||||
|
|
||||||
outer.addChild(createBtn("1"));
|
outer.addChild(createBtn("1"));
|
||||||
|
|
||||||
@ -100,14 +101,14 @@ export function test_remove_proxy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function test_remove_child_of_attached_proxy() {
|
export function test_remove_child_of_attached_proxy() {
|
||||||
var outer = new StackLayout();
|
const outer = new StackLayout();
|
||||||
var proxy = new ProxyViewContainer();
|
const proxy = new ProxyViewContainer();
|
||||||
|
|
||||||
outer.addChild(createBtn("1"));
|
outer.addChild(createBtn("1"));
|
||||||
|
|
||||||
outer.addChild(proxy);
|
outer.addChild(proxy);
|
||||||
proxy.addChild(createBtn("2"));
|
proxy.addChild(createBtn("2"));
|
||||||
var testBtn = createBtn("3")
|
const testBtn = createBtn("3");
|
||||||
proxy.addChild(testBtn);
|
proxy.addChild(testBtn);
|
||||||
proxy.addChild(createBtn("4"));
|
proxy.addChild(createBtn("4"));
|
||||||
|
|
||||||
@ -122,9 +123,9 @@ export function test_remove_child_of_attached_proxy() {
|
|||||||
helper.buildUIAndRunTest(outer, testAction);
|
helper.buildUIAndRunTest(outer, testAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function test_insert_inside_porxy() {
|
export function test_insert_inside_proxy() {
|
||||||
var outer = new StackLayout();
|
const outer = new StackLayout();
|
||||||
var proxy = new ProxyViewContainer();
|
const proxy = new ProxyViewContainer();
|
||||||
|
|
||||||
outer.addChild(createBtn("1"));
|
outer.addChild(createBtn("1"));
|
||||||
|
|
||||||
@ -143,9 +144,9 @@ export function test_insert_inside_porxy() {
|
|||||||
helper.buildUIAndRunTest(outer, testAction);
|
helper.buildUIAndRunTest(outer, testAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function test_insert_after_porxy() {
|
export function test_insert_after_proxy() {
|
||||||
var outer = new StackLayout();
|
const outer = new StackLayout();
|
||||||
var proxy = new ProxyViewContainer();
|
const proxy = new ProxyViewContainer();
|
||||||
|
|
||||||
outer.addChild(createBtn("1"));
|
outer.addChild(createBtn("1"));
|
||||||
|
|
||||||
@ -164,12 +165,12 @@ export function test_insert_after_porxy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function test_proxy_does_not_stop_request_layout_bubble() {
|
export function test_proxy_does_not_stop_request_layout_bubble() {
|
||||||
var outer = new StackLayout();
|
const outer = new StackLayout();
|
||||||
var proxy = new ProxyViewContainer();
|
const proxy = new ProxyViewContainer();
|
||||||
|
|
||||||
outer.addChild(createBtn("1"));
|
outer.addChild(createBtn("1"));
|
||||||
outer.addChild(proxy);
|
outer.addChild(proxy);
|
||||||
var btn = createBtn("2");
|
const btn = createBtn("2");
|
||||||
proxy.addChild(btn);
|
proxy.addChild(btn);
|
||||||
|
|
||||||
function testAction(views: Array<View>) {
|
function testAction(views: Array<View>) {
|
||||||
@ -184,51 +185,51 @@ export function test_proxy_does_not_stop_request_layout_bubble() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function test_proxy_iniside_page() {
|
export function test_proxy_iniside_page() {
|
||||||
var proxy = new ProxyViewContainer();
|
const proxy = new ProxyViewContainer();
|
||||||
proxy.addChild(createBtn("1"));
|
proxy.addChild(createBtn("1"));
|
||||||
|
|
||||||
function testAction(views: Array<View>) {
|
function testAction(views: Array<View>) {
|
||||||
var page = <Page>views[1];
|
const page = <Page>views[1];
|
||||||
waitUntilElementLayoutIsValid(page);
|
waitUntilElementLayoutIsValid(page);
|
||||||
};
|
};
|
||||||
|
|
||||||
helper.buildUIAndRunTest(proxy, testAction);
|
helper.buildUIAndRunTest(proxy, testAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function test_proxy_iniside_scroll_view() {
|
export function test_proxy_inside_scroll_view() {
|
||||||
var scroll = new ScrollView();
|
const scroll = new ScrollView();
|
||||||
|
const proxy = new ProxyViewContainer();
|
||||||
scroll.content = proxy;
|
scroll.content = proxy;
|
||||||
|
|
||||||
var proxy = new ProxyViewContainer();
|
|
||||||
proxy.addChild(createBtn("1"));
|
proxy.addChild(createBtn("1"));
|
||||||
|
|
||||||
function testAction(views: Array<View>) {
|
function testAction(views: Array<View>) {
|
||||||
var page = <Page>views[1];
|
const page = <Page>views[1];
|
||||||
waitUntilElementLayoutIsValid(page);
|
waitUntilElementLayoutIsValid(page);
|
||||||
};
|
};
|
||||||
|
|
||||||
helper.buildUIAndRunTest(scroll, testAction);
|
helper.buildUIAndRunTest(scroll, testAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function test_proxy_iniside_border() {
|
export function test_proxy_inside_border() {
|
||||||
var scroll = new ScrollView();
|
const scroll = new ScrollView();
|
||||||
|
const proxy = new ProxyViewContainer();
|
||||||
scroll.content = proxy;
|
scroll.content = proxy;
|
||||||
|
|
||||||
var proxy = new ProxyViewContainer();
|
|
||||||
proxy.addChild(createBtn("1"));
|
proxy.addChild(createBtn("1"));
|
||||||
|
|
||||||
function testAction(views: Array<View>) {
|
function testAction(views: Array<View>) {
|
||||||
var page = <Page>views[1];
|
const page = <Page>views[1];
|
||||||
waitUntilElementLayoutIsValid(page);
|
waitUntilElementLayoutIsValid(page);
|
||||||
};
|
};
|
||||||
|
|
||||||
helper.buildUIAndRunTest(scroll, testAction);
|
helper.buildUIAndRunTest(scroll, testAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function test_proxy_iniside_listview_itemtemplate_crash() {
|
export function test_proxy_inside_listview_itemTemplate_crash() {
|
||||||
// Usually reproducible with an Angular component in the template
|
// Usually reproducible with an Angular component in the template
|
||||||
// We use a simple declaration here to simulate it.
|
// We use a simple declaration here to simulate it.
|
||||||
var list = new ListView();
|
const list = new ListView();
|
||||||
list.items = ["item 1"];
|
list.items = ["item 1"];
|
||||||
list.itemTemplate = `
|
list.itemTemplate = `
|
||||||
<ProxyViewContainer>
|
<ProxyViewContainer>
|
||||||
@ -237,7 +238,7 @@ export function test_proxy_iniside_listview_itemtemplate_crash() {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
function testAction(views: Array<View>) {
|
function testAction(views: Array<View>) {
|
||||||
var page = <Page>views[1];
|
const page = <Page>views[1];
|
||||||
waitUntilElementLayoutIsValid(page);
|
waitUntilElementLayoutIsValid(page);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -245,17 +246,17 @@ export function test_proxy_iniside_listview_itemtemplate_crash() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Proxy as a direct child to of TabItem is not supported. Not sure if we want to support it.
|
// TODO: Proxy as a direct child to of TabItem is not supported. Not sure if we want to support it.
|
||||||
//export function test_proxy_iniside_tab() {
|
//export function test_proxy_inside_tab() {
|
||||||
// var proxy = new ProxyViewContainer();
|
// const proxy = new ProxyViewContainer();
|
||||||
// proxy.addChild(createBtn("1"));
|
// proxy.addChild(createBtn("1"));
|
||||||
|
|
||||||
// var tab = new TabView();
|
// const tab = new TabView();
|
||||||
// var items = new Array<TabViewItem>();
|
// const items = new Array<TabViewItem>();
|
||||||
// items.push(new TabViewItem({ title: "tab with proxy", view: proxy }));
|
// items.push(new TabViewItem({ title: "tab with proxy", view: proxy }));
|
||||||
// tab.items = items;
|
// tab.items = items;
|
||||||
|
|
||||||
// function testAction(views: Array<View>) {
|
// function testAction(views: Array<View>) {
|
||||||
// var page = <Page>views[1];
|
// const page = <Page>views[1];
|
||||||
// waitUntilElementLayoutIsValid(page);
|
// waitUntilElementLayoutIsValid(page);
|
||||||
// };
|
// };
|
||||||
|
|
||||||
@ -263,10 +264,10 @@ export function test_proxy_iniside_listview_itemtemplate_crash() {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
// TODO: Proxy as a direct child to of ActionBar is not supported. Not sure if we want to support it.
|
// TODO: Proxy as a direct child to of ActionBar is not supported. Not sure if we want to support it.
|
||||||
//export function test_proxy_iniside_actionBar() {
|
//export function test_proxy_inside_actionBar() {
|
||||||
// function testAction(views: Array<View>) {
|
// function testAction(views: Array<View>) {
|
||||||
// var page = <Page>views[1];
|
// const page = <Page>views[1];
|
||||||
// var proxy = new ProxyViewContainer();
|
// const proxy = new ProxyViewContainer();
|
||||||
// proxy.addChild(createBtn("1"));
|
// proxy.addChild(createBtn("1"));
|
||||||
// page.actionBar.titleView = proxy;
|
// page.actionBar.titleView = proxy;
|
||||||
// waitUntilElementLayoutIsValid(page);
|
// waitUntilElementLayoutIsValid(page);
|
||||||
@ -282,7 +283,7 @@ function waitUntilElementLayoutIsValid(view: View, timeoutSec?: number): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createBtn(text: string): Button {
|
function createBtn(text: string): Button {
|
||||||
var b = new Button();
|
const b = new Button();
|
||||||
b.text = text;
|
b.text = text;
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ export class TimePickerTest extends testModule.UITest<timePickerModule.TimePicke
|
|||||||
this.testView.hour = 14;
|
this.testView.hour = 14;
|
||||||
this.testView.maxHour = this.testView.hour + 1;
|
this.testView.maxHour = this.testView.hour + 1;
|
||||||
TKUnit.assertThrows(function() {
|
TKUnit.assertThrows(function() {
|
||||||
this.testView.hour = this.testView.maxHour + 1;;
|
this.testView.hour = this.testView.maxHour + 1;
|
||||||
}, "Setting hour property to a value greater than maxHour property value should throw.");
|
}, "Setting hour property to a value greater than maxHour property value should throw.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tns-core-modules": "2.4.0",
|
"tns-core-modules": "2.4.0"
|
||||||
"tns-core-modules-widgets": "file:///Users/vakrilov/Work/Projects/tns-core-modules-widgets/dist/tns-core-modules-widgets-2.5.0.tgz"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"tns-platform-declarations": "*",
|
"tns-platform-declarations": "*",
|
||||||
|
@ -80,6 +80,6 @@ export function stopMonitoring(): void {
|
|||||||
if (_monitorReachabilityRef) {
|
if (_monitorReachabilityRef) {
|
||||||
SCNetworkReachabilityUnscheduleFromRunLoop(_monitorReachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
SCNetworkReachabilityUnscheduleFromRunLoop(_monitorReachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||||
_monitorReachabilityRef = undefined;
|
_monitorReachabilityRef = undefined;
|
||||||
_connectionTypeChangedCallback = undefined;;
|
_connectionTypeChangedCallback = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ export class ImageSource implements definition.ImageSource {
|
|||||||
|
|
||||||
public toBase64String(format: string, quality = 100): string {
|
public toBase64String(format: string, quality = 100): string {
|
||||||
if (!this.android) {
|
if (!this.android) {
|
||||||
return null;;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var targetFormat = getTargetFormat(format);
|
var targetFormat = getTargetFormat(format);
|
||||||
|
@ -38,6 +38,6 @@ export class ActivityIndicator extends ActivityIndicatorBase {
|
|||||||
return this.nativeView.color;
|
return this.nativeView.color;
|
||||||
}
|
}
|
||||||
set [colorProperty.native](value: UIColor | Color) {
|
set [colorProperty.native](value: UIColor | Color) {
|
||||||
this.nativeView.color = value instanceof Color ? value.ios : value;;
|
this.nativeView.color = value instanceof Color ? value.ios : value;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -104,7 +104,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
|
|||||||
public bindingContext: any;
|
public bindingContext: any;
|
||||||
public nativeView: any;
|
public nativeView: any;
|
||||||
public parent: ViewBase;
|
public parent: ViewBase;
|
||||||
public isCollapsed = false;
|
public isCollapsed; // Default(false) set in prototype
|
||||||
|
|
||||||
public id: string;
|
public id: string;
|
||||||
public className: string;
|
public className: string;
|
||||||
@ -487,7 +487,8 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
|
|||||||
this._initNativeView();
|
this._initNativeView();
|
||||||
|
|
||||||
if (this.parent) {
|
if (this.parent) {
|
||||||
this._isAddedToNativeVisualTree = this.parent._addViewToNativeVisualTree(this, atIndex);
|
let nativeIndex = this.parent._childIndexToNativeChildIndex(atIndex);
|
||||||
|
this._isAddedToNativeVisualTree = this.parent._addViewToNativeVisualTree(this, nativeIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.nativeView) {
|
if (this.nativeView) {
|
||||||
@ -614,6 +615,8 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ViewBase.prototype.isCollapsed = false;
|
||||||
|
|
||||||
export const bindingContextProperty = new InheritedProperty<ViewBase, any>({ name: "bindingContext" });
|
export const bindingContextProperty = new InheritedProperty<ViewBase, any>({ name: "bindingContext" });
|
||||||
bindingContextProperty.register(ViewBase);
|
bindingContextProperty.register(ViewBase);
|
||||||
|
|
||||||
|
@ -785,14 +785,6 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
|||||||
return callback(this);
|
return callback(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
_addToSuperview(superview: any, index?: number): boolean {
|
|
||||||
// IOS specific
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_removeFromSuperview(): void {
|
|
||||||
// IOS specific
|
|
||||||
}
|
|
||||||
|
|
||||||
// public unsetInheritedProperties(): void {
|
// public unsetInheritedProperties(): void {
|
||||||
// // this._setValue(ProxyObject.bindingContextProperty, undefined, ValueSource.Inherited);
|
// // this._setValue(ProxyObject.bindingContextProperty, undefined, ValueSource.Inherited);
|
||||||
// // this._eachSetProperty((property) => {
|
// // this._eachSetProperty((property) => {
|
||||||
|
3
tns-core-modules/ui/core/view.d.ts
vendored
3
tns-core-modules/ui/core/view.d.ts
vendored
@ -536,9 +536,6 @@ declare module "ui/core/view" {
|
|||||||
|
|
||||||
_eachLayoutView(callback: (View) => void): void;
|
_eachLayoutView(callback: (View) => void): void;
|
||||||
|
|
||||||
_addToSuperview(superview: any, index?: number): boolean;
|
|
||||||
_removeFromSuperview();
|
|
||||||
|
|
||||||
public _applyXmlAttribute(attribute: string, value: any): boolean;
|
public _applyXmlAttribute(attribute: string, value: any): boolean;
|
||||||
public eachChildView(callback: (view: View) => boolean): void;
|
public eachChildView(callback: (view: View) => boolean): void;
|
||||||
|
|
||||||
|
@ -268,26 +268,6 @@ export class View extends ViewCommon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public _addToSuperview(superview: any, atIndex: number = Number.POSITIVE_INFINITY): boolean {
|
|
||||||
if (superview && this.nativeView) {
|
|
||||||
if (atIndex >= superview.subviews.count) {
|
|
||||||
superview.addSubview(this.nativeView);
|
|
||||||
} else {
|
|
||||||
superview.insertSubviewAtIndex(this.nativeView, atIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public _removeFromSuperview() {
|
|
||||||
if (this.nativeView) {
|
|
||||||
this.nativeView.removeFromSuperview();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default we update the view's presentation layer when setting backgroundColor and opacity properties.
|
// By default we update the view's presentation layer when setting backgroundColor and opacity properties.
|
||||||
// This is done by calling CATransaction begin and commit methods.
|
// This is done by calling CATransaction begin and commit methods.
|
||||||
// This action should be disabled when updating those properties during an animation.
|
// This action should be disabled when updating those properties during an animation.
|
||||||
@ -457,12 +437,27 @@ export class CustomLayoutView extends View {
|
|||||||
public _addViewToNativeVisualTree(child: View, atIndex: number): boolean {
|
public _addViewToNativeVisualTree(child: View, atIndex: number): boolean {
|
||||||
super._addViewToNativeVisualTree(child, atIndex);
|
super._addViewToNativeVisualTree(child, atIndex);
|
||||||
|
|
||||||
return child._addToSuperview(this.nativeView, atIndex);
|
const parentNativeView = this.nativeView;
|
||||||
|
const childNativeView = child.nativeView;
|
||||||
|
|
||||||
|
if (parentNativeView && childNativeView) {
|
||||||
|
if (typeof atIndex !== "number" || atIndex >= parentNativeView.subviews.count) {
|
||||||
|
parentNativeView.addSubview(childNativeView);
|
||||||
|
} else {
|
||||||
|
parentNativeView.insertSubviewAtIndex(childNativeView, atIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public _removeViewFromNativeVisualTree(child: View): void {
|
public _removeViewFromNativeVisualTree(child: View): void {
|
||||||
super._removeViewFromNativeVisualTree(child);
|
super._removeViewFromNativeVisualTree(child);
|
||||||
|
|
||||||
child._removeFromSuperview();
|
if (child.nativeView) {
|
||||||
|
child.nativeView.removeFromSuperview();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import {
|
|||||||
traceEnabled, traceWrite, traceCategories
|
traceEnabled, traceWrite, traceCategories
|
||||||
} from "./image-common";
|
} from "./image-common";
|
||||||
|
|
||||||
export * from "./image-common";;
|
export * from "./image-common";
|
||||||
|
|
||||||
export class Image extends ImageBase {
|
export class Image extends ImageBase {
|
||||||
private _ios: UIImageView;
|
private _ios: UIImageView;
|
||||||
|
@ -126,10 +126,10 @@ export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public eachLayoutChild(callback: (child: View, isLast: boolean) => void): void {
|
public eachLayoutChild(callback: (child: View, isLast: boolean) => void): void {
|
||||||
var lastChild: View = null;
|
var lastChild: View = null;
|
||||||
|
|
||||||
this.eachChildView((cv) => {
|
this.eachChildView((cv) => {
|
||||||
cv._eachLayoutView((lv) => {
|
cv._eachLayoutView((lv) => {
|
||||||
if (lastChild && !lastChild.isCollapsed) {
|
if (lastChild && !lastChild.isCollapsed) {
|
||||||
@ -141,7 +141,7 @@ export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefi
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (lastChild && !lastChild.isCollapsed) {
|
if (lastChild && !lastChild.isCollapsed) {
|
||||||
callback(lastChild, true);
|
callback(lastChild, true);
|
||||||
}
|
}
|
||||||
@ -149,5 +149,5 @@ export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const clipToBoundsProperty = new Property<LayoutBaseCommon, boolean>({name: "clipToBounds", defaultValue: true});
|
export const clipToBoundsProperty = new Property<LayoutBaseCommon, boolean>({ name: "clipToBounds", defaultValue: true });
|
||||||
clipToBoundsProperty.register(LayoutBaseCommon);
|
clipToBoundsProperty.register(LayoutBaseCommon);
|
@ -37,8 +37,8 @@ export class Progress extends ProgressBase {
|
|||||||
get [colorProperty.native](): UIColor {
|
get [colorProperty.native](): UIColor {
|
||||||
return this._ios.progressTintColor;
|
return this._ios.progressTintColor;
|
||||||
}
|
}
|
||||||
set [colorProperty.native](value: Color) {
|
set [colorProperty.native](value: Color | UIColor) {
|
||||||
this._ios.progressTintColor = value instanceof Color ? value.ios : value;;
|
this._ios.progressTintColor = value instanceof Color ? value.ios : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
get [backgroundColorProperty.native](): UIColor {
|
get [backgroundColorProperty.native](): UIColor {
|
||||||
|
@ -6,13 +6,9 @@ import { LayoutBase, View, traceEnabled, traceWrite, traceCategories } from "ui/
|
|||||||
*/
|
*/
|
||||||
// Cases to cover:
|
// Cases to cover:
|
||||||
// * Child is added to the attached proxy. Handled in _addViewToNativeVisualTree.
|
// * Child is added to the attached proxy. Handled in _addViewToNativeVisualTree.
|
||||||
// * Proxy (with children) is added to the DOM.
|
// * Proxy (with children) is added to the DOM. In _addViewToNativeVisualTree _addViewToNativeVisualTree recursively when the proxy is added to the parent.
|
||||||
// - IOS: Handled in _addToSuperview - when the proxy is added, it adds all its children to the new parent.
|
|
||||||
// - Android: _onAttached calls _addViewToNativeVisualTree recursively when the proxy is added to the parent.
|
|
||||||
// * Child is removed from attached proxy. Handled in _removeViewFromNativeVisualTree.
|
// * Child is removed from attached proxy. Handled in _removeViewFromNativeVisualTree.
|
||||||
// * Proxy (with children) is removed form the DOM.
|
// * Proxy (with children) is removed form the DOM. In _removeViewFromNativeVisualTree recursively when the proxy is removed from its parent.
|
||||||
// - IOS: Handled in _removeFromSuperview - when the proxy is removed, it removes all its children from its parent.
|
|
||||||
// - Android: _onDetached calls _removeViewFromNativeVisualTree recursively when the proxy is removed from its parent.
|
|
||||||
export class ProxyViewContainer extends LayoutBase implements ProxyViewContainerDefinition {
|
export class ProxyViewContainer extends LayoutBase implements ProxyViewContainerDefinition {
|
||||||
// No native view for proxy container.
|
// No native view for proxy container.
|
||||||
get ios(): any {
|
get ios(): any {
|
||||||
@ -97,27 +93,6 @@ export class ProxyViewContainer extends LayoutBase implements ProxyViewContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public _addToSuperview(superview: any, atIndex?: number): boolean {
|
|
||||||
let index = 0;
|
|
||||||
this.eachChildView((cv) => {
|
|
||||||
if (!cv._isAddedToNativeVisualTree) {
|
|
||||||
cv._isAddedToNativeVisualTree = this._addViewToNativeVisualTree(cv, index++);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public _removeFromSuperview() {
|
|
||||||
this.eachChildView((cv) => {
|
|
||||||
if (cv._isAddedToNativeVisualTree) {
|
|
||||||
this._removeViewFromNativeVisualTree(cv);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some layouts (e.g. GridLayout) need to get notified when adding and
|
* Some layouts (e.g. GridLayout) need to get notified when adding and
|
||||||
* removing children, so that they can update private measure data.
|
* removing children, so that they can update private measure data.
|
||||||
|
Reference in New Issue
Block a user