From 84819f6c9aa9a05ff516b4c8c149202716ac1f6d Mon Sep 17 00:00:00 2001 From: vakrilov Date: Fri, 10 Mar 2017 17:00:03 +0200 Subject: [PATCH] Implemented placeholder-color for text-view IOS --- apps/app/ui-tests-app/css/hint-text-color.ts | 32 +++++++++ apps/app/ui-tests-app/css/hint-text-color.xml | 24 +++++++ apps/app/ui-tests-app/css/main-page.ts | 1 + .../ui-tests-app/css/textview-hint-color.xml | 3 + tests/app/ui/text-view/text-view-tests.ts | 2 +- .../ui/text-view/text-view.ios.ts | 67 ++++++++++++------- 6 files changed, 104 insertions(+), 25 deletions(-) create mode 100644 apps/app/ui-tests-app/css/hint-text-color.ts create mode 100644 apps/app/ui-tests-app/css/hint-text-color.xml diff --git a/apps/app/ui-tests-app/css/hint-text-color.ts b/apps/app/ui-tests-app/css/hint-text-color.ts new file mode 100644 index 000000000..a58c6c93e --- /dev/null +++ b/apps/app/ui-tests-app/css/hint-text-color.ts @@ -0,0 +1,32 @@ +import { Page } from "tns-core-modules/ui/page"; +import { unsetValue } from "tns-core-modules/ui/core/view"; +import { TextView } from "tns-core-modules/ui/text-view"; +import { TextField } from "tns-core-modules/ui/text-field"; + +function exectuteOnAll(page: Page, callback: (txt: TextView | TextField) => void) { + page.getViewById("container").eachChild((child) => { + if(child instanceof TextView || child instanceof TextField) { + callback(child); + } + return true; + }) +} + +export function setText(args) { + exectuteOnAll(args.object.page, (txt) => { + txt.text = "set text"; + }) +} + +export function resetStyles(args) { + exectuteOnAll(args.object.page, (txt) => { + txt.style.color = unsetValue; + txt.style.placeholderColor = unsetValue; + }) +} + +export function resetText(args) { + exectuteOnAll(args.object.page, (txt) => { + txt.text = ""; + }) +} diff --git a/apps/app/ui-tests-app/css/hint-text-color.xml b/apps/app/ui-tests-app/css/hint-text-color.xml new file mode 100644 index 000000000..a86de2fe0 --- /dev/null +++ b/apps/app/ui-tests-app/css/hint-text-color.xml @@ -0,0 +1,24 @@ + + + + + +