mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
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:
19
apps/app/ui-tests-app/text-field/focus-blur-events.ts
Normal file
19
apps/app/ui-tests-app/text-field/focus-blur-events.ts
Normal 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";
|
||||
});
|
||||
}
|
6
apps/app/ui-tests-app/text-field/focus-blur-events.xml
Normal file
6
apps/app/ui-tests-app/text-field/focus-blur-events.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<Page xmlns="http://www.nativescript.org/tns.xsd" loaded="onLoaded">
|
||||
<StackLayout>
|
||||
<TextField id="textField" />
|
||||
<TextView id="textView" />
|
||||
</StackLayout>
|
||||
</Page>
|
@ -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;
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user