Skip to content

Commit 3fd65cc

Browse files
Include ui tests for focus/ blur events for text-view and text-field (NativeScript#4765)
* Include ui tests for focus/ blur events for text-view and text-field * Update main-page.ts
1 parent 7c9fcee commit 3fd65cc

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { TextField } from "tns-core-modules/ui/text-field";
2+
import { TextView } from "tns-core-modules/ui/text-view";
3+
4+
export function onLoaded(args) {
5+
const page = args.object;
6+
const textField = <TextField>page.getViewById("textField");
7+
const textView = <TextView>page.getViewById("textView");
8+
9+
attachToEvent(textField,"blur");
10+
attachToEvent(textField,"focus");
11+
attachToEvent(textView,"blur");
12+
attachToEvent(textView,"focus");
13+
}
14+
15+
function attachToEvent(control, event) {
16+
control.on(event, () => {
17+
control.text = event + " is thrown";
18+
});
19+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Page xmlns="http://www.nativescript.org/tns.xsd" loaded="onLoaded">
2+
<StackLayout>
3+
<TextField id="textField" />
4+
<TextView id="textView" />
5+
</StackLayout>
6+
</Page>

apps/app/ui-tests-app/text-field/main-page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export function loadExamples() {
1414
examples.set("secured-text-field", "text-field/secured-text-field-4135");
1515
examples.set("max-length", "text-field/max-length");
1616
examples.set("text-field-border", "text-field/text-field-border");
17+
examples.set("focus-blur-events", "text-field/focus-blur-events");
1718

1819
return examples;
1920
}

apps/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
"tns-core-modules": "*"
1717
},
1818
"devDependencies": {
19-
"tns-platform-declarations": "*",
2019
"babel-traverse": "6.10.4",
2120
"babel-types": "6.11.1",
2221
"babylon": "6.8.3",
2322
"lazy": "1.0.11",
2423
"nativescript-dev-typescript": "^0.3.0",
24+
"tns-platform-declarations": "*",
2525
"typescript": "~2.2.1"
2626
}
2727
}

tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
"tns-core-modules": "*"
1717
},
1818
"devDependencies": {
19-
"tns-platform-declarations": "*",
2019
"babel-traverse": "6.9.0",
2120
"babel-types": "6.9.0",
2221
"babylon": "6.8.0",
2322
"filewalker": "0.1.2",
2423
"lazy": "1.0.11",
24+
"tns-platform-declarations": "*",
2525
"typescript": "~2.2.1"
2626
}
2727
}

0 commit comments

Comments
 (0)