Include ui tests for focus/ blur events for text-view and text-field (#4765)

* Include ui tests for focus/ blur events for text-view and text-field

* Update main-page.ts
This commit is contained in:
SvetoslavTsenov
2017-08-28 23:29:56 +03:00
committed by GitHub
parent 7c9fceec65
commit 3fd65cce9f
5 changed files with 28 additions and 2 deletions

View File

@ -0,0 +1,19 @@
import { TextField } from "tns-core-modules/ui/text-field";
import { TextView } from "tns-core-modules/ui/text-view";
export function onLoaded(args) {
const page = args.object;
const textField = <TextField>page.getViewById("textField");
const textView = <TextView>page.getViewById("textView");
attachToEvent(textField,"blur");
attachToEvent(textField,"focus");
attachToEvent(textView,"blur");
attachToEvent(textView,"focus");
}
function attachToEvent(control, event) {
control.on(event, () => {
control.text = event + " is thrown";
});
}

View File

@ -0,0 +1,6 @@
<Page xmlns="http://www.nativescript.org/tns.xsd" loaded="onLoaded">
<StackLayout>
<TextField id="textField" />
<TextView id="textView" />
</StackLayout>
</Page>

View File

@ -14,6 +14,7 @@ export function loadExamples() {
examples.set("secured-text-field", "text-field/secured-text-field-4135");
examples.set("max-length", "text-field/max-length");
examples.set("text-field-border", "text-field/text-field-border");
examples.set("focus-blur-events", "text-field/focus-blur-events");
return examples;
}

View File

@ -16,12 +16,12 @@
"tns-core-modules": "*"
},
"devDependencies": {
"tns-platform-declarations": "*",
"babel-traverse": "6.10.4",
"babel-types": "6.11.1",
"babylon": "6.8.3",
"lazy": "1.0.11",
"nativescript-dev-typescript": "^0.3.0",
"tns-platform-declarations": "*",
"typescript": "~2.2.1"
}
}

View File

@ -16,12 +16,12 @@
"tns-core-modules": "*"
},
"devDependencies": {
"tns-platform-declarations": "*",
"babel-traverse": "6.9.0",
"babel-types": "6.9.0",
"babylon": "6.8.0",
"filewalker": "0.1.2",
"lazy": "1.0.11",
"tns-platform-declarations": "*",
"typescript": "~2.2.1"
}
}