Files
NativeScript/apps/app/ui-tests-app/text-field/focus-blur-events.ts
SvetoslavTsenov 3fd65cce9f 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
2017-08-28 23:29:56 +03:00

19 lines
584 B
TypeScript

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";
});
}