From 1d12136816de69d560e5c8dc8fba58f870a99682 Mon Sep 17 00:00:00 2001 From: Vasil Chimev Date: Tue, 13 Aug 2019 16:10:21 +0300 Subject: [PATCH] feat: apply styles when adding them to the application scope (#7652) --- e2e/ui-tests-app/app/app.css | 4 +- e2e/ui-tests-app/app/button/main-page.ts | 1 - e2e/ui-tests-app/app/button/styles-page.ts | 4 -- e2e/ui-tests-app/app/css/main-page.ts | 1 + .../app/{button => css}/styles-page.css | 0 e2e/ui-tests-app/app/css/styles-page.ts | 10 +++++ .../app/{button => css}/styles-page.xml | 4 +- .../e2e/suites/css/styles/styles-page.ts | 21 ++++++++++ .../e2e/suites/css/styles/styles.e2e-spec.ts | 41 +++++++++++++++++++ .../application/application-common.ts | 4 -- .../application/application.android.ts | 11 ++++- tns-core-modules/application/application.d.ts | 4 ++ .../application/application.ios.ts | 15 +++++-- 13 files changed, 103 insertions(+), 17 deletions(-) delete mode 100644 e2e/ui-tests-app/app/button/styles-page.ts rename e2e/ui-tests-app/app/{button => css}/styles-page.css (100%) create mode 100644 e2e/ui-tests-app/app/css/styles-page.ts rename e2e/ui-tests-app/app/{button => css}/styles-page.xml (82%) create mode 100644 e2e/ui-tests-app/e2e/suites/css/styles/styles-page.ts create mode 100644 e2e/ui-tests-app/e2e/suites/css/styles/styles.e2e-spec.ts diff --git a/e2e/ui-tests-app/app/app.css b/e2e/ui-tests-app/app/app.css index 7eac464ba..4140a0863 100644 --- a/e2e/ui-tests-app/app/app.css +++ b/e2e/ui-tests-app/app/app.css @@ -1,5 +1,5 @@ #app { - background-color: lightblue; + background-color: lightyellow; } .ui-tests-app-issue-1639-red { @@ -20,4 +20,4 @@ .ui-tests-app-issue-1639-yellow { color: yellow; margin-left: 30; -} \ No newline at end of file +} diff --git a/e2e/ui-tests-app/app/button/main-page.ts b/e2e/ui-tests-app/app/button/main-page.ts index c183ed765..ecb25dc25 100644 --- a/e2e/ui-tests-app/app/button/main-page.ts +++ b/e2e/ui-tests-app/app/button/main-page.ts @@ -13,7 +13,6 @@ export function loadExamples() { const examples = new Map(); examples.set("btn-wrap-text-alignment-4266", "button/btn-wrap-text-alignment-4266-page"); examples.set("button-border", "button/button-border-page"); - examples.set("styles", "button/styles-page"); examples.set("background", "button/background-page"); examples.set("border-playground", "button/border-playground-page"); examples.set("issue-4287", "button/issue-4287-page"); diff --git a/e2e/ui-tests-app/app/button/styles-page.ts b/e2e/ui-tests-app/app/button/styles-page.ts deleted file mode 100644 index 05b053e62..000000000 --- a/e2e/ui-tests-app/app/button/styles-page.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function onLoaded(args) { - var page = args.object; - page.addCss("#property { background-color: lightsalmon; }"); -} \ No newline at end of file diff --git a/e2e/ui-tests-app/app/css/main-page.ts b/e2e/ui-tests-app/app/css/main-page.ts index 6a8f5f3e1..28a135d95 100644 --- a/e2e/ui-tests-app/app/css/main-page.ts +++ b/e2e/ui-tests-app/app/css/main-page.ts @@ -45,6 +45,7 @@ export function loadExamples() { examples.set("background-shorthand", "css/background-shorthand-page"); examples.set("background-image-linear-gradient", "css/background-image-linear-gradient-page"); examples.set("background-image", "css/background-image-page"); + examples.set("styles", "css/styles-page"); return examples; } diff --git a/e2e/ui-tests-app/app/button/styles-page.css b/e2e/ui-tests-app/app/css/styles-page.css similarity index 100% rename from e2e/ui-tests-app/app/button/styles-page.css rename to e2e/ui-tests-app/app/css/styles-page.css diff --git a/e2e/ui-tests-app/app/css/styles-page.ts b/e2e/ui-tests-app/app/css/styles-page.ts new file mode 100644 index 000000000..51b2b958d --- /dev/null +++ b/e2e/ui-tests-app/app/css/styles-page.ts @@ -0,0 +1,10 @@ +import { addCss } from "tns-core-modules/application"; + +export function onLoaded(args) { + var page = args.object; + page.addCss("#property { background-color: lightsalmon; }"); +} + +export function onTap() { + addCss("#app { background-color: lightblue; }"); +} diff --git a/e2e/ui-tests-app/app/button/styles-page.xml b/e2e/ui-tests-app/app/css/styles-page.xml similarity index 82% rename from e2e/ui-tests-app/app/button/styles-page.xml rename to e2e/ui-tests-app/app/css/styles-page.xml index ab51df754..4cc225d57 100644 --- a/e2e/ui-tests-app/app/button/styles-page.xml +++ b/e2e/ui-tests-app/app/css/styles-page.xml @@ -1,9 +1,9 @@  -