mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 12:57:42 +08:00
Merge pull request #307 from NativeScript/view-backgroundImage
backgroundImage exposed to View
This commit is contained in:
@ -203,6 +203,17 @@ export function test_parse_ShouldParseSubProperties() {
|
|||||||
TKUnit.assert(sw.visibility === "collapsed", "Expected result: collapsed; Actual result: " + sw.visibility + "; type: " + typeof (sw.visibility));
|
TKUnit.assert(sw.visibility === "collapsed", "Expected result: collapsed; Actual result: " + sw.visibility + "; type: " + typeof (sw.visibility));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function test_parse_CanBindBackgroundImage() {
|
||||||
|
var p = <page.Page>builder.parse("<Page><StackLayout backgroundImage='{{ myProp }}' /></Page>");
|
||||||
|
var expected = "~/logo.png"
|
||||||
|
var obj = new observable.Observable();
|
||||||
|
obj.set("myProp", expected);
|
||||||
|
p.bindingContext = obj;
|
||||||
|
var sw = <stackLayoutModule.StackLayout>p.content;
|
||||||
|
|
||||||
|
TKUnit.assert(sw.backgroundImage === expected, "Expected result: " + expected + "; Actual result: " + sw.backgroundImage);
|
||||||
|
};
|
||||||
|
|
||||||
export function test_parse_ShouldParseCustomComponentWithoutXml() {
|
export function test_parse_ShouldParseCustomComponentWithoutXml() {
|
||||||
var p = <page.Page>builder.parse('<Page xmlns:customControls="xml-declaration/mymodule"><customControls:MyControl /></Page>');
|
var p = <page.Page>builder.parse('<Page xmlns:customControls="xml-declaration/mymodule"><customControls:MyControl /></Page>');
|
||||||
var ctrl = p.content;
|
var ctrl = p.content;
|
||||||
|
@ -202,6 +202,13 @@ export class View extends proxy.ProxyObject implements definition.View {
|
|||||||
this.style.backgroundColor = value;
|
this.style.backgroundColor = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get backgroundImage(): string {
|
||||||
|
return this.style.backgroundImage;
|
||||||
|
}
|
||||||
|
set backgroundImage(value: string) {
|
||||||
|
this.style.backgroundImage = value;
|
||||||
|
}
|
||||||
|
|
||||||
get minWidth(): number {
|
get minWidth(): number {
|
||||||
return this.style.minWidth;
|
return this.style.minWidth;
|
||||||
}
|
}
|
||||||
|
5
ui/core/view.d.ts
vendored
5
ui/core/view.d.ts
vendored
@ -139,6 +139,11 @@ declare module "ui/core/view" {
|
|||||||
*/
|
*/
|
||||||
backgroundColor: color.Color;
|
backgroundColor: color.Color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets or sets the background image of the view.
|
||||||
|
*/
|
||||||
|
backgroundImage: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets or sets the minimum width the view may grow to.
|
* Gets or sets the minimum width the view may grow to.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user