mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Css properties progress
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
import observable = require("data/observable");
|
||||
import pages = require("ui/page");
|
||||
|
||||
var vm = new observable.Observable();
|
||||
// Event handler for Page "loaded" event attached in main-page.xml
|
||||
export function pageLoaded(args: observable.EventData) {
|
||||
vm.set("style", "background-image: url('~/tests/pages/test2.png'); \nborder-color: green; \nborder-radius: 20; \nborder-width: 4;");
|
||||
// Get the event sender
|
||||
var page = <pages.Page>args.object;
|
||||
page.bindingContext = vm;
|
||||
}
|
||||
|
||||
export function applyTap(args){
|
||||
args.object.parent.style = vm.get("style");
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
<Page>
|
||||
<GridLayout style="background-image: url('~/pages/test2.png'); border-color: green; border-radius: 20; border-width: 4;">
|
||||
<Button text="just a button" horizontalAlignment="center" verticalAlignment="center"/>
|
||||
<Page loaded="pageLoaded">
|
||||
<GridLayout style="background-image: url('~/pages/test2.png'); border-color: green; border-radius: 20; border-width: 4;" rows="*, auto">
|
||||
<TextView text="{{ style }}" />
|
||||
<Button text="apply" horizontalAlignment="center" verticalAlignment="center" tap="applyTap" row="1"/>
|
||||
</GridLayout>
|
||||
</Page>
|
||||
@@ -22,7 +22,7 @@ export function test_css_dataURI_is_applied_to_backgroundImageSource() {
|
||||
var page = <pageModule.Page>views[1];
|
||||
page.css = "StackLayout { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC;') }";
|
||||
|
||||
var value = stack.style._getValue(styleModule.backgroundImageSourceProperty);
|
||||
var value = undefined; //stack.style._getValue(styleModule.backgroundImageSourceProperty);
|
||||
|
||||
TKUnit.assert(value !== undefined, "Style background-image not loaded correctly from data URI.");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user