mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Include test page for max-lenght poperty
This commit is contained in:
@ -13,6 +13,7 @@ export function pageLoaded(args: EventData) {
|
|||||||
|
|
||||||
examples.set("list-view-templates", "list-view/list-view");
|
examples.set("list-view-templates", "list-view/list-view");
|
||||||
examples.set("images-template", "list-view/images-template");
|
examples.set("images-template", "list-view/images-template");
|
||||||
|
examples.set("bindings", "list-view/listview-binding");
|
||||||
|
|
||||||
let viewModel = new SubMainPageViewModel(wrapLayout, examples);
|
let viewModel = new SubMainPageViewModel(wrapLayout, examples);
|
||||||
page.bindingContext = viewModel;
|
page.bindingContext = viewModel;
|
||||||
|
|||||||
14
apps/app/ui-tests-app/list-view/max-length.xml
Normal file
14
apps/app/ui-tests-app/list-view/max-length.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<Page loaded="pageLoaded">
|
||||||
|
<Page.actionBar>
|
||||||
|
<ActionBar title="maxLength" />
|
||||||
|
</Page.actionBar>
|
||||||
|
<StackLayout>
|
||||||
|
<TextField id="maxLenghtFromCodeBehindWithText" hint="max lenght and text from code behind" maxLength="3" />
|
||||||
|
<TextField id="maxLenghtFromCodeBehind" hint="set only max length from code behind" />
|
||||||
|
<TextField id="inXml" text="in xml" hint="in xml" maxLength="3" />
|
||||||
|
<TextField id="useInput" hint="user input" maxLength="3" />
|
||||||
|
<TextField id="useInput" hint="user input" maxLength="3" secure="true" />
|
||||||
|
|
||||||
|
<Button tap="setText" text="Revert to initial state" />
|
||||||
|
</StackLayout>
|
||||||
|
</Page>
|
||||||
@ -14,34 +14,42 @@ export function pageLoaded(args: EventData) {
|
|||||||
|
|
||||||
let page = <Page>args.object;
|
let page = <Page>args.object;
|
||||||
let wrapLayout = page.getViewById<WrapLayout>("wrapLayoutWithExamples");
|
let wrapLayout = page.getViewById<WrapLayout>("wrapLayoutWithExamples");
|
||||||
|
|
||||||
examples.set("action-bar", "action-bar/main-page");
|
examples.set("action-bar", "action-bar/main-page");
|
||||||
|
|
||||||
examples.set("bindings", "bindings/main-page");
|
examples.set("bindings", "bindings/main-page");
|
||||||
|
examples.set("button","button/main-page");
|
||||||
|
|
||||||
examples.set("css", "css/main-page");
|
examples.set("css", "css/main-page");
|
||||||
examples.set("fonts", "font/main-page");
|
|
||||||
examples.set("image-view", "image-view/main-page");
|
examples.set("dialogs", "dialogs/dialogs");
|
||||||
examples.set("tab-view", "tab-view/main-page");
|
|
||||||
examples.set("layouts", "layouts/main-page");
|
|
||||||
examples.set("events", "events/main-page");
|
examples.set("events", "events/main-page");
|
||||||
examples.set("webview", "web-view/main-page");
|
|
||||||
|
examples.set("fonts", "font/main-page");
|
||||||
examples.set("flexbox", "flexbox/flexbox-main-page");
|
examples.set("flexbox", "flexbox/flexbox-main-page");
|
||||||
|
examples.set("htmlview", "html-view/html-view");
|
||||||
|
|
||||||
|
examples.set("image-view", "image-view/main-page");
|
||||||
|
examples.set("issues", "issues/main-page");
|
||||||
|
|
||||||
|
examples.set("layouts", "layouts/main-page");
|
||||||
|
examples.set("list-picker", "list-picker/main-page");
|
||||||
|
examples.set("list-view", "list-view/main-page");
|
||||||
|
|
||||||
examples.set("modalview", "modal-view/modal-view");
|
examples.set("modalview", "modal-view/modal-view");
|
||||||
examples.set("dialogs", "dialogs/dialogs");
|
|
||||||
examples.set("htmlview", "html-view/html-view");
|
|
||||||
examples.set("timePicker", "time-picker/time-picker");
|
|
||||||
examples.set("segStyle", "segmented-bar/all");
|
|
||||||
examples.set("list-view", "list-view/main-page");
|
|
||||||
examples.set("issues", "issues/main-page");
|
|
||||||
examples.set("page", "page/main-page");
|
examples.set("page", "page/main-page");
|
||||||
|
|
||||||
examples.set("perf", "perf/main-page");
|
|
||||||
examples.set("list-picker", "list-picker/main-page");
|
|
||||||
|
|
||||||
examples.set("listview_binding", "pages/listview_binding");
|
|
||||||
examples.set("textfield", "text-field/main-page");
|
|
||||||
examples.set("button","button/main-page");
|
|
||||||
examples.set("perf","perf/main-page");
|
examples.set("perf","perf/main-page");
|
||||||
|
|
||||||
|
examples.set("segStyle", "segmented-bar/all");
|
||||||
|
|
||||||
|
examples.set("tab-view", "tab-view/main-page");
|
||||||
|
examples.set("timePicker", "time-picker/time-picker");
|
||||||
|
examples.set("text-field", "text-field/main-page");
|
||||||
|
|
||||||
|
examples.set("webview", "web-view/main-page");
|
||||||
|
|
||||||
let viewModel = new MainPageViewModel(wrapLayout, examples);
|
let viewModel = new MainPageViewModel(wrapLayout, examples);
|
||||||
page.bindingContext = viewModel;
|
page.bindingContext = viewModel;
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ export function pageLoaded(args: EventData) {
|
|||||||
|
|
||||||
let examples: Map<string, string> = new Map<string, string>();
|
let examples: Map<string, string> = new Map<string, string>();
|
||||||
examples.set("secured-text-field", "text-field/secured-text-field-4135");
|
examples.set("secured-text-field", "text-field/secured-text-field-4135");
|
||||||
|
examples.set("max-length", "text-field/max-length");
|
||||||
|
|
||||||
let viewModel = new SubMainPageViewModel(wrapLayout, examples);
|
let viewModel = new SubMainPageViewModel(wrapLayout, examples);
|
||||||
page.bindingContext = viewModel;
|
page.bindingContext = viewModel;
|
||||||
|
|||||||
30
apps/app/ui-tests-app/text-field/max-length.ts
Normal file
30
apps/app/ui-tests-app/text-field/max-length.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { Page } from "tns-core-modules/ui/page";
|
||||||
|
import { TextField } from "tns-core-modules/ui/text-field";
|
||||||
|
|
||||||
|
export function setText(args) {
|
||||||
|
let page = args;
|
||||||
|
|
||||||
|
if (page.constructor.name !== "Page") {
|
||||||
|
page = args.object.page;
|
||||||
|
setTextFieldText(page, "inXml", "in xml");
|
||||||
|
}
|
||||||
|
|
||||||
|
setTextFieldText(page, "maxLenghtFromCodeBehindWithText", "from code behind");
|
||||||
|
setTextFieldText(page, "useInput", "");
|
||||||
|
setTextFieldText(page, "maxLenghtFromCodeBehind", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function pageLoaded(args) {
|
||||||
|
const page = args.object;
|
||||||
|
setText(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTextFieldText(page: Page, name: string, text: string) {
|
||||||
|
const textField = <TextField>page.getViewById(name);
|
||||||
|
|
||||||
|
if (name === "maxLenghtFromCodeBehind" || name === "maxLenghtFromCodeBehindWithText") {
|
||||||
|
textField.maxLength = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
textField.text = text;
|
||||||
|
}
|
||||||
14
apps/app/ui-tests-app/text-field/max-length.xml
Normal file
14
apps/app/ui-tests-app/text-field/max-length.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<Page loaded="pageLoaded">
|
||||||
|
<Page.actionBar>
|
||||||
|
<ActionBar title="maxLength" />
|
||||||
|
</Page.actionBar>
|
||||||
|
<StackLayout>
|
||||||
|
<TextField id="maxLenghtFromCodeBehindWithText" hint="max lenght and text from code behind" maxLength="3" />
|
||||||
|
<TextField id="maxLenghtFromCodeBehind" hint="set only max length from code behind" />
|
||||||
|
<TextField id="inXml" text="in xml" hint="in xml" maxLength="3" />
|
||||||
|
<TextField id="useInput" hint="user input" maxLength="3" />
|
||||||
|
<TextField id="useInput" hint="user input" maxLength="3" secure="true" />
|
||||||
|
|
||||||
|
<Button tap="setText" text="Revert to initial state" />
|
||||||
|
</StackLayout>
|
||||||
|
</Page>
|
||||||
@ -3,7 +3,7 @@
|
|||||||
<Label text="hint" />
|
<Label text="hint" />
|
||||||
<TextField secure="true" text="test" hint="hint"></TextField>
|
<TextField secure="true" text="test" hint="hint"></TextField>
|
||||||
<TextField secure="true" text="text"></TextField>
|
<TextField secure="true" text="text"></TextField>
|
||||||
<TextField secure="true" hint="hint"></TextField>
|
<TextField secure="true" hint="hint" maxLength="3" ></TextField>
|
||||||
<Label text="bindings" />
|
<Label text="bindings" />
|
||||||
<TextField id="textField" automationText="textField" text="{{ textProperty }}" />
|
<TextField id="textField" automationText="textField" text="{{ textProperty }}" />
|
||||||
<TextField id="textFieldSecured" automationText="textFieldSecured" text="{{ textProperty }}" />
|
<TextField id="textFieldSecured" automationText="textFieldSecured" text="{{ textProperty }}" />
|
||||||
|
|||||||
Reference in New Issue
Block a user